Make a C++ Debug Prompt?
Is it possible?
How do I?
Moderator: Coders of Rage
-
- Chaos Rift Regular
- Posts: 198
- Joined: Thu Mar 26, 2009 8:42 pm
- Current Project: My Engine
- Programming Language of Choice: C++
How do I?
My first game: http://donsvoice.com/randomdever/Duck%2 ... 01.0.0.zip
My second game: http://donsvoice.com/randomdever/Space%20Invaders.zip
My third game: http://donsvoice.com/randomdever/BreakOut!.zip
My second game: http://donsvoice.com/randomdever/Space%20Invaders.zip
My third game: http://donsvoice.com/randomdever/BreakOut!.zip
- 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: How do I?
No. Not without having a C++ compiler/interpreter going in real-time.
It would be infinitely more easy to make an in-game assembly debug prompt. It would be an extremely platform specific endeavor, but it's very possible to do it on anything (Dreamcast even).
It would be infinitely more easy to make an in-game assembly debug prompt. It would be an extremely platform specific endeavor, but it's very possible to do it on anything (Dreamcast even).
-
- Chaos Rift Regular
- Posts: 198
- Joined: Thu Mar 26, 2009 8:42 pm
- Current Project: My Engine
- Programming Language of Choice: C++
Re: How do I?
Thanks for the reply.
BTW What about a random number generator function that would take the minimum and maximum number it could genereate?
BTW What about a random number generator function that would take the minimum and maximum number it could genereate?
My first game: http://donsvoice.com/randomdever/Duck%2 ... 01.0.0.zip
My second game: http://donsvoice.com/randomdever/Space%20Invaders.zip
My third game: http://donsvoice.com/randomdever/BreakOut!.zip
My second game: http://donsvoice.com/randomdever/Space%20Invaders.zip
My third game: http://donsvoice.com/randomdever/BreakOut!.zip
- 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: How do I?
rand() and being a little bit of a smartass will work.
Where number is equal to min+number of random numbers = max random number.
So if you want 10-20 randomly:
Code: Select all
rand()%number+min
So if you want 10-20 randomly:
Code: Select all
rand()%10+10
Re: How do I?
Code: Select all
int random_range(int min, int max)
{
return rand()%(max-min)+min;
}
personally i would make it like this.
Code: Select all
double random(double min, double max)
{
return (rand()/((double)(RAND_MAX)+1.0))*(max-min)+min;
}
you can just use an int case on the call if you just need an int value.
(int)random(lower, upper);
anyways.
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"
- 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: How do I?
Thanks, avansc. I had a hard time putting what I meant into words. Your first function is exactly what I was trying to say.
-
- Chaos Rift Regular
- Posts: 198
- Joined: Thu Mar 26, 2009 8:42 pm
- Current Project: My Engine
- Programming Language of Choice: C++
Re: How do I?
Thanks guys the random_range function works perfectly.
Sweet!
Edit: Now back to work
Sweet!
Edit: Now back to work
My first game: http://donsvoice.com/randomdever/Duck%2 ... 01.0.0.zip
My second game: http://donsvoice.com/randomdever/Space%20Invaders.zip
My third game: http://donsvoice.com/randomdever/BreakOut!.zip
My second game: http://donsvoice.com/randomdever/Space%20Invaders.zip
My third game: http://donsvoice.com/randomdever/BreakOut!.zip