• Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

182 Neutral

About szymczyk

  • Rank

Personal Information

  • Interests
  1. Getting 2D collisions to fire requires the following: Both of the colliding objects must have a 2D collider. At least one of the colliding objects must have a 2D rigid body component. In my 2D project the rigid body component has the Simulated checkbox selected. I'm not sure if that's a requirement. To answer your question about triggers, triggers are used to fire gameplay events. Imagine you have a role-playing game and you have a trap that fires arrows at the player when the player steps on it. To make the trap fire, you would give the trap a collider and make the collider a trigger. The trap's trigger handling code would fire the arrows.
  2. open window from opengl app

    I don't know why the code sample from the SDL wiki crashes, but the following article may help you:   Creating an OpenGL Context in SDL 2  
  3. SDL + XCode ... not linking?

    It sounds like you're trying to have the SDL framework copied into your game's application bundle when you build the project, but the framework isn't being copied. Since you don't have the SDL framework installed on your system, the game doesn't work because there's no SDL framework on the system. You can check to see if the SDL framework is in your game's application bundle by selecting the game in the Finder, right-clicking, and choosing Show Package Contents. The SDL framework should be under Contents > Frameworks in the application bundle.   If the SDL framework isn't in the application, you have to tell Xcode to copy it. Instructions for doing this are in the following article:   Using SDL with Xcode 4   Read the comment from Adam on Feb. 2, 2012 in the article. He has a workaround if the SDL framework isn't being copied to the application bundle.
  4. I found the cause of the release version crashing. After creating the OpenGL texture, I freed the memory of the SDL surface where I loaded the image file. Freeing the memory caused the crash. Thanks for the help, everyone.
  5. I was able to load the files when running the game inside Visual Studio. Inside the project folder are three folders: Debug, Release, and the name of the project. Inside Visual Studio the working directory was the folder that matched the project name. Moving the PNGs and DLLs into the folder matching the name of the project allowed me to load the PNGs when debugging in Visual Studio. I moved on to getting the release versions to work. I passed the full path to the PNG files in my code. The program crashed when I launched from Windows Explorer. When I stepped through the code in Visual Studio's debugger, the first two PNG files loaded, but the third one didn't. I do not have any non-English characters in my path. When I use fopen, I pass the name of the file. fopen returns a pointer whose address points to NULL when I pass the full path to the file as the filename.
  6. I run the release build from Windows Explorer. I also debug the debug build from Visual Studio. In both cases I place the PNGs and DLLs in the same directory as the executable. In both cases the PNG files do not load.
  7. I created a simple PNG and tried loading it, but IMG_Load returned a NULL pointer. I took one of the PNG files I couldn't load and tried to load it in an old texture loading sample I had, and the file loaded. The sample used the same code I originally used: SDL_RWFromFile and IMG_Load_RW. I also used the same DLLs in both programs. I don't know why the old sample loads PNG files but my game doesn't. Thanks for the help Spirrwell. You got me thinking deeper about the problem. When I discover a solution to this problem, I'll post it here.
  8. The FILE pointer is NULL when I call fopen. I have tried to load five different images, and they all return NULL after calling IMG_Load. However, I have a text file in my game, and that file loads. It's just the PNG files that don't load. The text file is in the application directory, just like the PNG files.
  9. I understood what you meant about calling IMG_Load. Pass the filename to IMG_Load. The code compiled fine, but IMG_Load returned NULL. Regarding the file names, I did notice that if I have a file named Tiles.png on Mac OS X, Windows Explorer shows the filename as Tiles. I added .png to the PNG files in Windows Explorer, but the file loading code fails both when the name is Tiles and Tiles.png.
  10. I call IMG_Load_RW after calling SDL_RWFromFile. I tried changing the texturing loading code to call IMG_Load instead of SDL_RWFromFile and IMG_Load_RW, but I still get the same error when I run the game. Thanks for the help.
  11. I am trying to make a Windows version of a game that uses SDL and SDL_image. The game's image files are PNG files. I am using SDL 1.2.15 and SDL_image 1.2.12. I compiled a release version of my game using Visual C++ 2008 Express on a 32-bit Vista virtual machine. The game builds with no errors. I create a Release version of the game and add the following files to the same directory as the executable file: The PNG files SDL.dll SDL_image.dll libpng15-15.dll zlib1.dll The dll files are the x86 versions from the SDL and SDL_image binary installations. When I run the game from outside Visual C++, a window opens and the game crashes. Stepping through the code in the debugger, I discovered the following code returns a null pointer: [CODE] SDL_RWops* textureFile; // filename is the argument I pass to the texture loading function. textureFile = SDL_RWFromFile(filename, "rb"); [/CODE] Adding a call to SDL's GetError functions to get more information about the error provides the error message "Couldn't open ImageFile.png", where ImageFile is one of the PNG files in the game. I figure the files aren't loading due to not having the PNG files or DLLs in the right location. But I thought putting them in the same location as the application was enough to get the image files to load. Are there additional libraries or files I need to place in the application folder to get the PNG files to load? I'm obviously missing something.
  12. 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.
  13. In the file SDLMain.m there is a method called setupWorkingDirectory. Comment out the code inside the method. Paste the following code inside the method: [CODE]NSString *resourcePath = [[NSBundle mainBundle] resourcePath]; [[NSFileManager defaultManager] changeCurrentDirectoryPath:resourcePath];[/CODE] Now the working directory should be set to your app bundle's Resources folder.
  14. 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="http://meandmark.com/blog/2009/12/sdl-tips-for-mac-os-x/"]SDL Tips for Mac OS X[/url]
  15. [quote name='Hinchy' timestamp='1334097717' post='4930026'] 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? [/quote] You should not be using automatic reference counting. That is for Objective-C code. You may have a search path problem, where Xcode can't find the SDL framework and/or headers. Start with adding the path to SDL to Xcode's Framework Search Paths build setting. If that doesn't work, add a path to the Header Search Paths build setting. If you're using Xcode 4, the following article may help you: [url="http://meandmark.com/blog/2012/01/using-sdl-with-xcode-4/"]Using SDL with Xcode 4[/url]
  • Advertisement