Ooops
October 31, 2020, 04:51:47 PM

Author Topic: MAC NG mouse issue in fullscreen  (Read 279 times)

Offline wadmixfm

  • Jr. Member
  • **
  • Posts: 64
MAC NG mouse issue in fullscreen
« on: August 23, 2020, 10:56:36 PM »
Code: [Select]
SuperStrict

Graphics 640,480,32

While Not AppTerminate() Or Not Confirm( "Terminate?" )
If KeyHit(KEY_ESCAPE) Then End
Cls
DrawText "press escape to quit",0,40
DrawText MouseX()+","+MouseY(),0,0
Flip

Wend

On a mac when you use this the mouse works in the opposite direction on the y axis is this a bug
this only happens when in fullscreen mode
when you change the graphics to 640,480,0 it works fine



Offline wadmixfm

  • Jr. Member
  • **
  • Posts: 64
Re: MAC NG mouse issue in fullscreen
« Reply #1 on: August 24, 2020, 12:19:43 PM »
has anyone else experienced this


i will try it on windows also

lee

Offline wadmixfm

  • Jr. Member
  • **
  • Posts: 64
Re: MAC NG mouse issue in fullscreen
« Reply #2 on: August 24, 2020, 12:53:22 PM »
These 2 pics are running the same file on 1.56ng for Windows and Mac os Catalina exactly the same code and as you can see the one that says 237,480 was produced on the Mac
The other is windows

Can someone tell me is this a module problem ,a graphics driver issue ???

Thanks

Lee

Offline Ashmoor

  • Jr. Member
  • **
  • Posts: 84
Re: MAC NG mouse issue in fullscreen
« Reply #3 on: August 24, 2020, 02:42:00 PM »
This is a standar MacOS issue. (edit) The screen origin is in the bottom left on MacOS instead of top left as is on Windows. SDL does the proper conversions and most things should work fine.

You should use SDL for mac.

Check out the code below:

Code: BlitzMax
  1.  
  2. Framework SDL.gl2sdlmax2d
  3. Import brl.jpgloader
  4. Import brl.Random
  5. Import brl.StandardIO
  6.  
  7. Global isFullScreen
  8.  
  9. Global bgImg:TImage=LoadImage("graphics/screen_tester1.jpg")
  10. If Not bgImg Then RuntimeError("cant load bgImg")
  11.  
  12.  
  13. Global vrWidth=1920
  14. Global vrHeight=1080
  15.  
  16. Global wWidth=960
  17. Global wHeight=600
  18.  
  19. Global fsWidth=DesktopWidth()
  20. Global fsHeight=DesktopHeight()
  21.  
  22. Graphics (wWidth,wHeight)
  23. SetBlend AlphaBlend
  24. SetVirtualResolution(vrWidth, vrHeight)
  25.  
  26.  
  27. Repeat
  28.  
  29.         Cls
  30.         If KeyHit (KEY_SPACE) Then
  31.                 EndGraphics()
  32.                
  33.                 If Not isFullScreen Then
  34.                         'switch to full screen
  35.                         isFullScreen=True
  36.                        
  37.                         Graphics (fsWidth, fsHeight)
  38.                         SetVirtualResolution(1920,1080)
  39.                        
  40.                         Local window:TSDLWindow = TSDLGLContext.GetCurrentWindow()
  41.                         window.SetFullScreen(SDL_WINDOW_FULLSCREEN_DESKTOP)
  42.                        
  43.                 Else
  44.                         'switch to windowed
  45.                         isFullScreen=False
  46.                          
  47.                         Graphics (wWidth,wHeight)
  48.                         SetVirtualResolution(1920,1080)
  49.                         Local window:TSDLWindow = TSDLGLContext.GetCurrentWindow()
  50.                         window.SetFullScreen(0)
  51.                
  52.                 EndIf
  53.                
  54.        
  55.         EndIf
  56.  
  57. 'draw something so we can check
  58.                 DrawImage(bgImg,0,0)
  59.                
  60.         SeedRnd(MilliSecs() / 1000)
  61.         For Local i :Int = 0 To 100
  62.                 SetColor Rand(0,255), Rand(0,255), Rand(0,255)
  63.                 DrawText("Hey", Rand(0, vrWidth-50), Rand(0, vrHeight-20))
  64.         Next
  65.                 SetColor (255,255,255)
  66.                
  67.                 SetScale(2.0,2.0)
  68.                 DrawText("rm:"+MouseX()+","+MouseY(),10,30)
  69.                 DrawText(VirtualMouseX()+","+VirtualMouseY(),10,10)
  70.                 SetScale(1.0,1.0)
  71.                
  72.                 Local x:Float, y:Float
  73.                 x=VirtualMouseX(); y=VirtualMouseY()
  74.                
  75.                 DrawRect(x-5,y-5,10,10)
  76.  
  77.         Flip()
  78.  
  79. 'end condition
  80.         If KeyHit(KEY_ESCAPE) Or AppTerminate() Then End
  81. Forever
  82.  

Offline Derron

  • Hero Member
  • *****
  • Posts: 3239
Re: MAC NG mouse issue in fullscreen
« Reply #4 on: August 24, 2020, 04:12:06 PM »
Brucey stated yesterday (in the discord channel) that he only supports sdl on mac os x. Maybe this should be stated on the website (until "fixed" - or taken care of elsewise)


bye
Ron

Offline iWasAdam

  • Hero Member
  • *****
  • Posts: 1985
Re: MAC NG mouse issue in fullscreen
« Reply #5 on: August 25, 2020, 06:56:33 AM »
Oh FFS!!!!!!!   :o :o :o :o :o :o :o :o :o :o :o

Ng has a half finished website
modules with no examples
working examples that don't - they work but not really how the should work
a dev chain where you can't build a mod without trashing things.
Several different modules for doing output - but none is the best one!

SO... for output it MUST be SDL. fine - where is the documentation and the base code for this. or do we have to make it up as we go?

Both Ashmoor and wadmixfm are correct - there are errors, and there are odd things. And these are all starting to become issues!


Offline Derron

  • Hero Member
  • *****
  • Posts: 3239
Re: MAC NG mouse issue in fullscreen
« Reply #6 on: August 25, 2020, 09:44:18 AM »
The issue with the brl modules on mac is ... that opengl is more or less deprecated and so ... we need to handle that soon anyways. Dunno if there is much benefit in fixing stuff in "brl" if SDL works.

Regarding "SDL" usage" ... yes maybe people should start using it "right from start" as you gain multiple stuff:
- better multi monitor support (brl full screen = full screen on all screens, sdl full screen = full screen on active monitor)
- touch support
- other platforms

Maybe the old "brl" backends are there for backwards compatibility (and because they work ... on linux and windows and "older macs") ?


@ Modules without examples
Yes, there is a lot of documentation missing - and if you know people who could write good documentation, tutorials and examples: give them a wink so they join us doing it.

Brucey added a lot of examples some months ago ... but some modules need more than just some examples, they need a kind of "introduction" (think of json, xml ...)


bye
Ron

Offline wadmixfm

  • Jr. Member
  • **
  • Posts: 64
Re: MAC NG mouse issue in fullscreen
« Reply #7 on: August 25, 2020, 02:46:52 PM »
well i did change to the sdl mod and yes it did work !!!!

but i got a few little errors for TTimer

so i changed it back to brl and it compiles and runs ok but just for the mac i can get around the mouse y been backward

but answer me this !!!!

if the mouse y origin is wrong why isn't the drawtext "Hi",x,y wrong ??





Offline Derron

  • Hero Member
  • *****
  • Posts: 3239
Re: MAC NG mouse issue in fullscreen
« Reply #8 on: August 25, 2020, 04:20:26 PM »
BTW this is the old issue for this:
https://github.com/bmx-ng/brl.mod/issues/79


If you need to use the "Brl..." stuff and not "SDL", then .. maybe have your own
MyMouseX() - which returns mouseX()
MyMouseY() - which returns "GraphicsHeight() - mouseY()" when on full screen and mac os x ...



@ Timer issues with SDL.
There is "sdl.sdltimer" - maybe import this, instead of "brl.timerdefault". If you do not use "Framework", then "brl.timerdefault" is automatically loaded.


bye
Ron

Offline wadmixfm

  • Jr. Member
  • **
  • Posts: 64
Re: MAC NG mouse issue in fullscreen
« Reply #9 on: August 25, 2020, 09:23:17 PM »
cheers ron

as i say i can get around it , but its not the norm so to speak, maybe i am still in vanilla mode and not done the full transition to NG Yet !!!!!!

getting there slowly

The project i am working on is coming together nicely now i have managed to rid it of all the goto's and labels and found a way to make it work and flow better

cheers for all the help people

mac version though is definitely different to the windows version there are a lot of tweaks you have to keep in mind when coding on the mac

Lee

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal