Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
GWRon opened this issue Mar 11, 2024 · 0 comments
Open

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

GWRon opened this issue Mar 11, 2024 · 0 comments

Comments

@GWRon
Copy link
Contributor

GWRon commented Mar 11, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant