QB64.org Forum

Active Forums => Programs => Topic started by: SMcNeill on October 16, 2021, 07:36:18 pm

Title: DisplayedScaled
Post by: SMcNeill on October 16, 2021, 07:36:18 pm
A little SUB which folks might want to make use of, if they have super high resolution monitors such as the one on my laptop.  At 3840x2048, most QB64 screens end up soooo dang tiny that I can't read or interact with them at all!

My solution for now?  A simple little DisplayScale routine.

Code: QB64: [Select]
  1. Screen _NewImage(1024, 720, 32)
  2. Const ScreenScale = 2.5
  3.  
  4.  
  5. Print "Foo"
  6. Print "Testing"
  7.  
  8. Sleep 'So we can see our screen before we scale it
  9.  
  10. DisplayScaled
  11.  
  12. Sleep 'so we can watch it scale
  13.  
  14.  
  15. Print "Cheetos?"
  16. Print "Testing...1...2..3" 'and, as you can tell here, we keep using the screen the same as always.
  17.  
  18. DisplayScaled 'All we do is call DisplayedScaled to display the screen at scale, rather than call _DISPLAY
  19.  
  20.  
  21. Sub DisplayScaled
  22.     Static DisplayDoubleScreen As Long
  23.     D = _Dest: S = _Source
  24.     If DisplayDoubleScreen = 0 Then
  25.         DisplayDoubleScreen = _NewImage(_Width * ScreenScale, _Height * ScreenScale, 32)
  26.         Screen DisplayDoubleScreen
  27.     End If
  28.     _PutImage , S, DisplayDoubleScreen
  29.     _Display
  30.     _Dest D: _Source S

Others might find this useful for something else, but it's probably going to become something that I tend to toss into a lot of my programs when I write them on my laptop in the future. 

Just swap out calls to _DISPLAY with DisplayScaled, and it does all the work for us.  ;)
Title: Re: DisplayedScaled
Post by: Dav on October 17, 2021, 07:16:26 pm
Very interesting solution.  3840x2048?  Wow.  I guess my 640x480 puzzles look more like icons on your screen.  I'll have to up my sizes.  My laptop has a max of 1366x768, and I stop at around 640 _HEIGHT because the taskbar always covers up the bottom of my QB64 screens.

- Dav
Title: Re: DisplayedScaled
Post by: SMcNeill on October 17, 2021, 07:36:15 pm
Very interesting solution.  3840x2048?  Wow.  I guess my 640x480 puzzles look more like icons on your screen.  I'll have to up my sizes.  My laptop has a max of 1366x768, and I stop at around 640 _HEIGHT because the taskbar always covers up the bottom of my QB64 screens.

- Dav

3840x2048 on a tiny little 17 inch screen.  You can just image how large a 8 pixel letter is on that! 

If you're curious, it'd look like this screenshot looks on a 1920x1024 monitor:

 


Print "Hello Tiny World!"
Print "This is how an image on a 640x480 screen looks on my laptop."
Print "Can you read me?"
Title: Re: DisplayedScaled
Post by: Qwerkey on October 18, 2021, 05:03:33 am
Ooh, must have a go.  On my HD (1920x1080) 14" screen, my QB64 windows are looking pretty small.  Steve, why were you born so inventive?
Title: Re: DisplayedScaled
Post by: Qwerkey on October 18, 2021, 07:46:21 am
Thank you, works perfectly.
Title: Re: DisplayedScaled
Post by: SMcNeill on October 18, 2021, 07:52:58 am
Thank you, works perfectly.

Glad someone else can make use of it.  👍
Title: Re: DisplayedScaled
Post by: Petr on October 18, 2021, 11:06:23 am
@SMcNeill

Thanks for sharing. I solve similar problems when using icons. Some users have a resolution of 1366x800, others have 1920x1050, others have an extreme like you. All what remains, is to count over percentages (at fullscreen) when the resolution is obtained using _DESKTOPWIDTH and _DESKTOPHEIGHT.