My first step for creating this game was to set up a new solution/project in visual studio and get an app that simply creates a window and draws a blank screen using directX. I've always had problems starting a game project and this one is no exception. Figuring out which libraries need to be linked and what properties need to be set for each project has always given me fits.
I'm trying to create a solution where most of the base game functionality is stored in one project, while the game specific stuff is stored in another project. This was the source of most of my frustration. I've never created a multi project C++ solution before, so I was getting linker errors all over the place when I was trying to use a class from GameBase in my TestrisClone Project. After much research I figured how to get the two projects to play nice:
- Make sure the base project outputs a .lib and not a .exe. To do this right click on the project and select properties. Go to Configuration Properties -> General -> Configuration Type and change it to Static Library (.lib)
- Now you need to tell the game project where the base project is so it can include the headers. Right click on the game project and select properties. Go to Configuration Properties -> C/C++ -> General -> Additional Include Directories and add the directory that contains the files you want to include, in my case ..\GameBase
- You also need to point the game project to the game base library. Open the properties again for the game project and go to Configuration Properties -> Linker -> General -> Additional Library Directories and enter in the directory where the .lib file is created, in my case it was $(OutDir)
- Finally you need to set up the solution project dependencies so that the projects build in the correct order. To do that, right click the game project and select Project Dependencies. Select the GameBase project as a project that the game project depends on. Now the GameBase project will always build before the game project

My next goal of the project is to get a process manager created where all the game logic will be managed.
No comments:
Post a Comment