Page 2 of 2 FirstFirst 12
Results 11 to 20 of 20

Thread: Brace for it... I think WILL's going to become a Mac.

  1. #11

    Re: Brace for it... I think WILL's going to become a Mac.

    @Will - Pinwheel of death or completely freezing will be your most common problem on a mac, vs. kernel panic.

    For handling paths across operating systems, make a string variable and in the creation or initialization events just have ifdefs for each of the operating systems you want to support with the paths you want to use

  2. #12
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25

    Re: Brace for it... I think WILL's going to become a Mac.

    Well no such luck with any attempt at installing ghostscript. I'm running 10.6 (Snow Leopard) so all of this old stuff won't work without recompiling and configuring with terminal commands all of which are all over my head right now (heck the last Mac I touched was the first color macs back in the early to mid 90s. ) So I guess for now I'll just live without preview or using EPS files. I don't think I've ever used them either.

    As for the Lazarus Project setup. I kinda like the ifdef approach as long as it doesn't get too crazy. However I'd likely only do this for the top 3 OSes anyhow. (Mac, Win32/64 and Linux)

    Garland's Quest, Treasure Hunters and my new cool digital world game (without a current title) coming to a Mac near you.

    Oh as a pleasant side-note, I've managed to find a nice program that will convert all my existing WMV, MPeG-2 and AVI files over to MPEG4 files for use with iMovie and Final Cut 7. You may well see a return to all those cool game footage videos I used to make. Only they wouldn't have the poor framerate my older system gave them.

    With that though, does anyone know a really good program for capturing screen video like FRAPS? (Obviously it MUST run on Mac OS X 10.6 )
    Jason McMillen
    Pascal Game Development
    Co-Founder





  3. #13

    Re: Brace for it... I think WILL's going to become a Mac.

    Well, well, since yesterday I also own a Mac, which is nice, so far. Currently I'm trying to get Lazarus to work, and the next step will be compiling a Mac version of my game project. Once I'm being able to do so, I'll get out patch 1.5.4, for Windows, Linux and for the first time, Mac. Which is lots of effort and costs for perhaps only a few more users...

  4. #14
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25

    Re: Brace for it... I think WILL's going to become a Mac.

    Yeah I'm still having trouble with compiling apps on my Mac. Lazarus doesn't seem to do everything needed to generate a properly running or distributable application/program. I currently am trying to figure out why my version of Lazarus (0.9.28.2 beta) will not compile my project using just JEDI-SDL. (no OpenGL)

    I have placed the following at the top of my semi-ported Scorch2D tutorial code...
    Code:
    program scorch2d;
    
    {$IFDEF Win32}
     {$IFDEF FPC}
      {$APPTYPE GUI}   // FreePascal/Lazarus
     {$ELSE}
      {$APPTYPE CONSOLE} // Delphi
     {$ENDIF}
    {$ENDIF}
    {$IFDEF DARWIN}
     {$linklib SDLmain}
     {$PASCALMAINNAME SDL_main} // This line gives me errors
    
     {$linkframework Cocoa}
     {$linkframework SDL}
    {$ENDIF}
    
    uses
     SysUtils,
     // JEDI-SDL
     sdl,
     sdlutils,
    
     GraphicsUnit,
     GameObjectUnit,
     GameConstantsUnit;
    
    ...and so on...
    I've already installed all 3 packages for the last stable Lazarus, installed XCode from Apple's developer site and installed the SDL framework from the libsdl site for Mac OS X into my developer folders. (I would hope this is done properly anyhow I followed the instructions from the FPC/Laz wiki using the disk images aka the dmg files)

    I've also updated my library and includes paths to match where my copy of JEDI-SDL is installed. I can compile just fine without the $PASCALMAINNAME line in my code, but the ran executable fails with all kinds of debugging information. To the best of my understanding somehow somewhere $PASCALMAINNAME does not exist as a symbol in either the version of FPC or Lazarus that I'm using.

    Does anyone know whats going on and what I have to do to fix this? This is a stone wall to any further software development for me.
    Jason McMillen
    Pascal Game Development
    Co-Founder





  5. #15

    Re: Brace for it... I think WILL's going to become a Mac.

    Well, first off I'm going to admit that I've never done any FPC compiling on a Mac. First thing to consider is that Lazarus should come bundled with SDL already (just not the libs). So first thing (you've probably already done) is downloaded the dynlibs or w/e from libsdl.org.

    I'm pretty much going to assume from here on out you're going to use FPC/Lazarus' SDL units instead of JEDI-SDL. (I have gotten JEDI-SDL to work in the past, but it's not worth it)

    As for whatever else you're doing with {$linklib} etc., I've had no experience with having to do that. Again main problem being I haven't tried to compile on a Mac, but personally I'd try out the below first.

    So here's basically an SDL core I've created for myself that has been tested to work on Windows Vista at the very least.

    [pascal]
    program project1;

    {$mode objfpc}{$H+}
    {$apptype gui}

    uses
    {$IFDEF UNIX}{$IFDEF UseCThreads}
    cthreads,
    {$ENDIF}{$ENDIF}
    Classes,sdl,sdl_image,sdl_mixer
    { you can add units after this };

    {$IFDEF WINDOWS}{$R project1.rc}{$ENDIF}
    var
    scr: PSDL_Surface;
    running: boolean;
    event: TSDL_Event;
    imgs: array of PSDL_Surface;
    destr: TSDL_Rect;
    mus: array of PMix_music; //or _chunk
    scene: integer;

    procedure LoadImg(f: string; t: boolean);
    var
    timg: PSDL_Surface;
    begin
    setlength(imgs,length(imgs)+1);
    timg := IMG_Load(PChar(f));
    if(t) then
    begin
    imgs[length(imgs)-1] := SDL_DisplayFormatAlpha(timg);
    end else
    begin
    imgs[length(imgs)-1] := SDL_DisplayFormat(timg);
    end;
    SDL_FreeSurface(timg);
    end;

    procedure LoadMusic(f: string);
    begin
    setlength(mus,length(mus)+1);
    mus[length(mus)-1] := Mix_Loadmus(PChar(f));
    end;

    procedure LoadMenu();
    begin
    LoadImg('ascent.png',true);

    LoadMusic('tmp.mp3');
    Mix_PlayMusic(mus[0],-1);
    scene := 1;
    end;

    begin
    scene := 0;
    running := true;
    SDL_Init(SDL_INIT_VIDEO);
    SDL_InitSubSystem(SDL_INIT_AUDIO);
    Mix_OpenAudio(22050, AUDIO_S16SYS, 2, 4096);

    scr := SDL_SetVideoMode(640,480,8,SDL_SWSURFACE);
    SDL_WM_SetCaption('SDL Framework',nil);


    destr.x := 160-62;
    destr.y := 40;
    destr.w := 123;
    destr.h := 29;
    while(running) do
    begin
    while(SDL_PollEvent(@event) = 1) do
    begin
    case event.type_ of
    SDL_QUITEV:
    begin
    running := false;
    end;
    SDL_KEYDOWN:
    begin
    running := false;
    end;
    end;
    end;
    case scene of
    0:
    begin
    loadMenu();
    end;
    1:
    begin
    // Draw menu
    end;
    end;
    SDL_BlitSurface(imgs[0],nil,scr,@destr);
    SDL_UpdateRect(scr,0,0,0,0);
    SDL_Delay(1);
    end;
    SDL_FreeSurface(scr);
    SDL_Quit;
    end.
    [/pascal]
    I don't know if this will require you uninstalling any JEDI-SDL packages, and you're definitely going to want to change filenames and possibly never load and play the music.

    Anyway. Sorry I can't help with Mac-specific problems, but with any luck the above will work for you with a few minor tweaks For the record, I'm using a beta of .9.28.3 from March.

  6. #16

    Re: Brace for it... I think WILL's going to become a Mac.

    Quote Originally Posted by dazappa
    First thing to consider is that Lazarus should come bundled with SDL already (just not the libs).
    FreePascal ships with SDL headers. Tiny but important difference.

    Quote Originally Posted by dazappa
    I'm pretty much going to assume from here on out you're going to use FPC/Lazarus' SDL units instead of JEDI-SDL. (I have gotten JEDI-SDL to work in the past, but it's not worth it)
    Actually FreePascal's SDL headers are practically identical to JEDI-SDL (which is to be expected since FreePascal's SDL headers are based off JEDI-SDL). There are some slight differences like FreePascal's headers automatically link against libSDL on Linux and stuff like that.

    Quote Originally Posted by dazappa
    As for whatever else you're doing with {$linklib} etc., I've had no experience with having to do that.
    On Windows and Linux the shared library (SDL.dll and libSDL.so respectively) is being linked against the application automatically. However, on Mac OS X this is not the case. That's why all that {$link..}-stuff is for.

    A few things that need to be changed in order for your code to work on Mac OS X:
    - Link against SDL
    - You cannot assign the values in Mix_OpenAudio directly. You need to declare variables or constants, initialize them with the needed values and assign those. It will result in an access violation if you don't do this. It sounds like a strange issue, and for some reason this error only occurs since Mac OS X 10.5.6.
    - The frequence needs when calling Mix_OpenAudio needs to be set to 44100 kHz


    And a few hints:
    - {$apptype gui} does not exist on Mac OS X.
    - The second parameter of SDL_WM_SetCaption() does not set the icon itself of your application, but the text that is displayed in the menu bar. (See: http://sdl.beuc.net/sdl.wiki/SDL_WM_SetCaption) On Windows, the second parameter is ignored.
    Basically calling it like
    [pascal]
    SDL_WM_SetCaption('My Title', 'My Title');
    [/pascal]
    is the best way to go and would prevent some unintentional flaws on Linux.
    Freeze Development | Elysion Game Framework | Twitter: @Stoney_FD
    Check out my new book: Irrlicht 1.7.1 Realtime 3D Engine Beginner's Guide (It's C++ flavored though)

    Programmer: A device for converting coffein into software.

  7. #17

    Re: Brace for it... I think WILL's going to become a Mac.

    I've got similar problems.

    I've installed

    1. XCode
    2. Lazarus
    3. FreePascal
    4. FreePascal Sources
    5. SDL (so now there is a folder /Library/Frameworks/SDL.framework)

    For compiling, I'm using the SDL that FreePascal is already shipping with.

    However, I get the error

    ld: Library not found for -lSDLmain
    Error: Error while linking

    This error occurs when and when not using {$linklib SDLmain} or {$linkframework SDL}. I'm really clueless, because I have absolutely no experience with Macs.

    Another strange thing:

    SDL_WM_SETICON(SDL_LOADBMP('graphics/icon.png'), 0);

    works with JEDI-SDL, but not with builtin-SDL; there this gives me an error that 0 is a wrong parameter; it seems to expect PUInt8 instead of ShortInt. Never used that type before -- can somebody explain this?

  8. #18

    Re: Brace for it... I think WILL's going to become a Mac.

    To get the libSDLmain library, follow the instructions on the FreePascal page: http://wiki.lazarus.freepascal.org/F...pecific_issues


    PUInt8 requires you to use a a pointer, that means in your case you have to use "nil" instead of "0".
    Freeze Development | Elysion Game Framework | Twitter: @Stoney_FD
    Check out my new book: Irrlicht 1.7.1 Realtime 3D Engine Beginner's Guide (It's C++ flavored though)

    Programmer: A device for converting coffein into software.

  9. #19
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25

    Re: Brace for it... I think WILL's going to become a Mac.

    Ok so what is the deal with FPC 2.2.4 and FPC 2.4.0 here? I though Mac OS X support was added ages ago, but from what Stoney keeps telling me I need 2.4.0 so that the $PASCALMAINNAME symbol will exist. Why is this thing so important that my program would keep crashing every time it's ran?
    Jason McMillen
    Pascal Game Development
    Co-Founder





  10. #20

    Re: Brace for it... I think WILL's going to become a Mac.

    Hi Everyone working on Mac OS X.
    It looks like you are missing SDLMain.o? Do you have that?
    If not you will need it to be able to build run correctly under Mac OS X.
    I couldn't work out a way to get it working without it.

    If you plan to release a univeral binary for both PPC and i386 systems, then you'll need an SDLMain.o that is PPC as well.

    I have both SDLMain.i386 and SDLMain.ppc, which are being used in Game Maker 7.5 on Mac OS X, so can forward that on if necessary. I should probably check that into Sourceforge at some point.

    I hope that helps.
    <br /><br />There are a lot of people who are dead while they are still alive. I want to be alive until the day I die.<br />-= Paulo Coelho =-

Page 2 of 2 FirstFirst 12

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •