   Window Program Organization
  Hi Folks,  I''m looking for a little direction on organizing a Windows program.  I''ve been messing around with "hobby" programing since my Commodore64 days with machine language.  I no some C and enough C++ to get myself in trouble.  But I''m scratching my head over Windows.  It''s hard to get my brain out of linear mode.  Life was so easy when the program started here, did some stuff, then ended over there.  With Windows you have to program in a circle, with continuous passes through Game_main().  It makes my head spin.  Anyway, I''m working on a game that will have many, many functions.  Is it best to get these all put in a separate group of header or cpp files?  I really don''t want a mile long main file with the Game-main function in it.  It just gets very unwieldy.  Also, is there a problem taking all the Windows overhead and DirectX stuff and sticking it into a separate file?  Thanks for any tips.  Slider 
quote:Original post by Slider38  With Windows you have to program in a circle, with continuous passes through Game_main().No, you don''t.Programming for Windows is no different than any other OS code structure-wise. You have an entry point (WinMain() - analogous to main()) and you call functions from there. Perhaps you are referring to the window procedure, WndProc(). That is not where you want your game logic; that function is executed in a separate thread and is a message handler.quote:Anyway, I''m working on a game that will have many, many functions.  Is it best to get these all put in a separate group of header or cpp files?Organizing Code Files in C and C++, right here in our Articles section. Enjoy! ;  Thanks very much for the response.  The article on organization was great.  My reference to circular programming was from the reading I''ve done.  It seems every article or book I''ve read makes calls from Win_Main to a Game_Main function where the main game programming is done.  As this Game_Main function is called repeatedly, it does seem sort of circular to me.  I never really thought about calling game functions directly from Win_Main.  That would simplify things.  I just had not seen examples of that being done.  Thanks again for your help.  Slider ;  The alternative is to use multiple threads; have the GetMessage()/TranslateMessage()/DispatchMessage() loop going in one thread, and your game logic (running in a linear way) in the other thread. 