I was typing it on my iPod Touch, and it thinks i was talking about Sexually Transmitted Diseases, and obviously I would have figured it out, the compiler might have even fixed it as i was typing it :DMarauderIIC wrote: And it's not STD::string. It's std::string.
String help?
Moderator: Coders of Rage
- ibly31
- Chaos Rift Junior
- Posts: 312
- Joined: Thu Feb 19, 2009 8:47 pm
- Current Project: Like... seven different ones
- Favorite Gaming Platforms: Xbox 360, Gamecube
- Programming Language of Choice: C++, ObjC
- Location: New Jersey.
Re: String help?
Website/Tumblr
My Projects
The best thing about UDP jokes is that I don’t care if you get them or not.
- MarauderIIC
- Respected Programmer
- Posts: 3406
- Joined: Sat Jul 10, 2004 3:05 pm
- Location: Maryland, USA
Re: String help?
Haha, alright.
Also, I've used the console with SDL applications (on accident). My checkers program actually took cin and cout and updated the separate SDL window (it was originally a console app and I just changed main() to have argc and argv and built it with SDL).
Also, I've used the console with SDL applications (on accident). My checkers program actually took cin and cout and updated the separate SDL window (it was originally a console app and I just changed main() to have argc and argv and built it with SDL).
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.
- programmerinprogress
- Chaos Rift Devotee
- Posts: 632
- Joined: Wed Oct 29, 2008 7:31 am
- Current Project: some crazy stuff, i'll tell soon :-)
- Favorite Gaming Platforms: PC
- Programming Language of Choice: C++!
- Location: The UK
- Contact:
Re: String help?
Really? well I can't get it to work, and i've done some googling, and apparently this problem is quite common, and i've tried the majority of the remedies suggested (with the exception of the ones that want me to recompile SDL), most of them state that SDL 'redirects' streams to output files.
---------------------------------------------------------------------------------------
I think I can program pretty well, it's my compiler that needs convincing!
---------------------------------------------------------------------------------------
And now a joke to lighten to mood :D
I wander what programming language anakin skywalker used to program C3-PO's AI back on tatooine? my guess is Jawa :P
I think I can program pretty well, it's my compiler that needs convincing!
---------------------------------------------------------------------------------------
And now a joke to lighten to mood :D
I wander what programming language anakin skywalker used to program C3-PO's AI back on tatooine? my guess is Jawa :P
- ibly31
- Chaos Rift Junior
- Posts: 312
- Joined: Thu Feb 19, 2009 8:47 pm
- Current Project: Like... seven different ones
- Favorite Gaming Platforms: Xbox 360, Gamecube
- Programming Language of Choice: C++, ObjC
- Location: New Jersey.
Re: String help?
I packaged a nice little function, its called addInt(std::string, int num)
and you'd call it by this
std::string asfd = addInt("Value = ",value);
draw asdf...
and you'd call it by this
std::string asfd = addInt("Value = ",value);
draw asdf...
Website/Tumblr
My Projects
The best thing about UDP jokes is that I don’t care if you get them or not.
Re: String help?
Actually, mystringstream.str() is the converted string-version and mystringstream.str().c_str() for the C-string. But since that's not what you wanted to do I won't delve deeper.ibly31 wrote:I don't wanna make a whole new string and a new header... Then there'd be the problem of concertng that back to a STD::string and them to a c_str()
- ibly31
- Chaos Rift Junior
- Posts: 312
- Joined: Thu Feb 19, 2009 8:47 pm
- Current Project: Like... seven different ones
- Favorite Gaming Platforms: Xbox 360, Gamecube
- Programming Language of Choice: C++, ObjC
- Location: New Jersey.
Re: String help?
Yeah, lol i ended up using stringstream anyway.
I have a question on Keystates, they arent working... whats wrong with this code?
I have a question on Keystates, they arent working... whats wrong with this code?
Code: Select all
Uint8 *keystates = SDL_GetKeyState(NULL);
if(keystates[SDLK_UP])
charY -= speedX;
if(keystates[SDLK_DOWN])
charY += speedY;
if(keystates[SDLK_LEFT])
charX -= speedX;
if(keystates[SDLK_RIGHT])
charX += speedX;
if(keystates[SDLK_ESCAPE])
quit = true;
Website/Tumblr
My Projects
The best thing about UDP jokes is that I don’t care if you get them or not.
- Ginto8
- ES Beta Backer
- Posts: 1064
- Joined: Tue Jan 06, 2009 4:12 pm
- Programming Language of Choice: C/C++, Java
Re: String help?
It looks fine... Could you tell us what's happening wrong?
Quit procrastinating and make something awesome.
Ducky wrote:Give a man some wood, he'll be warm for the night. Put him on fire and he'll be warm for the rest of his life.
- ibly31
- Chaos Rift Junior
- Posts: 312
- Joined: Thu Feb 19, 2009 8:47 pm
- Current Project: Like... seven different ones
- Favorite Gaming Platforms: Xbox 360, Gamecube
- Programming Language of Choice: C++, ObjC
- Location: New Jersey.
Re: String help?
I fixed it, the main while(quit == false) loop didn't have another while(pollevent) loop inside it.
Website/Tumblr
My Projects
The best thing about UDP jokes is that I don’t care if you get them or not.