March 05, 2021, 12:13:19 AM

Author Topic: How do you use SDL in BMax?  (Read 118 times)

Offline Scaremonger

How do you use SDL in BMax?
« on: February 12, 2021, 04:57:47 PM »
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.
Code: [Select]
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...
Follow me at ITSpeedway.net.

Offline Derron

Re: How do you use SDL in BMax?
« Reply #1 on: February 12, 2021, 11:36:46 PM »
We had some similar request (indirectly) some months ago.


https://www.syntaxbomb.com/index.php/topic,7971.msg347044595.html#msg347044595


bye
Ron

Offline Scaremonger

Re: How do you use SDL in BMax?
« Reply #2 on: February 13, 2021, 08:50:26 AM »
@Derron, Awesome and Thanks. That was just what I needed.

Code: [Select]
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
Follow me at ITSpeedway.net.

Offline Derron

Re: How do you use SDL in BMax?
« Reply #3 on: February 13, 2021, 09:39:18 AM »
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

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal