Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 58 59 [60] 61 62 ... 796

Author Topic: if self.isCoder(): post() #Programming Thread  (Read 886789 times)

Gatleos

  • Bay Watcher
  • Mournhold... City of Light... City of MAGIC!
    • View Profile
    • Someone Sig This
Re: if self.isCoder(): post() #Programming Thread
« Reply #885 on: January 25, 2012, 10:47:47 pm »

I've done quite a bit of C++/SDL, I could take a look at it.
Logged
Think of it like Sim City, except with rival mayors that seek to destroy your citizens by arming legions of homeless people and sending them to attack you.
Quote from: Moonshadow101
it would be funny to see babies spontaneously combust
Gat HQ (Sigtext)
++U+U++ // ,.,.@UUUUUUUU

MaximumZero

  • Bay Watcher
  • Stare into the abyss.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #886 on: January 25, 2012, 11:07:33 pm »

So, we're doing Rock, Paper, Scissors in C++, and my teacher says that my random number generator will always generate the same thing, but I can't get it to do it. Could someone look this over for me, please?

Spoiler (click to show/hide)
Logged
  
Holy crap, why did I not start watching One Punch Man earlier? This is the best thing.
probably figured an autobiography wouldn't be interesting

RulerOfNothing

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #887 on: January 25, 2012, 11:24:10 pm »

It could be because you are calling srand every time the computerchoice function is called. You should only call srand once.
Logged

MaximumZero

  • Bay Watcher
  • Stare into the abyss.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #888 on: January 25, 2012, 11:36:02 pm »

So, I just move that out to main, then?
Logged
  
Holy crap, why did I not start watching One Punch Man earlier? This is the best thing.
probably figured an autobiography wouldn't be interesting

RulerOfNothing

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #889 on: January 26, 2012, 12:07:29 am »

So, I just move that out to main, then?
Yes.
Logged

MaximumZero

  • Bay Watcher
  • Stare into the abyss.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #890 on: January 26, 2012, 12:43:51 am »

Schweet. Thanks.
Logged
  
Holy crap, why did I not start watching One Punch Man earlier? This is the best thing.
probably figured an autobiography wouldn't be interesting

Valid_Dark

  • Bay Watcher
  • If you wont let me Dream, I wont let you sleep.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #891 on: January 26, 2012, 02:19:29 am »

I can NOT get sdl_ttf to work,

here's a basic rundown of what I have written
Spoiler (click to show/hide)

yes it's blitted after anything that would blit in front of it,
yes sdl_flip is after the blit,
I don't understand why it's not working,
compiles fine and runs, just doesn't show the text.

Changed my mind and decided to post my full code here,

Spoiler (click to show/hide)

I think I'm going to rewrite the trajectory part as a function, should clean up the code quite a bit.
« Last Edit: January 26, 2012, 02:51:06 am by Valid_Dark »
Logged
There are 10 types of people in this world. Those that understand binary and those that don't


Quote
My milkshake brings all the criminals to justice.

RulerOfNothing

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #892 on: January 26, 2012, 02:33:50 am »

Can I have a look at the code Valid_Dark?
Logged

Valid_Dark

  • Bay Watcher
  • If you wont let me Dream, I wont let you sleep.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #893 on: January 26, 2012, 03:26:28 am »

is there any way to use a void function inside a void function?

Spoiler (click to show/hide)
« Last Edit: January 26, 2012, 03:33:34 am by Valid_Dark »
Logged
There are 10 types of people in this world. Those that understand binary and those that don't


Quote
My milkshake brings all the criminals to justice.

RulerOfNothing

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #894 on: January 26, 2012, 03:38:01 am »

There is no rule against using a void function inside another void function in C++, and it doesn't violate any coding standard I've heard of.
Logged

fergus

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #895 on: January 26, 2012, 03:44:39 am »

You may use any function inside of any other function.
Logged
BY THE GODS! THIS QUOTE MADE MY SIG BOX HAVE A SCROLL BAR! HAPPY DAYS INDEED!
BY THE GODS! YOU HAVE TOO MANY SIGS!

Valid_Dark

  • Bay Watcher
  • If you wont let me Dream, I wont let you sleep.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #896 on: January 26, 2012, 03:47:40 am »

Well when I tried it it said it wasn't defined
Logged
There are 10 types of people in this world. Those that understand binary and those that don't


Quote
My milkshake brings all the criminals to justice.

RulerOfNothing

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #897 on: January 26, 2012, 03:52:30 am »

One thing that might be causing the problem is that you need to declare any function which is used in TrajectFR above TrajectFR.
Logged

Valid_Dark

  • Bay Watcher
  • If you wont let me Dream, I wont let you sleep.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #898 on: January 26, 2012, 03:56:28 am »

<3 thank you,
Logged
There are 10 types of people in this world. Those that understand binary and those that don't


Quote
My milkshake brings all the criminals to justice.

Gatleos

  • Bay Watcher
  • Mournhold... City of Light... City of MAGIC!
    • View Profile
    • Someone Sig This
Re: if self.isCoder(): post() #Programming Thread
« Reply #899 on: January 26, 2012, 08:43:39 am »

Welp, Valid_Dark, you may want to firmly secure your hands before I tell you this so that you don't facepalm your brain through the back of your skull.
Spoiler (click to show/hide)
As for other tips... if you're planning on making any other SDL projects larger than this one, I'd recommend putting all of the SDL-specific init and setup functions in a single, out-of-the-way function to keep your code clean and unobstructed. Just develop a set of useful SDL helper functions as you go, and eventually you'll have a fast-to-use SDL application engine that you can use as the framework for any project.
Logged
Think of it like Sim City, except with rival mayors that seek to destroy your citizens by arming legions of homeless people and sending them to attack you.
Quote from: Moonshadow101
it would be funny to see babies spontaneously combust
Gat HQ (Sigtext)
++U+U++ // ,.,.@UUUUUUUU
Pages: 1 ... 58 59 [60] 61 62 ... 796