B3D style scaling window
BlitzMax Forums/BlitzMax Programming/B3D style scaling window
| ||
Is there a way to create a window in BMax that behaves in the same way that a scaled one would in B3D using the following command, Graphics 640,480,32,3 Ideally, I want something that automatically scales the content of the window when resized. Thanks for any help, Jason. |
| ||
If you use MaxGUI you can do it pretty easily - as you resize the window the attached canvas resizes also and the graphics are automatically scaled. Without MaxGUI is somewhat more difficult. |
| ||
I`ve tried with MaxGui but the canvas stays the same size when I adjust the window. Do I need to resize the canvas myself in code? Please could you provide a simple example? Thanks. Jason. |
| ||
as you resize the window the attached canvas resizes also and the graphics are automatically scaled. I wouldn't have thought so. On the Size event, you need to reset the viewport to the new dimensions. But this won't scale anything for you. You would need to calculate the 1:1 scale of the original dimensions to whatever was current, and then maybe call SetScale. (although SetScale isn't a true scaling function). |
| ||
I`ve tried with MaxGui but the canvas stays the same size when I adjust the window. Do I need to resize the canvas myself in code? The canvas can be resized by MaxGui automatically -> SetGadgetLayout Your graphics need to be scaled by you, check out the Redraw() function Edit: Removed the background window |
| ||
Instead of using maxGui, you can also changeLocal style = WS_VISIBLE | WS_CAPTION | WS_SYSMENUto Local style = WS_OVERLAPPEDWINDOW |WS_VISIBLEin "d3d7graphics.bmx". Same window styles must be used in "bbGLGraphicsCreateGraphics" in glgraphics.win32.c |
| ||
?Win32 Local style=GetWindowLongA(GetActiveWindow(),GWL_STYLE) SetWindowLongA GetActiveWindow(),GWL_STYLE,style|WS_SIZEBOX ? Just insert that after you call Graphics. After that, you will need to reset the projection matrix each frame in case the user resizes the window. |
| ||
That will allow the OpenGL to emulate Blitz3D's scalable window. All you have to do is copy and paste it into the bottom of you source file. I attempted to get the D3D7 driver to work but couldn't. |
| ||
Thanks everyone, problem solved. Jason. |