IrrLib Documentation:f ------------------------ //Important Note from the start: C++ is case senstitive, ReadArchive is not the same as readarchive Private: irr::IrrlichtDevice *device; This is the main device for 'talking' to Irrlicht. This is very important and only the class should interact with it. irr::video::IVideoDriver* driver; irr::scene::ISceneManager* smgr; The driver handles textures and the smgr handles putting models in the scene. irr::scene::IAnimatedMesh* mesh; irr::scene::ISceneNode* node; A mesh object stores a mesh, aka a q3 level. A node, from what I understand contains where the camera should be placed. Public: //These functions are the ones you call! IrrLib::IrrLib(); IrrLib::IrrLib(irr::video::E_DRIVER_TYPE drivertype, irr::core::dimension2d & res, irr::u32 bits, bool fullscreen, bool stencilbuffer, bool vsync, irr::IEventReceiver * receiver); IrrLib::IrrLib(int drivertype, int width, int height, int bits, bool fullscreen, bool stencilbuffer, bool vsync, irr::IEventReceiver * receiver); All 3 of those are class constructor. They construct both the class AND Irrlicht. The first one loads it with defualt values, using software driver. The second is more for the hard core Irrlicht users, you pass the normal Irrlicht values. The third is for new users, you don't need a PhD in order to use it. Code Example: int main(){ IrrLib Irrlicht; //you are free to name the class variable whatever you want //This use the defualt constructor, creates an Irrlicht device with defualt values. } int main(){ IrrLib Irrlicht(EDT_OPENGL, core::dimension2d(640, 480), 16, false, false, false, 0); //This uses the second constructor } int main(){ IrrLib Irrlicht(3, 640, 480, 16, false, false, false, 0) //This uses the third constructor using the opengl driver. } Table for drivertype: 0 - EDT_NULL; 1 - EDT_SOFTWARE; 2 - EDT_BURNINGSVIDEO; 3 - EDT_OPENGL; 4 - EDT_DIRECT3D8; 5 - EDT_DIRECT3D9; default - EDT_SOFTWARE; //Be careful with 4 and 5 when using someone else's complied Irrlicht, it could crash your program or cause a memory leak if DirectX is not complied into the library! IrrLib::~IrrLib(); The deconstructor, clean up after ourselves because our moms wont! Need to clear up some dynamic variables that was created so we don't have memory leaks. /* Simple so far eh? Don't worry it gets harder ;) */ void IrrLib::ReadArchive(std::string file) This loads an archive into Irrlicht. Code Example: int main(){ IrrLib Irrlicht; Irrlicht.ReadArchive("c:\program files\my game\myzip.zip"); } void IrrLib::LoadQ3Level(std::string q3level); This loads a q3 level onto the scene. Code Example: int main(){ IrrLib Irrlicht; Irrlicht.ReadArchive("c:\program files\my game\myzip.zip"); Irrlicht.LoadQ3Level("20kdm2.bsp"); } void IrrLib::CameraPos(int x, int y, int z); //I think this moves the actual camera? void IrrLib::CameraPos(); CameraPos is an overloaded function for a reason, sometimes you do model the level around the orgin, and sometimes you don't. So I took in account both to make it easier for people using this library. Code Example: int main(){ IrrLib Irrlicht; Irrlicht.ReadArchive("c:\program files\my game\myzip.zip"); Irrlicht.LoadQ3Level("20kdm2.bsp"); IrrLib.CameraPos(); //Sets the camera at the orgin } int main(){ IrrLib Irrlicht; Irrlicht.ReadArchive("c:\program files\my game\myzip.zip"); Irrlicht.LoadQ3Level("20kdm2.bsp"); IrrLib.CameraPos(-1300, -144, -1249); //Sets the camera at that x, y, z position } void IrrLib::AddFPSCam(); This simply adds a camera FPS style. Will add other cameras later. Code Example: int main(){ IrrLib Irrlicht; Irrlicht.ReadArchive("c:\program files\my game\myzip.zip"); Irrlicht.LoadQ3Level("20kdm2.bsp"); IrrLib.CameraPos(-1300, -144, -1249); //Sets the camera at that x, y, z position Irrlicht.AddFPSCam(); } void IrrLib::VisibleCursor(bool tf); This hides or shows the mouse cursor. Usually you want it hidden. Code Example: int main(){ IrrLib Irrlicht; Irrlicht.ReadArchive("c:\program files\my game\myzip.zip"); Irrlicht.LoadQ3Level("20kdm2.bsp"); IrrLib.CameraPos(-1300, -144, -1249); //Sets the camera at that x, y, z position Irrlicht.AddFPSCam(); Irrlicht.VisibleCursor(false); } int IrrLib::GetFPSCount(); This returns an int of what the current frames per second count is. int main(){ IrrLib Irrlicht; cout << Irrlicht.GetFPSCount() << endl; return 0; } bool IrrLib::DeviceIsRunning(); This returns weither or not the Irrlicht device is running, aka a test to see if the user exists. Code Example: int main(){ IrrLib Irrlicht; Irrlicht.ReadArchive("c:\program files\my game\myzip.zip"); Irrlicht.LoadQ3Level("20kdm2.bsp"); IrrLib.CameraPos(-1300, -144, -1249); //Sets the camera at that x, y, z position Irrlicht.AddFPSCam(); Irrlicht.VisibleCursor(false); while (Irrlicht.DeviceIsRunning()){ //Do cool stuff } } bool IrrLib::IsActiveWindow(); This returns if the Irrlicht spawned window is the window, ie did the user alt tab to play a game of freecell? int main(){ IrrLib Irrlicht; Irrlicht.ReadArchive("c:\program files\my game\myzip.zip"); Irrlicht.LoadQ3Level("20kdm2.bsp"); IrrLib.CameraPos(-1300, -144, -1249); //Sets the camera at that x, y, z position Irrlicht.AddFPSCam(); Irrlicht.VisibleCursor(false); while (Irrlicht.DeviceIsRunning()){ if (Irrlicht.IsActiveWindow()) { //Do cool stuff } } } void IrrLib::BeginScene(); void IrrLib::BeginScene(irr::video::SColor color); void IrrLib::BeginScene(bool usebackBuffer, bool usezBuffer, irr::video::SColor color); This has 3 overloaded functions to allow more of a customization to the interaction between Irrlicht Library -> Irrlicht Engine. The first uses default values, backbuffer = true, zBuffer = true, and a 'color' of video::SColor(0,200,200,200). //grey I think? The second assumes, backbuffer = true, zBuffer = true, and a custom color of your choice for the backcolor. The third is all your choice. Code Example: int main(){ IrrLib Irrlicht; Irrlicht.ReadArchive("c:\program files\my game\myzip.zip"); Irrlicht.LoadQ3Level("20kdm2.bsp"); IrrLib.CameraPos(-1300, -144, -1249); //Sets the camera at that x, y, z position Irrlicht.AddFPSCam(); Irrlicht.VisibleCursor(false); while (Irrlicht.DeviceIsRunning()){ if (Irrlicht.IsActiveWindow()) { Irrlicht.BeginScene(); } } } int main(){ IrrLib Irrlicht; Irrlicht.ReadArchive("c:\program files\my game\myzip.zip"); Irrlicht.LoadQ3Level("20kdm2.bsp"); IrrLib.CameraPos(-1300, -144, -1249); //Sets the camera at that x, y, z position Irrlicht.AddFPSCam(); Irrlicht.VisibleCursor(false); while (Irrlicht.DeviceIsRunning()){ if (Irrlicht.IsActiveWindow()) { Irrlicht.BeginScene(video::SColor(0,200,200,200)); } } } int main(){ IrrLib Irrlicht; Irrlicht.ReadArchive("c:\program files\my game\myzip.zip"); Irrlicht.LoadQ3Level("20kdm2.bsp"); IrrLib.CameraPos(-1300, -144, -1249); //Sets the camera at that x, y, z position Irrlicht.AddFPSCam(); Irrlicht.VisibleCursor(false); while (Irrlicht.DeviceIsRunning()){ if (Irrlicht.IsActiveWindow()) { Irrlicht.BeginScene(false, false, video::SColor(0,200,200,200)); } } } void IrrLib::DrawAll(); Draws everything on the scene. Code Example: int main(){ IrrLib Irrlicht; Irrlicht.ReadArchive("c:\program files\my game\myzip.zip"); Irrlicht.LoadQ3Level("20kdm2.bsp"); IrrLib.CameraPos(-1300, -144, -1249); //Sets the camera at that x, y, z position Irrlicht.AddFPSCam(); Irrlicht.VisibleCursor(false); while (Irrlicht.DeviceIsRunning()){ if (Irrlicht.IsActiveWindow()) { Irrlicht.BeginScene(); Irrlicht.DrawAll(); } } } void IrrLib::EndScene() Ends the scene. Code Example: int main(){ IrrLib Irrlicht; Irrlicht.ReadArchive("c:\program files\my game\myzip.zip"); Irrlicht.LoadQ3Level("20kdm2.bsp"); IrrLib.CameraPos(-1300, -144, -1249); //Sets the camera at that x, y, z position Irrlicht.AddFPSCam(); Irrlicht.VisibleCursor(false); while (Irrlicht.DeviceIsRunning()){ if (Irrlicht.IsActiveWindow()) { Irrlicht.BeginScene(); Irrlicht.DrawAll(); Irrlicht.EndScene(); } } } void IrrLib::SetWindowCaption(irr::core::stringw str); Tells Irrlicht what to set the window caption. Code Example: int main(){ IrrLib Irrlicht; Irrlicht.ReadArchive("c:\program files\my game\myzip.zip"); Irrlicht.LoadQ3Level("20kdm2.bsp"); IrrLib.CameraPos(-1300, -144, -1249); //Sets the camera at that x, y, z position Irrlicht.AddFPSCam(); Irrlicht.VisibleCursor(false); while (Irrlicht.DeviceIsRunning()){ if (Irrlicht.IsActiveWindow()) { Irrlicht.BeginScene(); Irrlicht.DrawAll(); Irrlicht.EndScene(); Irrlicht.SetWindowCaption(L"Irrlicht is awsome!"); } } } irr:core::stringw IrrLib::GetDriverName(); Returns a stringw of what the driver name is. Code Example: int main(){ IrrLib Irrlicht; Irrlicht.ReadArchive("c:\program files\my game\myzip.zip"); Irrlicht.LoadQ3Level("20kdm2.bsp"); IrrLib.CameraPos(-1300, -144, -1249); //Sets the camera at that x, y, z position Irrlicht.AddFPSCam(); Irrlicht.VisibleCursor(false); while (Irrlicht.DeviceIsRunning()){ if (Irrlicht.IsActiveWindow()) { Irrlicht.BeginScene(); Irrlicht.DrawAll(); Irrlicht.EndScene(); Irrlicht.SetWindowCaption(L"Irrlicht is awsome! This is using " + Irrlicht.GetDriverName()); } } } void IrrLib::EndIrrlicht(); Ends the Irrlicht scene. int main(){ IrrLib Irrlicht; Irrlicht.ReadArchive("c:\program files\my game\myzip.zip"); Irrlicht.LoadQ3Level("20kdm2.bsp"); IrrLib.CameraPos(-1300, -144, -1249); //Sets the camera at that x, y, z position Irrlicht.AddFPSCam(); Irrlicht.VisibleCursor(false); while (Irrlicht.DeviceIsRunning()){ if (Irrlicht.IsActiveWindow()) { Irrlicht.BeginScene(); Irrlicht.DrawAll(); Irrlicht.EndScene(); Irrlicht.SetWindowCaption(L"Irrlicht is awsome! This is using " + Irrlicht.GetDriverName()) } } IrrLib.EndIrrlicht(); return 0; //the deconstructor will delete all our dynamic vars so we don't have horriable memory leaks! } Part 2: Putting it all together! //This exmaple is example #2 from the Irrlicht doc examples int main(){ IrrLib Irrlicht; Irrlicht.ReadArchive("../../media/map-20kdm2.pk3"); Irrlicht.LoadQ3Level("20kdm2.bsp"); IrrLib.CameraPos(-1300, -144, -1249); //Sets the camera at that x, y, z position Irrlicht.AddFPSCam(); Irrlicht.VisibleCursor(false); int lastFPS = -1; while (Irrlicht.DeviceIsRunning()){ if (Irrlicht.IsActiveWindow()) { Irrlicht.BeginScene(); Irrlicht.DrawAll(); Irrlicht.EndScene(); int fps = Irrlicht.GetFPSCount(); if (lastFPS != fps) { core::stringw str = L"Irrlicht Engine - Quake 3 Map example ["; str += Irrlicht.GetDriverName(); str += "] FPS:"; str += fps; Irrlicht.SetWindowCaption(str.c_str()); lastfps = fps; } } } IrrLib.EndIrrlicht(); return 0; //the deconstructor will delete all our dynamic vars so we don't have horriable memory leaks! //That was easy wasn't it? //Everything is now humanreadable, I think your next door neighbor could even figure out whats going on....maybe }