bmx-ng / sdl.mod

SDL backend for BlitzMax
7 stars 6 forks source link

SDL - Flags defined as "ULong" while we now support "UInt" #60

Open GWRon opened 6 months ago

GWRon commented 6 months ago

Hey,

While fiddling with another issue I stumbled over SDLVideo.mod ...

In there flags are defined as "ULong" and functions do all these shl 32 required to make it "Uint32" again. common.bmx:

Rem
bbdoc: fullscreen window
End Rem
Const SDL_WINDOW_FULLSCREEN:UInt = $00000001:ULong Shl 32
Rem
bbdoc: window usable with OpenGL context
End Rem
Const SDL_WINDOW_OPENGL:ULong = $00000002:ULong Shl 32

...

sdlvideo.bmx:

    Function Create:TSDLWindow(title:String, x:Int, y:Int, w:Int, h:Int, flags:ULong)
        Return _create(bmx_sdl_video_CreateWindow(title, x, y, w, h, UInt(flags Shr 32)))
    End Function

As NG supports "UInt" (which is 32bit - so Uint32 in C ?) shouldn't we be able to get rid of all these conversions and directly use the same UInt-values as the SDL lib does. Is there a specific reason to use ULong? Is it to transport some other flag in the variable too?

And when changing it, one could consider adding:

'for now sdl.mod/sdlvideo.mod does not expose it...
Extern
    Function SDL_GetWindowFlags:UInt(handle:Byte Ptr)
End Extern

too ... as this would allow to retrieve the current "fullscreen state" (and other things) - instead of having to store it in an machine state system.