Issue with two CreateCanvas calls
Archives Forums/BlitzMax Bug Reports/Issue with two CreateCanvas calls
| ||
This is an odd issue with the latest version of MaxGUI. The code below creates two canvases but the second is created the same size as the first instead of the requested size. It works if the creation order is reversed.
SuperStrict
Import MaxGui.Drivers
Global window:TGadget = CreateWindow:TGadget("Ed",60,60,1010,670,Null,WINDOW_TITLEBAR| WINDOW_CLIENTCOORDS )
Global moveableCanvas:TGadget = CreateCanvas( 116 , 281 , 64 , 64 , window:TGadget )
Global gameCanvas:TGadget = CreateCanvas( 200 , 23 , 800 , 600 , window:TGadget )
Repeat
WaitEvent()
Select EventID()
Case EVENT_WINDOWCLOSE
End
Case EVENT_GADGETPAINT
Select EventSource()
Case gameCanvas
SetGraphics CanvasGraphics( gameCanvas )
Cls
Flip
Case moveableCanvas
SetGraphics CanvasGraphics( moveableCanvas )
Cls
Flip
End Select
End Select
Forever
|
| ||
| I've done some investigation, and it appears as though this is actually a D3D9 bug. If you use the D3D7 or OpenGL drivers, the bug doesn't exist. Mark? Skid? |
| ||
| The viewport size is not related to the current graphics object but the draw state of Max2D (singleton design). You therefore need to call SetViewPort at the beginning of a redraw block when managing multiple targets. |
| ||
| The viewport size is not related to the current graphics object but the draw state of Max2D (singleton design). You therefore need to call SetViewPort at the beginning of a redraw block when managing multiple targets. I'm not sure that is the problem here, Skid... The following produces the same buggy results (but for DX9 driver only): SuperStrict
Import MaxGui.Drivers
Global window:TGadget = CreateWindow:TGadget("Ed",60,60,1010,670,Null,WINDOW_TITLEBAR| WINDOW_CLIENTCOORDS )
Global moveableCanvas:TGadget = CreateCanvas( 116 , 281 , 64 , 64 , window:TGadget )
Global gameCanvas:TGadget = CreateCanvas( 200 , 23 , 800 , 600 , window:TGadget )
Repeat
WaitEvent()
Select EventID()
Case EVENT_WINDOWCLOSE
End
Case EVENT_GADGETPAINT
Select EventSource()
Case gameCanvas
SetGraphics CanvasGraphics( gameCanvas )
SetViewport 0, 0, ClientWidth(gameCanvas), ClientHeight(gameCanvas)
Cls
Flip
Case moveableCanvas
SetGraphics CanvasGraphics( moveableCanvas )
SetViewport 0, 0, ClientWidth(moveableCanvas), ClientHeight(moveableCanvas)
Cls
Flip
End Select
End Select
Forever |
| ||
| Agreed. |
| ||
| Hi, Fix coming soon in 1.39 release. |