CDemo.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. // This is a Demo of the Irrlicht Engine (c) 2006 by N.Gebhardt.
  2. // This file is not documented.
  3. #ifndef __C_DEMO_H_INCLUDED__
  4. #define __C_DEMO_H_INCLUDED__
  5. //#define USE_IRRKLANG
  6. //#define USE_SDL_MIXER
  7. #include <irrlicht.h>
  8. #ifdef _IRR_WINDOWS_
  9. #include <windows.h>
  10. #endif
  11. using namespace irr;
  12. // audio support
  13. #ifdef USE_IRRKLANG
  14. #include <irrKlang.h> // problem here? go to http://www.ambiera.com/irrklang and download
  15. // the irrKlang library or undefine USE_IRRKLANG at the beginning
  16. // of this file.
  17. #ifdef _MSC_VER
  18. #pragma comment (lib, "irrKlang.lib")
  19. #endif
  20. #endif
  21. #ifdef USE_SDL_MIXER
  22. # include <SDL/SDL.h>
  23. # include <SDL/SDL_mixer.h>
  24. #endif
  25. const int CAMERA_COUNT = 7;
  26. class CDemo : public IEventReceiver
  27. {
  28. public:
  29. CDemo(bool fullscreen, bool music, bool shadows, bool additive, bool vsync, bool aa, video::E_DRIVER_TYPE driver);
  30. ~CDemo();
  31. void run();
  32. virtual bool OnEvent(const SEvent& event);
  33. private:
  34. void createLoadingScreen();
  35. void loadSceneData();
  36. void switchToNextScene();
  37. void shoot();
  38. void createParticleImpacts();
  39. bool fullscreen;
  40. bool music;
  41. bool shadows;
  42. bool additive;
  43. bool vsync;
  44. bool aa;
  45. video::E_DRIVER_TYPE driverType;
  46. IrrlichtDevice *device;
  47. #ifdef USE_IRRKLANG
  48. void startIrrKlang();
  49. irrklang::ISoundEngine* irrKlang;
  50. irrklang::ISoundSource* ballSound;
  51. irrklang::ISoundSource* impactSound;
  52. #endif
  53. #ifdef USE_SDL_MIXER
  54. void startSound();
  55. void playSound(Mix_Chunk *);
  56. void pollSound();
  57. Mix_Music *stream;
  58. Mix_Chunk *ballSound;
  59. Mix_Chunk *impactSound;
  60. #endif
  61. struct SParticleImpact
  62. {
  63. u32 when;
  64. core::vector3df pos;
  65. core::vector3df outVector;
  66. };
  67. int currentScene;
  68. video::SColor backColor;
  69. gui::IGUIStaticText* statusText;
  70. gui::IGUIInOutFader* inOutFader;
  71. scene::IQ3LevelMesh* quakeLevelMesh;
  72. scene::ISceneNode* quakeLevelNode;
  73. scene::ISceneNode* skyboxNode;
  74. scene::IAnimatedMeshSceneNode* model1;
  75. scene::IAnimatedMeshSceneNode* model2;
  76. scene::IParticleSystemSceneNode* campFire;
  77. scene::IMetaTriangleSelector* metaSelector;
  78. scene::ITriangleSelector* mapSelector;
  79. s32 sceneStartTime;
  80. s32 timeForThisScene;
  81. core::array<SParticleImpact> Impacts;
  82. };
  83. #endif