Multiple entry points for the program

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Multiple entry points for the program

      Hello Everyone, I am new here just started reading game coding complete and I am really enjoying so thank you to Mike and Rez for writing this awesome resource.

      Now to my questions, I am reading through the source code and I ran across what seems like two different entry points to start the game engine. One is in the GameCode4_2010.cpp its entry function is "int APIENTRY _tWinMain(parameters...)" the other entry point is in GameCode4.cpp "INT WINAPI GameCode4(parameters...)". Now my questions is are these both entry points? and if so how do the relate to each other. I already tried searching the forum for answers and could not seem to find what I was looking for so any insight is appreciated.

      Thank you.

      Joseph.
    • Hey Joseph, welcome to the forums :D .

      It seems that the file GameCode4_2010.cpp is actually an auto-generated file, and will not do much more than open up a window. There may be a reason for this file such as Mike & Rez intending to move things in there, however it's likely an oversight and could be removed. I let Mike or Rez weigh in on whether this is correct.
      PC - Custom Built
      CPU: 3rd Gen. Intel i7 3770 3.4Ghz
      GPU: ATI Radeon HD 7959 3GB
      RAM: 16GB

      Laptop - Alienware M17x
      CPU: 3rd Gen. Intel i7 - Ivy Bridge
      GPU: NVIDIA GeForce GTX 660M - 2GB GDDR5
      RAM: 8GB Dual Channel DDR3 @ 1600mhz
    • Joseph_d wrote:

      Hello Everyone, I am new here just started reading game coding complete and I am really enjoying so thank you to Mike and Rez for writing this awesome resource.


      Thanks! I'm really glad you're enjoying it. :)


      Now to my questions, I am reading through the source code and I ran across what seems like two different entry points to start the game engine. One is in the GameCode4_2010.cpp its entry function is "int APIENTRY _tWinMain(parameters...)" the other entry point is in GameCode4.cpp "INT WINAPI GameCode4(parameters...)". Now my questions is are these both entry points? and if so how do the relate to each other. I already tried searching the forum for answers and could not seem to find what I was looking for so any insight is appreciated.

      The correct entry point is in TeapotWars.cpp. I actually don't know what the GameCode4_2010.cpp file is for, it might have been something Mike was testing out a while back. It looks rather old and just defines the skeleton of a windows app. It's not even including any of the GCC stuff.

      -Rez
    • Thank you both for the help GameCode4_2010.cpp is indeed a auto generated file, Visual Studio generates the same general file when you choose Win32 as the project type. Good to know I can safely ignored it, I was going in circles trying to find the connection between it and the rest of the code base.

      So this is my understanding so far, please correct me if I am wrong. The engine is not capable of being started on its own. It is always tied to a game you are creating since the code inside of TeapotWars.cpp is the actual entry point and calls GameCode4(hInstance, hPrevInstance, lpCmdLine, nCmdShow).

      Joseph.
    • Correct. The engine project just builds into a lib file, which the game itself links. Then it calls what is effectively the engines entry point.

      -Rez
    • Yes, but also so that it can be used by multiple games. You could have a dozen games all linking to the same library, although in practice most companies branch their engine for each project to ensure that development on the engine doesn't destabilize the game projects.

      -Rez
    • Thank you Rez,

      That makes a lot of sense. After messing around with win23 programming a bit I have decided to use SDL or something similar to abstract the application layer further from the OS. Do you think I will be able to get away with a single application layer for the top three operating systems?

      Thank you for all of your help and insight! it is much appreciated!
    • Yes, but it's probably still worth abstracting. If you have SDL calls everywhere in your code, it will be very difficult to remove them should you choose to use another library. If you wrap all the SDL calls into your own interfaces, swapping out SDL becomes as easy as reimplementing the interface.

      -Rez