Blitzmax & macOS Mojave

Started by sonic, October 14, 2018, 14:17:32

Previous topic - Next topic

Derron

Yes Mac OS X hides the folder in the finder/File Manager.

Go to a terminal. Move into your folder via "cd ~/Your/BlitzMax/Folder" (the "~" is a abbreviation for your home folder) ... or use "cd .." to go one folder "out" and "cd name" to move into the subfolder "name".

When then in your BlitzMax folder - go into the "maxide.app" folder.
cd maxide.app/Contents/MacOS (case sensitive, so might be "MaxIDE.app" on your side)

to start you then type in
./maxide (case sensitive, so might be "./MaxIDE" on your side)


the "./" is there to make the OS aware of the binary being exactly in this folder and not a system wide available command.


bye
Ron

MickMuze

Thank you, this is exactly what I needed!! :D It's awesome to finally see my game running again.

The game ran almost perfect with NG. The only thing I noticed which I found odd was the mouseY() seemed to be inverted. The top of the screen was my max screen height instead of 0 and the bottom of the screen was 0. This cause my image mouse icon to go down when I moved the mouse up and up when I moved the mouse down. NG Bug?

Derron

Maybe an SDL bug? Can you create a simple example and note down what OS version you use on what gpu?

I only run an older OS X on a "non certified computer" - so others need to chime in when it comes to verifying your issue - Qube has a Mac, Brucey has a Mac, others surely too


bye
Ron

MickMuze

My OS is Mojave version 10.14.2
GPU: Intel Iris Plus Graphics 655 1536 MB

Strict
Graphics 1280,800,32,60

Global MouseIcon:TImage
MouseIcon = LoadImage("10x10icon.png")

DrawCursor()

Function DrawCursor()

Repeat
Cls
DrawImage(MouseIcon,MouseX(), MouseY())
DrawText(MouseY()),10,10
If KeyDown(KEY_ESCAPE) Then End
Flip
Forever

End Function


In windowed mode it seems to work correctly. In Full screen mode as I have here, both the mouse and the graphic icon which should appear overlapping the mouse icon behave separately. The mouse seems to move around the screen correctly but the 10x10icon is inverted.

Derron

So hardware cursor is correct but custom image drawn at mouseX,mouseY is inverted?

Bye
Ron

MickMuze

#50
yes, but only on full screen. It's something to do with MouseY() on fullscreen. When I move the hardware cursor to the bottom of the screen, it displays MouseY() as 0 but the 10x10icon.png will then be at the top of the screen (because MouseY() is returning 0). When I move the hardware cursor to the top of the screen it will display MouseY() as 800 and the 10x10icon.png will then be at the bottom. So the image seems to be going exactly where MouseY() is telling it to go. Just MouseY() is not where the actual mouse cursor is. Again, only in fullscreen mode. In windowed mode, everything seems to behave how it should.


P.S. MouseX() is not inverted. It is always behaving as it should.

Derron

In OpenGL "0,0" is at the bottom left - while in Max2D (BlitzMaX) "0,0" is on the top left, maybe there is something borked. Will create a github issue for this - maybe Brucey can verify it on his Mac.


bye
Ron

Derron

you can follow progress of the issue there:
https://github.com/bmx-ng/brl.mod/issues/79

And yes, it might be a bit "hacky" but meanwhile you could use your own "MouseY()" ... and handle the invertion on your own when doing full screen on mac.
Most of the time you are better having your own Mouse type to allow easier handling of "mouse clicks" (which are not _hits_ in all cases) or blockage of clicks (avoid spamming), double clicks handling ... not to forget about handling virtual resolutions (designed: 800,600, used: 1280*720 ->  black bars needed, and scaled mouse coords).


bye
Ron

MickMuze

I'll keep checking over there. I did whip up a cheap kinda hack around for it that works ok but yeah, kinda ugly. Hopefully this problem gets fixed at some point. Thanks again for your help.

Xerra

I just fired up the newest Blitzmax build as I wanted to build an old game of mine so I could potentially sequel it and found this mouse problem as well.
M2 Pro Mac mini - 16GB 512 SSD
ACER Nitro 5 15.6" Gaming Laptop - Intel® Core™ i7, RTX 3050, 1 TB SSD
Vic 20 - 3.5k 1mhz 6502

Latest game - https://xerra.itch.io/Gridrunner
Blog: http://xerra.co.uk
Itch.IO: https://xerra.itch.io/

sonic

sooo i got this to run at least using the terminal method. but i am unable to get it to build minib3d - it seems not to say which line is causing the issue, which makes it tricky to debug...

the error i get is: Can't find interface for module 'brl.blitz'

Yellownakji

Quote from: sonic on January 01, 2019, 16:11:56
sooo i got this to run at least using the terminal method. but i am unable to get it to build minib3d - it seems not to say which line is causing the issue, which makes it tricky to debug...

the error i get is: Can't find interface for module 'brl.blitz'

Check that [NG Install dir]\Mod\BRL\blitz exists and that the module is built.

Derron

Quote from: Brucey via github issue
Hi. There are several issues currently with Mojave and the default OpenGL graphics modules for BlitzMax.

I would like to suggest moving over to use the SDL backend (sdl.mod) on macOS. The latest SDL has fixed all the currently known macOS issues (fullscreen y flipping, fullscreen refresh sync, etc), and their team is generally quick to fix new ones.

Generally, all you need to do is to import SDL.gl2sdlmax2d, rather than BRL.GLMax2D.
If you are not using a Framework (and therefore all of BRL and Pub modules are automatically imported) you will need to switch to using the Framework statement, and then import the required modules for your project.
source: https://github.com/bmx-ng/brl.mod/issues/79


bye
Ron

imaginaryhuman

#58
Thanks for getting this working on MacOS Brucey. I too upgraded my mac and found suddenly I couldn't use blitz any more. I tried NG but I had the same issue with the signing and had to launch the max IDE from the terminal. But i hate the terminal. So researched and found that you can use Automator.app on the Mac to make a very simple automation. You make a new automation and add a Utilities/Run Shell Script action. In the script, type in a script as given in this thread or as below, for me I did something like this... (you can probably figure out a more efficient one, I'm not familiar with terminal syntax stuff or how to make this 'flexible' to work on everyone's setup, so you'll have to change the folder names/path as you see fit)

cd /
cd applications/blitzmaxng/maxide.app/contents/macos
./maxide

then save the automation. In the save dialog, there's a dropdown option to save it as an application. Choose that. Put the application in your blitz folder or whatever you like. You can also then drag this icon into the dock to launch easily. Clicking the icon will run the automation and thus launch the IDE without having to go to the terminal.

Little trick I learned from here:
https://stackoverflow.com/questions/281372/executing-shell-scripts-from-the-os-x-dock

I guess to make that work on "anyone's" computer you'd need a way to locate the app from within a shell script without knowing where it is, or have a way to modify the script. Maybe make a little blitz app that finds the path of the blitzmax folder and auto-generates an automator action or something?

Also you can change the icon of the automator app by simply right-clicking its icon and doing a 'Get Info', then click and drag some other application icon (e.g. maxide app) and drop it onto the top left of the getinfo window where it shows the icon. .. mouse should show a plus sign.... as soon as you let go it assigns the icon to the app. Now the automator app 'looks like' the maxide app.

sonic

#59
hi there,

i'm still plugging away at this because High Sierra is very unstable on my macbook and i really need to move to Mojave if possible.

i have got minib3d to build as a module by switching to the SDL backend. all modules seem correctly built now.

however, trying to build my project, it says that it "Can't find interface for module 'sidesign.minib3d" - not sure where to go from here.

EDIT:
somehow i spotted the TGlobal inside Reflection was clashing with TGlobal in minib3d. i renamed it to MGlobal, and it finally gets as far as 'Executing' - however, i now see this error:

"Cannot initialise SDLSystemDriver. System driver already configured as MacOSSystemDriver"

EDIT2:
ok i got that to work by removing a call to a driver initialisation within MiniB3D.

it now builds and runs, very happy to see that!

... but fails after about half a second after repeated calls to linkedlist.ValueAtIndex(index) - i've tested that the index being requested is less than the Count() of the list, but it keeps failing (runtime error "List index out of range), often at the higher indices of the list, but always within its Count(). the list is 1690 entities large, and it tends to fall over at indices like 1592. not sure what i'm doing wrong here.

at somewhat of a loss on this one.

i should mention that i had to switch back to BRL.GLMax2D as the SDL backend didn't work. i have hacked Linkedlist.bmx to return null when it can't find ValueAtIndex(index), and things seem to work, except that i had to hack in the MouseY() flip because of not using SDL. 

i think this is solid enough for me to make the move to Mojave, possibly.

EDIT3: could the list issue be related to this: https://github.com/bmx-ng/brl.mod/issues/44? i hacked out 'IF _count=-1' in BRL.Linkedlist.Count(), so that it always returns the actual number rather than the cached one. Behaviour is now as expected, but there is obviously a better way to do this (fixing the thing that causes _count to hold the incorrect value!)

so - i'm going to try a clean install of Mojave, but before i do, am i going to see issues with the fact that i'm still on GLMax2D? ideally i'd like to switch to the SDL backend, but i have no idea how to write the Framework commands to import what i need