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