#include #include "IrrLib.h" #include using namespace std; using namespace irr; using namespace core; using namespace scene; using namespace video; using namespace io; using namespace gui; int main(){ /* Driver types: 0 = NULL 1 = EDT_SOFTWARE 2 = EDT_BURNINGSVIDEO 3 = EDT_OPENGL 4 = EDT_DIRECT3D8 *Note not supported by Microsoft anymore 5 = EDT_DIRECT3D9 *Reccommended defualt = EDT_SOFTWARE Note: Do not set vsync, last param, to true unless you want to slow down your software. ie playing doom on a $5,000 gaming machine, would be wise to use vsync in that senerio. */ //This is a non defualt constructor for the IrrLib //Defualt uses software with 640x480 res and all settings to false // You can declare a default Irrlicht like this: // IrrLib Irrlicht; /* IrrLib::IrrLib(int nDrivertype, int width, int height, int bits, bool fullscreen, bool stencilbuffer, bool vsync); As you can see from the function prototype, I am created a new Irrlicht device using Direct3D9 driver, 640x480 res, with fullscreen off, stencil buffer on, and vsync off */ IrrLib Irrlicht(5, 640, 480, 16, false, true, false); //if Irrlicht is the active window // You don't have to use it, but your 'game' will still be running if the user alt tabs to word or something //Lets create a loop until the Irrlicht device is stoped while (Irrlicht.DeviceIsRunning()) if (Irrlicht.IsActiveWindow()) { //grey background Irrlicht.BeginScene(); //Tells Irrlicht to draw everything to the screen, GUI elements/3D-2D objects including spheres Irrlicht.DrawAll(); //Tells Irrlicht that we are done drawing anything Irrlicht.EndScene(); //If user hits escape, exit //Note* Exit condition has to be done last else you will get a nonsense error from Irrlicht saying it couldn't draw. if (Irrlicht.IrrEvent.keyStates[KEY_ESCAPE]){ Irrlicht.IrrEvent.keyStates[KEY_ESCAPE] = false; Irrlicht.Exit(); } //This demostrates setting a static window caption Irrlicht.SetWindowCaption(L"Hello world, this is a fun game!"); } //Our game is done, tell Irrlicht to clean up and exit Irrlicht.EndIrrlicht(); return 0; //the deconstructor will delete all our dynamic vars so we don't have horriable memory leaks! }