Resizing ails
BlitzMax Forums/MaxGUI Module/Resizing ails
| ||
I have the following problem: for a program of mine, I want to have a resizable window on screen that can only be proportionally resized. To explain this further: the window has a size of 800x600 at the beginning and when resized, it is to keep that 4:3 ratio. So far, so good. I know how to set the window size as desired, but I'd like the window to keep the ratio also during resizing – which it doesn't. Secondly, I want the window's content to scale with the window's size. Also not much of a problem, but I'd like the contents to scale live, while the window is resized (meaning: the content should always be visible in the right size) – which it doesn't. Third problem – and that might possibly be a specific Mac problem: when I change the window's size to something bigger than the original size, the content of the canvas in the window gets pretty messed up, as shown in the screenshot below. ![]() If someone has some ideas, any help would be appreciated. Thanks in advance! Here's my code: |
| ||
3) Just a guess: try to enable GLShareContexts () before creating the canvas. It does the trick at my place. |
| ||
No, unfortunately that doesn't help. :( |
| ||
The Solution for resizing canvas's is in this thread: http://www.blitzmax.com/Community/posts.php?topic=70396#787269 |
| ||
Okay, implementing the event hook helps with problems 1 and 2: my window now actually retains the 4:3 ratio and the canvas remains visible during resizing. So far, so good. Unfortunately, problem 3 remains – the graphics I draw into the canvas is still becoming messed up on upscaling. Any solutions for that? |
| ||
Nobody any idea on problem 3? At least someone who has seen something similar before? Or am I alone with this problem? Anybody? |
| ||
Do you really have used the hook code mentioned? or have you just copied your eventhandling into the hook? if the last, then take a closer look at the resize handling. You need to set the Viewport to the new sizes: Case EVENT_WINDOWSIZE SetGraphics CanvasGraphics(Canvas) SetViewport 0,0,ClientWidth(Window),ClientHeight(Window) RedrawGadget Canvas Return Null |
| ||
Yep. SetViewPort is the most important bit, since, although you are resizing the graphics context when you resize the window, it doesn't automatically adjust the viewport - hence the visual noise you see. |
| ||
Ah, I see now. SetViewport or not, that didn't made any difference. But the line *before* that did. I originally had the SetGraphics command only at another point in the code. After adding that in the event handling code, it works now as it should. Thanks for the help! |