PureBasic 5.70 LTS beta 1 est disponible
Avec un nouveau sous-système pour Linux basé sur Qt

Le , par comtois, Responsable Purebasic
Hello everybody,

After a long delay (currently due to lack of time in my personal life, which I hope will get better soon), here is the first beta of the 5.70 LTS version which brings a bunch of new things ! First, a big thanks to Timo (Fr34k) who did a brand new subsystem for Linux: QT . Thanks to Guillot and Comtois for the new 3D functions ! Other cool stuffs are available, for example DPI support for Windows (the IDE is compiled with this switch on so you can test). Here is the full list of changes:

Code:
- Added: Brand new QT subsystem for Linux
- Added: DPI aware support for Windows app (/DPIAWARE compiler switch and DPI Aware check in IDE)
- Added: #PS, #NPS, #PS$ and #NPS$ constants (Path seperator character depending of the OS)
- Added: #PB_JSON_NoClear support to ExtractJSONStructure
- Added: #PB_Path_Winding filling mode for VectorDrawing
- Added: DesktopResolutionX(), DesktopResolutionY(), DesktopScaleX(), DesktopScaleY(), DesktopUnscaleX(), DesktopUnscaleY()
- Added: an optional 'Mode' parameter for OpenConsole() to specify the string format to use
- Added: #PB_Vehicle_IsInContact, #PB_Vehicle_ContactPointX/Y/Z, #PB_Vehicle_ContactPointY/Z for GetVehicleAttribute()
- Added: #PB_Vehicle_ContactPointNormalX/Y/Z, #PB_Vehicle_ContactPointNormalY/Z, #PB_Vehicle_CurrentSpeedKmHour, #PB_Vehicle_ForwardVectorX/Y/Z
- Added: #PB_Material_ProjectiveTexturing for SetMaterialAttribute()
- Added: ParticleScaleRate(), ParticleAngle(), CameraReflection()
- Added: BuildMeshManualLod(), BuildMeshLod(), MeshVertex(), CreateDataMesh()
- Added: EntityDirection(), EntityDirectionX(), EntityDirectionY(), EntityDirectionZ()
- Added: #PB_Local/#PB_Parent/#PB_World support for ApplyEntityForce(), ApplyEntityImpulse(), ApplyEntityTorque() and ApplyEntityTorqueImpulse()

Have fun and don't hesitate to reports any found issues !

The Fantaisie Software Team
Information complémentaire

About the DPI aware feature, it's currently Windows only and works automatically: all GUI elements are scaled automatically depending of the monitor DPI settings. That means than you can still create your GUI using absolute values, it will scale correctly. That said, some gadget (like CanvasGadget(), ImageGadget() etc.) won't scale their content automatically, so you will need to use the new Desktop DPI functions to allow proper support. The IDE has been adapted for DPI support in a very short time, with only canvas based gadget which needed some adjustment. Dialog library is also fully DPI compliant !
Concernant les fonctions 3D de cette version, c'est surtout le travail de Guillot, je me suis contenté d'ajouter de nouvelles constantes à la bibliothèque Vehicle.


Vous avez aimé cette actualité ? Alors partagez-la avec vos amis en cliquant sur les boutons ci-dessous :


 Poster une réponse

Avatar de comtois comtois - Responsable Purebasic https://www.developpez.com
le 02/06/2018 à 3:46
Timo (Freak) l'auteur du nouveau sous système Qt pour la version linux de PureBasic nous fournit un peu plus d'informations (je ne traduis pas, votre anglais est bien meilleur que le mien) :

Here is some more info regarding the Qt subsystem:

We have introduced this subsystem because there are a number of problems with the Gtk3 subsystem which are rooted in deep differences between the PB and Gtk philosophy and therefore cannot be fixed easily. Qt is much more "PB friendly" as it turns out. Since Qt is also available under the LGPL since some time, there is also no license issue in the way anymore. We are hoping that this new subsystem becomes stable enough to be the new default on Linux at some point in the future. Don't worry if you still want to use Gtk: We do not plan to remove support for it, it just might stop being the default sometime.

License:
The license is LGPL and we are not statically linking (the binaries provided with the Linux distribution are used). So the license situation is the same as with Gtk. Commercial use should be no problem.

Dependencies:
The minimum Qt version is 5.5.
The following should install everything you need to compile (Ubuntu). The runtime dependencies should be available on any recent Linux distribution already:

Code : Sélectionner tout
apt-get install qtbase5-dev qttools5-dev qtmultimedia5-dev qtdeclarative5-dev libqt5svg5-dev libqt5webkit5-dev libqt5multimedia5-plugins
Usage:
Just set "qt" as the used subsystem and all related libraries will switch to Qt (there should be no Gtk dependency anymore then). Of course this also means you cannot use any Gtk functions anymore to manipulate the GUI.

Scripting:
Since Qt is a C++ framework we cannot provide simple library imports to allow manipulating PB objects directly via API like it is possible with Gtk (or the Windows API). To allow at least some measure of API access, there is a new QtScript() command available which allows executing JavaScript code in the Qt QML engine and allows access to the PB GUI objects that inherit from QObject. It also allows interaction with the PB runtime library.

The command is simple:

Code : Sélectionner tout
Result$ = QtScript(Script$)
If you have the PB debugger enabled, then errors in the JavaScript code will be reported through the PB debugger.

The following functions are available inside the script:

Code : Sélectionner tout
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
PB object access. Returns the JS object representing the given PB object id.
  gadget(id)
  menu(id)
  statusbar(id)
  systray(id)
  toolbar(id)
  window(id)
 
Misc functions:
  debug(message)          - send a message to the PB debugger. Does nothing if debugger is off
  dump(object)            - dump a Qt object to a string. Useful for debugging or to discover what members are available in an object
 
PB Runtime integration:
  runtime.get(key)        - read a PB runtime value (variable, constant)
  runtime.set(key, value) - set a PB runtime variable
  runtime.call(key)       - call a PB runtime procedure. The procedure must have 0 arguments! If you want to pass a value, use runtime.set() on a global variable
More functions may be added later.

An example:

Code : Sélectionner tout
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Runtime Procedure QtSignalHandler()
    MessageRequester("", "Signal received!")
  EndProcedure 
 
  If OpenWindow(0, 0, 0, 320, 250, "FrameGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    ButtonGadget(0, 10,  10, 300, 50, "Original Text")
 
    ; show the ButtonGadget object's content
    Debug QtScript("dump(gadget(0))")
 
    ; modify the gadget text   
    QtScript(~"gadget(0).text = \"Modified Text\"")
 
    ; Connect a function to the "clicked" signal and call back into PB code
    ; Now if you click the gadget, the procedure is called
    QtScript(~"gadget(0).clicked.connect(function() { runtime.call(\"QtSignalHandler()\"); })")   
 
    Repeat
    Until WaitWindowEvent() = #PB_Event_CloseWindow
  EndIf
Other OS:
I know some of you are hoping for Qt on all OS, but I don't think this will be happening for various reasons:

  • Even though Qt is cross-platform, there are still a number of OS-specifics that are visible, especially in the details. So we would have to support and bugfix a "different" Qt subsystem for each OS. This is more work than you probably think, even if most of the code is shared.
  • On the other OS we already have a quite good integration with the native API, so we want to focus on that and not spend work on an "alternative" GUI subsystem that most people will not have any use for.
  • To me, having the same underlying framework on all OS only brings a benefit if you have full access to the framework in a cross-platform way as well. If you are limited to only what PB offers through its libraries, then what does it matter if it is Qt or Windows API below? (except that Qt would bring a ton of Dll dependencies on Windows)
  • As I said above, we developed this subsystem to solve a specific problem on Linux. The benefit of having it available on all OS simply do not justify the cost in my opinion.
Responsable bénévole de la rubrique Qt : Thibaut Cuvelier -