|
Post by J7M on May 16, 2021 3:17:52 GMT -6
Hi, I have a program running fine in a window with 640x480 pixel. The screen of my laptop is 1920x1080. The screen of my desktop is 2560x1440. If I switch to fullscreen, the aspect ratio is wrong. For example a circle is stretched in x direction. I see it on both computers running Ubuntu 20.10. I have not tested it in Win10. Am I doing something wrong?
Best regards, J7M
Here my program:
IsFullscreen = true
SCREENX = 640 SCREENY = 480
if(IsFullscreen = true) then WindowOpen(0, "Test", 0 ,0, SCREENX, SCREENY, 1) else WindowOpen(0, "Test", WINDOWPOS_CENTERED, WINDOWPOS_CENTERED, SCREENX, SCREENY, 0) end if
CanvasOpen(0 , SCREENX, SCREENY, 0, 0, SCREENX, SCREENY, 0)
SetColor(rgb(255,255,255)) Circle(SCREENX/2,SCREENY/2,150) update waitkey
I can somehow fix it. But it is complicated:
IsFullscreen = true
SCREENX = 640 SCREENY = 480
Canvas_Offset = 0
if(IsFullscreen = true) then w = 0 h = 0 f = 0 GetDesktopDisplayMode(0, w, h, f) WindowRatio = (w/h) / (SCREENX/SCREENY) WindowOpen(0, "Test", 0 ,0, SCREENX * WindowRatio, SCREENY, 1) Canvas_Offset = -1*(SCREENX - SCREENX * WindowRatio)/2 'Move canvas to center of the screen (black border left and right) else WindowOpen(0, "Test", WINDOWPOS_CENTERED, WINDOWPOS_CENTERED, SCREENX, SCREENY, 0) end if
CanvasOpen(0 , SCREENX, SCREENY, Canvas_Offset, 0, SCREENX, SCREENY, 0)
SetColor(rgb(255,255,255)) Circle(SCREENX/2,SCREENY/2,150) update waitkey
|
|
|
Post by rosy on May 16, 2021 7:51:32 GMT -6
The aspect ratio of this window is different from that of the screen, so the image is stretched ...
I am making a 640x400 window, it has an intermediate aspect ratio ...
|
|
|
Post by J7M on May 18, 2021 8:42:40 GMT -6
I think it would be nice for the unexperienced programmer (who is the main target of rc-basic), if rc-basic is doing all the magic of scaling and keeping the correct aspect ration in the background.
|
|
|
Post by rosy on May 18, 2021 10:38:58 GMT -6
1. It is impossible. 2. Inexperienced programmer would learn nothing then.
|
|