irrlicht.h 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. /* irrlicht.h -- interface of the 'Irrlicht Engine'
  2. Copyright (C) 2002-2012 Nikolaus Gebhardt
  3. This software is provided 'as-is', without any express or implied
  4. warranty. In no event will the authors be held liable for any damages
  5. arising from the use of this software.
  6. Permission is granted to anyone to use this software for any purpose,
  7. including commercial applications, and to alter it and redistribute it
  8. freely, subject to the following restrictions:
  9. 1. The origin of this software must not be misrepresented; you must not
  10. claim that you wrote the original software. If you use this software
  11. in a product, an acknowledgment in the product documentation would be
  12. appreciated but is not required.
  13. 2. Altered source versions must be plainly marked as such, and must not be
  14. misrepresented as being the original software.
  15. 3. This notice may not be removed or altered from any source distribution.
  16. Please note that the Irrlicht Engine is based in part on the work of the
  17. Independent JPEG Group, the zlib and the libPng. This means that if you use
  18. the Irrlicht Engine in your product, you must acknowledge somewhere in your
  19. documentation that you've used the IJG code. It would also be nice to mention
  20. that you use the Irrlicht Engine, the zlib and libPng. See the README files
  21. in the jpeglib, the zlib and libPng for further information.
  22. */
  23. #pragma once
  24. #include "IrrlichtDevice.h"
  25. #include "dimension2d.h"
  26. #include "EDriverTypes.h"
  27. #include "IEventReceiver.h"
  28. #include "irrTypes.h"
  29. #include "SIrrCreationParameters.h"
  30. #include "IrrCompileConfig.h" // for IRRLICHT_API and IRRCALLCONV
  31. /*! \mainpage Irrlicht Engine 1.9 API documentation
  32. *
  33. * <div align="center"><img src="logobig.png" ></div>
  34. *
  35. * \section intro Introduction
  36. *
  37. * Welcome to the Irrlicht Engine API documentation.
  38. * Here you'll find any information you'll need to develop applications with
  39. * the Irrlicht Engine. If you are looking for a tutorial on how to start, you'll
  40. * find some on the homepage of the Irrlicht Engine at
  41. * <A HREF="http://irrlicht.sourceforge.net" >irrlicht.sourceforge.net</A>
  42. * or inside the SDK in the examples directory.
  43. *
  44. * The Irrlicht Engine is intended to be an easy-to-use 3d engine, so
  45. * this documentation is an important part of it. If you have any questions or
  46. * suggestions, just send a email to the author of the engine, Nikolaus Gebhardt
  47. * (niko (at) irrlicht3d.org).
  48. *
  49. *
  50. * \section links Links
  51. *
  52. * <A HREF="namespaces.html">Namespaces</A>: A very good place to start reading
  53. * the documentation.<BR>
  54. * <A HREF="annotated.html">Class list</A>: List of all classes with descriptions.<BR>
  55. * <A HREF="functions.html">Class members</A>: Good place to find forgotten features.<BR>
  56. *
  57. * \section irrexample Short example
  58. *
  59. * A simple application, starting up the engine, loading a Quake 2 animated
  60. * model file and the corresponding texture, animating and displaying it
  61. * in front of a blue background and placing a user controlable 3d camera
  62. * would look like the following code. I think this example shows the usage
  63. * of the engine quite well:
  64. *
  65. * \code
  66. * #include <irrlicht.h>
  67. * // include a bunch of other stuff...
  68. *
  69. * using namespace irr;
  70. *
  71. * int main()
  72. * {
  73. * // start up the engine
  74. * IrrlichtDevice *device = createDevice(video::EDT_OPENGL,
  75. * core::dimension2d<u32>(640,480));
  76. *
  77. * video::IVideoDriver* driver = device->getVideoDriver();
  78. * scene::ISceneManager* scenemgr = device->getSceneManager();
  79. *
  80. * device->setWindowCaption(L"Hello World!");
  81. *
  82. * // load and show quake2 .md2 model
  83. * scene::ISceneNode* node = scenemgr->addAnimatedMeshSceneNode(
  84. * scenemgr->getMesh("quake2model.md2"));
  85. *
  86. * // if everything worked, add a texture and disable lighting
  87. * if (node)
  88. * {
  89. * node->setMaterialTexture(0, driver->getTexture("texture.bmp"));
  90. * node->setMaterialFlag(video::EMF_LIGHTING, false);
  91. * }
  92. *
  93. * // add a first person shooter style user controlled camera
  94. * scenemgr->addCameraSceneNodeFPS();
  95. *
  96. * // draw everything
  97. * while(device->run() && driver)
  98. * {
  99. * driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255,0,0,255));
  100. * scenemgr->drawAll();
  101. * driver->endScene();
  102. * }
  103. *
  104. * // delete device
  105. * device->drop();
  106. * return 0;
  107. * }
  108. * \endcode
  109. *
  110. * Irrlicht can load a lot of file formats automatically, see irr::scene::ISceneManager::getMesh()
  111. * for a detailed list. So if you would like to replace the simple blue screen background by
  112. * a cool Quake 3 Map, optimized by an octree, just insert this code
  113. * somewhere before the while loop:
  114. *
  115. * \code
  116. * // add .pk3 archive to the file system
  117. * device->getFileSystem()->addZipFileArchive("quake3map.pk3");
  118. *
  119. * // load .bsp file and show it using an octree
  120. * scenemgr->addOctreeSceneNode(
  121. * scenemgr->getMesh("quake3map.bsp"));
  122. * \endcode
  123. *
  124. * As you can see, the engine uses namespaces. Everything in the engine is
  125. * placed into the namespace 'irr', but there are also 5 sub namespaces.
  126. * You can find a list of all namespaces with descriptions at the
  127. * <A HREF="namespaces.html"> namespaces page</A>.
  128. * This is also a good place to start reading the documentation. If you
  129. * don't want to write the namespace names all the time, just use all namespaces like
  130. * this:
  131. * \code
  132. * using namespace core;
  133. * using namespace scene;
  134. * using namespace video;
  135. * using namespace io;
  136. * using namespace gui;
  137. * \endcode
  138. *
  139. * There is a lot more the engine can do, but I hope this gave a short
  140. * overview over the basic features of the engine. For more examples, please take
  141. * a look into the examples directory of the SDK.
  142. */
  143. //! Everything in the Irrlicht Engine can be found in this namespace.
  144. namespace irr
  145. {
  146. //! Creates an Irrlicht device. The Irrlicht device is the root object for using the engine.
  147. /** If you need more parameters to be passed to the creation of the Irrlicht Engine device,
  148. use the createDeviceEx() function.
  149. \param driverType: Type of the video driver to use.
  150. \param windowSize: Size of the window or the video mode in fullscreen mode.
  151. \param bits: Bits per pixel in fullscreen mode. Ignored if windowed mode.
  152. \param fullscreen: Should be set to true if the device should run in fullscreen. Otherwise
  153. the device runs in windowed mode.
  154. \param stencilbuffer: Specifies if the stencil buffer should be enabled. Set this to true,
  155. if you want the engine be able to draw stencil buffer shadows. Note that not all
  156. devices are able to use the stencil buffer. If they don't no shadows will be drawn.
  157. \param vsync: Specifies vertical synchronization: If set to true, the driver will wait
  158. for the vertical retrace period, otherwise not.
  159. \param receiver: A user created event receiver.
  160. \return Returns pointer to the created IrrlichtDevice or null if the
  161. device could not be created.
  162. */
  163. extern "C" IRRLICHT_API IrrlichtDevice *IRRCALLCONV createDevice(
  164. video::E_DRIVER_TYPE driverType = video::EDT_OPENGL,
  165. // parentheses are necessary for some compilers
  166. const core::dimension2d<u32> &windowSize = (core::dimension2d<u32>(640, 480)),
  167. u32 bits = 32,
  168. bool fullscreen = false,
  169. bool stencilbuffer = true,
  170. bool vsync = false,
  171. IEventReceiver *receiver = 0);
  172. //! Creates an Irrlicht device with the option to specify advanced parameters.
  173. /** Usually you should used createDevice() for creating an Irrlicht Engine device.
  174. Use this function only if you wish to specify advanced parameters like a window
  175. handle in which the device should be created.
  176. \param parameters: Structure containing advanced parameters for the creation of the device.
  177. See irr::SIrrlichtCreationParameters for details.
  178. \return Returns pointer to the created IrrlichtDevice or null if the
  179. device could not be created. */
  180. extern "C" IRRLICHT_API IrrlichtDevice *IRRCALLCONV createDeviceEx(
  181. const SIrrlichtCreationParameters &parameters);
  182. // THE FOLLOWING IS AN EMPTY LIST OF ALL SUB NAMESPACES
  183. // EXISTING ONLY FOR THE DOCUMENTATION SOFTWARE DOXYGEN.
  184. //! Basic classes such as vectors, planes, arrays, lists, and so on can be found in this namespace.
  185. namespace core
  186. {
  187. }
  188. //! The gui namespace contains useful classes for easy creation of a graphical user interface.
  189. namespace gui
  190. {
  191. }
  192. //! This namespace provides interfaces for input/output: Reading and writing files, accessing zip archives, ...
  193. namespace io
  194. {
  195. }
  196. //! All scene management can be found in this namespace: Mesh loading, special scene nodes like octrees and billboards, ...
  197. namespace scene
  198. {
  199. }
  200. //! The video namespace contains classes for accessing the video driver. All 2d and 3d rendering is done here.
  201. namespace video
  202. {
  203. }
  204. }
  205. /*! \file irrlicht.h
  206. \brief Main header file of the irrlicht, needed to create a device.
  207. */