PureBasic 5.20 bêta 1 est disponible sur votre compte
Le 2013-06-20 13:08:21, par comtois, Responsable Purebasic
La version 5.20 beta 1 est disponible sur votre compte. C'est tout chaud, ça vient de sortir !
Liste des nouveautés
Et quelques exemples pour montrer comment fonctionnent les nouveautés :
MODULE
Les modules permettent de protéger du code pour le réutiliser plus facilement.
RUNTIME
DIALOG
Comme d'habitude, la doc sera mise à jour soit avec l'une des prochaines versions bêtas ou pour la version finale.
Liste des nouveautés
Added: Module support for the compiler
Added: Runtime library
Added: Dialog library
Added: GTK3 subsystem for Linux
Added: DirectX11 subsystem for Windows
Added: JoystickName(), JoystickZ()
Added: Optional #PB_Relative flag to JoystickX/Y/Z() to have more precise values
Added: Optional pad number to JoystickX/Y/Z() to handle more complex gamepads (full support of XBox 360 one for example)
Added: ZoomSprite() now accepts #PB_Default as Width/Height to reset to initial sprite size
Added: 'Color' and 'Alpha' parameter to DisplayTransparentSprite()
Added: ClipSprite() now support #PB_Default for individual parameter
Added: #PB_Sprite_PixelCollision flag to CreateSprite(), LoadSprite() to enable pixel collision
Added: Zoom support to SpritePixelCollision() and SpriteCollision()
Added: OpenGL support for SpriteBlending() (warning, it just wraps OpenGL mode, so it can behave different than DirectX)
Added: 32-bit support for SpriteOutput() for DX and OpenGL
Added: #PB_EventType_Focus and #PB_EventType_LostFocus support to EditorGadget()
Added: #PB_EventType_RightClick support to ListViewGadget()
Added: #PB_EventType_Change support to PanelGadget() and DateGadget()
Added: #Prototype support to Defined()
Added: All Init() functions can be called more than once without issue (like InitSound(), InitNetwork() etc.)
Added: #PB_FileSystem_Force support to DeleteFile()
Added: #PB_FileSystem_NoExtension support to GetFilePart()
Added: Back color parameter to CreateImage()
Added: Gosub are now allowed again inside Procedure
Added: #PB_Entity_NbSubEntities to GetEntityAttribute()
Added: MeshIndexCount(), SetRenderQueue(), FetchEntityMaterial(), GetMeshData(), SetMeshData()
Added: CPUName(), Un/BindEvent(), Un/BindGadgetEvent(), Un/BindMenuEvent()
Added: Previous location is displayed when declaring a structure, interface, prototype or procedure twice.
Added: 2 license files to easy add the needed information when shipping PB programs (see reference documentation)
Added: Bool() is now evaluated at compile time if the whole expression is constant
Added: Debugger check for SortStructuredList() and SortList() to ensure the specified list is of correct type
Added: Linux executables created on new distribution should still work on old linux.
Optimized: Pixel sprite collision routines are now much faster with DirectX
Optimized: More peephole optimizations on x64 assembler output
Optimized: Faster compilation for big programs
Optimized: Linux build server have been upgraded, now using a better GCC which produce better code.
Changed: renamed ZoomSprite3D() to ZoomSprite()
Changed: renamed TransformSprite3D() to TransformSprite()
Changed: renamed RotateSprite3D() to RotateSprite()
Changed: renamed Sprite3DQuality() to SpriteQuality()
Changed: renamed Sprite3DBlending() to SpriteBlending()
Changed: Packer plugin constant renamed to #PB_PackerPlugin_XXX
Updated: WebGadget() on Windows doesn't needs ATL.dll anymore
Updated: zlib to 1.2.7
Updated: pqlib (PostgreSQL) to 9.2.4
Updated: SCNotification scintilla structure
Removed: Mozilla ActiveX support for WebGadget() on Windows as the last ActiveX version is way too old (2005)
Removed: Sprite3D library (merged with regular sprite library)
Removed: Palette library (outdated)
Removed: DisplayTranslucentSprite() -> replaced with 'Alpha' parameter for DisplayTransparentSprite()
Removed: DisplaySolidSprite() -> replaced with 'Color' parameter for DisplayTransparentSprite()
Removed: DisplayRGBFilter() -> can be replaced with a zoomed sprite with color
Removed: DisplayShadowSprite() -> can be replaced with DisplayTransparentSprite() with color
Removed: StartSpecialFX(), StopSpecialFX(), DisplayAlphaSprite(), ChangeAlphaIntensity(), UseBuffer()
Removed: Carbon subsystem on OS X, it was too old be used with new libs
Added: Runtime library
Added: Dialog library
Added: GTK3 subsystem for Linux
Added: DirectX11 subsystem for Windows
Added: JoystickName(), JoystickZ()
Added: Optional #PB_Relative flag to JoystickX/Y/Z() to have more precise values
Added: Optional pad number to JoystickX/Y/Z() to handle more complex gamepads (full support of XBox 360 one for example)
Added: ZoomSprite() now accepts #PB_Default as Width/Height to reset to initial sprite size
Added: 'Color' and 'Alpha' parameter to DisplayTransparentSprite()
Added: ClipSprite() now support #PB_Default for individual parameter
Added: #PB_Sprite_PixelCollision flag to CreateSprite(), LoadSprite() to enable pixel collision
Added: Zoom support to SpritePixelCollision() and SpriteCollision()
Added: OpenGL support for SpriteBlending() (warning, it just wraps OpenGL mode, so it can behave different than DirectX)
Added: 32-bit support for SpriteOutput() for DX and OpenGL
Added: #PB_EventType_Focus and #PB_EventType_LostFocus support to EditorGadget()
Added: #PB_EventType_RightClick support to ListViewGadget()
Added: #PB_EventType_Change support to PanelGadget() and DateGadget()
Added: #Prototype support to Defined()
Added: All Init() functions can be called more than once without issue (like InitSound(), InitNetwork() etc.)
Added: #PB_FileSystem_Force support to DeleteFile()
Added: #PB_FileSystem_NoExtension support to GetFilePart()
Added: Back color parameter to CreateImage()
Added: Gosub are now allowed again inside Procedure
Added: #PB_Entity_NbSubEntities to GetEntityAttribute()
Added: MeshIndexCount(), SetRenderQueue(), FetchEntityMaterial(), GetMeshData(), SetMeshData()
Added: CPUName(), Un/BindEvent(), Un/BindGadgetEvent(), Un/BindMenuEvent()
Added: Previous location is displayed when declaring a structure, interface, prototype or procedure twice.
Added: 2 license files to easy add the needed information when shipping PB programs (see reference documentation)
Added: Bool() is now evaluated at compile time if the whole expression is constant
Added: Debugger check for SortStructuredList() and SortList() to ensure the specified list is of correct type
Added: Linux executables created on new distribution should still work on old linux.
Optimized: Pixel sprite collision routines are now much faster with DirectX
Optimized: More peephole optimizations on x64 assembler output
Optimized: Faster compilation for big programs
Optimized: Linux build server have been upgraded, now using a better GCC which produce better code.
Changed: renamed ZoomSprite3D() to ZoomSprite()
Changed: renamed TransformSprite3D() to TransformSprite()
Changed: renamed RotateSprite3D() to RotateSprite()
Changed: renamed Sprite3DQuality() to SpriteQuality()
Changed: renamed Sprite3DBlending() to SpriteBlending()
Changed: Packer plugin constant renamed to #PB_PackerPlugin_XXX
Updated: WebGadget() on Windows doesn't needs ATL.dll anymore
Updated: zlib to 1.2.7
Updated: pqlib (PostgreSQL) to 9.2.4
Updated: SCNotification scintilla structure
Removed: Mozilla ActiveX support for WebGadget() on Windows as the last ActiveX version is way too old (2005)
Removed: Sprite3D library (merged with regular sprite library)
Removed: Palette library (outdated)
Removed: DisplayTranslucentSprite() -> replaced with 'Alpha' parameter for DisplayTransparentSprite()
Removed: DisplaySolidSprite() -> replaced with 'Color' parameter for DisplayTransparentSprite()
Removed: DisplayRGBFilter() -> can be replaced with a zoomed sprite with color
Removed: DisplayShadowSprite() -> can be replaced with DisplayTransparentSprite() with color
Removed: StartSpecialFX(), StopSpecialFX(), DisplayAlphaSprite(), ChangeAlphaIntensity(), UseBuffer()
Removed: Carbon subsystem on OS X, it was too old be used with new libs
MODULE
Les modules permettent de protéger du code pour le réutiliser plus facilement.
Code : |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | ; ; Quick module test ; ; All item declared in the module definition will be public ; Works for everything like array, list, structure, macro etc. ; DeclareModule Vehicule #VehiculeConstant = 10 #VehiculeConstant2 = 20 Declare NewAuto(Flags) Declare NewBoat() EndDeclareModule ; This procedure will be redefined in the module without issue ; Procedure Init() Debug "Main Init" EndProcedure ; The module implementation ; Only residents definition will be available here ; Module Vehicule #PrivateConstant = 30 Procedure Init() Debug "Vehicule Init" EndProcedure Procedure NewAuto(Flags) Init() Debug "NewAuto" EndProcedure Procedure NewBoat() Init() Debug "NewBoat" EndProcedure EndModule Init() Vehicule::NewAuto(Vehicule::#VehiculeConstant) Vehicule::NewBoat() ; Or with module import ; UseModule Vehicule NewAuto(#VehiculeConstant) NewBoat() HideModule Vehicule |
Code : |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | Runtime Procedure RuntimeProcedure() Debug "RuntimeProcedure" EndProcedure RuntimeProcedure() Debug GetRuntimeInteger("RuntimeProcedure()") Debug @RuntimeProcedure() Runtime Enumeration #Runtime1 #Runtime2 #Runtime3 EndEnumeration Debug GetRuntimeInteger("#Runtime2") Debug GetRuntimeInteger("#Runtime3") Procedure TestProce() EndProcedure Runtime TestProce() #AnotherConstant = 54 jiji.l = 10 *Pointer = 52 Runtime TestProce(), #AnotherConstant, jiji, *Pointer Debug GetRuntimeInteger("jiji") jiji.l = 20 Debug GetRuntimeInteger("jiji") Debug GetRuntimeInteger("*Pointer") Debug IsRuntime("jiji") Debug IsRuntime("jiji2") ;Point.Point ;Runtime Point DeclareModule Common Enumeration Test #fred = 15 EndEnumeration EndDeclareModule Module Common Runtime Procedure RuntimeModuleProcedure() Debug "RuntimeModuleProcedure" Debug @RuntimeModuleProcedure() EndProcedure RuntimeModuleProcedure() EndModule Debug GetRuntimeInteger("Common::RuntimeModuleProcedure()") Enumeration Common::Test #fred2 EndEnumeration Debug Common::#fred Debug Common::#fred2 Runtime Common::#fred Debug GetRuntimeInteger("Common::#fred") |
Code : |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | <?xml version="1.0"?> <!-- Window --> <window id="0" name="hello" text="Window" label="TestDialog" width="320" height="10" flags="#PB_Window_SizeGadget|#PB_Window_MaximizeGadget|#PB_Window_MinimizeGadget"> <splitter width="300" height="500"> <hbox> <checkbox name="checkbox1" text="Run only one Instance" disabled="yes" Flags=""/> <progressbar text="Vrey vreyv rye"/> <trackbar text="Ole" invisible="no" Flags="#PB_TrackBar_Ticks|#PB_TrackBar_Ticks|#PB_TrackBar_Ticks" width="150"/> <option text="option 1" name="option1" onevent="CheckBoxEvent()"/> <option text="option 2"/> </hbox> <vbox> <listview text="option 3" height="50"/> <button text="Ole 2"/> <listicon text="option 4" height="50"/> <string text="string content"/> <editor text="editorgadget" height="50"/> <text text="Text gadget"/> </vbox> </splitter> </window> |
Code : |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | Runtime Procedure CheckBoxEvent() Debug "Option 1" EndProcedure Procedure Main() LoadXML(0, "ui.xml") CreateDialog(0) OpenXMLDialog(0, 0, "hello") HideWindow(0, 0) While WaitWindowEvent() <> #PB_Event_CloseWindow : Wend EndProcedure Main() |
-
comtoisResponsable PurebasicPetite explication sur la bibliothèque Runtime, je ne traduis pas votre anglais est meilleur que le mien.'Runtime' add information in the executable to access these token at runtime. For example, you can add a procedure as runtime, and then get its address by using a string. It's useful for module or libraries so you can query the executable about some of its component (it's a bit like RTTI in C++). The new Dialog lib use it to get the procedure for event, directly from the XML. It wouldn't be possible without that. So you can see it like a standard way to access internal data. You can also imagine a small scripting frontend which could change the value of your variables on the run.le 21/06/2013 à 6:58
-
comtoisResponsable PurebasicUn autre exemple de dialog
Envoyé par Fred le 21/06/2013 à 19:54 -
comtoisResponsable PurebasicLa bêta 2 est disponible sur votre compte. Cette version comporte la correction des bogues, la mise à jour de la bibliothèque zlib (1.2.8) et suppression de Gosub dans une procédure car il ne fonctionne pas encore correctement.update: beta 2 is available and with the usual bug fixes. As well, zlib have been updated to 1.2.8 and Gosub in procedure have been removed as it can't work for now. Happy testing !le 21/06/2013 à 20:15
-
comtoisResponsable PurebasicLa bêta 3 est disponible sur votre compte.HideModule est renommé en UnuseModule.update: beta 3 is out with the usual bug fixes. 'HideModule' has been renamed to 'UnuseModule' for better consistency. Happy testing !le 26/06/2013 à 16:52
-
comtoisResponsable PurebasicFreak détaille un peu plus l'usage des modules :
Les modules permettent le découpage du code en plusieurs parties isolées les unes des autres. Il n'y a pas de risque de conflits avec des noms de variables ou des noms de procédures contradictoires avec d'autres parties de code. Seul le code d'un module défini dans le bloc "DeclareModule" est accessible de l'extérieur. Cela permet de décomposer un projet en éléments plus petits / plus simples pouvant être codés séparément, sans qu'ils interfèrent les uns avec les autres.
Exemple:
Admettons que le programme comporte deux grands domaines: faire des trucs A et des trucs B. Le programme pourrait être structuré ainsi:
ThingA.pb:Code : 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29DeclareModule ThingA ; This is the only procedure callable from the outside Declare DoThingA(foo, bar) EndDeclareModule Module ThingA ; Here we can use simple names without fear of a name collision with another ; module. Without Modules, these would have to be called "ThingA_x" to separate ; them similar names in the ThingB code. Global x = 1, y = 2 ; This procedure is only visible in here, so again, we can use any name we want ; without a collision with other code Procedure Calculate() ProcedureReturn 42 EndProcedure ; this can be called from the outside Procedure DoThingA(foo, bar) x = Calculate() + y Debug x EndProcedure EndModule
ThingB.pb:Code : 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23DeclareModule ThingB ; visible from the outside Declare DoThingB() EndDeclareModule Module ThingB ; here, the same names are used as in the ThingA module, but no problem. ; The global variable here is not the same as the one in ThingA. Global y Procedure Calculate() ProcedureReturn 21 EndProcedure Procedure DoThingB() y = Calculate() Debug y EndProcedure EndModule
Main.pb:Code : 1
2
3
4
5
6
7
8
9
10
11
12
13XIncludeFile "ThingA.pb" XIncludeFile "ThingB.pb" ; open the needed modules UseModule ThingA UseModule ThingB ; somewhere in the main code, call the modules ; ... DoThingA(1, 2) ;.. and later... DoThingB()
ThingA :: DoThingA () et ThingB :: DoThingB ()
Ou en ouvrant les modules avec UseModule comme dans l'exemple ci-dessus, à chacun de choisir son style.
Dans le cas où du code doit être partagé entre les 2 modules, mettez le dans un module, exemple :
Common.pb:Code : 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18DeclareModule Common ; some shared constants #SomeConstant = 1 #OtherConstant = 25 ; some shared code Declare ReadConfiguration() EndDeclareModule Module Common ; the shared procedure Procedure ReadConfiguration() EndProcedure EndModule
Code : 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21DeclareModule ThingA ; This is the only procedure callable from the outside Declare DoThingA(foo, bar) EndDeclareModule Module ThingA UseModule Common Procedure DoThingA(foo, bar) ReadConfiguration() Debug #SomeConstant EndProcedure EndModule
Code : 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16DeclareModule ThingB Declare DoThingB() EndDeclareModule Module ThingB UseModule Common Procedure DoThingB() ReadConfiguration() ; ... EndProcedure EndModule
Cette séparation permet également de réutiliser plus facilement le code.
Si je veux utiliser ThingA dans un autre programme, je peux inclure ThingA.pb avec un risque minime de conflits :
Seul le nom du module lui-même et la procédure DoThingA() sont accessibles de l'extérieur.le 28/06/2013 à 20:49 -
comtoisResponsable PurebasicLa bêta 4 est disponible sur votre compte.update: beta 4 is out. Only bug fixes this time ! I have also published a new ui.xml example which show resizing (see below).
Code : 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19<?xml version="1.0"?> <!-- Window --> <window id="0" name="hello" text="Window" label="TestDialog" minwidth="auto" minheight="auto" flags="#PB_Window_SizeGadget|#PB_Window_MaximizeGadget|#PB_Window_MinimizeGadget"> <hbox expand="item:2"> <vbox expand="no"> <checkbox name="checkbox1" text="Run only one instance ?" disabled="yes" Flags=""/> <progressbar height="25"/> <trackbar invisible="no" Flags="#PB_TrackBar_Ticks" height="25"/> <option text="option 1" name="option1"/> <option text="option 2"/> <checkbox name="checkbox1" text="Enable alpha-blending" Flags=""/> <option text="scale x2" name="scale"/> <option text="scale x3"/> </vbox> <editor name="editor" width="200" height="50"> </editor> </hbox> </window>
le 28/06/2013 à 20:55 -
comtoisResponsable PurebasicLa beta 5 est disponible sur votre compte.
Dans cette version la bibliothèque 'Module' est renommée 'Music' pour éviter la confusion avec les modules (code protégé).update: beta 5 is available. As always, some bug fixes and also the 'Module' lib fully renamed to 'Music'. Added #PB_Module support to Defined() for completeness.le 30/06/2013 à 22:23 -
comtoisResponsable PurebasicLa bêta 6 est disponible, elle comporte de nombreuses corrections de bogues et quelques nouveautés.update: beta 6 is out. As always, many bug fixes and some new features added:
Added: Debugger now support module syntax in the expression evaluation and item display.
Added: #PB_EventType_FirstCustomValue for use with PostEvent()
Added: CameraFollow(), ExamineWorldCollisions(), NextWorldCollision(), FirstWorldCollisionEntity(), SecondWorldCollisionEntity()
Added: WorldCollisionContact(), WorldCollisionNormal(), WorldCollisionAppliedImpulse()
Added: BuildMeshTangentVectors(), MeshVertexTangent()le 16/07/2013 à 19:11 -
comtoisResponsable PurebasicVoila une information fort utile, voici un exemple qui montre comment redimensionner automatiquement les gadgets en fonction de la taille des caractères.
la constante #PB_Gadget_RequiredSize sera disponible dans une prochaine beta.Envoyé par Fred Code : 1
2
3
4
5
6
7
8
9
10
11
12
13#PB_Gadget_RequiredSize = 1 ; Missing in the resident in the current beta, will be in the next OpenWindow(1, #PB_Any, #PB_Any, 400, 200, "Font Resolution", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) ButtonGadget(2, 110, 20, 0, 0, "TEST TEXT") ResizeGadget(2, #PB_Ignore, #PB_Ignore, GadgetWidth(2, #PB_Gadget_RequiredSize), GadgetHeight(2, #PB_Gadget_RequiredSize)) ButtonGadget(3, 110, 50, 0, 0, "TEST TEXT") SetGadgetFont(3, LoadFont(0, "Arial", 30)) ResizeGadget(3, #PB_Ignore, #PB_Ignore, GadgetWidth(3, #PB_Gadget_RequiredSize), GadgetHeight(3, #PB_Gadget_RequiredSize)) While WaitWindowEvent() ! #PB_Event_CloseWindow : CloseWindow : Wend
le 19/07/2013 à 10:57 -
comtoisResponsable PurebasicLa beta 7 est disponible sur votre compte. La doc est complète à l'exception de la biblio 'Dialog' (en anglais pour l'instant). les bogues importants sont corrigés pour que vous puissiez continuer de tester. Et il y a quelques changements :update: beta 7 is available on your online account. The documentation is complete except for the 'Dialog' library (english only). As always, some bug fixes and a some changes:
Added: CopyTexture()
Renamed: Frame3DGadget() to FrameGadget()
Renamed: Frame3DGadget3D() to FrameGadget3D()le 24/07/2013 à 17:56