You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to see MaxGUI working with SDL (so eg sdlrendermax2d).
For now this is not possible as MaxGUI's GTK3Driver initializes its own systemdriver. First step is extending this system driver to use TSDLSystem instead ... also
Type TGTK3SystemDriver Extends TSDLSystemDriver Implements IWrappedSystemDriver
(I actually copied the whole mode and made it a maxgui.mod/SDLGTK3MaxGUI.mod)
Next thing to comment out is
'?linux
' attach max's fd to a glib event source so things like timers can work
' guisystem.gsource = bmx_gtk_event_source_new(bbSystemAsyncFD())
'?
but I am not sure if it needs something similar at the end - or if SDL handles it for us already.
It then compiles the following - but segfaults on "cls" (null element) and asserts that AttachGraphics failed:Assert failedAttachGraphics failed:
SuperStrictFrameworkBrl.StandardIOImportMaxGui.SDLGTK3MaxGUIImportSDL.SDLRendermax2DImportSDL.SDLTimerImportbrl.EventQueueGlobal window:TGadget=CreateWindow("Canvas",100,100, 600, 400 ,Null,WINDOW_TITLEBAR)
Global canvas:TGadget=CreateCanvas(100,100, 400,200,window)
Global X:Int=150,Y:Int=100, Xadd:Int=1, YAdd:Int=1
CreateTimer 60While WaitEvent()
Select EventID()
Case EVENT_TIMERTICK
GameLogic
RedrawGadget canvas
Case EVENT_GADGETPAINT
Draw
Case EVENT_WINDOWCLOSE, EVENT_APPTERMINATE
End
End SelectWendFunctionDraw()
SetGraphics CanvasGraphics(Canvas)
Cls
DrawOval X,Y,20,20
Flip 0End FunctionFunctionGameLogic()
X:+ Xadd
Y:+ Yadd
If X<0Or X>400Then Xadd=-Xadd
If Y<0Or Y>200Then Yadd=-Yadd
End Function
(code adjusted from Midimasters sample at discord)
The text was updated successfully, but these errors were encountered:
Method AttachGraphics:TGraphics( flags:Long )
Mode = flags
End Method
Method CanvasGraphics:TGraphics()
If Not canvas Then
canvas = BRL.Graphics.AttachGraphics(gdk_x11_window_get_xid(gtk_widget_get_window(handle)), Mode)
End If
Return canvas
End Method
fails to attach the graphics.
BTW it is interesting to see the Method AttachGraphics to say it returns a TGraphics instance but does not return ... anything (than null)
Maybe sdlgraphics.mod/sdlgraphics.bmx:
Method AttachGraphics:TSDLGraphics( widget:Byte Ptr,flags:Long ) Override
Local t:TSDLGraphics=New TSDLGraphics
't._context=bbGLGraphicsAttachGraphics( widget,flags )
Return t
End Method
needs some ... functionality (context...) ?
GWRon
changed the title
SDL + MaxGUI (System drivers already initialized)
SDL + MaxGUI (System drivers already initialized) -> sdlgraphics AttachGraphics not working?
Oct 10, 2023
I would like to see MaxGUI working with SDL (so eg sdlrendermax2d).
For now this is not possible as MaxGUI's GTK3Driver initializes its own systemdriver. First step is extending this system driver to use TSDLSystem instead ... also
(I actually copied the whole mode and made it a maxgui.mod/SDLGTK3MaxGUI.mod)
Next thing to comment out is
but I am not sure if it needs something similar at the end - or if SDL handles it for us already.
It then compiles the following - but segfaults on "cls" (null element) and asserts that
AttachGraphics failed:Assert failedAttachGraphics failed
:(code adjusted from Midimasters sample at discord)
The text was updated successfully, but these errors were encountered: