SDL - XCode
Moderator: Coders of Rage
SDL - XCode
In my main.cpp file whenever I try to create an SDL_Rect my player class decides to stop rendering, even when there's absolutely no connection between
my player object and the rectangle. Anyone know whats going on?
my player object and the rectangle. Anyone know whats going on?
- dandymcgee
- ES Beta Backer
- Posts: 4709
- Joined: Tue Apr 29, 2008 3:24 pm
- Current Project: https://github.com/dbechrd/RicoTech
- Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
- Programming Language of Choice: C
- Location: San Francisco
- Contact:
Re: SDL - XCode
You should probably post the relevant code, from the minimal circumstances in which it happens.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches!
Re: SDL - XCode
main.cpp: http://pastebin.com/5hPrpmrh
bullet.cpp: http://pastebin.com/PWnPh6jq
In main you won't see an SDL_Rect since I was trying to "hide" it behind the bullet constructor
but even with that it refuses to draw the player. if I remove the bullet then it draws the player
just fine.
(Tell me if you want to see any other files)
bullet.cpp: http://pastebin.com/PWnPh6jq
In main you won't see an SDL_Rect since I was trying to "hide" it behind the bullet constructor
but even with that it refuses to draw the player. if I remove the bullet then it draws the player
just fine.
(Tell me if you want to see any other files)
- Van-B
- Chaos Rift Regular
- Posts: 125
- Joined: Tue Aug 10, 2010 7:17 am
- Current Project: iPhone puzzle game
- Favorite Gaming Platforms: All - Except Amiga
- Programming Language of Choice: DBPro, ObjC++
- Location: Scotland
Re: SDL - XCode
Probably not relevant, but I always thought that you had to use .mm for C++ files in XCode, otherwise it get's upset.
Health, ammo.... and bacon and eggs.
- Falco Girgis
- Elysian Shadows Team
- Posts: 10294
- Joined: Thu May 20, 2004 2:04 pm
- Current Project: Elysian Shadows
- Favorite Gaming Platforms: Dreamcast, SNES, NES
- Programming Language of Choice: C/++
- Location: Studio Vorbis, AL
- Contact:
Re: SDL - XCode
You're supposed to stop linking to the Appkit library/includes. But yeah, changing your .cpps to .mms does the same trick.Van-B wrote:Probably not relevant, but I always thought that you had to use .mm for C++ files in XCode, otherwise it get's upset.
Why in god's name XCode is too stupid to stop including Objective-C libraries when you're clearly using only C++ is beyond me...
- hurstshifter
- ES Beta Backer
- Posts: 713
- Joined: Mon Jun 08, 2009 8:33 pm
- Favorite Gaming Platforms: SNES
- Programming Language of Choice: C/++
- Location: Boston, MA
- Contact:
Re: SDL - XCode
I think the answer is in there somewhere...GyroVorbis wrote: Why in god's name XCode is too stupid to stop including Objective-C libraries when you're clearly using only C++ is beyond me...
"Time is an illusion. Lunchtime, doubly so."
http://www.thenerdnight.com
http://www.thenerdnight.com
Re: SDL - XCode
I've renamed my cpps to mms its still doing the same thing. I tried removing SDLMain.h & SDLMain.m, also tried making a new "console application" including the SDL frameworks from there but it refused to compile.
I don't really understand why including those libraries would cause an SDL_Rect to mess up drawing my player (especially since they have no connection with one another)
I don't really understand why including those libraries would cause an SDL_Rect to mess up drawing my player (especially since they have no connection with one another)
Re: SDL - XCode
Your problem has NOTHING to do with what they mentioned. You do not use mm for c++, you use mm when you do objectiveC.
The reference Falco is making is that when you create a target, and its of type cocoa, it by default includes some things that can cause you issues. If you create whats called a BSD target, it wont be an issue.
NOTE: making a project and adding a target(binary) have differences, making a project will do all the setup for you, adding a target however expects you to not be the stupid one.
Xcode has a perfectly fine debugger built in that you can step through and exactly see where the player class stops rendering.
The reference Falco is making is that when you create a target, and its of type cocoa, it by default includes some things that can cause you issues. If you create whats called a BSD target, it wont be an issue.
NOTE: making a project and adding a target(binary) have differences, making a project will do all the setup for you, adding a target however expects you to not be the stupid one.
Xcode has a perfectly fine debugger built in that you can step through and exactly see where the player class stops rendering.
Some person, "I have a black belt in karate"
Dad, "Yea well I have a fan belt in street fighting"
Dad, "Yea well I have a fan belt in street fighting"
- Van-B
- Chaos Rift Regular
- Posts: 125
- Joined: Tue Aug 10, 2010 7:17 am
- Current Project: iPhone puzzle game
- Favorite Gaming Platforms: All - Except Amiga
- Programming Language of Choice: DBPro, ObjC++
- Location: Scotland
Re: SDL - XCode
You need to use .MM to compile C++ classes.
That could have PLENTY to do with a problem with CPP files, XCode and classes.
That could have PLENTY to do with a problem with CPP files, XCode and classes.
Health, ammo.... and bacon and eggs.
- MrDeathNote
- ES Beta Backer
- Posts: 594
- Joined: Sun Oct 11, 2009 9:57 am
- Current Project: cocos2d-x project
- Favorite Gaming Platforms: SNES, Sega Megadrive, XBox 360
- Programming Language of Choice: C/++
- Location: Belfast, Ireland
- Contact:
Re: SDL - XCode
You don't man, i use xcode for mac and it compiles my .cpp files just fine.Van-B wrote:You need to use .MM to compile C++ classes.
That could have PLENTY to do with a problem with CPP files, XCode and classes.
http://www.youtube.com/user/MrDeathNote1988
"C makes it easy to shoot yourself in the foot. C++ makes it
harder, but when you do, it blows away your whole leg." - Bjarne Stroustrup
"C makes it easy to shoot yourself in the foot. C++ makes it
harder, but when you do, it blows away your whole leg." - Bjarne Stroustrup
- Van-B
- Chaos Rift Regular
- Posts: 125
- Joined: Tue Aug 10, 2010 7:17 am
- Current Project: iPhone puzzle game
- Favorite Gaming Platforms: All - Except Amiga
- Programming Language of Choice: DBPro, ObjC++
- Location: Scotland
Re: SDL - XCode
Ahh, its probably related to the way I've been adding files - I would add an .M, then change it to .MM, ignoring the .CPP extension completely.
Health, ammo.... and bacon and eggs.