Posts: 37
Threads: 12
Joined: Jun 2022
Reputation:
6
I have a question.
My program starts with the command $RESIZE:SMOOTH in SCREEN 0 (text mode).
Everything works perfectly but if you want to maximize the screen the first row disappears. What can I do about it?
I know there is a command _FULLSCREEN _SQUAREPIXELS , _SMOOTH but I don't want it.
Here's a demo:
Code: (Select All) $RESIZE:SMOOTH
FOR a = 1 TO 10
LOCATE a, 1: PRINT "This is line"; a;
NEXT
PRINT: PRINT "Now maximize this Window and then return to a regular Window."
PRINT "As you can see, the first two rows disappear. How to solve?"
PRINT "Press any key to quit this program"
x$ = INPUT$(1)
SYSTEM
Posts: 3,974
Threads: 177
Joined: Apr 2022
Reputation:
219
07-22-2022, 04:46 PM
(This post was last modified: 07-22-2022, 04:49 PM by bplus.)
Hi @BDS107,
This works on my system Win 10 Laptop:
Code: (Select All) $Resize:On
For a = 1 To 10
Locate a, 1: Print "This is line"; a;
Next
Print: Print "Now maximize this Window and then return to a regular Window."
Print "As you can see, the first two rows disappear. How to solve?"
Print "Press any key to quit this program"
x$ = Input$(1)
System
There is not a loss of clarity of image. It appears to increase rows and cols as opposed to expanding the image.
b = b + ...
Posts: 2,696
Threads: 327
Joined: Apr 2022
Reputation:
217
When I maximize, the first 4 rows disappear on my display, but when I minimize, they come back as normal.
Something is off with the scaling factor when $RESIZE:SMOOTH and $RESIZE:STRETCH is used, and this needs to be recorded as a bug so it can be fixed when one of the developers have time to look into the issue.
Right now, the only solution would be to use $RESIZE:ON and then check for size changes and scale your display manually to adjust for them, and that's a lot more work than just adding a simple $RESIZE:SMOOTH to the top of your code.
Posts: 2,696
Threads: 327
Joined: Apr 2022
Reputation:
217
The issue here can be easily diagnosed and explained.
Take the code you wrote and run it. Now, manually grab the corner of the screen and drag the window until it'd be full screen. As soon as you let go of the mouse button, the screen then will "snap" back to where it can display as much as possible with maintaining the original aspect ration.
When you click the maximize button, it doesn't center the screen and place black bars along the edges to maintain your aspect ratio (like you see with many older movies and tv shows when they play on todays modern television sets). Instead, it scales the image so that it fills the screen completely, even if it has to clip off part of the screen when it does so.
The choices here, for this type of fix, would be to:
1) Either stretch the image to fit the whole screen and not pay any attention to the aspect ratio. (Some shows do this, which can lead to distorted faces and elongated circles and such being prominent.)
or
2) Maximize the image so that it fits the screen as much as possible, and then center it and add those black border bars along the edges to maintain the proper ratio.
I don't know which of these solutions would be easiest to implement, or even if OpenGL allows for easily making such adjustments, so the fix for this might be a while before it comes. For now, I'd suggest just grabbing the corner of the window and resizing it to the size you want with the mouse, without making use of that maximize button at all.
Posts: 2,696
Threads: 327
Joined: Apr 2022
Reputation:
217
Issue reported and logged in the repo. I don't know when someone will sort out where it's at and get around to fixing it, but at least it's a known issue now. https://github.com/QB64-Phoenix-Edition/...issues/128
Posts: 37
Threads: 12
Joined: Jun 2022
Reputation:
6
Hi, thanks for looking and reporting this as a bug.
When I'm home I'll take a look at this.
Now, I'm on vacation in London.
Posts: 37
Threads: 12
Joined: Jun 2022
Reputation:
6
Here's another and better example.
When $RESIZE:SMOOTH is used, the first 2 lines disappear during maximization. Resize Window is then OK.
With $RESIZE:ON maximizing and resize doesn't work for me.
Code: (Select All) $RESIZE:ON
SCREEN 0, 1, 0, 0: COLOR 15, 1: CLS
DEFINT A-Z
LOCATE 1, 1: PRINT CHR$(219); CHR$(223); CHR$(221); "......"; CHR$(222); STRING$(69, 223); CHR$(219);
FOR a = 2 TO 24: LOCATE a, 1: PRINT CHR$(219); SPACE$(78); CHR$(219);: NEXT
LOCATE 25, 1: PRINT CHR$(219); STRING$(25, 220); CHR$(221); "......."; CHR$(222); STRING$(44, 220); CHR$(219);
COLOR 14
FOR a = 1 TO 25
LOCATE a, a + 3: PRINT "Line"; STR$(a);
NEXT
COLOR 7: LOCATE 7, 25: PRINT "Now maximize or resize this Window";
LOCATE 8, 25: PRINT "Change the first line in the code from";
LOCATE 9, 25: PRINT "'$RESIZE:ON' to '$RESIZE:SMOOTH'"
LOCATE 11, 25: PRINT "Press ANY key to end";
DO: LOOP UNTIL INKEY$ <> ""
SYSTEM
Here the result:
Posts: 2,696
Threads: 327
Joined: Apr 2022
Reputation:
217
With $RESIZE:ON, you have to manually handle resize events yourself. They screen doesn't auto-scale. (Think of how the IDE adds rows and columns but doesn't adjust font size, when you expand it.)
Posts: 89
Threads: 19
Joined: Apr 2022
Reputation:
14
Here's a quick demo of manually using $RESIZE:ON to change the number of rows and columns which are available on screen, without scaling the display image itself:
Code: (Select All) $Resize:On
activeScreen = _NewImage(80, 25, 0) 'standard screen 0
Screen activeScreen
DrawBorder
_Delay .25
clearInitialResize = _Resize 'clear thr size change from where QB64 first starts up
Do
If _Resize Then
tempScreen = _NewImage(_ResizeWidth \ _FontWidth, _ResizeHeight \ _FontHeight, 0)
Screen tempScreen
_FreeImage activeScreen
activeScreen = tempScreen
DrawBorder
End If
Loop Until _KeyHit
System
Sub DrawBorder
Color 4
For x = 1 To _Width
Locate 1, x: Print Chr$(219);
Locate _Height, x: Print Chr$(219);
Next
For y = 1 To _Height
Locate y, 1: Print Chr$(219);
Locate y, _Width: Print Chr$(219);
Next
Color 15
Locate _Height \ 2, _Width \ 2 - 12: Print "Resize On, Non-Scale Demo"
Locate _Height \ 2 + 2, 3: Print "Width:"; _Width
Locate _Height \ 2 + 3, 3: Print "Height:"; _Height
End Sub
Posts: 89
Threads: 19
Joined: Apr 2022
Reputation:
14
And here's a demo of using $RESIZE:ON to scale the screen, like you were originally intending:
Code: (Select All) $Resize:On
activeScreen = _NewImage(640, 400, 256) '256 color screen so we can use _PUTIMAGE for scaling
viewScreen = _NewImage(640, 400, 256) 'a second screen to scale to
Screen viewScreen
_Dest activeScreen: _Source activeScreen
DrawBorder
_Delay .25
clearInitialResize = _Resize 'clear thr size change from where QB64 first starts up
Do
If _Resize Then
tempScreen = _NewImage(_ResizeWidth, _ResizeHeight, 256)
Screen tempScreen
_FreeImage viewScreen
viewScreen = tempScreen
End If
_PutImage , activeScreen, viewScreen
_Limit 30
Loop Until _KeyHit
System
Sub DrawBorder
Color 4
For x = 1 To _Width \ _FontWidth
Locate 1, x: Print Chr$(219);
Locate _Height \ _FontHeight, x: Print Chr$(219);
Next
For y = 1 To _Height \ _FontHeight
Locate y, 1: Print Chr$(219);
Locate y, _Width \ _FontWidth: Print Chr$(219);
Next
Color 15
Locate 3, 3: Print "Resize On, Scale-Size Demo"
Locate 5, 3: Print "Width:"; _Width
Locate 6, 3: Print "Height:"; _Height
End Sub
Note that it's up to you to maintain the same aspect ratio, which I didn't do here to illustrate how things can "stretch" and distort if you don't do so when manually resizing like this.
|