Thoughts on Allegro on Mac OS X

lillo
Unregistered
 
Post: #31
That phrase sounded a little exagerated to me too, Charles was probably a bit too excited by Allegro finally coming to OSX almost feature complete when he submited the news Rasp

About your last try of Allegro under OSX, let me tell you Allegro didn't support OSX natively until a couple of weeks ago... You were forced to use it via X11 if you wanted it under Mac.
I had a native OSX port in the works since months ago, but was blocked because of multithreading issues. Then I solved them, and from then on development proceeded quickly.

Anyway, here's the truth as I see it: currently Allegro plays almost the same as SDL, but with some differences. Where SDL supports OpenGL (but as soon as Allegro becomes stable enough be sure I'll port AllegroGL) and overlay surfaces, Allegro uses a more optimized threaded screen updating technique (in windowed mode; in fullscreen you have direct access to the video memory so you do your screen updates the way you like it), and supports hw accelerated blits (in fullscreen mode) even without OpenGL (via CopyBits).
In addition Allegro has MIDI support out of the box in addition to digital sound output. Allegro has still no joystick support though, as I have no USB joystick to test a possible driver with; but the library has already an HID Manager interface that is currenly only used to detect the number of mouse buttons, but is ready to support the joystick.
If you want to contribute, you're welcome!

Keep in mind Allegro and SDL are fundamentally different: the former is more oriented to the programmer who wants to concentrate on game design and directly start coding it without entering into very low level stuff. It has almost everything a game programmer would want for 2d games right out of the box. The latter is more oriented to the programmer who prefers to code everything by himself; you have to code your own blitters for example.

The OSX Allegro port is young. It has to maturate, and that's why we're asking and we thank you for testing, support and any help you can give us.
Quote this message in a reply
kattkieru
Unregistered
 
Post: #32
The simplest way to answer your question is to download the CVS source, build it and play with the examples. It's no longer just a x11 port -- it's fully cocoa. But don't take my word for it.
Quote this message in a reply
ClosetPacifist
Unregistered
 
Post: #33
Hmm... Just finished downloading the April 2002 devtools, and have had none of the problems I had before compiling Allegro, but a new one's come up. Hope it's possible to compile this with 10.1.5. Annoyed

It dies out with this set of output, and I can't figure out how to get it to work. I guess 'CGDisplayFade.h' isn't on 10.1.5, but when I take out the references to it it dies out at the end.
Code:
gcc3 -DALLEGRO_SRC -Wall -Wno-unused -Wno-long-double  -O2 -funroll-loops -ffast-math
     -fomit-frame-pointer -pipe -DALLEGRO_USE_C -I. -I./include
     -o obj/macosx/alleg/qzfull.o -c src/macosx/qzfull.m
src/macosx/qzfull.m:94: undefined type, found `CGDisplayFadeReservationToken'
src/macosx/qzfull.m:223: undefined type, found `CGDisplayFadeReservationToken'
cpp-precomp: warning: errors during smart preprocessing, retrying in basic mode
src/macosx/qzfull.m: In function `private_osx_qz_full_init':
src/macosx/qzfull.m:94: `CGDisplayFadeReservationToken' undeclared (first use in this function)
src/macosx/qzfull.m:94: (Each undeclared identifier is reported only once
src/macosx/qzfull.m:94: for each function it appears in.)
src/macosx/qzfull.m:94: parse error before "token"
src/macosx/qzfull.m:134: warning: implicit declaration of function
     `CGDisplayBestModeForParametersAndRefreshRateWithProperty'
src/macosx/qzfull.m:136: `kCGDisplayModeIsStretched' undeclared (first use in this function)
src/macosx/qzfull.m:136: warning: assignment makes pointer from integer without a cast
src/macosx/qzfull.m:144: warning: implicit declaration of function `CGAcquireDisplayFadeReservation'
src/macosx/qzfull.m:144: `kCGMaxDisplayReservationInterval' undeclared (first use in this function)
src/macosx/qzfull.m:144: `token' undeclared (first use in this function)
src/macosx/qzfull.m:145: warning: implicit declaration of function `CGDisplayFade'
src/macosx/qzfull.m:145: `kCGDisplayBlendNormal' undeclared (first use in this function)
src/macosx/qzfull.m:145: `kCGDisplayBlendSolidColor' undeclared (first use in this function)
src/macosx/qzfull.m:146: warning: implicit declaration of function `CGReleaseDisplayFadeReservation'
src/macosx/qzfull.m:156: warning: cannot find class (factory) method
src/macosx/qzfull.m:156: warning: return type for `setMenuBarVisible:' defaults to id
src/macosx/qzfull.m: In function `osx_qz_full_exit':
src/macosx/qzfull.m:223: `CGDisplayFadeReservationToken' undeclared (first use in this function)
src/macosx/qzfull.m:223: parse error before "token"
src/macosx/qzfull.m:239: `kCGMaxDisplayReservationInterval' undeclared (first use in this function)
src/macosx/qzfull.m:239: `token' undeclared (first use in this function)
src/macosx/qzfull.m:240: `kCGDisplayBlendNormal' undeclared (first use in this function)
src/macosx/qzfull.m:240: `kCGDisplayBlendSolidColor' undeclared (first use in this function)
src/macosx/qzfull.m:244: warning: cannot find class (factory) method
src/macosx/qzfull.m:244: warning: return type for `setMenuBarVisible:' defaults to id
make: *** [obj/macosx/alleg/qzfull.o] Error 1

On the other hand, If I use kattkieru's build, I get the following error when I try to compile something:
Code:
/usr/bin/ld: can't locate framework for: -framework Allegro



I also got an error early on, and had to change the line in alosx.h:
Code:
#import <IOKit/hid/IOHIDUsageTables.h>

to:
Code:
#include <Kernel/IOKit/hidsystem/IOHIDUsageTables.h>

after finding the code here . It didn't complain about that after that.

Many thanks to everyone who's worked on the project. Hope that this posts readable.

EDIT: This verifies that the Fade stuff is new to 10.2.
Quote this message in a reply
lillo
Unregistered
 
Post: #34
Thanks for the report.
I've just applied a couple of patches that should fix the issue... I didn't use HideMenuBar()/ShowMenuBar() because those were the only Carbon dependencies left, so I replaced them by [NSMenu setMenuBarVisible: BOOL]. Thanks to you I've discovered this is 10.2 only, so I reverted to the old Carbon method.

Other than hopefully fixing compiling under 10.1.x (let me know if there are still problems!), the current CVS snapshot features:

- reduced CPU usage: I've investigated in the issue and now apps consume ~0.5/1% of CPU when in windowed mode with no activity.

- now uses "gcc3" as default compiler

- some bugfixes (of which one is important)

So anyone who downloaded the CVS snapshot is really encouraged to do a cvs update to sync with what's currently there. Thanks!

To Feanor: I missed your last post, sorry; here's a reply:
fixdemo only works when you've successfully made and installed the lib.
demo.dat isn't included in the WIP versions to reduce zip size; you need to download it and place it in the demo/ directory.
Quote this message in a reply
kattkieru
Unregistered
 
Post: #35
Hi all,

The DMG image I posted before had a bug: it was missing the dynamic library! This has to do with the current build system and me not doing all the proper checking.

I've uploaded a new one, with an extra installer inside, which should work. Make sure to use both .pkg installers and then copy the framework into your ~/Library/Frameworks directory.
Quote this message in a reply
ClosetPacifist
Unregistered
 
Post: #36
Cool. Now I just get the following error(s) right before it finishes:
[SOURCECODE]gcc3: unrecognized option `-single_module'
ld: common symbols not allowed with MH_DYLIB output format[/SOURCECODE]
And then, ater it lists a number of lines like this :
[SOURCECODE]obj/macosx/alleg/allegro.o definition of common __current_palette (size 1024)[/SOURCECODE]
it gives this error:
[SOURCECODE]/usr/bin/libtool: internal link edit command failed
[/SOURCECODE]

And kattkieru: Erp, is the file's location the same? Redownloaded it from the link you provided earlier, but it still only has one installer.
Quote this message in a reply
lillo
Unregistered
 
Post: #37
Right now I can't get rid of the -single_module option, and I know this was introduced only in December 2002 dev tools...

I'll see if I can do something, even if I doubt it. For now you can compile just the static library by doing

make STATICLINK=1
sudo make install STATICLINK=1

You won't be able to install the framework and Project Builder template though as these require the dynamic library.
Quote this message in a reply
lillo
Unregistered
 
Post: #38
Found the -fno-common gcc option that helped me solving the problem; you should now be able to compile the dynamic library (and install the framework and PB template) also with April 2002 Developer Tools Smile

Just do a(nother) CVS update and retry building the library.

Please let me know of any trouble!
Quote this message in a reply
kattkieru
Unregistered
 
Post: #39
Well now... I didn't think it was possible for two files to have identical file names and live in the same directory, but it apparently is possible on my host. ^_^;; I'm not sure how that happened, and it's not like there was an extra space or anything...

anyway, the link should be fixed now. In case you don't want to scroll up: http://ministryofdoom.org/cloud/files/al...10-wip.dmg
Quote this message in a reply
ClosetPacifist
Unregistered
 
Post: #40
Mmm... Now it dies out with this error, when compiling both the dynamic and static libraries:
[SOURCECODE]ld: Undefined symbols:
_pthread_sigmask
/usr/bin/libtool: internal link edit command failed
make: *** [lib/macosx/liballeg-4.1.10.dylib] Error 1[/SOURCECODE]
Quote this message in a reply
ClosetPacifist
Unregistered
 
Post: #41
Holy sweet! Err, ya. Decided to actually put some effort forth, and, after a quick google search, added this to the osx header file:
[SOURCECODE]#define pthread_sigmask(A,B,C) sigprocmask((A),(B),©)[/SOURCECODE]

Some other notes:
The default make clean complains about the option -v.

It gives an error like this in both compilation and running of the default app:
[SOURCECODE]gcc3 -DALLEGRO_SRC -Wall -Wno-unused
-Wno-long-double -O2 -funroll-loops -ffast-math
-fomit-frame-pointer -fno-common -pipe -DALLEGRO_USE_C
-I. -I./include -o obj/macosx/alleg/system.o -c
src/macosx/system.m
src/macosx/system.m: In function `osx_event_handler':
src/macosx/system.m:311: warning: `AllegroWindow' does not respond to `invalidateShadow'[/SOURCECODE]
Gonna try to compile it after commenting out that line.

It won't compile the fixbundle app, with the following error:
[SOURCECODE]gcc3 -s -o tools/macosx/fixbundle
obj/macosx/alleg/fixbundle.o lib/macosx/liballeg-4.1.10.dylib
-framework Cocoa
ld: obj/macosx/alleg/fixbundle.o illegal reference to symbol:
_SetIconFamilyData defined in indirectly referenced dynamic
library
/System/Library/Frameworks/Carbon.framework/Versions/A/
Frameworks/HIToolbox.framework/Versions/A/HIToolbox
make: *** [tools/macosx/fixbundle] Error 1[/SOURCECODE]

Many, many thanks for your efforts on the project! Off to play around with it!

EDIT: Cut up the really long lines.
EDIT2: Yay! commenting out the line provides nearly-error-free-compiling!
EDIT3: Commenting things out to make things work is so fun! Commented out references to SetIcon and WriteIconFile in tools/macosx/fixbundle.c, then removing -s from makefile.osx seems to get you a complete build! YAY! (it's still compiling, but I have high hopes)
I'm elated! I think it's time for some italian ice!
EDIT4: Wee-tawh! It did indeed finish compiling! YAY!
EDIT5: Umm, ya. I'm almost gone. Just wanted to say that the demo is awesome fun, heh.
Quote this message in a reply
lillo
Unregistered
 
Post: #42
ClosetPacifist: sorry for not responding so far... I've moved my PCs around and I'm still battling to get the iBook online again via my other PC. Hope to have it on by the end of the day...

About pthread_sigmask, it works on 10.2, so I think on previous versions it was broken. Thanks for the fix!

I assume the invalidateShadow method is also 10.2 stuff. Is there a way to check the system version at compile time so I can #ifdef things out?

I seems fixbundle needs Carbon to be linked explicitely. I'll update the makefile as soon as I can (see above). Commenting out things makes the programs to compile, but they'll not work properly... Rolleyes
Quote this message in a reply
lillo
Unregistered
 
Post: #43
ok, got the iBook back on the net Smile

Commited some changes to CVS to address the problems ClosetPacifist reported. Everything should compile out of the box on 10.1.x... I'd be grateful if someone could test it once again.

About make clean and the -v problem, that's the only thing not yet solved; this would need hacking the global multiplatform Allegro makefile, as the clean target assumes rm to support the -v option on unix variants (like OSX is)... Really weird on 10.1.x rm didn't support it.
Hope to solve this issue too soon!
Quote this message in a reply
ClosetPacifist
Unregistered
 
Post: #44
Just pulled down the latest CVS, and still had to insert the pthreads #define, as well as remove the 'LFLAGS += -s' line from Makefile.osx, but then it compiled fine.
Quote this message in a reply
lillo
Unregistered
 
Post: #45
ClosetPacifist: the current CVS version should have the -s and the pthread problems fixed. About this last one, I've made another try: now libpthread is explicitely linked to programs... Hope this solves the issue, otherwise please let me know.

Latest snapshot also (finally) includes an HID joystick driver. Have fun!
Quote this message in a reply
Post Reply