Ooops
August 04, 2020, 11:51:40 AM

Author Topic: BlitzmaxNG fullscreen virtual resolution issues macOS Catalina  (Read 109 times)

Offline Ashmoor

  • Jr. Member
  • **
  • Posts: 60
The code below works perfectly fine on windows but does not work on macOS Catalina. Switching to fullscreen triggers some issue that leads to drawing it as in the image linked below code. Any idea how to fix this?

Using SetViewport leads to even weirder issues, both in windowed mode and full screen. It either draws just a part of the bgImg in the bottom left corner of the screen or the top part of bgImg at the top of the screen.

However, if I set a different width and height for the graphics call and leave everything else as is (with or without viewport), it works. For example 1110x619 works fine but 800x450 does not. It is not a matter of aspect ratio (does not matter if it's 16/9 or 4/3 or whatever).

Code: BlitzMax
  1.  
  2. Framework SDL.gl2sdlmax2d
  3. Import brl.jpgloader
  4.  
  5. Global fullscreen%=0
  6.  
  7.  
  8. Graphics 800,600,fullscreen
  9. SetBlend(ALPHABLEND)
  10.  
  11. Global bgImg:TImage=LoadImage("graphics/p1_wallpaper.jpg")
  12. 'Global bgImg:TImage=LoadImage("graphics/bgimg.jpg")
  13. If Not bgImg Then RuntimeError("cant load bgImg")
  14.  
  15. 'SetViewport(0,0,1920,1080)
  16. SetVirtualResolution(1920,1080)
  17.  
  18.  
  19.  
  20. Repeat
  21.  
  22.         Cls
  23.         DrawImage (bgImg,0,0)
  24.         DrawText(MouseX()+","+MouseY(),10,10)
  25.         Flip
  26.        
  27.         If KeyHit (KEY_ESCAPE) Or AppTerminate() Then End
  28.         If KeyHit(KEY_1) Then PrintViewPort()
  29.         If KeyHit(KEY_2)Then printcoords()
  30.         If KeyHit (KEY_3) Then
  31.                 fullscreen=Not(fullscreen)
  32.                 EndGraphics()
  33.                 ReInitGraphics()
  34.         EndIf
  35.                
  36. Forever
  37.  
  38. Function ReInitGraphics()
  39.         Graphics 800,600,fullscreen
  40.         SetVirtualResolution(1920,1080)
  41. EndFunction
  42.  
  43.  
  44. Function PrintViewPort()
  45.         Local xo%, yo%, vw%,vh%
  46.  
  47.         GetViewport(xo,yo,vw,vh)
  48.         Print "viewport:"+xo+","+yo+","+vw+","+vh
  49.         Local x#,y#
  50.         GetOrigin( x,y )
  51.         Print "origin:"+x+","+y
  52. EndFunction
  53.  
  54. Function PrintCoords()
  55.         Print ("x:"+MouseX()+"y:"+MouseY())
  56.         Print("vx:"+VirtualMouseX()+" vy:"+VirtualMouseY())
  57. EndFunction
  58.  
  59.  

Image: https://drive.google.com/file/d/192Kur5i7nMhaIa8yTOcYBdyN0zmcGuBi/view?usp=sharing

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal