MaxGUI: Multiply Canvas crashes

BlitzMax Forums/BlitzMax Programming/MaxGUI: Multiply Canvas crashes

Space Fractal(Posted 2007) [#1]
When Im trying to put some graphics on my second canvas, but it crash with a DX error. Blitz+ could without issues, but why can BlitzMax not?

Global Data, X, Y, Do$

Global Refresh:TGadget
Global TimeLine:TGadget
Global ShowG:TGraphics
Global TimeLineG:TGraphics





Local wx=ClientWidth(Desktop())/2-1024/2
Local wy=ClientHeight(Desktop())/2-768/2
Local Window:TGadget=CreateWindow("Test", wx, wy, 1024, 768, Null, WINDOW_TITLEBAR | WINDOW_MENU | WINDOW_STATUS | WINDOW_CLIENTCOORDS)
Show=CreateCanvas(224, 0,800,600,Window,0)
TimeLine=CreateCanvas(244,600,0,160,Window,0)

ShowG=CanvasGraphics(Show)
TimeLineG=CanvasGraphics(TimeLine)

SetGraphicsDriver D3D7Max2DDriver()


Repeat
	SetGraphics ShowG
	SetClsColor(0, 0, 0)
	Cls()

	' HUNC on the secound canvas????? BUG? (DXERROR err=UNKNOWN:-2147024809 87)
	' How do I create multiply canvas and draw on them without crash?
	SetGraphics TimeLineG
	SetClsColor(255, 255, 255)
	Cls()

	Flip 1
Forever


For my side this may should been moved to BlitzMax bug, if this is a bug.


Dreamora(Posted 2007) [#2]
I miss the event part there like EVENT_GADGETREPAINT which is used and needed to set the graphics of the currently redrawn canvas.
You won't be able to work with MaxGUI without doing it the event based way.
At best you check out Assaris great tutorials on MaxGUI :)


btw: Is your desktop size large enough? From your spec you would need to have an 1280x1024 and a window of that size, as your canvas span a size of 800x760 already + window title etc.


Space Fractal(Posted 2007) [#3]
Dont think about the cords. This app may need a big screensize, because it a editor for a contain game Im going to create.

OK, im looking on that. But for some reason, it have never have such of this problem on blitz+.


skidracer(Posted 2007) [#4]
The design is a little different than b+, Max2D is only really designed to draw and flip one thing at a time, GL possibly allows you to paint to a second graphics context in the middle of painting the first but the max2d context itself is going to be disrupted so best to avoid such designs.

Oh it does work, your timeline gadget is zero pixels wide which should cause an error when it is created but instead is causing the dx driver to die.


Space Fractal(Posted 2007) [#5]
Yep, it should return a simple error. Good spotted about that little error.

But If I have set couble pixels in width, it so hang, instead of some error reporting (would just test, what it happens, no other).


Jake L.(Posted 2007) [#6]
@Dreamora

As I understand it the *only* thing EVENT_GADGETPAINT does is to tell you that the OS thinks your canvas needs a redraw (resize, overlapping window moved etc..). It's totally fine to ignore this and redraw the canvas each frame from within a main loop, isn't it?