Hi , is there a fix for the mac version of blitzmax NG ???

Started by wadmixfm, January 28, 2025, 17:26:00

Previous topic - Next topic

wadmixfm

Hi this has been asked before but never really got a definitive answer to the problem

On the mac , when you create a app window with

graphics 1024,768

everything works well

but if you use

graphics 1024,768,32

everything works apart from the mouse , its in a like mirror mode top is bottom - bottom is top

so the y axis is 768=0 and 0 =768

is this a bug ??

Lee
Yes its really me :)

Dabz

#1
Seems like a bug to me as colour depth shouldnt have nothing to do with the mouse.

Quick fix would be to flip the value of the mouse Y coordinate, so, in effect, I'd simply do something like this:-

SuperStrict

Graphics 640,480,32
Local my:Int
Repeat
Cls
'Flip the mouse so it resembles the mac 32bit depth bug
my = MouseY()-GraphicsHeight()
'Then turn that frown back upside down! :)
my = GraphicsHeight()+my ;<----my is your buggy MouseY()
DrawText my,0,0
Flip
Until KeyDown(KEY_ESCAPE)

I havent got a Mac, hence why I had to introduce your bug in windows version.

Dabz
Intel Core i5 6400 2.7GHz, NVIDIA GeForce GTX 1070 (8GB), 16Gig DDR4 RAM, 256GB SSD, 1TB HDD, Windows 10 64bit

wadmixfm

is there a way to use the fullscreen mode ??

my app runs at 1280x760 on a mac and windows machine

but if i want to set the window to full

how is it possible ??

Cheers

i do remember seeing a function for it a few years ago but that was for Blitzmax vanilla 1.28 32 bit

but now i am using Blitzmax Ng 64bits of goodness on both mac and windows


Lee
Yes its really me :)

Midimaster

If full-screen is your target, you have to look, which resolutions are available on your system (here: your MAC). 
The Graphics-Module offers a function to display all available Resolutions in a list.
...back from North Pole.

Midimaster

In cooperation with RON we can offer you this solution:

SuperStrict
Framework Brl.StandardIO
Import sdl.glsdlmax2d

Graphics 800,600,32
Repeat
    Cls
    DrawRect MouseX(), MouseY(), 10,10
    Flip
    If KeyHit(KEY_ESCAPE) Then End
Until AppTerminate()

This works in FULLSCREEN and also in Windowed mode on all systems. The MouseY() returns correct results and even the positioning of the windowed Window on a MAC works:

SuperStrict
Framework Brl.StandardIO
Import sdl.glsdlmax2d

Graphics 1280,760,0,0,0,0,0
Repeat
    Cls
    DrawRect MouseX(), MouseY(), 10,10
    Flip
    If KeyHit(KEY_ESCAPE) Then End
Until AppTerminate()
...back from North Pole.

Baggey

QuoteVERY NICE! 8)
 
SuperStrict
Framework Brl.StandardIO
Import sdl.glsdlmax2d
Graphics 1280,760,0,0,0,0,0
Repeat
    Cls
    DrawRect MouseX(), MouseY(), 10,10
    Flip
    If KeyHit(KEY_ESCAPE) Then End
Until AppTerminate()
Is there away of re-positioning the window start up position?
Running a PC that just Aint fast enough!? i7 4Ghz Quad core 32GB ram  2x1TB SSD and NVIDIA Quadro K1200 on 2 x HP Z24's . DID Technology stop! Or have we been assimulated!

Windows10, Parrot OS, Raspberry Pi Black Edition! , ZX Spectrum 48k, C64, Enterprise 128K, The SID chip. Im Misunderstood!

wadmixfm

Yes its really me :)

wadmixfm

well a little update for you

this bit of code does work on the mac

SuperStrict
Framework Brl.StandardIO
Import sdl.glsdlmax2d

Graphics 1280,760,60,0,0,0,0
Repeat
    Cls
    DrawRect MouseX(), MouseY(), 10,10
    Flip
    If KeyHit(KEY_ESCAPE) Then End
Until AppTerminate()


in fullscreen mode 100%

but breakthru will not do it ,at the top of breakthru i put this

SuperStrict
Framework Brl.StandardIO
Import sdl.glsdlmax2d

Graphics 1280,760,60,0,0,0,0


and it throws an exception

Compile Error

Type 'tsound' not found


but if i change the framework to Import i get this

Unhandled Exception:Cannot initialise SDLSystemDriver. System driver already configured as MacOSSystemDriver

This is on the Mac Catalina NOT Windows

on the graphics command the 60 makes it fullscreen i did try 32 also but still throws an error

Yes its really me :)

Derron

framework = do only load the framework and the imports you do.

no framework = load all in brl.mod and pub.mod


So if you use SDL you will need to import the brl.mod-modules your app requires on your own (brl.audio and the likes) until all modules you use are imported you might run into segfaults.


I am sure one could create a "stub" module which just imports all brl.mod-things (despite the "not compatible with sdl modules" - like brl.systemdefault) and the sdl.mod-stuff brl.mod elsewise "offers" ... so you import just this as "framework" and get a complete "sdl-based" thingy running.

bye
Ron

wadmixfm

if i put this at the top

SuperStrict
Import BRL.StandardIO
Import SDL.d3d9sdlmax2d
Graphics 1280,760,60,0,0,0,0

it goes into fullscreen but the mouse Y axis is still in reverse , left and right is perfect up and down Nooooo Gooooo
Yes its really me :)

wadmixfm

i think this mouse reverse thing is something more simple than changing a graphics driver i maybe wrong but surely its a mouse function issue , how come left and right works ok but not up and down ??

this is very baffling

Lee
Yes its really me :)

Midimaster

#11
QuoteWadMixFM: ....but breakthru will not do it ,at the top of breakthru i put this
SuperStrict
Framework Brl.StandardIO
Import sdl.glsdlmax2d

....
and it throws an exception
Compile Error
Type 'tsound' not found
Of course it throws, because the Framework command removes all (..for your project..) needed modules. so the error message has nothing to do with the Graphics, but with missing other modules.

In the case we use Framework, we need to find out all the modules in our project and import (add) them at top of the code. This can be a little annoying at the beginning, but after some minutes of false starts, you return to a prefect project launch.

In the case of using a different Graphics driver, we need to use Framework to prevent, that the default driver is loaded.

I'm no friend of this Framework stuff, because BlitzMax offers no tool to scan my code and report, which modules are neccessary.

Does anybody has an idea, how we could improve this?


...back from North Pole.

Derron

Quote from: wadmixfm on February 04, 2025, 23:34:22i think this mouse reverse thing is something more simple than changing a graphics driver i maybe wrong but surely its a mouse function issue , how come left and right works ok but not up and down ??

this is very baffling

Lee

for OpenGL it is because in OpenGL "bottom left" is "0,0" while for a "application window" coordinates will be "top left" is "0,0". Inside of "brl.systemdefault" and "brl.glgraphics" there is code which "switches" things ... eg some old Apple code asks "NSViews" about "isFlipped" ... and if that is true, then y coordinate becomes "height - y".

If now such "isflipped" is not handled correctly, or not reported ... things go wonky of course.


As now your D3D-target shows the same issue ... things become odd - are you sure to NOT use any customization in your mods which already try to taggle the mouse.y-switch?

I upgraded my old Catalina install (which had issues with the mouse only moving in the blitzmax windows when I click the mouse - or if it "really" got focused aka MaxIDE closed ... and fullscreen sometimes failed to get a proper "view" and then stalled, required alt+shift+esc force quit with the result of a greyed out forever Maxide (as the process still is thought to be running I guess). Old Mac still fetches last Monterey updates and when coming home today I will try further things on it). But old brl.glgraphics, brl.systemdefault use ancient Mac frameworks (NS...) to do things. I am not sure how well things are supported after 20 yrs. SDL.mod should be superior in these regards but of course there might still be flaws in the "drivers" Brucey put on top of them. While he is a Mac user this does not mean he checked every constellation ... and with even less Mac BlitzMax NG users than Linux users (maybe even less than raspi :P), things take some time until being discovered.


Quote from: Midimaster on February 05, 2025, 00:36:18In the case of using a different Graphics driver, we need to use Framework to prevent, that the default driver is loaded.

It is not directly the graphics driver (brl.glmax2d vs brl.d3d9max2d ...) but the SDL graphics driver requires their SDL "environment". And SDL provides their own window handling, event handling, ... and they cannot work together with eg brl.systemdefault (hence the messages...). But as "no framework command" means to import _anything_ in "brl.mod/*.*" a no-framework-application automatically imports brl.systemdefault and thus can not use SDL stuff.


Quote from: Midimaster on February 05, 2025, 00:36:18Does anybody has an idea, how we could improve this?

I proposed already a solution. Theoretically you should easily be able to write an "sdl.mod/framework.mod" (or how such things should be named) which imports any "brl.mod" and "pub.mod" despite "colliding" or "having replacement" things (so skipping brl.systemdefault, brl.glmax2d, ...) but import all others. Yes, a manual procedure for now.
but once done, you would just do:

SuperStrict
Framework sdl.framework
Import "additionalfiles_of_my_app.bmx"
...

Graphics 800, 600
...



 

Baggey

I tried a google search to find out about the usage of
sdl.glsdlmax2d But didn't get much joy. Is there somewhere i can find how to use the commands of this module? examples etc..?

im particularly interested in direct access to pixel, pitch buffer etc.. of this sdl.glsdlmax2d "Module"dl.glsdlmax2d


Kind Regards Baggey
Running a PC that just Aint fast enough!? i7 4Ghz Quad core 32GB ram  2x1TB SSD and NVIDIA Quadro K1200 on 2 x HP Z24's . DID Technology stop! Or have we been assimulated!

Windows10, Parrot OS, Raspberry Pi Black Edition! , ZX Spectrum 48k, C64, Enterprise 128K, The SID chip. Im Misunderstood!

Derron

sdl.glsdlmax2d is the exact same as brl.glmax2d - despite using SDL instead of "brl stuff".
Means you can use the same commands ... 

gl...max2d -> gl implementation/driver for max2d - so brl.max2d defines the commands.


If you used sdl.sdlrendermax2d then you would use sdl.sdlrender in the background. Check google for SDL ... and what it offers. TSDLWindow, TSDLVideo (not video playback!), ... this should allow you to create resizable windows, multi windows, ... but of course it is up to you to find out how to do all these things.



bye
Ron