How do you use SDL in BMax?

Started by Scaremonger, February 12, 2021, 16:57:47

Previous topic - Next topic

Scaremonger

Hi,

Bruceys documentation shows that you have quite a bit on control over a graphics window using SDL, but how do you use it?

I was able to create a re-sizeable and transparent window using the following but I have no Max2D fucntionality.

Framework SDL.gl2sdlmax2d

Local window:TSDLWindow = New TSDLWindow.Create( "TEST SDL WIN", 10,10,320,200, SDL_WINDOW_RESIZABLE )
window.setOpacity( 0.5 )

Repeat
Print("hello world")
Until KeyHit( KEY_ESCAPE )


If I just use Graphics() I don't seem to be able to obtain a handle to the TSDLWindow object.

Any suggestions?
Si...

Derron


Scaremonger

@Derron, Awesome and Thanks. That was just what I needed.


SuperStrict
Framework SDL.gl2sdlmax2d

Graphics(800, 600)

Local window:TSDLWindow = TSDLGLContext.GetCurrentWindow()
window.setOpacity( 0.5 )

Repeat
Cls
DrawText( "X", MouseX(), MouseY() )
Flip
Until KeyHit(KEY_ESCAPE) Or AppTerminate()

End

Derron

Cool :)


Could be useful for a virus game in which you emulate a terminal (see competition...) :)


Interestingly the blitzmax mouse cursor position lags behind... at least on my computer.


bye
Ron