• Content count

  • Joined

  • Last visited

Community Reputation

100 Neutral

About ZachHinchy

  • Rank
  1. Here we go, there it is. Thanks szymczyk, couldn't have done it without your help. [img][/img]
  2. overnight in the hospital wooooooooooooooo.
  3. Apple I'ma be honest you may be user-friendly, but your platforms are hard as hell to develop for.
  4. [quote name='szymczyk' timestamp='1334260493' post='4930661'] There's a possible fix to your problem in the comments to the Using SDL with Xcode 4 article I linked to earlier in this thread. Read adam's comment. [/quote]YES! THAT'S IT!
  5. [quote name='szymczyk' timestamp='1334170319' post='4930338'][stuff][/quote]Thank you! So, here's an update. I noticed something interesting in the GDB logs: [url=""][/url] This happens when SDL.framework is located in both /Library/Frameworks and the application bundle. If I remove SDL.framework from /Library/Frameworks, the game refuses to open, OS X complaining that the game's not compatible etc etc. If I remove SDL.framework from the application bundle... the game runs! Until it crashes at Crypto++, anyway (keep in mind that's a statically linked library, not a framework, as that's all I could find for it on OS X). EDIT: I've narrowed the problem child down to just SDL.framework... the SDL_* frameworks all work just fine. EDIT 2: Manage to fix Crypto++. So, now all we have to do is get SDL.framework to play nice...
  6. [quote name='szymczyk' timestamp='1334116137' post='4930105'] You most likely have a working directory problem where the game can't find your image, sound, and data files. The simplest solution is to open the SDLMain.m file and change the working directory to your app bundle's Resources folder. More detailed information on changing the working directory is in the following article: [url=""]SDL Tips for Mac OS X[/url] [/quote]I'm not really sure what to do with the code in that article. Objective-C confuses the heck out of me. Though for what it's worth my resources are actually loading, or at least the images are -- on the splash screen, if I disable SDL_PollEvent, I see the splash screen as it would normally display. I of course still would like to figure out where to put that code, as having the resources in the app bundle would be quite preferable. Here's my setupWorkingDirectory code: [code]/* Set the working directory to the .app's parent directory */ - (void) setupWorkingDirectory:(BOOL)shouldChdir { if (shouldChdir) { char parentdir[MAXPATHLEN]; CFURLRef url = CFBundleCopyBundleURL(CFBundleGetMainBundle()); CFURLRef url2 = CFURLCreateCopyDeletingLastPathComponent(0, url); if (CFURLGetFileSystemRepresentation(url2, 1, (UInt8 *)parentdir, MAXPATHLEN)) { chdir(parentdir); /* chdir to the binary app's parent */ } CFRelease(url); CFRelease(url2); } }[/code]
  8. Turns out I was being incredibly dense and using #elseif instead of #else. Now it compiles. However, now the program is crashing with an EXC_BAD_ACCESS signal at SDL_PollEvent(&event). If I remove the event handling code, the game runs, though obviously without input. Also, if I force it to skip the splash screen and start the level, it crashes with an EXC_BAD_ACCESS signal at the call to the encryption library I use to encrypt level and save data (Crypto++). It's also worth nothing that while the splash screen runs, no sound plays on it.
  9. [quote name='szymczyk' timestamp='1334095569' post='4930018']SDL is not a system framework. You should use quotes instead of angle brackets to include SDL, SDL_image, and SDL_mixer. SDL has a header file for OpenGL, SDL_opengl.h, that keeps you from having to worry about how to include the OpenGL headers on various operating systems. I suggest including SDL_opengl.h instead of gl.h.[/quote]Ah, thank you. Have adjusted my code with both of these in mind. [quote name='szymczyk' timestamp='1334095569' post='4930018']You haven't said how you are trying to compile your code. Are you using Xcode or are you trying to compile using a makefile? If you are using a makefile, you need to link to the Cocoa framework because the Mac version of SDL uses Cocoa. You also need to add the file SDLMain.m to your Xcode project or makefile. SDLMain.m contains glue code that allows you to compile SDL code on Mac OS X.[/quote]Sorry, I'm using Xcode. I am also using SDLMain.m and linking to the cocoa framework. After making those changes to the code and reading your SDL and OpenGL on Mac OS X article, I'm still getting errors: Parse Issue Unknown type name 'GLuint' Almost all the errors are like this, sometimes replacing GLuint with other things such as Mix_Chunk and SDL_Color... basically any defined data type. Eventually I get a "Too many errors emitted, stopping now." message. EDIT: On clean and rebuild I've discovered SDLMain is throwing up a ton of errors related to automatic reference counting mode. I'm going to assume I should be compiling with automatic reference counting OFF -- could someone confirm this for me?
  10. We've been encountering many barriers in our attempts to compile our SDL/OpenGL game on Mac OS X. The main development OS is Windows but we've also had no problem building the game for Linux operating systems. The preferred method of library distribution on OS X is through frameworks, and SDL is no different. Since SDL has several sub-libraries, each in a separate framework, the #include code is different between systems. (The OpenGL #include code is also different, for the record.) [code]#ifndef __APPLE__ #include <GL/gl.h> #include <SDL/SDL.h> #include <SDL/SDL_image.h> #include <SDL/SDL_mixer.h> #elseif #include <OpenGL/gl.h> #include <SDL/SDL.h> #include <SDL_image/SDL_image.h> #include <SDL_mixer/SDL_mixer.h> #endif[/code] This is all fine and dandy but that actually gives me compilation errors in the frameworks' headers themselves, as they refer to files from other parts of SDL with the assumption they're in the same folder. One could edit the headers but other errors happen then. Since frameworks are the "proper" way of distributing libraries in your application bundles, I'm going to assume that there's just something wrong on my end and not that SDL frameworks are completely unusable by anyone. In addition, a perturbing problem with OpenGL is that it insists that [b]GLuint [/b]is not defined. This is baffling, considering you can go to OpenGL/gl.h yourself and plainly see the typedef of GLuint. I've been struggling with these issues for a while and I'd appreciate it if someone would be able to help with this.
  11. I am making a game using OpenGL, with SDL_Image employed to load the textures. When drawn on screen, there's no alpha -- in an exact square around the opaque contents of the texture, black is drawn; outside that space, white is drawn. Here is my OpenGL init code... [code] SDL_SetVideoMode(windowWidth, windowHeight, 16, SDL_HWSURFACE|SDL_GL_DOUBLEBUFFER|SDL_OPENGL); glClearColor(0, 0, 0, 0); glClearDepth(1.0f); glViewport(0, 0, windowWidth, windowHeight); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0, windowWidth, windowHeight, 0, 1, -1); glMatrixMode(GL_MODELVIEW); glEnable(GL_TEXTURE_2D); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glLoadIdentity();[/code] is my image loading function... [code] SDL_Surface *loadImage (const char *filename, bool alpha = true) { SDL_Surface* loadedImage = NULL; SDL_Surface* zoomedImage = NULL; SDL_Surface* optimizedImage = NULL; loadedImage = IMG_Load(filename); if (loadedImage != NULL) { zoomedImage = zoomSurface(loadedImage,windowScaleH/4,windowScaleH/4,SMOOTHING_ON); SDL_FreeSurface(loadedImage); if (alpha) optimizedImage = SDL_DisplayFormatAlpha(zoomedImage); else optimizedImage = SDL_DisplayFormat(zoomedImage); SDL_FreeSurface(zoomedImage); } return optimizedImage; }[/code] is the code I actually use to create the GL texture... [code] GLuint thisIsMyTexture; glGenTextures(1, &thisIsMyTexture); temporarySurface = loadImage("theimagetomytexture.png"); glBindTexture(GL_TEXTURE_2D,thisIsMyTexture); glTexImage2D(GL_TEXTURE_2D, 0, 4, temporarySurface->w, temporarySurface->h, 0, GL_RGBA, GL_UNSIGNED_BYTE, temporarySurface->pixels); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );[/code] ...and the drawing code itself. [code] glBindTexture(GL_TEXTURE_2D,thisIsMyTexture); glBegin( GL_QUADS ); glTexCoord2f(0.0f, 0.0f); glVertex3f(0.0f, 0.0f, 1.0f); glTexCoord2f(1.0f, 0.0f); glVertex3f(32.0f, 0.0f, 1.0f); glTexCoord2f(1.0f, 1.0f); glVertex3f(32.0f, 32.0f, 1.0f); glTexCoord2f(0.0f, 1.0f); glVertex3f(0.0f, 32.0f, 1.0f); glEnd();[/code] That's all the relevant information I can think of. Help would be appreciated!