Search found 312 matches
- Sat Mar 14, 2009 8:30 pm
- Forum: Programming Discussion
- Topic: String help?
- Replies: 22
- Views: 1384
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? Uint8 *keystates = SDL_GetKeyState(NULL); if(keystates[SDLK_UP]) charY -= speedX; if(keystates[SDLK_DOWN]) charY += speedY; if(keystates[SDLK_LEFT]) charX -= speedX; if(k...
- Sat Mar 14, 2009 4:53 pm
- Forum: Programming Discussion
- Topic: String help?
- Replies: 22
- Views: 1384
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...
- Sat Mar 14, 2009 9:58 am
- Forum: Programming Discussion
- Topic: String help?
- Replies: 22
- Views: 1384
Re: String help?
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.
- Sat Mar 14, 2009 8:24 am
- Forum: Programming Discussion
- Topic: String help?
- Replies: 22
- Views: 1384
Re: String help?
Why would I use them? Cin is just for input, and that wouldn't be good cuz I can't control where it is, and Cout is just displaying text which I can do with SDL TTF extention
- Fri Mar 13, 2009 5:35 pm
- Forum: Programming Discussion
- Topic: String help?
- Replies: 22
- Views: 1384
Re: String help?
As for your first question, you'd be doing something like this #include <iostream> #include <sstream> using namespace std; int main () { int numbah=31; ostringstream mystringstream; mystringstream << "N=" << numbah; cout << mystringstream.str() << endl; return 0; } I don't wanna make a wh...
- Fri Mar 13, 2009 4:51 pm
- Forum: Programming Discussion
- Topic: String help?
- Replies: 22
- Views: 1384
Re: String help?
Thank you! THAT helped soo much. The c_str() bit! Now that I understand conversion from a std::String to a char[], how do you write to strings? ...hmm like... how do i explain, "X Value = " + xvalue + ", Y value = " + yvalue; How do you do this with std::strings? EDIT: Oh, and is...
- Fri Mar 13, 2009 3:54 pm
- Forum: Programming Discussion
- Topic: String help?
- Replies: 22
- Views: 1384
Re: String help?
well I guess my real question is how to display values in SDL. Anyone?
- Thu Mar 12, 2009 9:50 pm
- Forum: Programming Discussion
- Topic: String help?
- Replies: 22
- Views: 1384
String help?
How do you use STD::string? I always thought it was
Int numbah=31;
STD::string mystring
Mystring << "N=" << numbah;
But it's giving errors. And how do you display values in SDl? I can't figure out how to convert int to char*...
Int numbah=31;
STD::string mystring
Mystring << "N=" << numbah;
But it's giving errors. And how do you display values in SDl? I can't figure out how to convert int to char*...
- Thu Mar 12, 2009 6:37 pm
- Forum: Programming Discussion
- Topic: 2 Questions on SDL...
- Replies: 15
- Views: 1143
Re: 2 Questions on SDL...
What size sprites is the ES team using? I'm using 32x32 is that the way to go?
- Wed Mar 11, 2009 8:24 pm
- Forum: Programming Discussion
- Topic: 2 Questions on SDL...
- Replies: 15
- Views: 1143
Re: 2 Questions on SDL...
Hmm, now text isn't working: is there a way to draw text without the sdl_ttf extention?
- Wed Mar 11, 2009 7:15 pm
- Forum: Programming Discussion
- Topic: 2 Questions on SDL...
- Replies: 15
- Views: 1143
Re: 2 Questions on SDL...
Oh duh... I made it SDL_Rect clip[41] and it was trying to write 44 elements. Sorry, lol even sorry-er to my heart, my blood pressure was like *2. :oops: EDIT: OH sorry, um, Damn, I actually was testing around, to see if it would work with "val = val + 1" instead of "val++" and I...
- Wed Mar 11, 2009 7:03 pm
- Forum: Programming Discussion
- Topic: 2 Questions on SDL...
- Replies: 15
- Views: 1143
Re: 2 Questions on SDL...
OH sorry, um, Damn, I actually was testing around, to see if it would work with "val = val + 1" instead of "val++" and I didn't want you guys bitching at me, so I change it to val++, and i forgot the val =... and thats not the error. I dont under-effin-stand! x*y are both ints......
- Wed Mar 11, 2009 6:33 pm
- Forum: Programming Discussion
- Topic: 2 Questions on SDL...
- Replies: 15
- Views: 1143
Re: 2 Questions on SDL...
RANDOMERRORWTF?!?!?! Okay... this is really f***ing gay. THIS code works: void initClips(){ for(int y = 0; y <=11; y++){ for(int x = 0; x <= 3; x++){ clip[x*y].h = 32; clip[x*y].w = 32; clip[x*y].x = x*32; clip[x*y].y = y*32; } } } But this doesn't: void initClips(){ int val = 0; for(int y = 0; y <=...
- Wed Mar 11, 2009 5:58 pm
- Forum: Programming Discussion
- Topic: 2 Questions on SDL...
- Replies: 15
- Views: 1143
Re: 2 Questions on SDL...
So, how do I know which key is which in the array? Is there a specific list?
So if I'm checking for up, and its 3rd in the list, would i do *psuedo code*
if(keystatearray[3] == 1){
movecharacterup();
}
So if I'm checking for up, and its 3rd in the list, would i do *psuedo code*
if(keystatearray[3] == 1){
movecharacterup();
}
- Tue Mar 10, 2009 8:26 pm
- Forum: Programming Discussion
- Topic: 2 Questions on SDL...
- Replies: 15
- Views: 1143
2 Questions on SDL...
One: How do you change the cursor from that odd inverted black one that it makes you have? Two: How do you get keys to repeat? My keys are like... semiautomatic, one event per press, instead of auto, one press, as many events as you want until you let go. Hold down any key while in a text box, you s...