Welcome, Guest. Please login or register.
Login with username, password and session length

 
Advanced search
49750 Posts in 5835 Topics- by 2075 Members - Latest Member: Steamforge
 
Pages: [1] 2
Print
Author Topic: Phoenix, Asphyre or Andorra on Mac OS    (Read 2177 times)
wagenheimer
5-Bit Warrior
*
Posts: 52


cezar@wagenheimer.com
View Profile WWW
« on: July 24, 2009, 09:31:09 PM »

Somebody here get some success on running Phoenix, Asphyre or Andorra on Mac Os?

- Andorra 2D, it compiles, but when I did run it shows nothing.
- Phoenix, it almost compiles, I did get Linker error.
- Asphyre, still need some conversion to become Linux/Mac Os compatible.

Anybody here have some success with some of this engines in Mac Os?
Logged

------------------------
Wagenheimer's Game Development Blog
http://www.wagenheimer.com
Gtalk - wagenheimer@gmail.com
From Brazil
igel457
5-Bit Warrior
*
Posts: 37

230872869
View Profile WWW
« Reply #1 on: July 27, 2009, 05:38:56 AM »

Andorra 2D should work if you use the GLFW or SDL windowframework (the LCL TOpenGLContext, which is used by default does not work on MacOS, if I'm well informed).

Information about how to use other "windowframeworks" can be found in the "SimpleNoVCL" demo. Simply include "AdSDL" or "AdGLFW" instead of "AdStdWindow".

For me it would be very nice to know whether Andorra 2D runs on MacOS as I don't own a Mac (and don't plan to obtain one...).
Logged

Stoney
Octal Champion
**
Posts: 146


318922532 JohannesStein@hotmail.com
View Profile WWW
« Reply #2 on: July 29, 2009, 05:26:03 PM »

Aspyhre won't work on a Mac, because as far as I know, Aspyre just uses DirectX and DirectX is Windows-only.

Andorra 2D should work if you use the GLFW or SDL windowframework (the LCL TOpenGLContext, which is used by default does not work on MacOS, if I'm well informed).

Information about how to use other "windowframeworks" can be found in the "SimpleNoVCL" demo. Simply include "AdSDL" or "AdGLFW" instead of "AdStdWindow".

For me it would be very nice to know whether Andorra 2D runs on MacOS as I don't own a Mac (and don't plan to obtain one...).

GLFW won't work by default. You need to modify following lines in the glfw.pas (Line 356f.). Originally, it should look like this:
Code:
const
{$IFDEF WIN32}
  DLLNAME = 'glfw.dll';
{$ELSE}
  DLLNAME = 'libglfw.so';
{$ENDIF}
Now it need to look like this:
Code:
const
{$IFDEF WIN32}
  DLLNAME = 'glfw.dll';
{$ELSE}
  {$IFDEF DARWIN}
  DLLNAME = 'libglfw.dylib';
  {$ELSE}
  DLLNAME = 'libglfw.so';
  {$ENDIF}
{$ENDIF}
Now you need to get libglfw.dylib. There are two possibilites to do that: Install Fink and download libglfw.dylib and then configure to link against /sw/lib (if that's the directory where you put Fink) or download the source package from the GLFW homepage and compile it yourself. (You need to link against the library, of course.)
When deploying your application, don't forget to leave the path to your library relative or others can't use your application if they don't have Fink installed.
(The better way would be to build a GLFW.framework, I guess, it should work like described above, but I couldn't test it yet.)

As for Andorra2D, I tried a few things, but I couldn't get it to work. Yet. I will try harder once my exams are over. Smiley

Phoenix2D should work with the fix described in this post, but I wouldn't recommand to use GLFW on a Mac, because it uses the old Carbon interface, which is an old artefact from Mac OS 9 - times and is still supported in Snow Leopard, but who knows, what will happen with Carbon in Mac OS 10.7?
Furthermore, the GLFW Object Pascal port hasn't been updated since 2005 if I recall correctly.

The safest bet is to use SDL (and/or OpenGL) which uses Cocoa (introduced with Mac OS X and a lot more future-proof than Carbon). This is the combination I'm using at the moment and built a little framework around it, you can check some of the games on my blog and recently my framework has been used for a semi-commercial product.
I'm not quite sure if my framework would fit your needs since I designed it espacially for prototyping and rapid game development.


Update: I tried to port Phoenix in the last hours. Unfortunately without any success and tried the two latest beta versions. There are following problems:
- dglOpenGL.pas needs to be modified like described here: http://delphigl.com/forum/viewtopic.php?t=6872&highlight=mac (last post)
- The FreeImage Delphi Wrapper only supports Windows and is not designed to be platform-independant, there are too many dependencies on Windows.pas
- Also there is no equivalent for getTickCount, so phxTimer won't work
« Last Edit: July 30, 2009, 05:44:00 AM by Stoney » Logged

Programmer: A device for converting coffein into software.
Andreaz
Byte Master
**
Posts: 436

30683329
View Profile WWW Email
« Reply #3 on: July 30, 2009, 05:41:45 AM »

Phoenix2D should work with the fix described in this post, but I wouldn't recommand to use GLFW on a Mac, because it uses the old Carbon interface, which is an old artefact from Mac OS 9 - times and is still supported in Snow Leopard, but who knows, what will happen with Carbon in Mac OS 10.7?
Furthermore, the GLFW Object Pascal port hasn't been updated since 2005 if I recall correctly.

The safest bet is to use SDL (and/or OpenGL) which uses Cocoa (introduced with Mac OS X and a lot more future-proof than Carbon). This is the combination I'm using at the moment and built a little framework around it, you can check some of the games on my blog and recently my framework has been used for a semi-commercial product.
I'm not quite sure if my framework would fit your needs since I designed it espacially for prototyping and rapid game development.

I have added a SDL renderer to Phoenix in the latest version (the demo 13_Device.SDL), if you feel like it test it out Wink
http://phoenixlib.net/files/Phoenix%202009-07-30.7z

It uses GraphicEx for the image loading so no need for Freeimage.dll either.



Logged

/Andreas

Oh, and this code appears to be an approximate replacement for return(random()&0x01);

http://www.pascalgamedevelopment.com/viewforum.php?f=71

http://www.phoenixlib.net/
pstudio
Byte Master
**
Posts: 353


pstudio.tk@gmail.com
View Profile
« Reply #4 on: July 31, 2009, 11:42:22 AM »

Hi Andreaz,
I tried out the latest Phoenix and it is looking great.

However I'm having some trouble using it with Turbo Delphi on Windows. If I try and run and debug the Template example I get an access violation. But if I just build it and run it through Windows it works fine. Have you experienced any like that? The previous versions of Phoenix didn't have this problem.

EDIT:

It turns out the access violation happens when the OGL renderer calls glfwOpenWindow() which seems pretty strange to me.

I think I'll move this to it's own topic since it is a bit offtopic.
« Last Edit: July 31, 2009, 04:47:35 PM by pstudio » Logged

Follow my Computer Science Bachelor project about Surface Computing on my blog: http://lehim.blogspot.com/

Let me teach you the ways of fighting like a true Brute. Join http://pstudio.mybrute.com It takes literally 5 minutes a day to play, but still quite fun.
Stoney
Octal Champion
**
Posts: 146


318922532 JohannesStein@hotmail.com
View Profile WWW
« Reply #5 on: August 01, 2009, 04:11:57 PM »

I clearly underestimated the amount of time it would take to port one of these engines to Mac OS X.
But it's not all bad news, I updated the GLFW header from API version 2.5 to 2.6 and it's now cross-platform, works with Delphi and FreePascal on Windows, Linux and most important Mac OS X. Furthermore, I modified the dglOpenGL header to work correctly with GLFW on Linux and Mac OS X.
I also converted the Mipmaps example from C to Object Pascal.
Take a look at my blog post or download the updated glfw.pas here.
Logged

Programmer: A device for converting coffein into software.
wagenheimer
5-Bit Warrior
*
Posts: 52


cezar@wagenheimer.com
View Profile WWW
« Reply #6 on: August 07, 2009, 06:59:40 PM »

Hi Stoney!

Have you any success in making the Phoenix run in Mac OS??? I'm still with some big problems...

There are a solution for the GetTickCount Problem.

http://forum.lazarus.freepascal.org/index.php?topic=6099.0

Logged

------------------------
Wagenheimer's Game Development Blog
http://www.wagenheimer.com
Gtalk - wagenheimer@gmail.com
From Brazil
Stoney
Octal Champion
**
Posts: 146


318922532 JohannesStein@hotmail.com
View Profile WWW
« Reply #7 on: August 11, 2009, 06:47:54 AM »

I haven't had much success yet.
I've used Andreaz Phoenix version from 09-07-30. The problem with GetTickCount has been solved.

I tried to get the DeviceSDL sample to work.
But there are still some other problems:
- GraphicEx doesn't really work on Mac OS X:
-- The included JPG unit doesn't work
-- Asm calls can't be used on Mac OS X (e.g. GraphicColor.pas)
-- The Convert16_8/Convert16_8Alpha for example won't work. Errors:
Code: pascal
/Users/.../GraphicColor.pas(649,33) Error: Illegal qualifier
/Users/.../GraphicColor.pas(649,33) Hint: may be pointer dereference is missing
/Users/.../GraphicColor.pas(649,33) Error: Illegal expression
/Users/.../GraphicColor.pas(649,33) Fatal: Syntax error, ";" expected but "identifier R" found
-- Compression doesn't work

So, I tried to get an empty window to work. But still, I got a linker error:
Code: pascal
Undefined symbols:
 "_iconv_close", referenced from: _CWSTRING_FINITHREAD in cwstring.o _CWSTRING_FINITHREAD in cwstring.o
 "WSRegisterMenuItem", referenced from: _WSMENUS_REGISTERMENUITEM in wsmenus.o
 "WSRegisterHintWindow", referenced from: _WSFORMS_REGISTERHINTWINDOW in wsforms.o
 "WSRegisterPopupMenu", referenced from: _WSMENUS_REGISTERPOPUPMENU in wsmenus.o
 "WSRegisterWinControl", referenced from: _WSCONTROLS_REGISTERWINCONTROL in wscontrols.o
 "WSRegisterCustomForm", referenced from: _WSFORMS_REGISTERCUSTOMFORM in wsforms.o
 "WSRegisterMainMenu", referenced from: _WSMENUS_REGISTERMAINMENU in wsmenus.o
 "WSRegisterControl", referenced from: _WSCONTROLS_REGISTERCONTROL in wscontrols.o
 "WSRegisterCustomImageList", referenced from: _WSIMGLIST_REGISTERCUSTOMIMAGELIST in wsimglist.o
 "WSRegisterCustomControl", referenced from: _WSCONTROLS_REGISTERCUSTOMCONTROL in wscontrols.o
 "_iconv_open", referenced from: _CWSTRING_INITTHREAD in cwstring.o _CWSTRING_INITTHREAD in cwstring.o
 "WSRegisterGraphicControl", referenced from: _WSCONTROLS_REGISTERGRAPHICCONTROL in wscontrols.o
 "WSRegisterCustomFrame", referenced from: _WSFORMS_REGISTERCUSTOMFRAME in wsforms.o
 "WSRegisterScrollBox", referenced from: _WSFORMS_REGISTERSCROLLBOX in wsforms.o
 "_iconv", referenced from: _CWSTRING_WIDE2ANSIMOVE$PWIDECHAR$ANSISTRING$LONGINT in cwstring.o _CWSTRING_WIDE2ANSIMOVE$PWIDECHAR$ANSISTRING$LONGINT in cwstring.o _CWSTRING_ANSI2WIDEMOVE$PCHAR$WIDESTRING$LONGINT in cwstring.o _CWSTRING_ANSI2WIDEMOVE$PCHAR$WIDESTRING$LONGINT in cwstring.o
 "WSRegisterMenu", referenced from: _WSMENUS_REGISTERMENU in wsmenus.o
 "WSRegisterScrollingWinControl", referenced from: _WSFORMS_REGISTERSCROLLINGWINCONTROL in wsforms.o
 "WSRegisterDragImageList", referenced from: _WSCONTROLS_REGISTERDRAGIMAGELIST in wscontrols.o
ld: symbol(s) not found
Error: Error while linking
So you need to add the unit Interfaces in the DeviceSDL.dpr, but still some errors left:
Code: pascal
Undefined symbols:
 "_iconv_close", referenced from: _CWSTRING_FINITHREAD in cwstring.o _CWSTRING_FINITHREAD in cwstring.o
 "_iconv_open", referenced from: _CWSTRING_INITTHREAD in cwstring.o _CWSTRING_INITTHREAD in cwstring.o
 "_iconv", referenced from: _CWSTRING_WIDE2ANSIMOVE$PWIDECHAR$ANSISTRING$LONGINT in cwstring.o _CWSTRING_WIDE2ANSIMOVE$PWIDECHAR$ANSISTRING$LONGINT in cwstring.o _CWSTRING_ANSI2WIDEMOVE$PCHAR$WIDESTRING$LONGINT in cwstring.o _CWSTRING_ANSI2WIDEMOVE$PCHAR$WIDESTRING$LONGINT in cwstring.o
ld: symbol(s) not found
Error: Error while linking
And that's were I'm stuck right now. The curious part is, libiconv is installed on my machine and I linked to it.

Maybe it's a bug because I used a daily snapshot of Lazarus, but for some reason I can't properly uninstall Lazarus on Mac OS X and if I just replace my daily snapshot with the old 0.9.26 Lazarus, Lazarus won't start.
« Last Edit: August 11, 2009, 09:21:48 AM by Stoney » Logged

Programmer: A device for converting coffein into software.
Traveler
Administrator
Petabyte Protector
*****
Posts: 1804



View Profile WWW
« Reply #8 on: August 11, 2009, 07:30:33 AM »

Hi Stoney, I've modified your reply so that the pascal code becomes more clear.
Logged
Andreaz
Byte Master
**
Posts: 436

30683329
View Profile WWW Email
« Reply #9 on: August 12, 2009, 03:34:13 AM »

Could it be something like this bug that we have bumped into?

http://bugs.freepascal.org/view.php?id=11565
Logged

/Andreas

Oh, and this code appears to be an approximate replacement for return(random()&0x01);

http://www.pascalgamedevelopment.com/viewforum.php?f=71

http://www.phoenixlib.net/
wagenheimer
5-Bit Warrior
*
Posts: 52


cezar@wagenheimer.com
View Profile WWW
« Reply #10 on: August 21, 2009, 07:07:41 PM »

Anybody have any news progress on this?
Logged

------------------------
Wagenheimer's Game Development Blog
http://www.wagenheimer.com
Gtalk - wagenheimer@gmail.com
From Brazil
Stoney
Octal Champion
**
Posts: 146


318922532 JohannesStein@hotmail.com
View Profile WWW
« Reply #11 on: September 11, 2009, 05:51:24 PM »

Allright, I got an empty window to work with Phoenix using the SDLDevice example.
Step-by-step:
1. Download and install Fink from http://www.finkproject.org/
2. Install the sdl package through Fink (Open a terminal and type "fink install sdl" (without ") and enter your password.)
3. Download and extract the Phoenix file Andreaz posted in this thread.
4. Apply the dglOpenGL.pas fixes from http://delphigl.com/forum/viewtopic.php?t=6872&highlight=mac or download the latest GLFW.pas from either this thread or my blog and replace the dglOpenGL.pas unit.
5. Rename phxOpenGL.SDL.pas to phxOpenGL_SDL.pas (in /inc). Open the unit and change "unit phxOpenGL.SDL" to "unit phxOpenGL_SDL".
6. Open the DeviceSDL.dpr with Lazaras (it is located in /demos/13_DeviceSDL). I used the latest daily Lazarus and FreePascal snapshots.
7. Add the following lines to the DeviceSDL.dpr (best between progam and uses):
Code: Pascal
{$IFDEF FPC}
  {$IFDEF DARWIN}
    {$linklib gcc}
    {$linklib SDLmain}
  {$ENDIF}
{$ENDIF}   
8. Remove any references to phxGraphicEx or phxFreeImage (both in the dpr-File and in Main.pas)
9. Remove (or just add // in front of the line) any reference to Image and Font.
10. Open "Project | Compiler settings" and click on "Linker" on the left. Click on the checkbox in settings and add the following line:
Code:
-L/usr/lib -L/usr/X11R6/lib -L/sw/lib -lSDL
11. Click on Run and the project compiles and you can see an empty window. Yeah. Smiley

Additional notes:
- You can link against the SDL framework which is better way to go, because deploying the application is much easier that way, but for some reason when linked against the framework the application produces AV when it's being closed.
- The generated executable is about 20 MB big. Using strip and upx shrinks the executable to about 1,2 MB.

Using FreeImage doesn't work because there are too many dependencies to Windows. So I removed the reference to the windows unit and implemented PRGBQuad, PBITMAPINFOHEADER and PBITMAPINFO as suggested by FreeImage.h
When try to compile with this changes, following errors occur:
Code: Pascal
phxFreeImage.pas:405:junk `@4$stub' after expression
phxFreeImage.pas:741:junk `@4$stub' after expression
phxFreeImage.pas:746:junk `@4$stub' after expression
phxFreeImage.pas:751:junk `@4$stub' after expression
phxFreeImage.pas:756:junk `@4$stub' after expression
phxFreeImage.pas:762:junk `@4$stub' after expression
phxFreeImage.pas:766:junk `@4$stub' after expression
phxFreeImage.pas:803:junk `@4$stub' after expression
phxFreeImage.pas:900:junk `@4$stub' after expression
phxFreeImage.pas:989:junk `@4$stub' after expression
phxFreeImage.pas:1111:junk `@24$stub' after expression
phxFreeImage.pas:1118:junk `@4$stub' after expression
phxFreeImage.pas:1124:junk `@4$stub' after expression
phxFreeImage.pas:1194:junk `@4$stub' after expression
phxFreeImage.pas:1212:junk `@24$stub' after expression
phxFreeImage.pas:1219:junk `@4$stub' after expression
phxFreeImage.pas:1225:junk `@4$stub' after expression
phxFreeImage.pas:1290:junk `@4$stub' after expression
phxFreeImage.pas:1308:junk `@24$stub' after expression
phxFreeImage.pas:1315:junk `@4$stub' after expression
phxFreeImage.pas:1321:junk `@4$stub' after expression
phxFreeImage.pas:1376:junk `@4$stub' after expression
phxFreeImage.pas:1449:junk `@12$stub' after expression
phxFreeImage.pas:1461:junk `@4$stub' after expression
phxFreeImage.pas:1471:junk `@4$stub' after expression
phxFreeImage.pas:1510:junk `@16$stub' after expression
phxFreeImage.pas:1524:junk `@4$stub' after expression
phxFreeImage.pas:1609:junk `@4$stub' after expression
phxFreeImage.pas:1635:junk `@4$stub' after expression
phxFreeImage.pas:1677:junk `@20$stub' after expression
phxFreeImage.pas:1681:junk `@4$stub' after expression
phxFreeImage.pas:1752:junk `@4$stub' after expression
phxFreeImage.pas:1756:junk `@4$stub' after expression
phxFreeImage.pas:2022:junk `@16$stub' after expression
phxFreeImage.pas:2035:junk `@4$stub' after expression
phxFreeImage.pas:2103:junk `@20$stub' after expression
phxFreeImage.pas:2107:junk `@4$stub' after expression
phxFreeImage.pas:2384:junk `@16$stub' after expression
phxFreeImage.pas:2397:junk `@4$stub' after expression
phxFreeImage.pas:2465:junk `@20$stub' after expression
phxFreeImage.pas:2469:junk `@4$stub' after expression
phxFreeImage.pas:2746:junk `@16$stub' after expression
phxFreeImage.pas:2759:junk `@4$stub' after expression
phxFreeImage.pas:2827:junk `@20$stub' after expression
phxFreeImage.pas:2831:junk `@4$stub' after expression
phxFreeImage.pas:3108:junk `@16$stub' after expression
phxFreeImage.pas:3121:junk `@4$stub' after expression
phxFreeImage.pas:3189:junk `@20$stub' after expression
phxFreeImage.pas:3193:junk `@4$stub' after expression
phxFreeImage.pas:4211:invalid character '_' in mnemonic
phxFreeImage.pas:4212:Rest of line ignored. 1st junk character valued 64 (@).
phxFreeImage.pas:4251:invalid character '_' in mnemonic
phxFreeImage.pas:4252:Rest of line ignored. 1st junk character valued 64 (@).
phxFreeImage.pas:4261:invalid character '_' in mnemonic
phxFreeImage.pas:4262:Rest of line ignored. 1st junk character valued 64 (@).
phxFreeImage.pas:4271:invalid character '_' in mnemonic
phxFreeImage.pas:4272:Rest of line ignored. 1st junk character valued 64 (@).
phxFreeImage.pas:4281:invalid character '_' in mnemonic
phxFreeImage.pas:4282:Rest of line ignored. 1st junk character valued 64 (@).
phxFreeImage.pas:4291:invalid character '_' in mnemonic
phxFreeImage.pas:4292:Rest of line ignored. 1st junk character valued 64 (@).
phxFreeImage.pas:4301:invalid character '_' in mnemonic
phxFreeImage.pas:4302:Rest of line ignored. 1st junk character valued 64 (@).
phxFreeImage.pas:4321:invalid character '_' in mnemonic
phxFreeImage.pas:4322:Rest of line ignored. 1st junk character valued 64 (@).
phxFreeImage.pas:4341:invalid character '_' in mnemonic
phxFreeImage.pas:4342:Rest of line ignored. 1st junk character valued 64 (@).
phxFreeImage.pas:4351:invalid character '_' in mnemonic
phxFreeImage.pas:4352:Rest of line ignored. 1st junk character valued 64 (@).
phxFreeImage.pas:4361:invalid character '_' in mnemonic
phxFreeImage.pas:4362:Rest of line ignored. 1st junk character valued 64 (@).
phxFreeImage.pas:4371:invalid character '_' in mnemonic
phxFreeImage.pas:4372:Rest of line ignored. 1st junk character valued 64 (@).
phxFreeImage.pas:4421:invalid character '_' in mnemonic
phxFreeImage.pas:4422:Rest of line ignored. 1st junk character valued 64 (@).
phxFreeImage.pas:4441:invalid character '_' in mnemonic
phxFreeImage.pas:4442:Rest of line ignored. 1st junk character valued 64 (@).
phxFreeImage.pas:4451:invalid character '_' in mnemonic
phxFreeImage.pas:4452:Rest of line ignored. 1st junk character valued 64 (@).
phxFreeImage.pas:4471:invalid character '_' in mnemonic
phxFreeImage.pas:4472:Rest of line ignored. 1st junk character valued 64 (@).
../../inc/phxFreeImage.pas(14,48) Error: Error while assembling exitcode 1
../../inc/phxFreeImage.pas(14,48) Fatal: There were 2 errors compiling module, stopping

I found a reference to phxSDL_image, but I couldn't find that unit in any Phoenix release. Is there a way to include SDL_image instead of FreeImage or GraphicEx?
« Last Edit: September 11, 2009, 06:06:18 PM by Stoney » Logged

Programmer: A device for converting coffein into software.
Stoney
Octal Champion
**
Posts: 146


318922532 JohannesStein@hotmail.com
View Profile WWW
« Reply #12 on: September 12, 2009, 07:27:41 PM »

Using the latest snapshot Phoenix is finally working on a Mac.
Here is the screenshot proof:


There are still some fixes I need to apply, but it wouldn't take more than a few days.
Logged

Programmer: A device for converting coffein into software.
wagenheimer
5-Bit Warrior
*
Posts: 52


cezar@wagenheimer.com
View Profile WWW
« Reply #13 on: September 12, 2009, 07:31:41 PM »

What wonderful news!!! Keep on the good work!
Logged

------------------------
Wagenheimer's Game Development Blog
http://www.wagenheimer.com
Gtalk - wagenheimer@gmail.com
From Brazil
Stoney
Octal Champion
**
Posts: 146


318922532 JohannesStein@hotmail.com
View Profile WWW
« Reply #14 on: September 15, 2009, 06:05:17 PM »

Based on the latest Phoenix snapshot I've put together a little Mac OS demo. Download here (ca. 9 MB)

There is one bug which still annoys me: When I link against the frameworks, as soon as I close the application I get an access violation. Might it be connected to the fact that I use the Lazarus daily snapshots.
Logged

Programmer: A device for converting coffein into software.
Pages: [1] 2
Print
Jump to: