forked from Mirrorlandia_minetest/irrlicht
Minor comment changes in example 16
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6306 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
parent
530ddbf32f
commit
d31b7aa261
@ -41,7 +41,7 @@ using namespace irr;
|
|||||||
using namespace scene;
|
using namespace scene;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Again, to be able to use the Irrlicht.DLL file, we need to link with the
|
Again, to be able to use the Irrlicht.dll on Windows, we link with the
|
||||||
Irrlicht.lib. We could set this option in the project settings, but
|
Irrlicht.lib. We could set this option in the project settings, but
|
||||||
to make it easy, we use a pragma comment lib:
|
to make it easy, we use a pragma comment lib:
|
||||||
*/
|
*/
|
||||||
@ -66,10 +66,10 @@ public:
|
|||||||
|
|
||||||
bool OnEvent(const SEvent& event)
|
bool OnEvent(const SEvent& event)
|
||||||
{
|
{
|
||||||
// check if user presses the key F9
|
|
||||||
if ((event.EventType == EET_KEY_INPUT_EVENT) &&
|
if ((event.EventType == EET_KEY_INPUT_EVENT) &&
|
||||||
event.KeyInput.PressedDown)
|
event.KeyInput.PressedDown)
|
||||||
{
|
{
|
||||||
|
// check if user presses the key F9 for making a screenshot
|
||||||
if (event.KeyInput.Key == KEY_F9)
|
if (event.KeyInput.Key == KEY_F9)
|
||||||
{
|
{
|
||||||
video::IImage* image = Device->getVideoDriver()->createScreenShot();
|
video::IImage* image = Device->getVideoDriver()->createScreenShot();
|
||||||
@ -83,8 +83,8 @@ public:
|
|||||||
image->drop();
|
image->drop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
// Check for F8 - enabling/disabling display of bounding box for the map
|
||||||
if (event.KeyInput.Key == KEY_F8)
|
else if (event.KeyInput.Key == KEY_F8)
|
||||||
{
|
{
|
||||||
if (Node->isDebugDataVisible())
|
if (Node->isDebugDataVisible())
|
||||||
Node->setDebugDataVisible(scene::EDS_OFF);
|
Node->setDebugDataVisible(scene::EDS_OFF);
|
||||||
@ -112,7 +112,7 @@ int IRRCALLCONV main(int argc, char* argv[])
|
|||||||
/*
|
/*
|
||||||
Like in the HelloWorld example, we create an IrrlichtDevice with
|
Like in the HelloWorld example, we create an IrrlichtDevice with
|
||||||
createDevice(). The difference now is that we ask the user to select
|
createDevice(). The difference now is that we ask the user to select
|
||||||
which hardware accelerated driver to use. The Software device would be
|
which hardware accelerated driver to use. The Software device might be
|
||||||
too slow to draw a huge Quake 3 map, but just for the fun of it, we make
|
too slow to draw a huge Quake 3 map, but just for the fun of it, we make
|
||||||
this decision possible too.
|
this decision possible too.
|
||||||
*/
|
*/
|
||||||
@ -130,6 +130,7 @@ int IRRCALLCONV main(int argc, char* argv[])
|
|||||||
if (device == 0)
|
if (device == 0)
|
||||||
return 1; // could not create selected driver.
|
return 1; // could not create selected driver.
|
||||||
|
|
||||||
|
// We allow passing a map name as command line parameter
|
||||||
const char* mapname=0;
|
const char* mapname=0;
|
||||||
if (argc>2)
|
if (argc>2)
|
||||||
mapname = argv[2];
|
mapname = argv[2];
|
||||||
@ -170,7 +171,7 @@ int IRRCALLCONV main(int argc, char* argv[])
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
Now we can load the mesh by calling getMesh(). We get a pointer returned
|
Now we can load the mesh by calling getMesh(). We get a pointer returned
|
||||||
to a IAnimatedMesh. As you know, Quake 3 maps are not really animated,
|
to an IAnimatedMesh. As you know, Quake 3 maps are not really animated,
|
||||||
they are only a huge chunk of static geometry with some materials
|
they are only a huge chunk of static geometry with some materials
|
||||||
attached. Hence the IAnimated mesh consists of only one frame,
|
attached. Hence the IAnimated mesh consists of only one frame,
|
||||||
so we get the "first frame" of the "animation", which is our quake level
|
so we get the "first frame" of the "animation", which is our quake level
|
||||||
@ -203,9 +204,9 @@ int IRRCALLCONV main(int argc, char* argv[])
|
|||||||
device->setEventReceiver(&screenshotFactory);
|
device->setEventReceiver(&screenshotFactory);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
now construct SceneNodes for each Shader
|
now construct SceneNodes for each shader
|
||||||
The Objects are stored in the quake mesh scene::E_Q3_MESH_ITEMS
|
The objects are stored in the quake mesh scene::E_Q3_MESH_ITEMS
|
||||||
and the Shader ID is stored in the MaterialParameters
|
and the shader ID is stored in the MaterialParameters
|
||||||
mostly dark looking skulls and moving lava.. or green flashing tubes?
|
mostly dark looking skulls and moving lava.. or green flashing tubes?
|
||||||
*/
|
*/
|
||||||
if ( mesh )
|
if ( mesh )
|
||||||
@ -253,9 +254,9 @@ int IRRCALLCONV main(int argc, char* argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Now we only need a Camera to look at the Quake 3 map. And we want to
|
Now we only need a camera to look at the Quake 3 map. And we want to
|
||||||
create a user controlled camera. There are some different cameras
|
create a user controlled camera. There are some different cameras
|
||||||
available in the Irrlicht engine. For example the Maya Camera which can
|
available in the Irrlicht engine. For example the Maya camera which can
|
||||||
be controlled comparable to the camera in Maya: Rotate with left mouse
|
be controlled comparable to the camera in Maya: Rotate with left mouse
|
||||||
button pressed, Zoom with both buttons pressed, translate with right
|
button pressed, Zoom with both buttons pressed, translate with right
|
||||||
mouse button pressed. This could be created with
|
mouse button pressed. This could be created with
|
||||||
@ -266,8 +267,8 @@ int IRRCALLCONV main(int argc, char* argv[])
|
|||||||
scene::ICameraSceneNode* camera = smgr->addCameraSceneNodeFPS();
|
scene::ICameraSceneNode* camera = smgr->addCameraSceneNodeFPS();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
so we need a good starting Position in the level.
|
so we need a good starting position in the level.
|
||||||
we can ask the Quake3 Loader for all entities with class_name
|
we can ask the Quake3 loader for all entities with class_name
|
||||||
"info_player_deathmatch"
|
"info_player_deathmatch"
|
||||||
we choose a random launch
|
we choose a random launch
|
||||||
*/
|
*/
|
||||||
@ -356,6 +357,8 @@ int IRRCALLCONV main(int argc, char* argv[])
|
|||||||
gui->drawAll();
|
gui->drawAll();
|
||||||
driver->endScene();
|
driver->endScene();
|
||||||
|
|
||||||
|
// Display some info
|
||||||
|
// Setting window caption can be rather slow, so usually shouldn't be done each frame.
|
||||||
int fps = driver->getFPS();
|
int fps = driver->getFPS();
|
||||||
if (1 || lastFPS != fps)
|
if (1 || lastFPS != fps)
|
||||||
{
|
{
|
||||||
@ -376,7 +379,7 @@ int IRRCALLCONV main(int argc, char* argv[])
|
|||||||
str += "/";
|
str += "/";
|
||||||
str += attr->getAttributeAsInt("drawn_transparent_effect");
|
str += attr->getAttributeAsInt("drawn_transparent_effect");
|
||||||
#endif
|
#endif
|
||||||
device->setWindowCaption(str.c_str());
|
device->setWindowCaption(str.c_str());
|
||||||
lastFPS = fps;
|
lastFPS = fps;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user