Menu

Graphics on a mac

rcj
2007-05-02
2013-06-03
  • rcj

    rcj - 2007-05-02

    Hi everyone!

    I've been going through the compilation process of SLASH'EM for almost a week and I finally have my binaries, on which I have supported tty, SDL/GL, and X11, but I am unable to run them for this reason: Mac OS X is a jerk about starting graphical programs from the command line, or at least SDL programs, and no keyboard input is detected by SLASH'EM, and also because I have no idea how to specify using X11 instead. I got the idea from reading various documents that this could be achieved through a command line option, but I have failed to actually find one that works.

    So pretty much if anyone knows about setting this up, that would be pretty cool!

    And as a minor side note, whenever I recompile and it cleans out the old slashemdir contents, it fails to put in the png files necessary for the SDL/GL version so I have to copy them from glhack. Is that my fault or a bug?

     
    • rcj

      rcj - 2007-05-03

      Guys! It's working!

      I don't know if anyone is interested, but I will tell you how I did it anyway. Getting it to build is pretty simple: change Gl/gl.h to OpenGL/gl.h in include/wingl.h, add -framework OpenGL to WINGLLIB in the Makefile, and I had to comment out the declaration of tparm in win/tty/termcap.c. And after that basically following the unix build instructions. This got me a bunch of memory errors and no keyboard input. From minor SDL programming experience on OS X I knew that there were some magic files called SDLMain.m and SDLMain.h that set up a basic SDL cocoa app so I decided to add those to the build. Now, I don't know much about the structure of the code or how to write well formed Makefiles or anything, and this whole thing seemed like a pretty ugly hack to me, but what I did was I added SDLMain.m/h to win/gl/ and added SDLMain.m to WINGLSRC and SDLMain.o to WINGLOBJ and then down near the rules for building the gl_*.o files I added this rule:

      SDLMain.o: ../win/gl/SDLMain.m
          $(CC) $(CFLAGS) $(SDLGL_CFLAGS) -c ../win/gl/SDLMain.m

      After that you have to go to sys/unix/unixmain.c and change the declaration of main to SDL_main, which is then called after SDLMain.c sets up a standard cocoa/SDL app. Then you build it and it works just fine.

      Also, in the Makefile in the top level you have to add CNF_SHARE_GLND to CNF_SHARE_DAT and then add CNF_SHARE_DAT to SHARE_DAT in order to get the graphics files included in the build.

      Also, I know this was pretty vague and I probably forgot something, so if anyone wants the source, email me!

      Lastly, I still can't find the right options to use a different windowing system or set the tiles to anything except for 32x32, so if anyone knows about that, I'd like to hear.

       
      • Paul Hurtley

        Paul Hurtley - 2007-05-03

        Hi rcj:

        Thanks for looking into this. I've not yet been able to duplicate your success. One question I have: the Makefile includes a call 'sdl-config --cflags'. I don't have a copy of the program sdl-config on my system, and without it the SDL/GL code won't compile. Do you have a copy, or did you just edit the Makefile?

        Paul

         
        • rcj

          rcj - 2007-05-03

          I wasn't sure how to fix that the easy way, so I downloaded the SDL source and built it unix-style, which puts everything in the place that SLASH'EM expects them to be. It's actually not bad, the SDL Makefile has everything it needs to work on OS X so it's just a make; make install affair.

           

Log in to post a comment.