Disclaimer

This demonstration was done on Visual Studio 2005 Professional. Visual Studio 2005 Express users should first ensure they have the latest Microsoft Platform SDK before continuing. It is required to build OpenGL applications with VS2005.

Steps to Install

  1. Get SDL, SDL_image, SDL_mixer installed
  2. Set up a new game project
  3. Build your first Propane Injector application

Get SDL, SDL_image, SDL_mixer installed

SDL

Download the SDL Development Libraries (NOT the Runtime Libraries) from SDL's website. Unpack them to a convenient place; these are the files we'll compile with.

Before getting started, read the VisualC.html file in the unpacked library. It has lots of last-minute notes on how to configure Visual Studio for SDL (under Creating a Project with SDL, not the build step -- we don't need that right now).

Now go to Visual Studio and pick Tools -> Options, then Projects and Solutions and VC++ Directories.

Pick Show Directories For: Include Files and then add a new directory, pointing to the include/ subdirectory for the SDL files.

Do the same for Library Files and the lib/ subdirectory.

SDL_image

Download the win32 development libraries for SDL_image from this site, and add their include and lib paths to your VS2005 global options as before.

SDL_mixer

Download the development libraries for SDL_mixer from the site, and add their include and lib paths to your VS2005 global options as before.

Configuring for Visual Studio

You should be done for now! Time to write us some code. Yee haw!

Building a Propane Injector project

Getting Propane Injector

Get the latest release from the site and unpack it into your project's new directory.

Creating your Project

Create a new C++ Win32 Application (either Console or just normal Project -- doesn't matter but I far prefer non-Console apps). Make sure the project is specified to be created "Empty".

Make sure that your include directories and library directories are still set (Tools->Options). Sometimes VS2005 forgets.

Writing the code

Make sure the engine directory from the Propane Injector build is added to your project. Best method is to just drag the folder from Explorer into your project, which will kludge up the auto-filter folders with junk. Hooray Microsoft!

Okay, now add a new C++ file to your project and start writing code.

#include "engine/PropaneInjector.h"

int main(int argc, char *argv[]) {
	PI_initSDL(800, 600);
	PI_initGL(800, 600);
	PI_setWindowTitle("Hello world from PI on VS2005");

	bool isDone = false;
	SDL_Event event;

	while(!isDone) {
		PI_clearScreen();

		while(SDL_PollEvent(&event)) {
			if(event.type == SDL_QUIT) {
				isDone = true;
			}
		}

		PI_flip();
		PI_delay(0);
	}

	return 0;
}
	

WARNING: You might have some problems compiling with the new shader stuff. VS2005 appears rather picky compared to Dev-C++. You might need to remove WindowsShader.cpp, PropaneShader.*, PropaneRenderToTexture* and some other next-gen files from your project until it builds properly, as well as all references to glext.h and wglext.h. Propane Injector v0.30 throws a lot of deprecated/unsafe errors, even when the functions are safe. This will be resolved in future versions.

If it built properly, you should be set to go (providing you have the VS8 runtime libraries installed).

Make sure to copy all your DLL files for SDL, SDL_image and SDL_mixer from the lib directories as needed!

Make sure your application is set to build as Multi-Threaded DLL. Otherwise you get 0x8000003 errors. Set Multi-Threaded DLL Debug for your debug configuration, or you'll get link errors.

Pixel/Vertex Shaders

If you don't have a modern wglext.h file included with your VS2005 includes, you will not be able to compile Propane Shader under Windows XP or earlier. Future versions of this documentation will have instructions on getting shaders working under XP, but please in the meantime google for "wglext" and spend a few minutes hacking on it to get shaders working. They DO work on Win32; they just need to have the proper compiler configuration.

Success!

You are now ready to start developing cross-platform applications with Propane Injector.

Future versions of Propane Injector will improve VS2005 compatibility, but it is possible to develop advanced sprite-based games using the functionality that works (Propane Shader should work fine with a modern wglext file, but adding this is beyond the scope of this tutorial). Feel free to submit patches!