Active Forums => QB64 Discussion => Topic started by: Qwerkey on January 10, 2019, 11:21:26 am
Title: Resizing Questions
Post by: Qwerkey on January 10, 2019, 11:21:26 am
$RESIZE:ON and its associated code allows a user to resize the program window. I am in the habit a writing graphics programs which use large screens, sometimes larger than members' monitors. Fellippe has advised me to use the $RESIZE:ON method.
But when a user changes the program's window size, does everything inside the window scale? I don't see why things such as _MOUSEX and graphics would scale inside the new window size. Such parameters are defined as pixel distances from the window Top-Left and not as fractions of the window size. Have the QB64 magicians been clever enough that all program "distances" scale with the $Resized window? If not, of course, a mouse click will not necessarily work properly at appropriate places.
Title: Re: Resizing Questions
Post by: Gets on January 10, 2019, 11:51:25 am
Quote
Have the QB64 magicians been clever enough that all program "distances" scale with the $Resized window?
Yes.
Title: Re: Resizing Questions
Post by: Qwerkey on January 14, 2019, 06:34:14 am
I think that I have managed (at last) to answer my own question, with a little help from Fellippe.
The $RESIZE:ON and its associated code does NOT automatically scale everything inside the window. The user must adjust all x- and y- distances with written code for scaling to the new _WIDTH and HEIGHT of the window (screen).
The first block of code demonstrates the usage of $RESIZE:ON and its associated _RESIZE code. This allows the user to change the widow size, but the image and _PRINTSTRING text do no scale with the window size. They stay at their fixed (x,y) positions and fixed sizes, and this is as we expect: those positions are defined as pixel distances from the top left. The text figures given are: screen width, screen height, mousex and mousey. Resize the window and see what happens. Esc to quit.
If you want the image to scale with the window, then write code for the x- and y- positions scaled to the window size, as in the next code block (lines 31-38). Now the image scales with screen size. The size of the _PRINTSTRING text does not scale, of course.
Title: Re: Resizing Questions
Post by: FellippeHeitor on January 14, 2019, 08:14:28 am
Don't forget about $RESIZE:SMOOTH and $RESIZE:STRETCH, which don't require polling _RESIZEWIDTH or _RESIZEHEIGHT or creating a new screen, as they just stretch the screen to the new resized dimensions and automatically adjust mouse clicks.
Title: Re: Resizing Questions
Post by: Qwerkey on January 14, 2019, 08:36:34 am
Oh, Pardom me. I had not understood from the wiki that $RESIZE:SMOOTH and $RESIZE:STRETCH don't require polling, _RESIZEWIDTH, _RESIZEHEIGHT or creating a new screen.
When I tried $RESIZE:SMOOTH and $RESIZE:STRETCH with the first code (and with previous efforts of mine), nothing much seemed to happen.
$RESIZE:SMOOTH and $RESIZE:STRETCH do automatically scale everything with the window size with just the one command.
Perhaps the wiki is not as clear as it might be for us dopeyer members.
Title: Re: Resizing Questions
Post by: FellippeHeitor on January 14, 2019, 08:57:02 am
Title: Re: Resizing Questions
Post by: Qwerkey on January 14, 2019, 10:27:55 am
Would I be right in thinking that $RESIZE:STRETCH (or $RESIZE:SMOOTH) can only feature once (at the beginning of the code) in a program?
I've tried a conditional $RESIZE:STRETCH mid code, just before a SCREEN statement, so that you can resize a large screen (should it need it), but not a smaller one (which doesn't need it). It appeared that you can only have Resize either on or off permanently (this was for a non-Inform project).
Having the $RESIZE:OFF function available implies that you can turn on/off resizing at will. But this does not seem to be the case, although I must say that I am still in wonder that this auto-scaled resizing has been achieved.
Title: Re: Resizing Questions
Post by: FellippeHeitor on January 14, 2019, 10:32:24 am
Set $RESIZE once (it's a precompiler switch), then use