#include <iostream> #include "IrrLib.h" #include <irrlicht.h> 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 If you are confused using the driver types consider using an enum: //note you can name the drivers what ever you want, C++ will still number them correctly assuming they are in this order enum IrrDriverType { NULL, EDT_SOFTWARE, EDT_BURNINGSVIDEO, EDT_OPENGL, EDT_DIRECT3D8, EDT_DIRECT3D9 }; IrrDriverType = EDT_DIRECT3D9; //then pass IrrDriverType to Irrlicht constructor IrrLib Irrlicht(IrrDriverType, 640, 480, 16, false, true, false); 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()) { //Default begin scene uses a 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(); } //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! }
#include <iostream> #include "IrrLib.h" #include <irrlicht.h> 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 If you are confused using the driver types consider using an enum: //note you can name the drivers what ever you want, C++ will still number them correctly assuming they are in this order enum IrrDriverType { NULL, EDT_SOFTWARE, EDT_BURNINGSVIDEO, EDT_OPENGL, EDT_DIRECT3D8, EDT_DIRECT3D9 }; IrrDriverType = EDT_DIRECT3D9; //then pass IrrDriverType to Irrlicht constructor IrrLib Irrlicht(IrrDriverType, 640, 480, 16, false, true, false); 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); /* CreateNewSphereNode takes in XYZ coords, a texture, and either to apply Irrlicht lighting to it or not */ IrrObj sphere1 = Irrlicht.Irr3DLib.Sphere.CreateNewSphereNode(0, 0, 30, "../../media/wall.bmp", false); IrrObj sphere2 = Irrlicht.Irr3DLib.Sphere.CreateNewSphereNode(0, 20, 40, "../../media/wall.bmp", false); IrrObj sphere3 = Irrlicht.Irr3DLib.Sphere.CreateNewSphereNode(0, 0, 50, "../../media/wall.bmp", 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()) { //Default begin scene uses a 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(); } //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! }
1.5.4