Hi All,
Thanks to Fred vS, Nimbus and Roland, I've changed the code to resize the window for each platform. Now the code is:
procedure TFormMain.FormCreate(Sender: TObject);
{$ifdef Linux}var BoundsRect_client: TRect;{$endif}
begin
{$ifdef MAXIMIZE_SCENE_ON_MONITOR}
FScene := TOGLCScene.Create(OpenGLControl1, SCREEN_WIDTH_AT_DESIGN_TIME/SCREEN_HEIGHT_AT_DESIGN_TIME);
{$ifdef WINDOWED_MODE}
// WINDOWED MODE
{$if defined(Linux)}
BoundsRect_client := Monitor.BoundsRect;
BoundsRect_client.Width := Monitor.BoundsRect.width - 100;
BoundsRect_client.left:= 50;
BoundsRect_client.height := Monitor.BoundsRect.height - 100;
BoundsRect_client.top:= 50;
BoundsRect := BoundsRect_client;
WindowState := wsNormal;
{$elseif defined(Windows)}
WindowState := wsMaximized;
BorderIcons := [biSystemMenu, biMinimize, biMaximize]; // necessary to see the task bar
{$elseif defined(Darwin)}
BorderIcons := [biSystemMenu,biMinimize];
BoundsRect := Monitor.BoundsRect;
{$endif}
{$else}
// FULLSCREEN MODE
{$if defined(Windows) or defined(Linux)}
BorderIcons := [];
BorderStyle := bsNone;
WindowState := wsFullScreen;
ShowWindow(Handle, SW_SHOWFULLSCREEN);
BoundsRect := Monitor.BoundsRect;
{$elseif defined(Darwin)}
BoundsRect := Monitor.BoundsRect;
{$endif}
{$endif}
{$else}
// WINDOWED MODE WITH FIXED SIZE
ClientWidth := Trunc(SCREEN_WIDTH_AT_DESIGN_TIME);
ClientHeight := Trunc(SCREEN_HEIGHT_AT_DESIGN_TIME);
FScene := TOGLCScene.Create(OpenGLControl1, -1);
BorderIcons := [biSystemMenu];
BorderStyle := bsSingle;
WindowState := wsNormal;
{$endif}
...
Tested on Windows and VM Light Ubuntu 24.04 Noble Numbat. The code work for both windowed mode, fullscreen mode and window with fixed size mode.
For the moment, on macOS the window have the same size as the monitor for both mode. I tryed the full screen mode explained at
https://wiki.lazarus.freepascal.org/macOS_Programming_Tips#Launch/Toggle_full_screen without success: fpc give an internal error when using the {$modeswitch objectivec1} directive on my VM Catalina machine.
Here
https://github.com/bastibe/libsndfile-binaries there is a script to compile libsndfile.so library without dependency (the previous .so provided with the game had a dependency with Flac). I've used this script and recompiled the libsndfile.so on a VM Ubuntu 20.04. ldd command say no dependency. The lib was tested on the VM LUbuntu 24.04, it work.
The game is updated.
Thanks again to Fred vS, Nimbus and Roland for their help !