PureBasic 5.50 final is out !

Developed or developing a new product in PureBasic? Tell the world about it.
Fred
Administrator
Administrator
Posts: 16619
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

PureBasic 5.50 final is out !

Post by Fred »

Hi there,

- Final version is out, thank you all for feedback and testing !

- Beta 3 is out and brings some more fixes.

- Beta 2 is out ! It does includes a bunch of fixes and updated SQLite lib to 3.13.0.

PureBasic 5.50 is now available as beta in your online account ! The most important change is the unicode only compiler. To sum-up, internal string representation are now always in unicode, and if you need to interact with third part libraries, the suggested approach is to use pseudotypes (p-ascii, p-utf8) combined with Import/EndImport or Prototypes. 2 new helpers functions have been added as well to created easily an ASCII or UTF8 buffer from a string: Ascii() and UTF8(). If your program was already compiled with the unicode switch, then nothing will changed for you (if it does, then there is a bug somewhere, don't hesitate to report it). Here is the full list of features:

Code: Select all

- Added: Vehicle library to create 3D vehicles with wheels easily
- Added: PickBody() to easily manipulate a 3D body with mouse
- Added: CreateTube(), CreateTorus(), CreateIcoSphere() and CreateCapsule()
- Added: #PB_Entity_PlaneBody and #PB_Entity_ConeBody body type
- Added: GenericJoint() to create any type of joint
- Added: Bounding box size support to CreateEntityBody()
- Added: RegisterFontFile() to use custom fonts file easily
- Added: PathLength(), PathPointX(), PathPointY(), PathPointAngle()
- Added: PathBoundsX(), PathBoundsY(), PathBoundsWidth(), PathBoundsHeight() to get the bounding box of a path
- Added: PathSegments(), AddPathSegments() to get/set a path in string format 
- Added: DebuggerError(), DebuggerWarning(), CloseDebugOutput()
- Added: ResetStructure() which clear and reinitialize a structure buffer
- Added: UTF8() and Ascii() to create easily UTF8 and Ascii string buffers (needs to be freed with FreeMemory())
- Added: FormatNumber() to have money like formatted numbers easily
- Added: @#StringConstant$ syntax support, to get the address of a string constant
- Added: #PB_MessageRequester_Info, #PB_MessageRequester_Error and #PB_MessageRequester_Warning for MessageRequester()

- Changed: ParticleVelocity() to support current velocity.

- Removed: ASCII mode for internal PureBasic string representation, PureBasic is now unicode only.
As every beta, only the english doc is up to date for now, so be sure to use it if you want to have more info about new commands.

Have fun !

The Fantaisie Software Team
User avatar
Comtois
Addict
Addict
Posts: 1429
Joined: Tue Aug 19, 2003 11:36 am
Location: Doubs - France

Re: PureBasic 5.50 beta 1 is out

Post by Comtois »

3D Examples need few changes to work --> SetVehicleSteering() become ApplyVehicleSteering(), etc.


Here Vehicle.pb updated :

Code: Select all

;
; ------------------------------------------------------------
;
;   PureBasic - CreateVehicle
;
;    (c) Fantaisie Software
;
; ------------------------------------------------------------
;
IncludeFile #PB_Compiler_Home + "examples/3d/Screen3DRequester.pb"

#CameraSpeed = 2

Global.f KeyX, KeyY, MouseX, MouseY, ElapsedTime

Structure Vector3
  x.f
  y.f
  z.f
EndStructure

Macro VECTOR3(V, a, b, c)
  V\x = a
  V\y = b
  V\z = c
EndMacro  

Structure s_Vehicle
  Chassis.i 
  Wheels.i[4]	
  EngineBrake.f
  EngineForce.f
  Steering.f
  
  SteeringLeft.i
  SteeringRight.i
EndStructure

Global Recul = #False 

Global MaxEngineForce.f = 2000.0
Global MaxEngineBrake.f = 150.0

Global SteeringIncrement.f = 0.5
Global SteeringClamp.f = 27     

Global WheelRadius.f = 0.5;
Global WheelWidth.f = 0.4 ;

Global SuspensionStiffness.f = 20.0
Global SuspensionDamping.f = 3.3
Global SuspensionCompression.f = 4.4
Global MaxSuspensionTravelCm.f = 500.0;
Global FrictionSlip.f = 20		

Global RollInfluence.f = 0.3
Global SuspensionRestLength.f = 0.6;

Global Vehicle.s_Vehicle

#CUBE_HALF_EXTENTS = 1

Declare BuildVehicle(*Vehicle.s_Vehicle)
Declare HandleVehicle()
Declare ControlVehicle(elapsedTime.f)
Declare.f  Interpolation(x1.f, x2.f, percent.f)

If InitEngine3D()
  
  InitSprite()
  InitKeyboard()
  InitMouse()
  
  If Screen3DRequester()
    Add3DArchive(#PB_Compiler_Home + "examples/3d/Data/Textures/", #PB_3DArchive_FileSystem)
    Add3DArchive(#PB_Compiler_Home + "examples/3d/Data/Packs/desert.zip", #PB_3DArchive_Zip)
    Add3DArchive(#PB_Compiler_Home + "examples/3d/Data/Scripts" , #PB_3DArchive_FileSystem)
    Parse3DScripts()
    
    WorldShadows(#PB_Shadow_Modulative, -1, RGB(105, 105, 105))
    
    ;- Material
    ;
    CreateMaterial(0, LoadTexture(0, "Wood.jpg"))
    GetScriptMaterial(1, "SphereMap/SphereMappedRustySteel")
    CreateMaterial(2, LoadTexture(2, "Dirt.jpg"))
    ScaleMaterial(2,0.05,0.05)
    GetScriptMaterial(3, "Scene/GroundBlend")
    
    ;-Ground
    ;
    CreatePlane(0, 500, 500, 5, 5, 5, 5)
    CreateEntity(0,MeshID(0),MaterialID(2))
    EntityRenderMode(0, 0) 
    CreateEntityBody(0, #PB_Entity_PlaneBody, 0, 0, 1)
    
    ;-Walls
    ;
    CreateCube(1, 1)
    CreateEntity(1,MeshID(1),MaterialID(2),0,1, 250)
    ScaleEntity(1,500,2,0.5) 
    CreateEntityBody(1, #PB_Entity_PlaneBody, 0, 0, 1,-1,-1,-1, 0,0,-1)
    
    CreateEntity(2,MeshID(1),MaterialID(2),0,1, -250)
    ScaleEntity(2,500,2,0.5) 
    CreateEntityBody(2, #PB_Entity_PlaneBody, 0, 0, 1,-1,-1,-1, 0,0,1)
    
    CreateEntity(3,MeshID(1),MaterialID(2),250,1, 0)
    ScaleEntity(3,0.5,2,500) 
    CreateEntityBody(3, #PB_Entity_PlaneBody, 0, 0, 1,-1,-1,-1, -1,0,0)
    
    CreateEntity(4,MeshID(1),MaterialID(2),-250,1, 0)
    ScaleEntity(4,0.5,2,500) 
    CreateEntityBody(4, #PB_Entity_PlaneBody, 0, 0, 1,-1,-1,-1, 1,0,0)
    
    
    CylinderMEsh = CreateCylinder(#PB_Any, 0.5, 2)
    
    For i=-250 To 250 Step 30
      Cylinder = CreateEntity(#PB_Any,MeshID(CylinderMEsh),MaterialID(1), 0, 1, i)
      CreateEntityBody(Cylinder, #PB_Entity_CylinderBody, 0, 0, 1)
    Next
    
    ;- Light 
    ;
    CreateLight(0 ,RGB(190, 190, 190), 400, 120, 100,#PB_Light_Directional)
    SetLightColor(0, #PB_Light_SpecularColor, RGB(255*0.4, 255*0.4,255*0.4)) 
    LightDirection(0 ,0.55, -0.3, -0.75) 
    AmbientColor(RGB(255*0.2, 255*0.2,255*0.2))
    
    ;- Camera 
    ;
    CreateCamera(0, 0, 0, 100, 100)
    MoveCamera(0,  800, 400, 80, #PB_Absolute)
    
    ; SkyBox
    ;
    SkyBox("desert07.jpg")
    
    ;-
    BuildVehicle(@Vehicle)
    
    ;-Main 
    ;
    Repeat
      Screen3DEvents()
      
      ExamineMouse()
      ExamineKeyboard()
      
      HandleVehicle()
      
      ControlVehicle(ElapsedTime/20)
      
      CameraFollow(0, EntityID(Vehicle\Chassis),180, 3.5, 10, 0.1, 0.1)
      
      ElapsedTime = RenderWorld()
      
      FlipBuffers()
      
    Until KeyboardPushed(#PB_Key_Escape)   
    
    End 
    
  EndIf 
  
Else
  MessageRequester("Error","Can't initialize engine3D")
EndIf 

Procedure Clamp(*var.float, min.f, max.f)
  If *var\f < min
    *var\f = min
  ElseIf *var\f > max
    *var\f = max
  EndIf
EndProcedure  

Procedure BuildVehicle(*Vehicle.s_Vehicle)
  Protected.VECTOR3 connectionPointCS0; wheelDirectionCS0,wheelAxleCS,
  
  With *Vehicle  
    
    \SteeringLeft = #False
    \SteeringRight = #False
    
    \EngineForce = 0
    \Steering = 0
    
    
    ;- >>> create vehicle  <<<<<
    
    connectionHeight.f = 0.6
    
    ChassisMesh = CreateCube(#PB_Any, 2)
    
    ChassisEntity = CreateEntity(#PB_Any, MeshID(chassisMesh), MaterialID(3), 0, 1, 0)
    ScaleEntity(ChassisEntity, 0.8, 0.7, 2)
    \Chassis = CreateVehicle(#PB_Any)
    AddSubEntity(\Chassis, ChassisEntity, #PB_Entity_BoxBody)
    
    EntityRenderMode(\Chassis, #PB_Entity_CastShadow)
    CreateVehicleBody(\Chassis, 700, 0.3, 0.8,suspensionStiffness, suspensionCompression, suspensionDamping, maxSuspensionTravelCm, frictionSlip)
    
    MoveEntity(\Chassis, 0, 3, 0,#PB_Absolute)
    DisableDebugger
    SetEntityAttribute(\Chassis, 27, 0.0)
    SetEntityAttribute(\Chassis, 28, 0.0)
    EnableDebugger
    
    
    Wheel = CreateSphere(#PB_Any, WheelRadius)
    For i = 0 To 3
      \Wheels[i] = CreateEntity(#PB_Any, MeshID(Wheel), #PB_Material_None)
      ScaleEntity(\Wheels[i], WheelWidth,1,1)
    Next
    
    ;-WheelSteerable and WheelsEngine
    VECTOR3(connectionPointCS0, #CUBE_HALF_EXTENTS-(0.2*WheelWidth), connectionHeight,2*#CUBE_HALF_EXTENTS-WheelRadius)
    AddVehicleWheel(\Chassis, \Wheels[0], 
                    connectionPointCS0\x, connectionPointCS0\y,connectionPointCS0\z,
                    -1, 0,0, SuspensionRestLength, WheelRadius, #True, RollInfluence)
    
    
    VECTOR3(connectionPointCS0, -#CUBE_HALF_EXTENTS+(0.2*WheelWidth), connectionHeight, 2*#CUBE_HALF_EXTENTS-WheelRadius)
    AddVehicleWheel(\Chassis, \Wheels[1], 
                    connectionPointCS0\x, connectionPointCS0\y,connectionPointCS0\z,
                    -1, 0,0, SuspensionRestLength, WheelRadius, #True, RollInfluence)
    
    
    VECTOR3(connectionPointCS0, -#CUBE_HALF_EXTENTS+(0.2*WheelWidth), connectionHeight, -2*#CUBE_HALF_EXTENTS+WheelRadius);
    AddVehicleWheel(\Chassis, \Wheels[2], 
                    connectionPointCS0\x, connectionPointCS0\y,connectionPointCS0\z,
                    -1, 0,0, SuspensionRestLength, WheelRadius, #False, RollInfluence)
    
    
    VECTOR3(connectionPointCS0, #CUBE_HALF_EXTENTS-(0.2*WheelWidth), connectionHeight, -2*#CUBE_HALF_EXTENTS+WheelRadius);
    AddVehicleWheel(\Chassis, \Wheels[3], 
                    connectionPointCS0\x, connectionPointCS0\y,connectionPointCS0\z,
                    -1, 0,0, SuspensionRestLength, WheelRadius, #False, RollInfluence)
    
    
  EndWith
EndProcedure

Procedure HandleVehicle()
  
  If KeyboardPushed(#PB_Key_Left)  
    Vehicle\SteeringLeft = #True
    Vehicle\SteeringRight = #False
    
  ElseIf KeyboardPushed(#PB_Key_Right)  
    Vehicle\SteeringRight = #True
    Vehicle\SteeringLeft = #False
  Else 
    Vehicle\SteeringRight = #False
    Vehicle\SteeringLeft = #False          
  EndIf
  
  If KeyboardPushed(#PB_Key_Down) 
    If GetEntityAttribute(Vehicle\Chassis, #PB_Entity_LinearVelocity)< 0.4
      Recul = #True
    EndIf  
    If Recul 
      Vehicle\EngineForce = -MaxEngineForce
      Vehicle\EngineBrake = 0  
    Else
      Vehicle\EngineForce = 0
      Vehicle\EngineBrake = MaxEngineBrake
    EndIf 
  ElseIf KeyboardPushed(#PB_Key_Up) 
    Vehicle\EngineForce = MaxEngineForce
    Vehicle\EngineBrake = 0
  Else
    Vehicle\EngineBrake = MaxEngineForce/ 100
    Vehicle\EngineForce = 0
    Recul = #False
  EndIf
  
  
EndProcedure

Procedure ControlVehicle(elapsedTime.f)
  
  ; apply engine Force on relevant wheels
  For i = 0 To 1
    ApplyVehicleBrake(Vehicle\Chassis, i, Vehicle\EngineBrake)  
    ApplyVehicleForce(Vehicle\Chassis, i, Vehicle\EngineForce)
  Next
  
  
  If (Vehicle\SteeringLeft)
    
    Vehicle\Steering + SteeringIncrement*elapsedTime
    If (Vehicle\Steering > SteeringClamp)
      Vehicle\Steering = SteeringClamp
    EndIf  
    
  ElseIf (Vehicle\SteeringRight)
    
    Vehicle\Steering - SteeringIncrement*elapsedTime
    If (Vehicle\Steering < -SteeringClamp)
      Vehicle\Steering = -SteeringClamp
    EndIf  
    
  Else
    Vehicle\Steering = Interpolation(Vehicle\Steering, 0, 0.05)
    
  EndIf
  
  ; apply Steering on relevant wheels
  
  For i = 0 To 1	
    ApplyVehicleSteering(Vehicle\Chassis, i, Vehicle\Steering)
  Next
  
EndProcedure

Procedure.f Interpolation(x1.f, x2.f, percent.f)
  If percent<0
    percent=0
  EndIf
  If percent>1
    percent=1
  EndIf
  ProcedureReturn x1 + percent * (x2 - x1)
  
EndProcedure
Please correct my english
http://purebasic.developpez.com/
Marc56us
Addict
Addict
Posts: 1477
Joined: Sat Feb 08, 2014 3:26 pm

Re: PureBasic 5.50 beta 1 is out

Post by Marc56us »

Thank's Fred 8)

My tests:

- Forgot the classic "?" (question-mark) icon constant for MessageRequester() (#MB_ICONQUESTION)

- In Form Designer, for DateGadget() parameter Date() is not set so CheckBox and up/down button spin do not appear if selected (old bug)

- In help file, for DebuggerWarning(), forgot to specify "The program execution will be stopped if the debugger is activated" (like DebuggerError() description)

I does not use graphics (for the moment) So I have not tested the rest.

Thank' s for FormatNumber() Excellent feature for business users :!: :wink:
Fred
Administrator
Administrator
Posts: 16619
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: PureBasic 5.50 beta 1 is out

Post by Fred »

DebuggerWarning() doesn't stop the program execution, it's just a warning. You should use the appropriate bug forum to report your issue or it will get lost :)
DontTalkToMe
Enthusiast
Enthusiast
Posts: 334
Joined: Mon Feb 04, 2013 5:28 pm

Re: PureBasic 5.50 beta 1 is out

Post by DontTalkToMe »

Thanks (adieu ascii builds, I hope you died for something good in exchange).

Is there hope for these two to be fixed before the final ?

http://www.purebasic.fr/english/viewtop ... 23&t=57846
http://www.purebasic.fr/english/viewtop ... =4&t=65153

Both are really annoying in the everyday work with the IDE :(
User avatar
falsam
Enthusiast
Enthusiast
Posts: 630
Joined: Wed Sep 21, 2011 9:11 am
Location: France
Contact:

Re: PureBasic 5.50 beta 1 is out

Post by falsam »

Thanks Fred for this new release.

First test:
-GetFunctionEntry() no longer works
Example GetFunctionEntry(fmodLib, "FMOD_Memory_Initialize") with PB 5.42 Works with PB 5.50 not works.

➽ Windows 11 64-bit - PB 6.0 x64 - AMD Ryzen 7 - NVIDIA GeForce GTX 1650 Ti

Sorry for my bad english and the Dunning–Kruger effect.
Joris
Addict
Addict
Posts: 885
Joined: Fri Oct 16, 2009 10:12 am
Location: BE

Re: PureBasic 5.50 beta 1 is out

Post by Joris »

Well now I must dive deeper into the use of unicode.
I only understand it uses 2 bytes instead of one, but as I always could simply avoid the use of unicode (never 'been forced' or feld the need to using it). I worked on that way.
Now that I need to do this step, I hope the water isn't that deep (I use a lot of text file in ascii ... as far as I'm even abale to see the difference).
If anyone has fine tips to make the learning curve easier, it's welcome.

Thanks Fred and the pb-team for your work.
Yeah I know, but keep in mind ... Leonardo da Vinci was also an autodidact.
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3870
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: PureBasic 5.50 beta 1 is out

Post by wilbert »

@Fred,
Any reason you didn't include all new Vector library commands ?
I really like AddPathSegments() and PathSegments() :)
Windows (x64)
Raspberry Pi OS (Arm64)
User_Russian
Addict
Addict
Posts: 1443
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

Re: PureBasic 5.50 beta 1 is out

Post by User_Russian »

Fred wrote:To sum-up, internal string representation are now always in unicode, and if you need to interact with third part libraries, the suggested approach is to use pseudotypes (p-ascii, p-utf8)
As I expected, it did not work.

Code: Select all

ProcedureDLL Tst(x.p-ascii)
  
EndProcedure
The lack of support for ASCII, can complicate the DLL development, because not all applications support unicode. And if with string parameters procedures, can be solved so.

Code: Select all

ProcedureDLL Tst(*x)
  s.s = PeekS(*x, -1, #PB_Ascii)
EndProcedure
But with structures much more complicated.

Code: Select all

Structure Param
  Str1.s
  Str2.s
  Str3.s
  Str4.s
  ; Many other string variables
EndStructure

ProcedureDLL Tst(*x.Param)
  s.Param
  s\Str1 = PeekS(@*x\Str1, -1, #PB_Ascii)
  s\Str2 = PeekS(@*x\Str2, -1, #PB_Ascii)
  s\Str3 = PeekS(@*x\Str3, -1, #PB_Ascii)
  s\Str4 = PeekS(@*x\Str4, -1, #PB_Ascii)
  ; Converting other variables structure
EndProcedure
The PB no function which converts the encoding of string variables in structures.
I propose to add the function ConversionStructure. Syntax:

Code: Select all

*Item.StructureName = ConversionStructure(*Source, Structure, SourceFormat [, DestinationFormat])
Parameters *Item.StructureName, *Source and Structure are the same as in the function AllocateStructure.
Parameters SourceFormat and DestinationFormat are the same as in the function PeekS.
If the parameter DestinationFormat is not specified, then the structure is converted to unicode.

It is also necessary to add to the function FreeStructure optional parameter Format. Syntax:

Code: Select all

FreeStructure(*Item [, Format])
If the parameter Format is not specified, it is assumed that this is a unicode structure.

Example 1. The application transmits the DLL structure with ASCII strings.

Code: Select all

Structure Param
  Str1.s
  Str2.s
  Str3.s
  Str4.s
  ; Many other string variables
EndStructure

ProcedureDLL Tst(*x.Param)
  
  *s.Param = ConversionStructure(*x, Param, #PB_Ascii) ; Converting structure from ASCII to Unicode.
  
  FreeStructure(*s) 
EndProcedure
Example 2. DLL returns an ASCII structure for the application.

Code: Select all

Structure Param
  Str1.s
  Str2.s
  Str3.s
  Str4.s
  ; Many other string variables
EndStructure


ProcedureDLL Tst()
  s.Param
  
  s\Str1 = "Data"
  
  *ret.Param = ConversionStructure(@x, Param, #PB_Unicode, #PB_Ascii) ; Converting structure from Unicode to ASCII.
  
  ProcedureReturn *ret
EndProcedure

ProcedureDLL FreeStruct(*x.Param) ; The application must call this procedure to release structure.
  If *x
    FreeStructure(*x, #PB_Ascii)
  EndIf
EndProcedure
User avatar
Mohawk70
Enthusiast
Enthusiast
Posts: 400
Joined: Thu May 11, 2006 1:04 am
Location: Florida, USA

Re: PureBasic 5.50 beta 1 is out

Post by Mohawk70 »

Thank you Fred! I didn't realize you had the ability to read minds! UTF8 (), Ascii (), FormatNumber (), and especially @#StringConstant$() & RegisterFont () are going to be extremely useful for me. I can
use them all in my most recent project I am starting today.
#NULL
Addict
Addict
Posts: 1440
Joined: Thu Aug 30, 2007 11:54 pm
Location: right here

Re: PureBasic 5.50 beta 1 is out

Post by #NULL »

thanks for the update.
Joris wrote:If anyone has fine tips to make the learning curve easier, it's welcome.
you can find good infos here: Unicode and PureBasic http://www.purebasic.fr/english/viewtop ... =7&t=61789
freak
PureBasic Team
PureBasic Team
Posts: 5929
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Re: PureBasic 5.50 beta 1 is out

Post by freak »

wilbert wrote:@Fred,
Any reason you didn't include all new Vector library commands ?
I really like AddPathSegments() and PathSegments() :)
I updated the changes list.
quidquid Latine dictum sit altum videtur
User avatar
StarBootics
Addict
Addict
Posts: 984
Joined: Sun Jul 07, 2013 11:35 am
Location: Canada

Re: PureBasic 5.50 beta 1 is out

Post by StarBootics »

DontTalkToMe wrote:Is there hope for these two to be fixed before the final ?

http://www.purebasic.fr/english/viewtop ... 23&t=57846
http://www.purebasic.fr/english/viewtop ... =4&t=65153

Both are really annoying in the everyday work with the IDE :(
Indeed, and I add these two

http://www.purebasic.fr/english/viewtop ... 23&t=65848
http://www.purebasic.fr/english/viewtop ... 23&t=65863

They are blocking me on my current project.

Best regards
StarBootics
The Stone Age did not end due to a shortage of stones !
User avatar
Lunasole
Addict
Addict
Posts: 1091
Joined: Mon Oct 26, 2015 2:55 am
Location: UA
Contact:

Re: PureBasic 5.50 beta 1 is out

Post by Lunasole »

Code: Select all

- Added: DebuggerError(), DebuggerWarning(), CloseDebugOutput()
- Added: ResetStructure() which clear and reinitialize a structure buffer
- Added: @#StringConstant$ syntax support, to get the address of a string constant
These 3 looking nice and useful ^^
"W̷i̷s̷h̷i̷n̷g o̷n a s̷t̷a̷r"
applePi
Addict
Addict
Posts: 1404
Joined: Sun Jun 25, 2006 7:28 pm

Re: PureBasic 5.50 beta 1 is out

Post by applePi »

Thanks Fred and team for this box of goodies, Generic joint (GenericJoint.pb) with Stiffness and Damping, vehicle, CreateTube with thickness ..., this is a machines shop !!.
Post Reply