1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Can i do that? (Sorry, long explanation and it's 4AM).

Discussion in 'C++' started by imported_newn, Aug 31, 2010.

  1. imported_newn

    imported_newn New Member

    Aug 31, 2010
    Likes Received:
    Trophy Points:
    Hi everyone. Sorry for a crappy title, but I'm not good at short explanations, plus it's almost 4AM in the morning over here.
    Anyway, before i start rewriting a nice and readable code for my Ping Pong game, i would like to ask a few questions about general/gaming programming:

    Can i write a menu in one header file and the main game loop, how the game runs in another header file. Like menu.h and game.h. Then write one more file with variables, for example variables.h.

    When i have all this, put the variables(); into both menu.h and header.h files, and inside the int main() loop, write like this:

    int main()
    if(menu select == 1)
    Like do the checking in the menu function, then if the menu is that, do the game loop.

    Okay, so another question: Is there more better and efficient way to do this thing? And is there a possibility, that something won't work, while doing it my way? If so, what?

    The reason i am asking, before trying, is because it's a hell lot of code I'm going to rewrite, and i wouldn't like to rewrite it one more time, i even probably would leave the first, crappy to read variant, instead of rewriting it second time. It's not very... Entertaining thing to do.

    P.S. since I'm still working a little bit on the game, I'm going to rewrite it little by little, like I'm still have to do some work on Physics and then make the menu work (Probably going to use dummy images, until i get the real images made). Then it would be just minor stuff, tweaking, which would require a nice code to read, so it should be rewritten by that time.


Share This Page