Saturday, July 12, 2008

The Great Changeover

MHQuake is now a C++ program. I changed over today, and have made the necessary amendments to the codebase to play nicely with C++. There are no classes (aside from my menu framework pseudo class), just C++ language written in a procedural manner.

Why did I do this? The main reasons are:

  1. Support for C in a lot of Microsoft libraries is weak.
  2. I wanted to be able to use function overloading (I've already come across a few cases where I needed it and have had to resolve things using function pointers instead).
  3. I wanted to clean up the DirectSound mess.
  4. I wanted to switch over the keyboard input to DirectInput.
  5. I wanted to have the advantage of the stricter type checking.
  6. I wanted to be able to use modern libraries like GDI+ for image loading, rather than having to rely on 10 year old unmaintained libraries like libjpeg.
  7. I wanted the advantage of constructors and destructors rather than having to keep track of things in global variables.
  8. I wanted to get rid of all cases where I had mixed C and C++ code in the existing codebase.
I won't be using the full gamut of el-bizarro C++ "features", and I won't be doing all of the above at once, but there are definitely valid reasons why this switchover will ultimately produce cleaner and more robust code.

0 comments: