MAC NG mouse issue in fullscreen

Started by wadmixfm, August 23, 2020, 22:56:36

Previous topic - Next topic

wadmixfm

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



wadmixfm

has anyone else experienced this


i will try it on windows also

lee

wadmixfm

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

Ashmoor

#3
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) Select


Framework SDL.gl2sdlmax2d
Import brl.jpgloader
Import brl.Random
Import brl.StandardIO

Global isFullScreen

Global bgImg:TImage=LoadImage("graphics/screen_tester1.jpg")
If Not bgImg Then RuntimeError("cant load bgImg")


Global vrWidth=1920
Global vrHeight=1080

Global wWidth=960
Global wHeight=600

Global fsWidth=DesktopWidth()
Global fsHeight=DesktopHeight()

Graphics (wWidth,wHeight)
SetBlend AlphaBlend
SetVirtualResolution(vrWidth, vrHeight)


Repeat

        Cls
        If KeyHit (KEY_SPACE) Then
                EndGraphics()
               
                If Not isFullScreen Then
                        'switch to full screen
                        isFullScreen=True
                       
                        Graphics (fsWidth, fsHeight)
                        SetVirtualResolution(1920,1080)
                       
                        Local window:TSDLWindow = TSDLGLContext.GetCurrentWindow()
                        window.SetFullScreen(SDL_WINDOW_FULLSCREEN_DESKTOP)
                       
                Else
                        'switch to windowed
                        isFullScreen=False
                         
                        Graphics (wWidth,wHeight)
                        SetVirtualResolution(1920,1080)
                        Local window:TSDLWindow = TSDLGLContext.GetCurrentWindow()
                        window.SetFullScreen(0)
               
                EndIf
               
       
        EndIf

'draw something so we can check
                DrawImage(bgImg,0,0)
               
        SeedRnd(MilliSecs() / 1000)
        For Local i :Int = 0 To 100
                SetColor Rand(0,255), Rand(0,255), Rand(0,255)
                DrawText("Hey", Rand(0, vrWidth-50), Rand(0, vrHeight-20))
        Next
                SetColor (255,255,255)
               
                SetScale(2.0,2.0)
                DrawText("rm:"+MouseX()+","+MouseY(),10,30)
                DrawText(VirtualMouseX()+","+VirtualMouseY(),10,10)
                SetScale(1.0,1.0)
               
                Local x:Float, y:Float
                x=VirtualMouseX(); y=VirtualMouseY()
               
                DrawRect(x-5,y-5,10,10)

        Flip()

'end condition
        If KeyHit(KEY_ESCAPE) Or AppTerminate() Then End
Forever

Derron

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

iWasAdam

#5
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!


Derron

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

wadmixfm

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 ??





Derron

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

wadmixfm

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