Merged revisions 2375:2440 from trunk.
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/branches/ogl-es@2441 dfc29bdd-3216-0410-991c-e03cc46cb475master
parent
e70fb7a727
commit
b24d213745
54
changes.txt
54
changes.txt
|
@ -1,5 +1,15 @@
|
|||
Changes in 1.6
|
||||
|
||||
- IOSOperator::getTextFromClipboard returns now const c8* instead of c8*
|
||||
|
||||
- Support for copy&paste on linux (X11) added (fixing bug 2804014 found by Pan)
|
||||
|
||||
- bugfix for 2795321 found by egrath: Don't rely anymore on broken XkbSetDetectableAutoRepeat.
|
||||
|
||||
- bugfix: Use make_lower throughout for spritebank filenames (found and patched by Ion Dune)
|
||||
|
||||
- bugfix: CMountPointReader::openFile no longer returns true for empty files. Corresponding test added.
|
||||
|
||||
- Direct3D now also uses screen coordinates in 2d mode, just like OpenGL. This means that screen coords are going from 0..ScreenWidth and 0..ScreenHeight instead of -1..1.
|
||||
|
||||
- ALT+F4 keypress now closes Windows SDL device
|
||||
|
@ -43,6 +53,50 @@ Changes in 1.6
|
|||
- The console device can now present images from the software drivers and display them as ASCII art in the console
|
||||
- By default it replaces the default font in the skin, to prevent fonts from being huge.
|
||||
|
||||
- Fixed problems with changing cursor visibility while mouse is pressed on windows
|
||||
|
||||
- Allow control of background drawing in listbox
|
||||
|
||||
- Allow control of drawing background and titlebar in windows
|
||||
|
||||
- Improved window serialization
|
||||
|
||||
- bugfix (2796207): menu acted (wrongly) on left-click down instead of left-click up.
|
||||
|
||||
- Fixed problem with highlighting menus when mouse was outside sub-menu area.
|
||||
|
||||
- Set "ButtonStates" for mouse events also on Linux (was only for Windows formerly)
|
||||
|
||||
- Add Shift+Control states to mouse event
|
||||
|
||||
- bugfix (2003238): serialize modal screens
|
||||
|
||||
- allow stacking modal screens
|
||||
|
||||
- allowing hiding modals
|
||||
|
||||
- replace many IsVisible checks with virtual isVisible() checks in IGUIElement
|
||||
|
||||
- bugfix: reset selected row when clearing CGUITable
|
||||
|
||||
- adding events EGET_EDITBOX_CHANGED and EGET_EDITBOX_MARKING_CHANGED
|
||||
|
||||
- prevent editbox from recalculating its textbreaking each frame
|
||||
|
||||
- let spinbox react on each textchange without waiting for enter to prevent getting value changes without corresponding EGET_SPINBOX_CHANGED events.
|
||||
|
||||
- new test for zipreader
|
||||
|
||||
- prevent dropping objects accidentally in many set functions
|
||||
|
||||
- Reversed change in vector3d::normalize.
|
||||
Works now again as documented and a corresponding test has been added.
|
||||
Does fix bug 2770709 (https://sourceforge.net/tracker/?func=detail&aid=2770709&group_id=74339&atid=540676)
|
||||
|
||||
- Animations can now be paused by setting the fps to 0.
|
||||
|
||||
- Avoid fp-precision problem in getPickedNodeBB (see also http://irrlicht.sourceforge.net/phpBB2/viewtopic.php?t=33838&highlight=).
|
||||
This change might also fix the problem with picking nodes found by aanderse (http://irrlicht.sourceforge.net/phpBB2/viewtopic.php?t=32890&highlight=)
|
||||
|
||||
Changes in 1.6 TA
|
||||
- implemented isALoadableFileFormat ( File *file ) for the Archive Loader
|
||||
|
|
|
@ -31,9 +31,9 @@ LDFLAGS = $(USERLDFLAGS)
|
|||
#default target is Linux
|
||||
all: all_linux
|
||||
|
||||
OGLESLIBS := -L$(HOME)/irrlicht/SDKPackage-ogles1/Builds/OGLES/LinuxPC/Lib -lGLES_CM
|
||||
# target specific settings
|
||||
all_linux all_win32 static_win32: LDFLAGS += -L$(IrrlichtHome)/lib/$(SYSTEM) -lIrrlicht
|
||||
all_linux: LDFLAGS += -L/usr/X11R6/lib$(LIBSELECT) -lGL -lXxf86vm -lXext -lX11
|
||||
all_linux: LDFLAGS = -L/usr/X11R6/lib$(LIBSELECT) -L../../lib/Linux -lIrrlicht $(OGLESLIBS) -lXxf86vm -lXext -lX11
|
||||
all_linux clean_linux: SYSTEM=Linux
|
||||
all_win32 clean_win32 static_win32: SYSTEM=Win32-gcc
|
||||
all_win32 clean_win32 static_win32: SUF=.exe
|
||||
|
|
|
@ -122,7 +122,7 @@ int main()
|
|||
dimensions, etc.
|
||||
*/
|
||||
IrrlichtDevice *device =
|
||||
createDevice( video::EDT_SOFTWARE, dimension2d<u32>(640, 480), 16,
|
||||
createDevice( video::EDT_OGLES1, dimension2d<u32>(640, 480), 16,
|
||||
false, false, false, 0);
|
||||
|
||||
if (!device)
|
||||
|
|
|
@ -16,8 +16,9 @@ ifeq ($(HOSTTYPE), x86_64)
|
|||
LIBSELECT=64
|
||||
endif
|
||||
|
||||
OGLESLIBS := -L$(HOME)/irrlicht/SDKPackage-ogles1/Builds/OGLES/LinuxPC/Lib -lGLES_CM
|
||||
# target specific settings
|
||||
all_linux: LDFLAGS = -L/usr/X11R6/lib$(LIBSELECT) -L../../lib/Linux -lIrrlicht -lGL -lXxf86vm -lXext -lX11
|
||||
all_linux: LDFLAGS = -L/usr/X11R6/lib$(LIBSELECT) -L../../lib/Linux -lIrrlicht $(OGLESLIBS) -lXxf86vm -lXext -lX11
|
||||
all_linux clean_linux: SYSTEM=Linux
|
||||
all_win32: LDFLAGS = -L../../lib/Win32-gcc -lIrrlicht -lopengl32 -lm
|
||||
all_win32 clean_win32: SYSTEM=Win32-gcc
|
||||
|
|
|
@ -70,14 +70,15 @@ public:
|
|||
{
|
||||
Material.Wireframe = false;
|
||||
Material.Lighting = false;
|
||||
Material.Thickness=0.f;
|
||||
|
||||
Vertices[0] = video::S3DVertex(0,0,10, 1,1,0,
|
||||
Vertices[0] = video::S3DVertex(0,0,10, 5,1,0,
|
||||
video::SColor(255,0,255,255), 0, 1);
|
||||
Vertices[1] = video::S3DVertex(10,0,-10, 1,0,0,
|
||||
Vertices[1] = video::S3DVertex(10,0,-10, 10,0,0,
|
||||
video::SColor(255,255,0,255), 1, 1);
|
||||
Vertices[2] = video::S3DVertex(0,20,0, 0,1,1,
|
||||
Vertices[2] = video::S3DVertex(0,20,0, 20,1,1,
|
||||
video::SColor(255,255,255,0), 1, 0);
|
||||
Vertices[3] = video::S3DVertex(-10,0,-10, 0,0,1,
|
||||
Vertices[3] = video::S3DVertex(-10,0,-10, 40,0,1,
|
||||
video::SColor(255,0,255,0), 0, 0);
|
||||
|
||||
/*
|
||||
|
@ -131,7 +132,7 @@ public:
|
|||
|
||||
driver->setMaterial(Material);
|
||||
driver->setTransform(video::ETS_WORLD, AbsoluteTransformation);
|
||||
driver->drawIndexedTriangleList(&Vertices[0], 4, &indices[0], 4);
|
||||
driver->drawVertexPrimitiveList(&Vertices[0], 4, &indices[0], 4, video::EVT_STANDARD, scene::EPT_POINTS);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -183,7 +184,7 @@ int main()
|
|||
case 'a': driverType = video::EDT_DIRECT3D9;break;
|
||||
case 'b': driverType = video::EDT_DIRECT3D8;break;
|
||||
case 'c': driverType = video::EDT_OPENGL; break;
|
||||
case 'd': driverType = video::EDT_SOFTWARE; break;
|
||||
case 'd': driverType = video::EDT_OGLES1; break;
|
||||
case 'e': driverType = video::EDT_BURNINGSVIDEO;break;
|
||||
case 'f': driverType = video::EDT_NULL; break;
|
||||
default: return 0;
|
||||
|
|
|
@ -16,8 +16,9 @@ ifeq ($(HOSTTYPE), x86_64)
|
|||
LIBSELECT=64
|
||||
endif
|
||||
|
||||
OGLESLIBS := -L$(HOME)/irrlicht/SDKPackage-ogles1/Builds/OGLES/LinuxPC/Lib -lGLES_CM
|
||||
# target specific settings
|
||||
all_linux: LDFLAGS = -L/usr/X11R6/lib$(LIBSELECT) -L../../lib/Linux -lIrrlicht -lGL -lXxf86vm -lXext -lX11
|
||||
all_linux: LDFLAGS = -L/usr/X11R6/lib$(LIBSELECT) -L../../lib/Linux -lIrrlicht $(OGLESLIBS) -lXxf86vm -lXext -lX11
|
||||
all_linux clean_linux: SYSTEM=Linux
|
||||
all_win32: LDFLAGS = -L../../lib/Win32-gcc -lIrrlicht -lopengl32 -lm
|
||||
all_win32: CPPFLAGS += -D__GNUWIN32__ -D_WIN32 -DWIN32 -D_WINDOWS -D_MBCS -D_USRDLL
|
||||
|
|
|
@ -87,7 +87,7 @@ int main()
|
|||
case 'a': driverType = video::EDT_DIRECT3D9;break;
|
||||
case 'b': driverType = video::EDT_DIRECT3D8;break;
|
||||
case 'c': driverType = video::EDT_OPENGL; break;
|
||||
case 'd': driverType = video::EDT_SOFTWARE; break;
|
||||
case 'd': driverType = video::EDT_OGLES1; break;
|
||||
case 'e': driverType = video::EDT_BURNINGSVIDEO;break;
|
||||
case 'f': driverType = video::EDT_NULL; break;
|
||||
default: return 0;
|
||||
|
|
|
@ -17,7 +17,9 @@ LIBSELECT=64
|
|||
endif
|
||||
|
||||
# target specific settings
|
||||
all_linux: LDFLAGS = -L/usr/X11R6/lib$(LIBSELECT) -L../../lib/Linux -lIrrlicht -lGL -lXxf86vm -lXext -lX11
|
||||
OGLESLIBS := -L$(HOME)/irrlicht/SDKPackage-ogles1/Builds/OGLES/LinuxPC/Lib -lGLES_CM
|
||||
# target specific settings
|
||||
all_linux: LDFLAGS = -L/usr/X11R6/lib$(LIBSELECT) -L../../lib/Linux -lIrrlicht $(OGLESLIBS) -lXxf86vm -lXext -lX11
|
||||
all_linux clean_linux: SYSTEM=Linux
|
||||
all_win32: LDFLAGS = -L../../lib/Win32-gcc -lIrrlicht -lopengl32 -lm
|
||||
all_win32 clean_win32: SYSTEM=Win32-gcc
|
||||
|
|
|
@ -175,7 +175,7 @@ int main()
|
|||
case 'a': driverType = video::EDT_DIRECT3D9;break;
|
||||
case 'b': driverType = video::EDT_DIRECT3D8;break;
|
||||
case 'c': driverType = video::EDT_OPENGL; break;
|
||||
case 'd': driverType = video::EDT_SOFTWARE; break;
|
||||
case 'd': driverType = video::EDT_OGLES1; break;
|
||||
case 'e': driverType = video::EDT_BURNINGSVIDEO;break;
|
||||
case 'f': driverType = video::EDT_NULL; break;
|
||||
default: return 1;
|
||||
|
|
|
@ -16,8 +16,9 @@ ifeq ($(HOSTTYPE), x86_64)
|
|||
LIBSELECT=64
|
||||
endif
|
||||
|
||||
OGLESLIBS := -L$(HOME)/irrlicht/SDKPackage-ogles1/Builds/OGLES/LinuxPC/Lib -lGLES_CM
|
||||
# target specific settings
|
||||
all_linux: LDFLAGS = -L/usr/X11R6/lib$(LIBSELECT) -L../../lib/Linux -lIrrlicht -lGL -lXxf86vm -lXext -lX11
|
||||
all_linux: LDFLAGS = -L/usr/X11R6/lib$(LIBSELECT) -L../../lib/Linux -lIrrlicht $(OGLESLIBS) -lXxf86vm -lXext -lX11
|
||||
all_linux clean_linux: SYSTEM=Linux
|
||||
all_win32: LDFLAGS = -L../../lib/Win32-gcc -lIrrlicht -lopengl32 -lm
|
||||
all_win32 clean_win32: SYSTEM=Win32-gcc
|
||||
|
|
|
@ -41,7 +41,7 @@ int main()
|
|||
case 'a': driverType = video::EDT_DIRECT3D9;break;
|
||||
case 'b': driverType = video::EDT_DIRECT3D8;break;
|
||||
case 'c': driverType = video::EDT_OPENGL; break;
|
||||
case 'd': driverType = video::EDT_SOFTWARE; break;
|
||||
case 'd': driverType = video::EDT_OGLES1; break;
|
||||
case 'e': driverType = video::EDT_BURNINGSVIDEO;break;
|
||||
case 'f': driverType = video::EDT_NULL; break;
|
||||
default: return 0;
|
||||
|
|
|
@ -16,8 +16,9 @@ ifeq ($(HOSTTYPE), x86_64)
|
|||
LIBSELECT=64
|
||||
endif
|
||||
|
||||
OGLESLIBS := -L$(HOME)/irrlicht/SDKPackage-ogles1/Builds/OGLES/LinuxPC/Lib -lGLES_CM
|
||||
# target specific settings
|
||||
all_linux: LDFLAGS = -L/usr/X11R6/lib$(LIBSELECT) -L../../lib/Linux -lIrrlicht -lGL -lXxf86vm -lXext -lX11
|
||||
all_linux: LDFLAGS = -L/usr/X11R6/lib$(LIBSELECT) -L../../lib/Linux -lIrrlicht $(OGLESLIBS) -lXxf86vm -lXext -lX11
|
||||
all_linux clean_linux: SYSTEM=Linux
|
||||
all_win32: LDFLAGS = -L../../lib/Win32-gcc -lIrrlicht -lopengl32 -lm
|
||||
all_win32 clean_win32: SYSTEM=Win32-gcc
|
||||
|
|
|
@ -54,7 +54,7 @@ int main()
|
|||
case 'a': driverType = video::EDT_DIRECT3D9;break;
|
||||
case 'b': driverType = video::EDT_DIRECT3D8;break;
|
||||
case 'c': driverType = video::EDT_OPENGL; break;
|
||||
case 'd': driverType = video::EDT_SOFTWARE; break;
|
||||
case 'd': driverType = video::EDT_OGLES1; break;
|
||||
case 'e': driverType = video::EDT_BURNINGSVIDEO;break;
|
||||
case 'f': driverType = video::EDT_NULL; break;
|
||||
default: return 0;
|
||||
|
|
|
@ -16,8 +16,9 @@ ifeq ($(HOSTTYPE), x86_64)
|
|||
LIBSELECT=64
|
||||
endif
|
||||
|
||||
OGLESLIBS := -L$(HOME)/irrlicht/SDKPackage-ogles1/Builds/OGLES/LinuxPC/Lib -lGLES_CM
|
||||
# target specific settings
|
||||
all_linux: LDFLAGS = -L/usr/X11R6/lib$(LIBSELECT) -L../../lib/Linux -lIrrlicht -lGL -lXxf86vm -lXext -lX11
|
||||
all_linux: LDFLAGS = -L/usr/X11R6/lib$(LIBSELECT) -L../../lib/Linux -lIrrlicht $(OGLESLIBS) -lXxf86vm -lXext -lX11
|
||||
all_linux clean_linux: SYSTEM=Linux
|
||||
all_win32: LDFLAGS = -L../../lib/Win32-gcc -lIrrlicht -lopengl32 -lm
|
||||
all_win32 clean_win32: SYSTEM=Win32-gcc
|
||||
|
|
|
@ -48,7 +48,7 @@ int main()
|
|||
case 'a': driverType = video::EDT_DIRECT3D9;break;
|
||||
case 'b': driverType = video::EDT_DIRECT3D8;break;
|
||||
case 'c': driverType = video::EDT_OPENGL; break;
|
||||
case 'd': driverType = video::EDT_SOFTWARE; break;
|
||||
case 'd': driverType = video::EDT_OGLES1; break;
|
||||
case 'e': driverType = video::EDT_BURNINGSVIDEO;break;
|
||||
case 'f': driverType = video::EDT_NULL; break;
|
||||
default: return 1;
|
||||
|
@ -68,6 +68,7 @@ int main()
|
|||
|
||||
video::IVideoDriver* driver = device->getVideoDriver();
|
||||
scene::ISceneManager* smgr = device->getSceneManager();
|
||||
scene::ISceneNode* node = 0;
|
||||
|
||||
/*
|
||||
For our environment, we load a .3ds file. It is a small room I modelled
|
||||
|
@ -84,14 +85,18 @@ int main()
|
|||
*/
|
||||
|
||||
scene::IAnimatedMesh* mesh = smgr->getMesh("../../media/room.3ds");
|
||||
if (mesh)
|
||||
{
|
||||
smgr->getMeshManipulator()->makePlanarTextureMapping(mesh->getMesh(0), 0.004f);
|
||||
|
||||
smgr->getMeshManipulator()->makePlanarTextureMapping(mesh->getMesh(0), 0.004f);
|
||||
|
||||
scene::ISceneNode* node = 0;
|
||||
|
||||
node = smgr->addAnimatedMeshSceneNode(mesh);
|
||||
node->setMaterialTexture(0, driver->getTexture("../../media/wall.jpg"));
|
||||
node->getMaterial(0).SpecularColor.set(0,0,0,0);
|
||||
node = smgr->addAnimatedMeshSceneNode(mesh);
|
||||
if (node)
|
||||
{
|
||||
((scene::IAnimatedMeshSceneNode*)node)->addShadowVolumeSceneNode();
|
||||
node->setMaterialTexture(0, driver->getTexture("../../media/wall.jpg"));
|
||||
node->getMaterial(0).SpecularColor.set(0,0,0,0);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Now, for the first special effect: Animated water. It works like this:
|
||||
|
@ -104,19 +109,25 @@ int main()
|
|||
want to.
|
||||
*/
|
||||
|
||||
mesh = smgr->addHillPlaneMesh( "myHill",
|
||||
core::dimension2d<f32>(20,20),
|
||||
core::dimension2d<u32>(40,40), 0, 0,
|
||||
core::dimension2d<f32>(0,0),
|
||||
core::dimension2d<f32>(10,10));
|
||||
mesh = 0;//smgr->addHillPlaneMesh( "myHill",
|
||||
// core::dimension2d<f32>(20,20),
|
||||
// core::dimension2d<u32>(40,40), 0, 0,
|
||||
// core::dimension2d<f32>(0,0),
|
||||
// core::dimension2d<f32>(10,10));
|
||||
|
||||
node = smgr->addWaterSurfaceSceneNode(mesh->getMesh(0), 3.0f, 300.0f, 30.0f);
|
||||
node->setPosition(core::vector3df(0,7,0));
|
||||
if (mesh)
|
||||
{
|
||||
node = smgr->addWaterSurfaceSceneNode(mesh->getMesh(0), 3.0f, 300.0f, 30.0f);
|
||||
if (node)
|
||||
{
|
||||
node->setPosition(core::vector3df(0,7,0));
|
||||
|
||||
node->setMaterialTexture(0, driver->getTexture("../../media/stones.jpg"));
|
||||
node->setMaterialTexture(1, driver->getTexture("../../media/water.jpg"));
|
||||
node->setMaterialTexture(0, driver->getTexture("../../media/stones.jpg"));
|
||||
node->setMaterialTexture(1, driver->getTexture("../../media/water.jpg"));
|
||||
|
||||
node->setMaterialType(video::EMT_REFLECTION_2_LAYER);
|
||||
node->setMaterialType(video::EMT_REFLECTION_2_LAYER);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
The second special effect is very basic, I bet you saw it already in
|
||||
|
@ -129,82 +140,23 @@ int main()
|
|||
|
||||
node = smgr->addLightSceneNode(0, core::vector3df(0,0,0),
|
||||
video::SColorf(1.0f, 0.6f, 0.7f, 1.0f), 800.0f);
|
||||
scene::ISceneNodeAnimator* anim = 0;
|
||||
anim = smgr->createFlyCircleAnimator (core::vector3df(0,150,0),250.0f);
|
||||
node->addAnimator(anim);
|
||||
anim->drop();
|
||||
if (node)
|
||||
{
|
||||
scene::ISceneNodeAnimator* anim = 0;
|
||||
anim = smgr->createFlyCircleAnimator (core::vector3df(0,150,0),250.0f);
|
||||
node->addAnimator(anim);
|
||||
anim->drop();
|
||||
}
|
||||
|
||||
// attach billboard to light
|
||||
|
||||
node = smgr->addBillboardSceneNode(node, core::dimension2d<f32>(50, 50));
|
||||
node->setMaterialFlag(video::EMF_LIGHTING, false);
|
||||
node->setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR);
|
||||
node->setMaterialTexture(0, driver->getTexture("../../media/particlewhite.bmp"));
|
||||
|
||||
/*
|
||||
The next special effect is a lot more interesting: A particle system.
|
||||
The particle system in the Irrlicht Engine is quite modular and
|
||||
extensible, but yet easy to use. There is a particle system scene node
|
||||
into which you can put a particle emitter, which makes particles come out
|
||||
of nothing. These emitters are quite flexible and usually have lots of
|
||||
parameters like direction, amount, and color of the particles they
|
||||
create.
|
||||
|
||||
There are different emitters, for example a point emitter which lets
|
||||
particles pop out at a fixed point. If the particle emitters available
|
||||
in the engine are not enough for you, you can easily create your own
|
||||
ones, you'll simply have to create a class derived from the
|
||||
IParticleEmitter interface and attach it to the particle system using
|
||||
setEmitter(). In this example we create a box particle emitter, which
|
||||
creates particles randomly inside a box. The parameters define the box,
|
||||
direction of the particles, minimal and maximal new particles per
|
||||
second, color, and minimal and maximal lifetime of the particles.
|
||||
|
||||
Because only with emitters particle system would be a little bit
|
||||
boring, there are particle affectors which modify particles while
|
||||
they fly around. Affectors can be added to a particle system for
|
||||
simulating additional effects like gravity or wind.
|
||||
The particle affector we use in this example is an affector which
|
||||
modifies the color of the particles: It lets them fade out. Like the
|
||||
particle emitters, additional particle affectors can also be
|
||||
implemented by you, simply derive a class from IParticleAffector and
|
||||
add it with addAffector().
|
||||
|
||||
After we set a nice material to the particle system, we have a cool
|
||||
looking camp fire. By adjusting material, texture, particle emitter,
|
||||
and affector parameters, it is also easily possible to create smoke,
|
||||
rain, explosions, snow, and so on.
|
||||
*/
|
||||
|
||||
// create a particle system
|
||||
|
||||
scene::IParticleSystemSceneNode* ps =
|
||||
smgr->addParticleSystemSceneNode(false);
|
||||
|
||||
scene::IParticleEmitter* em = ps->createBoxEmitter(
|
||||
core::aabbox3d<f32>(-7,0,-7,7,1,7), // emitter size
|
||||
core::vector3df(0.0f,0.06f,0.0f), // initial direction
|
||||
80,100, // emit rate
|
||||
video::SColor(0,255,255,255), // darkest color
|
||||
video::SColor(0,255,255,255), // brightest color
|
||||
800,2000,0, // min and max age, angle
|
||||
core::dimension2df(10.f,10.f), // min size
|
||||
core::dimension2df(20.f,20.f)); // max size
|
||||
|
||||
ps->setEmitter(em); // this grabs the emitter
|
||||
em->drop(); // so we can drop it here without deleting it
|
||||
|
||||
scene::IParticleAffector* paf = ps->createFadeOutParticleAffector();
|
||||
|
||||
ps->addAffector(paf); // same goes for the affector
|
||||
paf->drop();
|
||||
|
||||
ps->setPosition(core::vector3df(-70,60,40));
|
||||
ps->setScale(core::vector3df(2,2,2));
|
||||
ps->setMaterialFlag(video::EMF_LIGHTING, false);
|
||||
ps->setMaterialFlag(video::EMF_ZWRITE_ENABLE, false);
|
||||
ps->setMaterialTexture(0, driver->getTexture("../../media/fire.bmp"));
|
||||
ps->setMaterialType(video::EMT_TRANSPARENT_VERTEX_ALPHA);
|
||||
if (node)
|
||||
{
|
||||
node->setMaterialFlag(video::EMF_LIGHTING, false);
|
||||
node->setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR);
|
||||
node->setMaterialTexture(0, driver->getTexture("../../media/particlewhite.bmp"));
|
||||
}
|
||||
|
||||
/*
|
||||
Next we add a volumetric light node, which adds a glowing fake area light to
|
||||
|
@ -245,6 +197,80 @@ int main()
|
|||
glow->drop();
|
||||
}
|
||||
|
||||
/*
|
||||
The next special effect is a lot more interesting: A particle system.
|
||||
The particle system in the Irrlicht Engine is quite modular and
|
||||
extensible, but yet easy to use. There is a particle system scene node
|
||||
into which you can put a particle emitter, which makes particles come out
|
||||
of nothing. These emitters are quite flexible and usually have lots of
|
||||
parameters like direction, amount, and color of the particles they
|
||||
create.
|
||||
|
||||
There are different emitters, for example a point emitter which lets
|
||||
particles pop out at a fixed point. If the particle emitters available
|
||||
in the engine are not enough for you, you can easily create your own
|
||||
ones, you'll simply have to create a class derived from the
|
||||
IParticleEmitter interface and attach it to the particle system using
|
||||
setEmitter(). In this example we create a box particle emitter, which
|
||||
creates particles randomly inside a box. The parameters define the box,
|
||||
direction of the particles, minimal and maximal new particles per
|
||||
second, color, and minimal and maximal lifetime of the particles.
|
||||
|
||||
Because only with emitters particle system would be a little bit
|
||||
boring, there are particle affectors which modify particles while
|
||||
they fly around. Affectors can be added to a particle system for
|
||||
simulating additional effects like gravity or wind.
|
||||
The particle affector we use in this example is an affector which
|
||||
modifies the color of the particles: It lets them fade out. Like the
|
||||
particle emitters, additional particle affectors can also be
|
||||
implemented by you, simply derive a class from IParticleAffector and
|
||||
add it with addAffector().
|
||||
|
||||
After we set a nice material to the particle system, we have a cool
|
||||
looking camp fire. By adjusting material, texture, particle emitter,
|
||||
and affector parameters, it is also easily possible to create smoke,
|
||||
rain, explosions, snow, and so on.
|
||||
*/
|
||||
|
||||
// create a particle system
|
||||
|
||||
scene::IParticleSystemSceneNode* ps =
|
||||
smgr->addParticleSystemSceneNode(false);
|
||||
|
||||
if (ps)
|
||||
{
|
||||
scene::IParticleEmitter* em = ps->createBoxEmitter(
|
||||
core::aabbox3d<f32>(-7,0,-7,7,1,7), // emitter size
|
||||
core::vector3df(0.0f,0.06f,0.0f), // initial direction
|
||||
80,100, // emit rate
|
||||
video::SColor(0,255,255,255), // darkest color
|
||||
video::SColor(0,255,255,255), // brightest color
|
||||
800,2000,0, // min and max age, angle
|
||||
core::dimension2df(10.f,10.f), // min size
|
||||
core::dimension2df(20.f,20.f)); // max size
|
||||
|
||||
if (em)
|
||||
{
|
||||
ps->setEmitter(em); // this grabs the emitter
|
||||
em->drop(); // so we can drop it here without deleting it
|
||||
}
|
||||
|
||||
scene::IParticleAffector* paf = ps->createFadeOutParticleAffector();
|
||||
|
||||
if (paf)
|
||||
{
|
||||
ps->addAffector(paf); // same goes for the affector
|
||||
paf->drop();
|
||||
}
|
||||
|
||||
ps->setPosition(core::vector3df(-70,60,40));
|
||||
ps->setScale(core::vector3df(2,2,2));
|
||||
ps->setMaterialFlag(video::EMF_LIGHTING, false);
|
||||
// ps->setMaterialFlag(video::EMF_ZWRITE_ENABLE, false);
|
||||
ps->setMaterialTexture(0, driver->getTexture("../../media/fire.bmp"));
|
||||
ps->setMaterialType(video::EMT_TRANSPARENT_VERTEX_ALPHA);
|
||||
}
|
||||
|
||||
/*
|
||||
As our last special effect, we want a dynamic shadow be casted from an
|
||||
animated character. For this we load a DirectX .x model and place it
|
||||
|
|
|
@ -16,8 +16,9 @@ ifeq ($(HOSTTYPE), x86_64)
|
|||
LIBSELECT=64
|
||||
endif
|
||||
|
||||
OGLESLIBS := -L$(HOME)/irrlicht/SDKPackage-ogles1/Builds/OGLES/LinuxPC/Lib -lGLES_CM
|
||||
# target specific settings
|
||||
all_linux: LDFLAGS = -L/usr/X11R6/lib$(LIBSELECT) -L../../lib/Linux -lIrrlicht -lGL -lXxf86vm -lXext -lX11
|
||||
all_linux: LDFLAGS = -L/usr/X11R6/lib$(LIBSELECT) -L../../lib/Linux -lIrrlicht $(OGLESLIBS) -lXxf86vm -lXext -lX11
|
||||
all_linux clean_linux: SYSTEM=Linux
|
||||
all_win32: LDFLAGS = -L../../lib/Win32-gcc -lIrrlicht -lopengl32 -lm
|
||||
all_win32 clean_win32: SYSTEM=Win32-gcc
|
||||
|
|
|
@ -566,7 +566,7 @@ int main(int argc, char* argv[])
|
|||
case 'a': driverType = video::EDT_DIRECT3D9;break;
|
||||
case 'b': driverType = video::EDT_DIRECT3D8;break;
|
||||
case 'c': driverType = video::EDT_OPENGL; break;
|
||||
case 'd': driverType = video::EDT_SOFTWARE; break;
|
||||
case 'd': driverType = video::EDT_OGLES1; break;
|
||||
case 'e': driverType = video::EDT_BURNINGSVIDEO;break;
|
||||
case 'f': driverType = video::EDT_NULL; break;
|
||||
default: return 1;
|
||||
|
|
|
@ -16,8 +16,9 @@ ifeq ($(HOSTTYPE), x86_64)
|
|||
LIBSELECT=64
|
||||
endif
|
||||
|
||||
OGLESLIBS := -L$(HOME)/irrlicht/SDKPackage-ogles1/Builds/OGLES/LinuxPC/Lib -lGLES_CM
|
||||
# target specific settings
|
||||
all_linux: LDFLAGS = -L/usr/X11R6/lib$(LIBSELECT) -L../../lib/Linux -lIrrlicht -lGL -lXxf86vm -lXext -lX11
|
||||
all_linux: LDFLAGS = -L/usr/X11R6/lib$(LIBSELECT) -L../../lib/Linux -lIrrlicht $(OGLESLIBS) -lXxf86vm -lXext -lX11
|
||||
all_linux clean_linux: SYSTEM=Linux
|
||||
all_win32: LDFLAGS = -L../../lib/Win32-gcc -lIrrlicht -lopengl32 -lm
|
||||
all_win32 clean_win32: SYSTEM=Win32-gcc
|
||||
|
|
|
@ -131,7 +131,7 @@ int main()
|
|||
case 'a': driverType = video::EDT_DIRECT3D9;break;
|
||||
case 'b': driverType = video::EDT_DIRECT3D8;break;
|
||||
case 'c': driverType = video::EDT_OPENGL; break;
|
||||
case 'd': driverType = video::EDT_SOFTWARE; break;
|
||||
case 'd': driverType = video::EDT_OGLES1; break;
|
||||
case 'e': driverType = video::EDT_BURNINGSVIDEO;break;
|
||||
case 'f': driverType = video::EDT_NULL; break;
|
||||
default: return 1;
|
||||
|
|
|
@ -16,8 +16,9 @@ ifeq ($(HOSTTYPE), x86_64)
|
|||
LIBSELECT=64
|
||||
endif
|
||||
|
||||
OGLESLIBS := -L$(HOME)/irrlicht/SDKPackage-ogles1/Builds/OGLES/LinuxPC/Lib -lGLES_CM
|
||||
# target specific settings
|
||||
all_linux: LDFLAGS = -L/usr/X11R6/lib$(LIBSELECT) -L../../lib/Linux -lIrrlicht -lGL -lXxf86vm -lXext -lX11
|
||||
all_linux: LDFLAGS = -L/usr/X11R6/lib$(LIBSELECT) -L../../lib/Linux -lIrrlicht $(OGLESLIBS) -lXxf86vm -lXext -lX11
|
||||
all_linux clean_linux: SYSTEM=Linux
|
||||
all_win32: LDFLAGS = -L../../lib/Win32-gcc -lIrrlicht -lopengl32 -lm
|
||||
all_win32 clean_win32: SYSTEM=Win32-gcc
|
||||
|
|
|
@ -171,7 +171,7 @@ int main()
|
|||
case 'a': driverType = video::EDT_DIRECT3D9;break;
|
||||
case 'b': driverType = video::EDT_DIRECT3D8;break;
|
||||
case 'c': driverType = video::EDT_OPENGL; break;
|
||||
case 'd': driverType = video::EDT_SOFTWARE; break;
|
||||
case 'd': driverType = video::EDT_OGLES1; break;
|
||||
case 'e': driverType = video::EDT_BURNINGSVIDEO;break;
|
||||
case 'f': driverType = video::EDT_NULL; break;
|
||||
default: return 0;
|
||||
|
|
|
@ -6,8 +6,8 @@ Sources = main.cpp
|
|||
|
||||
# general compiler settings
|
||||
CPPFLAGS = -I../../include -I/usr/X11R6/include
|
||||
CXXFLAGS = -O3 -ffast-math
|
||||
#CXXFLAGS = -g -Wall
|
||||
#CXXFLAGS = -O3 -ffast-math
|
||||
CXXFLAGS = -g -Wall
|
||||
|
||||
#default target is Linux
|
||||
all: all_linux
|
||||
|
@ -16,8 +16,9 @@ ifeq ($(HOSTTYPE), x86_64)
|
|||
LIBSELECT=64
|
||||
endif
|
||||
|
||||
OGLESLIBS := -L$(HOME)/irrlicht/SDKPackage-ogles1/Builds/OGLES/LinuxPC/Lib -lGLES_CM
|
||||
# target specific settings
|
||||
all_linux: LDFLAGS = -L/usr/X11R6/lib$(LIBSELECT) -L../../lib/Linux -lIrrlicht -lGL -lXxf86vm -lXext -lX11
|
||||
all_linux: LDFLAGS = -L/usr/X11R6/lib$(LIBSELECT) -L../../lib/Linux -lIrrlicht $(OGLESLIBS) -lXxf86vm -lXext -lX11
|
||||
all_linux clean_linux: SYSTEM=Linux
|
||||
all_win32: LDFLAGS = -L../../lib/Win32-gcc -lIrrlicht -lopengl32 -lm
|
||||
all_win32 clean_win32: SYSTEM=Win32-gcc
|
||||
|
|
|
@ -101,7 +101,7 @@ int main()
|
|||
case 'a': driverType = video::EDT_DIRECT3D9;break;
|
||||
case 'b': driverType = video::EDT_DIRECT3D8;break;
|
||||
case 'c': driverType = video::EDT_OPENGL; break;
|
||||
case 'd': driverType = video::EDT_SOFTWARE; break;
|
||||
case 'd': driverType = video::EDT_OGLES1; break;
|
||||
case 'e': driverType = video::EDT_BURNINGSVIDEO;break;
|
||||
case 'f': driverType = video::EDT_NULL; break;
|
||||
default: return 1;
|
||||
|
|
|
@ -16,8 +16,9 @@ ifeq ($(HOSTTYPE), x86_64)
|
|||
LIBSELECT=64
|
||||
endif
|
||||
|
||||
OGLESLIBS := -L$(HOME)/irrlicht/SDKPackage-ogles1/Builds/OGLES/LinuxPC/Lib -lGLES_CM
|
||||
# target specific settings
|
||||
all_linux: LDFLAGS = -L/usr/X11R6/lib$(LIBSELECT) -L../../lib/Linux -lIrrlicht -lGL -lXxf86vm -lXext -lX11
|
||||
all_linux: LDFLAGS = -L/usr/X11R6/lib$(LIBSELECT) -L../../lib/Linux -lIrrlicht $(OGLESLIBS) -lXxf86vm -lXext -lX11
|
||||
all_linux clean_linux: SYSTEM=Linux
|
||||
all_win32: LDFLAGS = -L../../lib/Win32-gcc -lIrrlicht -lopengl32 -lm
|
||||
all_win32 clean_win32: SYSTEM=Win32-gcc
|
||||
|
|
|
@ -36,7 +36,7 @@ int main()
|
|||
case 'a': driverType = video::EDT_DIRECT3D9;break;
|
||||
case 'b': driverType = video::EDT_DIRECT3D8;break;
|
||||
case 'c': driverType = video::EDT_OPENGL; break;
|
||||
case 'd': driverType = video::EDT_SOFTWARE; break;
|
||||
case 'd': driverType = video::EDT_OGLES1; break;
|
||||
case 'e': driverType = video::EDT_BURNINGSVIDEO;break;
|
||||
case 'f': driverType = video::EDT_NULL; break;
|
||||
default: return 1;
|
||||
|
|
|
@ -16,8 +16,9 @@ ifeq ($(HOSTTYPE), x86_64)
|
|||
LIBSELECT=64
|
||||
endif
|
||||
|
||||
OGLESLIBS := -L$(HOME)/irrlicht/SDKPackage-ogles1/Builds/OGLES/LinuxPC/Lib -lGLES_CM
|
||||
# target specific settings
|
||||
all_linux: LDFLAGS = -L/usr/X11R6/lib$(LIBSELECT) -L../../lib/Linux -lIrrlicht -lGL -lXxf86vm -lXext -lX11
|
||||
all_linux: LDFLAGS = -L/usr/X11R6/lib$(LIBSELECT) -L../../lib/Linux -lIrrlicht $(OGLESLIBS) -lXxf86vm -lXext -lX11
|
||||
all_linux clean_linux: SYSTEM=Linux
|
||||
all_win32: LDFLAGS = -L../../lib/Win32-gcc -lIrrlicht -lopengl32 -lm
|
||||
all_win32 clean_win32: SYSTEM=Win32-gcc
|
||||
|
|
|
@ -16,8 +16,9 @@ ifeq ($(HOSTTYPE), x86_64)
|
|||
LIBSELECT=64
|
||||
endif
|
||||
|
||||
OGLESLIBS := -L$(HOME)/irrlicht/SDKPackage-ogles1/Builds/OGLES/LinuxPC/Lib -lGLES_CM
|
||||
# target specific settings
|
||||
all_linux: LDFLAGS = -L/usr/X11R6/lib$(LIBSELECT) -L../../lib/Linux -lIrrlicht -lGL -lXxf86vm -lXext -lX11
|
||||
all_linux: LDFLAGS = -L/usr/X11R6/lib$(LIBSELECT) -L../../lib/Linux -lIrrlicht $(OGLESLIBS) -lXxf86vm -lXext -lX11
|
||||
all_linux clean_linux: SYSTEM=Linux
|
||||
all_win32: LDFLAGS = -L../../lib/Win32-gcc -lIrrlicht -lopengl32 -lm
|
||||
all_win32 clean_win32: SYSTEM=Win32-gcc
|
||||
|
|
|
@ -37,7 +37,7 @@ int main(int argc, char** argv)
|
|||
case 'a': driverType = video::EDT_DIRECT3D9;break;
|
||||
case 'b': driverType = video::EDT_DIRECT3D8;break;
|
||||
case 'c': driverType = video::EDT_OPENGL; break;
|
||||
case 'd': driverType = video::EDT_SOFTWARE; break;
|
||||
case 'd': driverType = video::EDT_OGLES1; break;
|
||||
case 'e': driverType = video::EDT_BURNINGSVIDEO;break;
|
||||
case 'f': driverType = video::EDT_NULL; break;
|
||||
default: return 1;
|
||||
|
|
|
@ -16,8 +16,9 @@ ifeq ($(HOSTTYPE), x86_64)
|
|||
LIBSELECT=64
|
||||
endif
|
||||
|
||||
OGLESLIBS := -L$(HOME)/irrlicht/SDKPackage-ogles1/Builds/OGLES/LinuxPC/Lib -lGLES_CM
|
||||
# target specific settings
|
||||
all_linux: LDFLAGS = -L/usr/X11R6/lib$(LIBSELECT) -L../../lib/Linux -lIrrlicht -lGL -lXxf86vm -lXext -lX11
|
||||
all_linux: LDFLAGS = -L/usr/X11R6/lib$(LIBSELECT) -L../../lib/Linux -lIrrlicht $(OGLESLIBS) -lXxf86vm -lXext -lX11
|
||||
all_linux clean_linux: SYSTEM=Linux
|
||||
all_win32: LDFLAGS = -L../../lib/Win32-gcc -lIrrlicht -lopengl32 -lm
|
||||
all_win32 clean_win32: SYSTEM=Win32-gcc
|
||||
|
|
|
@ -142,7 +142,7 @@ int IRRCALLCONV main(int argc, char* argv[])
|
|||
case 'a': driverType = video::EDT_DIRECT3D9;break;
|
||||
case 'b': driverType = video::EDT_DIRECT3D8;break;
|
||||
case 'c': driverType = video::EDT_OPENGL; break;
|
||||
case 'd': driverType = video::EDT_SOFTWARE; break;
|
||||
case 'd': driverType = video::EDT_OGLES1; break;
|
||||
case 'e': driverType = video::EDT_BURNINGSVIDEO;break;
|
||||
case 'f': driverType = video::EDT_NULL; break;
|
||||
default: return 1;
|
||||
|
|
|
@ -16,8 +16,9 @@ ifeq ($(HOSTTYPE), x86_64)
|
|||
LIBSELECT=64
|
||||
endif
|
||||
|
||||
OGLESLIBS := -L$(HOME)/irrlicht/SDKPackage-ogles1/Builds/OGLES/LinuxPC/Lib -lGLES_CM
|
||||
# target specific settings
|
||||
all_linux: LDFLAGS = -L/usr/X11R6/lib$(LIBSELECT) -L../../lib/Linux -lIrrlicht -lGL -lXxf86vm -lXext -lX11
|
||||
all_linux: LDFLAGS = -L/usr/X11R6/lib$(LIBSELECT) -L../../lib/Linux -lIrrlicht $(OGLESLIBS) -lXxf86vm -lXext -lX11
|
||||
all_linux clean_linux: SYSTEM=Linux
|
||||
all_win32: LDFLAGS = -L../../lib/Win32-gcc -lIrrlicht -lopengl32 -lm
|
||||
all_win32 clean_win32: SYSTEM=Win32-gcc
|
||||
|
|
|
@ -90,7 +90,7 @@ int main()
|
|||
case 'a': driverType = video::EDT_DIRECT3D9;break;
|
||||
case 'b': driverType = video::EDT_DIRECT3D8;break;
|
||||
case 'c': driverType = video::EDT_OPENGL; break;
|
||||
case 'd': driverType = video::EDT_SOFTWARE; break;
|
||||
case 'd': driverType = video::EDT_OGLES1; break;
|
||||
case 'e': driverType = video::EDT_BURNINGSVIDEO;break;
|
||||
case 'f': driverType = video::EDT_NULL; break;
|
||||
default: return 1;
|
||||
|
|
|
@ -16,8 +16,9 @@ ifeq ($(HOSTTYPE), x86_64)
|
|||
LIBSELECT=64
|
||||
endif
|
||||
|
||||
OGLESLIBS := -L$(HOME)/irrlicht/SDKPackage-ogles1/Builds/OGLES/LinuxPC/Lib -lGLES_CM
|
||||
# target specific settings
|
||||
all_linux: LDFLAGS = -L/usr/X11R6/lib$(LIBSELECT) -L../../lib/Linux -lIrrlicht -lGL -lXxf86vm -lXext -lX11
|
||||
all_linux: LDFLAGS = -L/usr/X11R6/lib$(LIBSELECT) -L../../lib/Linux -lIrrlicht $(OGLESLIBS) -lXxf86vm -lXext -lX11
|
||||
all_linux clean_linux: SYSTEM=Linux
|
||||
all_win32: LDFLAGS = -L../../lib/Win32-gcc -lIrrlicht -lopengl32 -lm
|
||||
all_win32: CPPFLAGS += -D__GNUWIN32__ -D_WIN32 -DWIN32 -D_WINDOWS -D_MBCS -D_USRDLL
|
||||
|
|
|
@ -119,7 +119,7 @@ int main()
|
|||
case 'a': driverType = video::EDT_DIRECT3D9;break;
|
||||
case 'b': driverType = video::EDT_DIRECT3D8;break;
|
||||
case 'c': driverType = video::EDT_OPENGL; break;
|
||||
case 'd': driverType = video::EDT_SOFTWARE; break;
|
||||
case 'd': driverType = video::EDT_OGLES1; break;
|
||||
case 'e': driverType = video::EDT_BURNINGSVIDEO;break;
|
||||
case 'f': driverType = video::EDT_NULL; break;
|
||||
default: return 0;
|
||||
|
|
|
@ -16,8 +16,9 @@ ifeq ($(HOSTTYPE), x86_64)
|
|||
LIBSELECT=64
|
||||
endif
|
||||
|
||||
OGLESLIBS := -L$(HOME)/irrlicht/SDKPackage-ogles1/Builds/OGLES/LinuxPC/Lib -lGLES_CM
|
||||
# target specific settings
|
||||
all_linux: LDFLAGS = -L/usr/X11R6/lib$(LIBSELECT) -L../../lib/Linux -lIrrlicht -lGL -lXxf86vm -lXext -lX11
|
||||
all_linux: LDFLAGS = -L/usr/X11R6/lib$(LIBSELECT) -L../../lib/Linux -lIrrlicht $(OGLESLIBS) -lXxf86vm -lXext -lX11
|
||||
all_linux clean_linux: SYSTEM=Linux
|
||||
all_win32: LDFLAGS = -L../../lib/Win32-gcc -lIrrlicht -lopengl32 -lm
|
||||
all_win32: CPPFLAGS += -D__GNUWIN32__ -D_WIN32 -DWIN32 -D_WINDOWS -D_MBCS -D_USRDLL
|
||||
|
|
|
@ -297,7 +297,7 @@ int main(int argumentCount, char * argumentValues[])
|
|||
case 'a': driverType = video::EDT_DIRECT3D9;break;
|
||||
case 'b': driverType = video::EDT_DIRECT3D8;break;
|
||||
case 'c': driverType = video::EDT_OPENGL; break;
|
||||
case 'd': driverType = video::EDT_SOFTWARE; break;
|
||||
case 'd': driverType = video::EDT_OGLES1; break;
|
||||
case 'e': driverType = video::EDT_BURNINGSVIDEO;break;
|
||||
case 'f': driverType = video::EDT_NULL; break;
|
||||
default: return 0;
|
||||
|
|
|
@ -16,8 +16,9 @@ ifeq ($(HOSTTYPE), x86_64)
|
|||
LIBSELECT=64
|
||||
endif
|
||||
|
||||
OGLESLIBS := -L$(HOME)/irrlicht/SDKPackage-ogles1/Builds/OGLES/LinuxPC/Lib -lGLES_CM
|
||||
# target specific settings
|
||||
all_linux: LDFLAGS = -L/usr/X11R6/lib$(LIBSELECT) -L../../lib/Linux -lIrrlicht -lGL -lXxf86vm -lXext -lX11
|
||||
all_linux: LDFLAGS = -L/usr/X11R6/lib$(LIBSELECT) -L../../lib/Linux -lIrrlicht $(OGLESLIBS) -lXxf86vm -lXext -lX11
|
||||
all_linux clean_linux: SYSTEM=Linux
|
||||
all_win32: LDFLAGS = -L../../lib/Win32-gcc -lIrrlicht -lopengl32 -lm
|
||||
all_win32 clean_win32: SYSTEM=Win32-gcc
|
||||
|
|
|
@ -681,7 +681,7 @@ void CQuake3EventHandler::CreateGUI()
|
|||
gui.VideoDriver->addItem(L"Direct3D 9.0c", EDT_DIRECT3D9 );
|
||||
gui.VideoDriver->addItem(L"Direct3D 8.1", EDT_DIRECT3D8 );
|
||||
gui.VideoDriver->addItem(L"OpenGL 1.5", EDT_OPENGL);
|
||||
gui.VideoDriver->addItem(L"Software Renderer", EDT_SOFTWARE);
|
||||
gui.VideoDriver->addItem(L"Software Renderer", EDT_OGLES1);
|
||||
gui.VideoDriver->addItem(L"Burning's Video (TM) Thomas Alten", EDT_BURNINGSVIDEO);
|
||||
gui.VideoDriver->setSelected ( gui.VideoDriver->getIndexForItemData ( Game->deviceParam.DriverType ) );
|
||||
gui.VideoDriver->setToolTipText ( L"Use a VideoDriver" );
|
||||
|
@ -2092,7 +2092,7 @@ int IRRCALLCONV main(int argc, char* argv[])
|
|||
case 'a': game.deviceParam.DriverType = EDT_DIRECT3D9;break;
|
||||
case 'b': game.deviceParam.DriverType = EDT_DIRECT3D8;break;
|
||||
case 'c': game.deviceParam.DriverType = EDT_OPENGL; break;
|
||||
case 'd': game.deviceParam.DriverType = EDT_SOFTWARE; break;
|
||||
case 'd': game.deviceParam.DriverType = EDT_OGLES1; break;
|
||||
case 'e': game.deviceParam.DriverType = EDT_BURNINGSVIDEO;break;
|
||||
default: game.retVal = 3; break;
|
||||
}
|
||||
|
|
|
@ -18,8 +18,8 @@ using namespace quake3;
|
|||
//! This list is based on the original quake3.
|
||||
static const SItemElement Quake3ItemElement [] = {
|
||||
{ "item_health",
|
||||
"models/powerups/health/medium_cross.md3",
|
||||
"models/powerups/health/medium_sphere.md3",
|
||||
{"models/powerups/health/medium_cross.md3",
|
||||
"models/powerups/health/medium_sphere.md3"},
|
||||
"sound/items/n_health.wav",
|
||||
"icons/iconh_yellow",
|
||||
"25 Health",
|
||||
|
@ -29,8 +29,8 @@ static const SItemElement Quake3ItemElement [] = {
|
|||
SPECIAL_SFX_BOUNCE | SPECIAL_SFX_ROTATE_1
|
||||
},
|
||||
{ "item_health_large",
|
||||
"models/powerups/health/large_cross.md3",
|
||||
"models/powerups/health/large_sphere.md3",
|
||||
{"models/powerups/health/large_cross.md3",
|
||||
"models/powerups/health/large_sphere.md3"},
|
||||
"sound/items/l_health.wav",
|
||||
"icons/iconh_red",
|
||||
"50 Health",
|
||||
|
@ -41,8 +41,8 @@ static const SItemElement Quake3ItemElement [] = {
|
|||
},
|
||||
{
|
||||
"item_health_mega",
|
||||
"models/powerups/health/mega_cross.md3",
|
||||
"models/powerups/health/mega_sphere.md3",
|
||||
{"models/powerups/health/mega_cross.md3",
|
||||
"models/powerups/health/mega_sphere.md3"},
|
||||
"sound/items/m_health.wav",
|
||||
"icons/iconh_mega",
|
||||
"Mega Health",
|
||||
|
@ -53,8 +53,8 @@ static const SItemElement Quake3ItemElement [] = {
|
|||
},
|
||||
{
|
||||
"item_health_small",
|
||||
"models/powerups/health/small_cross.md3",
|
||||
"models/powerups/health/small_sphere.md3",
|
||||
{"models/powerups/health/small_cross.md3",
|
||||
"models/powerups/health/small_sphere.md3"},
|
||||
"sound/items/s_health.wav",
|
||||
"icons/iconh_green",
|
||||
"5 Health",
|
||||
|
@ -64,8 +64,8 @@ static const SItemElement Quake3ItemElement [] = {
|
|||
SPECIAL_SFX_BOUNCE | SPECIAL_SFX_ROTATE_1
|
||||
},
|
||||
{ "ammo_bullets",
|
||||
"models/powerups/ammo/machinegunam.md3",
|
||||
"",
|
||||
{"models/powerups/ammo/machinegunam.md3",
|
||||
""},
|
||||
"sound/misc/am_pkup.wav",
|
||||
"icons/icona_machinegun",
|
||||
"Bullets",
|
||||
|
@ -76,8 +76,8 @@ static const SItemElement Quake3ItemElement [] = {
|
|||
},
|
||||
{
|
||||
"ammo_cells",
|
||||
"models/powerups/ammo/plasmaam.md3",
|
||||
"",
|
||||
{"models/powerups/ammo/plasmaam.md3",
|
||||
""},
|
||||
"sound/misc/am_pkup.wav",
|
||||
"icons/icona_plasma",
|
||||
"Cells",
|
||||
|
@ -87,8 +87,8 @@ static const SItemElement Quake3ItemElement [] = {
|
|||
SPECIAL_SFX_BOUNCE
|
||||
},
|
||||
{ "ammo_rockets",
|
||||
"models/powerups/ammo/rocketam.md3",
|
||||
"",
|
||||
{"models/powerups/ammo/rocketam.md3",
|
||||
""},
|
||||
"",
|
||||
"icons/icona_rocket",
|
||||
"Rockets",
|
||||
|
@ -99,8 +99,8 @@ static const SItemElement Quake3ItemElement [] = {
|
|||
},
|
||||
{
|
||||
"ammo_shells",
|
||||
"models/powerups/ammo/shotgunam.md3",
|
||||
"",
|
||||
{"models/powerups/ammo/shotgunam.md3",
|
||||
""},
|
||||
"sound/misc/am_pkup.wav",
|
||||
"icons/icona_shotgun",
|
||||
"Shells",
|
||||
|
@ -111,8 +111,8 @@ static const SItemElement Quake3ItemElement [] = {
|
|||
},
|
||||
{
|
||||
"ammo_slugs",
|
||||
"models/powerups/ammo/railgunam.md3",
|
||||
"",
|
||||
{"models/powerups/ammo/railgunam.md3",
|
||||
""},
|
||||
"sound/misc/am_pkup.wav",
|
||||
"icons/icona_railgun",
|
||||
"Slugs",
|
||||
|
@ -123,8 +123,8 @@ static const SItemElement Quake3ItemElement [] = {
|
|||
},
|
||||
{
|
||||
"item_armor_body",
|
||||
"models/powerups/armor/armor_red.md3",
|
||||
"",
|
||||
{"models/powerups/armor/armor_red.md3",
|
||||
""},
|
||||
"sound/misc/ar2_pkup.wav",
|
||||
"icons/iconr_red",
|
||||
"Heavy Armor",
|
||||
|
@ -135,8 +135,8 @@ static const SItemElement Quake3ItemElement [] = {
|
|||
},
|
||||
{
|
||||
"item_armor_combat",
|
||||
"models/powerups/armor/armor_yel.md3",
|
||||
"",
|
||||
{"models/powerups/armor/armor_yel.md3",
|
||||
""},
|
||||
"sound/misc/ar2_pkup.wav",
|
||||
"icons/iconr_yellow",
|
||||
"Armor",
|
||||
|
@ -147,8 +147,8 @@ static const SItemElement Quake3ItemElement [] = {
|
|||
},
|
||||
{
|
||||
"item_armor_shard",
|
||||
"models/powerups/armor/shard.md3",
|
||||
"",
|
||||
{"models/powerups/armor/shard.md3",
|
||||
""},
|
||||
"sound/misc/ar1_pkup.wav",
|
||||
"icons/iconr_shard",
|
||||
"Armor Shared",
|
||||
|
@ -159,8 +159,8 @@ static const SItemElement Quake3ItemElement [] = {
|
|||
},
|
||||
{
|
||||
"weapon_gauntlet",
|
||||
"models/weapons2/gauntlet/gauntlet.md3",
|
||||
"",
|
||||
{"models/weapons2/gauntlet/gauntlet.md3",
|
||||
""},
|
||||
"sound/misc/w_pkup.wav",
|
||||
"icons/iconw_gauntlet",
|
||||
"Gauntlet",
|
||||
|
@ -171,8 +171,8 @@ static const SItemElement Quake3ItemElement [] = {
|
|||
},
|
||||
{
|
||||
"weapon_shotgun",
|
||||
"models/weapons2/shotgun/shotgun.md3",
|
||||
"",
|
||||
{"models/weapons2/shotgun/shotgun.md3",
|
||||
""},
|
||||
"sound/misc/w_pkup.wav",
|
||||
"icons/iconw_shotgun",
|
||||
"Shotgun",
|
||||
|
@ -183,8 +183,8 @@ static const SItemElement Quake3ItemElement [] = {
|
|||
},
|
||||
{
|
||||
"weapon_machinegun",
|
||||
"models/weapons2/machinegun/machinegun.md3",
|
||||
"",
|
||||
{"models/weapons2/machinegun/machinegun.md3",
|
||||
""},
|
||||
"sound/misc/w_pkup.wav",
|
||||
"icons/iconw_machinegun",
|
||||
"Machinegun",
|
||||
|
@ -195,8 +195,8 @@ static const SItemElement Quake3ItemElement [] = {
|
|||
},
|
||||
{
|
||||
"weapon_grenadelauncher",
|
||||
"models/weapons2/grenadel/grenadel.md3",
|
||||
"",
|
||||
{"models/weapons2/grenadel/grenadel.md3",
|
||||
""},
|
||||
"sound/misc/w_pkup.wav",
|
||||
"icons/iconw_grenade",
|
||||
"Grenade Launcher",
|
||||
|
@ -207,8 +207,8 @@ static const SItemElement Quake3ItemElement [] = {
|
|||
},
|
||||
{
|
||||
"weapon_rocketlauncher",
|
||||
"models/weapons2/rocketl/rocketl.md3",
|
||||
"",
|
||||
{"models/weapons2/rocketl/rocketl.md3",
|
||||
""},
|
||||
"sound/misc/w_pkup.wav",
|
||||
"icons/iconw_rocket",
|
||||
"Rocket Launcher",
|
||||
|
@ -219,8 +219,8 @@ static const SItemElement Quake3ItemElement [] = {
|
|||
},
|
||||
{
|
||||
"weapon_lightning",
|
||||
"models/weapons2/lightning/lightning.md3",
|
||||
"",
|
||||
{"models/weapons2/lightning/lightning.md3",
|
||||
""},
|
||||
"sound/misc/w_pkup.wav",
|
||||
"icons/iconw_lightning",
|
||||
"Lightning Gun",
|
||||
|
@ -231,8 +231,8 @@ static const SItemElement Quake3ItemElement [] = {
|
|||
},
|
||||
{
|
||||
"weapon_railgun",
|
||||
"models/weapons2/railgun/railgun.md3",
|
||||
"",
|
||||
{"models/weapons2/railgun/railgun.md3",
|
||||
""},
|
||||
"sound/misc/w_pkup.wav",
|
||||
"icons/iconw_railgun",
|
||||
"Railgun",
|
||||
|
@ -243,8 +243,8 @@ static const SItemElement Quake3ItemElement [] = {
|
|||
},
|
||||
{
|
||||
"weapon_plasmagun",
|
||||
"models/weapons2/plasma/plasma.md3",
|
||||
"",
|
||||
{"models/weapons2/plasma/plasma.md3",
|
||||
""},
|
||||
"sound/misc/w_pkup.wav",
|
||||
"icons/iconw_plasma",
|
||||
"Plasma Gun",
|
||||
|
@ -255,8 +255,8 @@ static const SItemElement Quake3ItemElement [] = {
|
|||
},
|
||||
{
|
||||
"weapon_bfg",
|
||||
"models/weapons2/bfg/bfg.md3",
|
||||
"",
|
||||
{"models/weapons2/bfg/bfg.md3",
|
||||
""},
|
||||
"sound/misc/w_pkup.wav",
|
||||
"icons/iconw_bfg",
|
||||
"BFG10K",
|
||||
|
@ -267,8 +267,8 @@ static const SItemElement Quake3ItemElement [] = {
|
|||
},
|
||||
{
|
||||
"weapon_grapplinghook",
|
||||
"models/weapons2/grapple/grapple.md3",
|
||||
"",
|
||||
{"models/weapons2/grapple/grapple.md3",
|
||||
""},
|
||||
"sound/misc/w_pkup.wav",
|
||||
"icons/iconw_grapple",
|
||||
"Grappling Hook",
|
||||
|
@ -278,7 +278,7 @@ static const SItemElement Quake3ItemElement [] = {
|
|||
SPECIAL_SFX_ROTATE
|
||||
},
|
||||
{
|
||||
""
|
||||
"",{"",""},"","","",0
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#ifndef __C_DEMO_H_INCLUDED__
|
||||
#define __C_DEMO_H_INCLUDED__
|
||||
|
||||
#define USE_IRRKLANG
|
||||
//#define USE_IRRKLANG
|
||||
//#define USE_SDL_MIXER
|
||||
|
||||
#include <irrlicht.h>
|
||||
|
|
|
@ -141,12 +141,12 @@ bool CMainMenu::run(bool& outFullscreen, bool& outMusic, bool& outShadows,
|
|||
};
|
||||
const SLightParticle lightParticle[] =
|
||||
{
|
||||
//LIGHT_GLOBAL,0,
|
||||
LIGHT_RED,0,
|
||||
LIGHT_BLUE,0,
|
||||
LIGHT_RED,1,
|
||||
LIGHT_BLUE,1,
|
||||
LIGHT_NONE,0
|
||||
//{LIGHT_GLOBAL,0,
|
||||
{LIGHT_RED,0},
|
||||
{LIGHT_BLUE,0},
|
||||
{LIGHT_RED,1},
|
||||
{LIGHT_BLUE,1},
|
||||
{LIGHT_NONE,0}
|
||||
};
|
||||
|
||||
const SLightParticle *l = lightParticle;
|
||||
|
@ -256,7 +256,7 @@ bool CMainMenu::run(bool& outFullscreen, bool& outMusic, bool& outShadows,
|
|||
case 1: outDriver = video::EDT_DIRECT3D8; break;
|
||||
case 2: outDriver = video::EDT_DIRECT3D9; break;
|
||||
case 3: outDriver = video::EDT_BURNINGSVIDEO; break;
|
||||
case 4: outDriver = video::EDT_SOFTWARE; break;
|
||||
case 4: outDriver = video::EDT_OGLES1; break;
|
||||
}
|
||||
|
||||
return start;
|
||||
|
|
|
@ -13,7 +13,8 @@ all: all_linux
|
|||
|
||||
# target specific settings
|
||||
all_linux: SYSTEM=Linux
|
||||
all_linux: LDFLAGS = -L/usr/X11R6/lib$(LIBSELECT) -L../../lib/$(SYSTEM) -lIrrlicht -lGL -lXxf86vm -lXext -lX11
|
||||
OGLESLIBS := -L$(HOME)/irrlicht/SDKPackage-ogles1/Builds/OGLES/LinuxPC/Lib -lGLES_CM
|
||||
all_linux: LDFLAGS = -L/usr/X11R6/lib$(LIBSELECT) -L../../lib/Linux -lIrrlicht $(OGLESLIBS) -lXxf86vm -lXext -lX11
|
||||
|
||||
all_win32 clean_win32: SYSTEM=Win32-gcc
|
||||
all_win32: LDFLAGS = -L../../lib/$(SYSTEM) -lIrrlicht -lopengl32 -lm
|
||||
|
|
|
@ -37,7 +37,7 @@ int main()
|
|||
case 'a': driverType = video::EDT_DIRECT3D9;break;
|
||||
case 'b': driverType = video::EDT_DIRECT3D8;break;
|
||||
case 'c': driverType = video::EDT_OPENGL; break;
|
||||
case 'd': driverType = video::EDT_SOFTWARE; break;
|
||||
case 'd': driverType = video::EDT_OGLES1; break;
|
||||
case 'e': driverType = video::EDT_BURNINGSVIDEO;break;
|
||||
case 'f': driverType = video::EDT_NULL; break;
|
||||
default: return 0;
|
||||
|
|
|
@ -19,9 +19,9 @@ namespace video
|
|||
EDT_NULL,
|
||||
|
||||
//! The Irrlicht Engine Software renderer.
|
||||
/** Runs on all platforms, with every hardware. It should only be used for
|
||||
2d graphics, but it can also perform some primitive 3d
|
||||
functions. These 3d drawing functions are quite fast, but
|
||||
/** Runs on all platforms, with every hardware. It should only
|
||||
be used for 2d graphics, but it can also perform some primitive
|
||||
3d functions. These 3d drawing functions are quite fast, but
|
||||
very inaccurate, and don't even support clipping in 3D mode. */
|
||||
EDT_SOFTWARE,
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace irr
|
|||
EET_MOUSE_INPUT_EVENT,
|
||||
|
||||
//! A key input event.
|
||||
/** Like mouse events, keyboard events are created by the device and passed to
|
||||
/** Like mouse events, keyboard events are created by the device and passed to
|
||||
IrrlichtDevice::postEventFromUser. They take the same path as mouse events. */
|
||||
EET_KEY_INPUT_EVENT,
|
||||
|
||||
|
@ -43,7 +43,7 @@ namespace irr
|
|||
Linux: Implemented, with POV hat issues.
|
||||
MacOS / Other: Not yet implemented.
|
||||
*/
|
||||
EET_JOYSTICK_INPUT_EVENT,
|
||||
EET_JOYSTICK_INPUT_EVENT,
|
||||
|
||||
//! A log event
|
||||
/** Log events are only passed to the user receiver if there is one. If they are absorbed by the
|
||||
|
@ -109,7 +109,11 @@ namespace irr
|
|||
EMBSM_LEFT = 0x01,
|
||||
EMBSM_RIGHT = 0x02,
|
||||
EMBSM_MIDDLE = 0x04,
|
||||
|
||||
//! currently only on windows
|
||||
EMBSM_EXTRA1 = 0x08,
|
||||
|
||||
//! currently only on windows
|
||||
EMBSM_EXTRA2 = 0x10,
|
||||
|
||||
EMBSM_FORCE_32_BIT = 0x7fffffff
|
||||
|
@ -179,9 +183,15 @@ namespace irr
|
|||
//! 'Cancel' was clicked on a messagebox
|
||||
EGET_MESSAGEBOX_CANCEL,
|
||||
|
||||
//! In an editbox was pressed 'ENTER'
|
||||
//! In an editbox 'ENTER' was pressed
|
||||
EGET_EDITBOX_ENTER,
|
||||
|
||||
//! The text in an editbox was changed. This does not include automatic changes in text-breaking.
|
||||
EGET_EDITBOX_CHANGED,
|
||||
|
||||
//! The marked area in an editbox was changed.
|
||||
EGET_EDITBOX_MARKING_CHANGED,
|
||||
|
||||
//! The tab was changed in an tab control
|
||||
EGET_TAB_CHANGED,
|
||||
|
||||
|
@ -201,13 +211,13 @@ namespace irr
|
|||
|
||||
//! A tree view node lost selection. See IGUITreeView::getLastEventNode().
|
||||
EGET_TREEVIEW_NODE_DESELECT,
|
||||
|
||||
|
||||
//! A tree view node was selected. See IGUITreeView::getLastEventNode().
|
||||
EGET_TREEVIEW_NODE_SELECT,
|
||||
|
||||
|
||||
//! A tree view node was expanded. See IGUITreeView::getLastEventNode().
|
||||
EGET_TREEVIEW_NODE_EXPAND,
|
||||
|
||||
|
||||
//! A tree view node was collapsed. See IGUITreeView::getLastEventNode().
|
||||
EGET_TREEVIEW_NODE_COLLAPS,
|
||||
|
||||
|
@ -245,6 +255,12 @@ struct SEvent
|
|||
/** Only valid if event was EMIE_MOUSE_WHEEL */
|
||||
f32 Wheel;
|
||||
|
||||
//! True if shift was also pressed
|
||||
bool Shift:1;
|
||||
|
||||
//! True if ctrl was also pressed
|
||||
bool Control:1;
|
||||
|
||||
//! A bitmap of button states. You can use isButtonPressed() to determine
|
||||
//! if a button is pressed or not.
|
||||
//! Currently only valid if the event was EMIE_MOUSE_MOVED
|
||||
|
@ -283,12 +299,12 @@ struct SEvent
|
|||
};
|
||||
|
||||
//! A joystick event.
|
||||
/** Unlike other events, joystick events represent the result of polling
|
||||
/** Unlike other events, joystick events represent the result of polling
|
||||
* each connected joystick once per run() of the device. Joystick events will
|
||||
* not be generated by default. If joystick support is available for the
|
||||
* active device, _IRR_COMPILE_WITH_JOYSTICK_EVENTS_ is defined, and
|
||||
* @ref IrrlichtDevice::activateJoysticks() has been called, an event of
|
||||
* this type will be generated once per joystick per @ref IrrlichtDevice::run()
|
||||
* not be generated by default. If joystick support is available for the
|
||||
* active device, _IRR_COMPILE_WITH_JOYSTICK_EVENTS_ is defined, and
|
||||
* @ref IrrlichtDevice::activateJoysticks() has been called, an event of
|
||||
* this type will be generated once per joystick per @ref IrrlichtDevice::run()
|
||||
* regardless of whether the state of the joystick has actually changed. */
|
||||
struct SJoystickEvent
|
||||
{
|
||||
|
@ -311,16 +327,16 @@ struct SEvent
|
|||
|
||||
/** For AXIS_X, AXIS_Y, AXIS_Z, AXIS_R, AXIS_U and AXIS_V
|
||||
* Values are in the range -32768 to 32767, with 0 representing
|
||||
* the center position. You will receive the raw value from the
|
||||
* joystick, and so will usually want to implement a dead zone around
|
||||
* the center of the range. Axes not supported by this joystick will
|
||||
* always have a value of 0. On Linux, POV hats are represented as axes,
|
||||
* the center position. You will receive the raw value from the
|
||||
* joystick, and so will usually want to implement a dead zone around
|
||||
* the center of the range. Axes not supported by this joystick will
|
||||
* always have a value of 0. On Linux, POV hats are represented as axes,
|
||||
* usually the last two active axis.
|
||||
*/
|
||||
s16 Axis[NUMBER_OF_AXES];
|
||||
|
||||
/** The POV represents the angle of the POV hat in degrees * 100,
|
||||
* from 0 to 35,900. A value of 65535 indicates that the POV hat
|
||||
/** The POV represents the angle of the POV hat in degrees * 100,
|
||||
* from 0 to 35,900. A value of 65535 indicates that the POV hat
|
||||
* is centered (or not present).
|
||||
* This value is only supported on Windows. On Linux, the POV hat
|
||||
* will be sent as 2 axes instead. */
|
||||
|
@ -340,7 +356,7 @@ struct SEvent
|
|||
return (ButtonStates & (1 << button)) ? true : false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
//! Any kind of log event.
|
||||
struct SLogEvent
|
||||
|
@ -399,7 +415,7 @@ struct SJoystickInfo
|
|||
{
|
||||
//! The ID of the joystick
|
||||
/** This is an internal Irrlicht index; it does not map directly
|
||||
* to any particular hardware joystick. It corresponds to the
|
||||
* to any particular hardware joystick. It corresponds to the
|
||||
* irr::SJoystickEvent Joystick ID. */
|
||||
u8 Joystick;
|
||||
|
||||
|
|
|
@ -358,7 +358,7 @@ public:
|
|||
|
||||
core::list<IGUIElement*>::Iterator it = Children.getLast();
|
||||
|
||||
if (IsVisible)
|
||||
if (isVisible())
|
||||
{
|
||||
while(it != Children.end())
|
||||
{
|
||||
|
@ -370,7 +370,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
if (IsVisible && isPointInside(point))
|
||||
if (isVisible() && isPointInside(point))
|
||||
target = this;
|
||||
|
||||
return target;
|
||||
|
@ -425,7 +425,7 @@ public:
|
|||
//! Draws the element and its children.
|
||||
virtual void draw()
|
||||
{
|
||||
if ( IsVisible )
|
||||
if ( isVisible() )
|
||||
{
|
||||
core::list<IGUIElement*>::Iterator it = Children.begin();
|
||||
for (; it != Children.end(); ++it)
|
||||
|
@ -437,7 +437,7 @@ public:
|
|||
//! animate the element and its children.
|
||||
virtual void OnPostRender(u32 timeMs)
|
||||
{
|
||||
if ( IsVisible )
|
||||
if ( isVisible() )
|
||||
{
|
||||
core::list<IGUIElement*>::Iterator it = Children.begin();
|
||||
for (; it != Children.end(); ++it)
|
||||
|
|
|
@ -118,6 +118,8 @@ namespace gui
|
|||
//! set global itemHeight
|
||||
virtual void setItemHeight( s32 height ) = 0;
|
||||
|
||||
//! Sets whether to draw the background
|
||||
virtual void setDrawBackground(bool draw) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -38,6 +38,18 @@ namespace gui
|
|||
//! Sets whether the window can be dragged by the mouse
|
||||
virtual void setDraggable(bool draggable) = 0;
|
||||
|
||||
//! Set if the window background will be drawn
|
||||
virtual void setDrawBackground(bool draw) = 0;
|
||||
|
||||
//! Get if the window background will be drawn
|
||||
virtual bool getDrawBackground() const = 0;
|
||||
|
||||
//! Set if the window titlebar will be drawn
|
||||
//! Note: If the background is not drawn, then the titlebar is automatically also not drawn
|
||||
virtual void setDrawTitlebar(bool draw) = 0;
|
||||
|
||||
//! Get if the window titlebar will be drawn
|
||||
virtual bool getDrawTitlebar() const = 0;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -32,7 +32,30 @@ enum ECOLOR_FORMAT
|
|||
ECF_R8G8B8,
|
||||
|
||||
//! Default 32 bit color format. 8 bits are used for every component: red, green, blue and alpha.
|
||||
ECF_A8R8G8B8
|
||||
ECF_A8R8G8B8,
|
||||
|
||||
/** Floating Point formats. The following formats may only be used for render target textures. */
|
||||
|
||||
//! 16 bit floating point format using 16 bits for the red channel.
|
||||
ECF_R16F,
|
||||
|
||||
//! 32 bit floating point format using 16 bits for the red channel and 16 bits for the green channel.
|
||||
ECF_G16R16F,
|
||||
|
||||
//! 64 bit floating point format 16 bits are used for the red, green, blue and alpha channels.
|
||||
ECF_A16B16G16R16F,
|
||||
|
||||
//! 32 bit floating point format using 32 bits for the red channel.
|
||||
ECF_R32F,
|
||||
|
||||
//! 64 bit floating point format using 32 bits for the red channel and 32 bits for the green channel.
|
||||
ECF_G32R32F,
|
||||
|
||||
//! 128 bit floating point format. 32 bits are used for the red, green, blue and alpha channels.
|
||||
ECF_A32B32G32R32F,
|
||||
|
||||
//! Unknown color format:
|
||||
ECF_UNKNOWN
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ public:
|
|||
|
||||
//! Get text from the clipboard
|
||||
/** \return Returns 0 if no string is in there. */
|
||||
virtual c8* getTextFromClipboard() const = 0;
|
||||
virtual const c8* getTextFromClipboard() const = 0;
|
||||
|
||||
//! Get the processor speed in megahertz
|
||||
/** \param MHz The integer variable to store the speed in.
|
||||
|
|
|
@ -25,9 +25,6 @@ namespace scene
|
|||
{
|
||||
public:
|
||||
|
||||
//! Destructor
|
||||
virtual ~ISceneCollisionManager() {}
|
||||
|
||||
//! Finds the collision point of a line and lots of triangles, if there is one.
|
||||
/** \param ray: Line with witch collisions are tested.
|
||||
\param selector: TriangleSelector containing the triangles. It
|
||||
|
@ -112,6 +109,8 @@ namespace scene
|
|||
\param idBitMask: Only scene nodes with an id with bits set
|
||||
like in this mask will be tested. If the BitMask is 0, this
|
||||
feature is disabled.
|
||||
Please note that the default node id of -1 will match with
|
||||
every bitmask != 0
|
||||
\param bNoDebugObjects: Doesn't take debug objects into account
|
||||
when true. These are scene nodes with IsDebugObject() = true.
|
||||
\param root If different from 0, the search is limited to the children of this node.
|
||||
|
@ -147,6 +146,8 @@ namespace scene
|
|||
bits contained in this mask will be tested. However, if this parameter is 0, then
|
||||
all nodes are checked.
|
||||
feature is disabled.
|
||||
Please note that the default node id of -1 will match with
|
||||
every bitmask != 0
|
||||
\param bNoDebugObjects: Doesn't take debug objects into account
|
||||
when true. These are scene nodes with IsDebugObject() = true.
|
||||
\return Scene node nearest to the camera, which collides with
|
||||
|
|
|
@ -322,11 +322,12 @@ namespace video
|
|||
and it should not be bigger than the backbuffer, because it
|
||||
shares the zbuffer with the screen buffer.
|
||||
\param name An optional name for the RTT.
|
||||
\param format The color format of the render target. Floating point formats are supported.
|
||||
\return Pointer to the created texture or 0 if the texture
|
||||
could not be created. This pointer should not be dropped. See
|
||||
IReferenceCounted::drop() for more information. */
|
||||
virtual ITexture* addRenderTargetTexture(const core::dimension2d<u32>& size,
|
||||
const core::string<c16>& name = "rt" ) =0;
|
||||
const core::string<c16>& name = "rt", const ECOLOR_FORMAT format = ECF_UNKNOWN) =0;
|
||||
|
||||
//! Removes a texture from the texture cache and deletes it.
|
||||
/** This method can free a lot of memory!
|
||||
|
|
|
@ -29,22 +29,32 @@ namespace scene
|
|||
//! Returns type of the scene node
|
||||
virtual ESCENE_NODE_TYPE getType() const { return ESNT_VOLUME_LIGHT; }
|
||||
|
||||
//! Sets the number of segments across the U axis
|
||||
virtual void setSubDivideU(const u32 inU) =0;
|
||||
|
||||
//! Sets the number of segments across the V axis
|
||||
virtual void setSubDivideV(const u32 inV) =0;
|
||||
|
||||
//! Returns the number of segments across the U axis
|
||||
virtual u32 getSubDivideU() const =0;
|
||||
|
||||
//! Returns the number of segments across the V axis
|
||||
virtual u32 getSubDivideV() const =0;
|
||||
|
||||
virtual void setFootColour(const video::SColor inColour) =0;
|
||||
virtual void setTailColour(const video::SColor inColour) =0;
|
||||
//! Sets the color of the base of the light
|
||||
virtual void setFootColor(const video::SColor inColour) =0;
|
||||
|
||||
virtual video::SColor getFootColour() const =0;
|
||||
virtual video::SColor getTailColour() const =0;
|
||||
//! Sets the color of the tip of the light
|
||||
virtual void setTailColor(const video::SColor inColour) =0;
|
||||
|
||||
//! Returns the color of the base of the light
|
||||
virtual video::SColor getFootColor() const =0;
|
||||
|
||||
//! Returns the color of the tip of the light
|
||||
virtual video::SColor getTailColor() const =0;
|
||||
};
|
||||
|
||||
} // end namespace scene
|
||||
} // end namespace irr
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -6,7 +6,13 @@
|
|||
#define __IRR_COMPILE_CONFIG_H_INCLUDED__
|
||||
|
||||
//! Irrlicht SDK Version
|
||||
#define IRRLICHT_SDK_VERSION "1.6 SVN"
|
||||
#define IRRLICHT_VERSION_MAJOR 1
|
||||
#define IRRLICHT_VERSION_MINOR 6
|
||||
#define IRRLICHT_VERSION_REVISION 0
|
||||
// This flag will be defined only in SVN, the official release code will have
|
||||
// it undefined
|
||||
#define IRRLICHT_VERSION_SVN
|
||||
#define IRRLICHT_SDK_VERSION "1.6-SVN"
|
||||
|
||||
#include <stdio.h> // TODO: Although included elsewhere this is required at least for mingw
|
||||
|
||||
|
@ -118,7 +124,7 @@ headers, e.g. Summer 2004. This is a Microsoft issue, not an Irrlicht one.
|
|||
#endif
|
||||
|
||||
//! Define _IRR_COMPILE_WITH_OPENGL_ to compile the Irrlicht engine with OpenGL.
|
||||
/** If you do not wish the engine to be compiled with OpengGL, comment this
|
||||
/** If you do not wish the engine to be compiled with OpenGL, comment this
|
||||
define out. */
|
||||
//#define _IRR_COMPILE_WITH_OPENGL_
|
||||
|
||||
|
|
|
@ -33,9 +33,10 @@ namespace irr
|
|||
} // end namespace scene
|
||||
|
||||
//! The Irrlicht device. You can create it with createDevice() or createDeviceEx().
|
||||
/** This is the most important class of the Irrlicht Engine. You can access everything
|
||||
in the engine if you have a pointer to an instance of this class.
|
||||
There should be only one instance of this class at any time.
|
||||
/** This is the most important class of the Irrlicht Engine. You can
|
||||
access everything in the engine if you have a pointer to an instance of
|
||||
this class. There should be only one instance of this class at any
|
||||
time.
|
||||
*/
|
||||
class IrrlichtDevice : public virtual IReferenceCounted
|
||||
{
|
||||
|
@ -229,6 +230,50 @@ namespace irr
|
|||
virtual bool getGammaRamp(f32 &red, f32 &green, f32 &blue,
|
||||
f32 &brightness, f32 &contrast) =0;
|
||||
|
||||
|
||||
//! Allows to check which drivers are supported by the engine.
|
||||
/** Even if true is returned the driver needs not be available
|
||||
for an actual configuration requested upon device creation. */
|
||||
static bool isDriverSupported(video::E_DRIVER_TYPE driver)
|
||||
{
|
||||
switch (driver)
|
||||
{
|
||||
case video::EDT_NULL:
|
||||
return true;
|
||||
case video::EDT_SOFTWARE:
|
||||
#ifdef _IRR_COMPILE_WITH_SOFTWARE_
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
case video::EDT_BURNINGSVIDEO:
|
||||
#ifdef _IRR_COMPILE_WITH_BURNINGSVIDEO_
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
case video::EDT_DIRECT3D8:
|
||||
#ifdef _IRR_COMPILE_WITH_DIRECT3D_8_
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
case video::EDT_DIRECT3D9:
|
||||
#ifdef _IRR_COMPILE_WITH_DIRECT3D_9_
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
case video::EDT_OPENGL:
|
||||
#ifdef _IRR_COMPILE_WITH_OPENGL_
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // end namespace irr
|
||||
|
|
|
@ -335,6 +335,10 @@ namespace video
|
|||
class SColorf
|
||||
{
|
||||
public:
|
||||
//! Default constructor for SColorf.
|
||||
/** Sets red, green and blue to 0.0f and alpha to 1.0f. */
|
||||
SColorf() : r(0.0f), g(0.0f), b(0.0f), a(1.0f) {}
|
||||
|
||||
//! Constructs a color from up to four color values: red, green, blue, and alpha.
|
||||
/** \param r: Red color component. Should be a value between
|
||||
0.0f meaning no red and 1.0f, meaning full red.
|
||||
|
@ -346,7 +350,7 @@ namespace video
|
|||
component defines how transparent a color should be. Has to be
|
||||
a value between 0.0f and 1.0f, 1.0f means not transparent
|
||||
(opaque), 0.0f means fully transparent. */
|
||||
SColorf(f32 r=0.f, f32 g=0.f, f32 b=0.f, f32 a=1.f) : r(r), g(g), b(b), a(a) {}
|
||||
SColorf(f32 r, f32 g, f32 b, f32 a = 1.0f) : r(r), g(g), b(b), a(a) {}
|
||||
|
||||
//! Constructs a color from 32 bit Color.
|
||||
/** \param c: 32 bit color from which this SColorf class is
|
||||
|
@ -484,7 +488,7 @@ namespace video
|
|||
const f32 maxVal = (f32)core::max_(color.getRed(), color.getGreen(), color.getBlue());
|
||||
const f32 minVal = (f32)core::min_(color.getRed(), color.getGreen(), color.getBlue());
|
||||
Luminance = (maxVal/minVal)*0.5f;
|
||||
if (maxVal==minVal)
|
||||
if (core::equals(maxVal, minVal))
|
||||
{
|
||||
Hue=0.f;
|
||||
Saturation=0.f;
|
||||
|
@ -502,7 +506,7 @@ namespace video
|
|||
}
|
||||
|
||||
if (maxVal==color.getRed())
|
||||
Hue = (color.getRed()-color.getBlue())/delta;
|
||||
Hue = (color.getGreen()-color.getBlue())/delta;
|
||||
else if (maxVal==color.getGreen())
|
||||
Hue = 2+(color.getBlue()-color.getRed())/delta;
|
||||
else if (maxVal==color.getBlue())
|
||||
|
@ -516,12 +520,12 @@ namespace video
|
|||
|
||||
inline void SColorHSL::toRGB(SColor &color) const
|
||||
{
|
||||
if ( Saturation == 0.0f) // grey
|
||||
if (core::iszero(Saturation)) // grey
|
||||
{
|
||||
u8 c = (u8) ( Luminance * 255.0 );
|
||||
color.setRed ( c );
|
||||
color.setGreen ( c );
|
||||
color.setBlue ( c );
|
||||
color.setRed(c);
|
||||
color.setGreen(c);
|
||||
color.setBlue(c);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -259,7 +259,7 @@ namespace video
|
|||
//! Value affecting the size of specular highlights.
|
||||
/** A value of 20 is common. If set to 0, no specular
|
||||
highlights are being used. To activate, simply set the
|
||||
shininess of a material to a value other than 0:
|
||||
shininess of a material to a value in the range [0.5;128]:
|
||||
\code
|
||||
sceneNode->getMaterial(0).Shininess = 20.0f;
|
||||
\endcode
|
||||
|
@ -300,13 +300,14 @@ namespace video
|
|||
//! Thickness of non-3dimensional elements such as lines and points.
|
||||
f32 Thickness;
|
||||
|
||||
//! Is the ZBuffer enabled? Default: 1
|
||||
/** Changed from bool to integer
|
||||
(0 == ZBuffer Off, 1 == ZBuffer LessEqual, 2 == ZBuffer Equal)
|
||||
*/
|
||||
//! Is the ZBuffer enabled? Default: ECFN_LESSEQUAL
|
||||
/** Values are from E_COMPARISON_FUNC. */
|
||||
u8 ZBuffer;
|
||||
|
||||
//! Sets the antialiasing mode
|
||||
/** Values are chosen from E_ANTI_ALIASING_MODE. Default is
|
||||
EAAM_SIMPLE|EAAM_LINE_SMOOTH, i.e. simple multi-sample
|
||||
anti-aliasing and lime smoothing is enabled. */
|
||||
u8 AntiAliasing;
|
||||
|
||||
//! Defines the enabled color planes
|
||||
|
@ -314,7 +315,7 @@ namespace video
|
|||
Only enabled color planes will be rendered to the current render
|
||||
target. Typical use is to disable all colors when rendering only to
|
||||
depth or stencil buffer, or using Red and Green for Stereo rendering. */
|
||||
u8 ColorMask;
|
||||
u8 ColorMask:4;
|
||||
|
||||
//! Defines the interpretation of vertex color in the lighting equation
|
||||
/** Values should be chosen from E_COLOR_MATERIAL.
|
||||
|
@ -322,7 +323,7 @@ namespace video
|
|||
material values for light modulation. This allows to easily change e.g. the
|
||||
diffuse light behavior of each face. The default, ECM_DIFFUSE, will result in
|
||||
a very similar rendering as with lighting turned off, just with light shading. */
|
||||
u8 ColorMaterial;
|
||||
u8 ColorMaterial:3;
|
||||
|
||||
//! Draw as wireframe or filled triangles? Default: false
|
||||
/** The user can access a material flag using
|
||||
|
@ -340,8 +341,9 @@ namespace video
|
|||
bool Lighting:1;
|
||||
|
||||
//! Is the zbuffer writeable or is it read-only. Default: true.
|
||||
/** This flag is ignored if the MaterialType is a transparent
|
||||
type. */
|
||||
/** This flag is forced to false if the MaterialType is a
|
||||
transparent type and the scene parameter
|
||||
ALLOW_ZWRITE_ON_TRANSPARENT is not set. */
|
||||
bool ZWriteEnable:1;
|
||||
|
||||
//! Is backface culling enabled? Default: true
|
||||
|
@ -353,7 +355,8 @@ namespace video
|
|||
//! Is fog enabled? Default: false
|
||||
bool FogEnable:1;
|
||||
|
||||
//! Should normals be normalized? Default: false
|
||||
//! Should normals be normalized?
|
||||
/** Always use this if the mesh lit and scaled. Default: false */
|
||||
bool NormalizeNormals:1;
|
||||
|
||||
//! Gets the texture transformation matrix for level i
|
||||
|
|
|
@ -338,8 +338,8 @@ public:
|
|||
}
|
||||
|
||||
|
||||
//! Get size of array.
|
||||
/** \return Size of elements used in the array. */
|
||||
//! Get number of occupied elements of the array.
|
||||
/** \return Size of elements in the array which are actually occupied. */
|
||||
u32 size() const
|
||||
{
|
||||
return used;
|
||||
|
@ -348,7 +348,7 @@ public:
|
|||
|
||||
//! Get amount of memory allocated.
|
||||
/** \return Amount of memory allocated. The amount of bytes
|
||||
allocated would be allocated_size() * sizeof(ElementsUsed); */
|
||||
allocated would be allocated_size() * sizeof(ElementTypeUsed); */
|
||||
u32 allocated_size() const
|
||||
{
|
||||
return allocated;
|
||||
|
|
|
@ -65,7 +65,7 @@ class line2d
|
|||
|
||||
//! Get the vector of the line.
|
||||
/** \return The vector of the line. */
|
||||
vector2d<T> getVector() const { return vector2d<T>(start.X - end.X, start.Y - end.Y); }
|
||||
vector2d<T> getVector() const { return vector2d<T>(end.X - start.X, end.Y - start.Y); }
|
||||
|
||||
//! Tests if this line intersects with another line.
|
||||
/** \param l: Other line to test intersection with.
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace core
|
|||
{
|
||||
|
||||
//! 3d vector template class with lots of operators and methods.
|
||||
/** The vector3d class is used in Irrlicht for three main purposes:
|
||||
/** The vector3d class is used in Irrlicht for three main purposes:
|
||||
1) As a direction vector (most of the methods assume this).
|
||||
2) As a position in 3d space (which is synonymous with a direction vector from the origin to this position).
|
||||
3) To hold three Euler rotations, where X is pitch, Y is yaw and Z is roll.
|
||||
|
@ -140,8 +140,11 @@ namespace core
|
|||
\return Reference to this vector after normalization. */
|
||||
vector3d<T>& normalize()
|
||||
{
|
||||
const f64 length = core::reciprocal_squareroot ( (f64) (X*X + Y*Y + Z*Z) );
|
||||
|
||||
f64 length = (f32)(X*X + Y*Y + Z*Z);
|
||||
if (core::equals(length, 0.0)) // this check isn't an optimization but prevents getting NAN in the sqrt.
|
||||
return *this;
|
||||
length = core::reciprocal_squareroot ( (f64) (X*X + Y*Y + Z*Z) );
|
||||
|
||||
X = (T)(X * length);
|
||||
Y = (T)(Y * length);
|
||||
Z = (T)(Z * length);
|
||||
|
@ -263,10 +266,10 @@ namespace core
|
|||
// Where target and seeker are of type ISceneNode*
|
||||
const vector3df toTarget(target->getAbsolutePosition() - seeker->getAbsolutePosition());
|
||||
const vector3df requiredRotation = toTarget.getHorizontalAngle();
|
||||
seeker->setRotation(requiredRotation);
|
||||
seeker->setRotation(requiredRotation);
|
||||
|
||||
\return A rotation vector containing the X (pitch) and Y (raw) rotations (in degrees) that when applied to a
|
||||
+Z (e.g. 0, 0, 1) direction vector would make it point in the same direction as this vector. The Z (roll) rotation
|
||||
\return A rotation vector containing the X (pitch) and Y (raw) rotations (in degrees) that when applied to a
|
||||
+Z (e.g. 0, 0, 1) direction vector would make it point in the same direction as this vector. The Z (roll) rotation
|
||||
is always 0, since two Euler rotations are sufficient to point in any given direction. */
|
||||
vector3d<T> getHorizontalAngle() const
|
||||
{
|
||||
|
@ -295,9 +298,9 @@ namespace core
|
|||
/** This vector is assumed to be a rotation vector composed of 3 Euler angle rotations, in degrees.
|
||||
The implementation performs the same calculations as using a matrix to do the rotation.
|
||||
|
||||
\param[in] forwards The direction representing "forwards" which will be rotated by this vector.
|
||||
\param[in] forwards The direction representing "forwards" which will be rotated by this vector.
|
||||
If you do not provide a direction, then the +Z axis (0, 0, 1) will be assumed to be forwards.
|
||||
\return A direction vector calculated by rotating the forwards direction by the 3 Euler angles
|
||||
\return A direction vector calculated by rotating the forwards direction by the 3 Euler angles
|
||||
(in degrees) represented by this vector. */
|
||||
vector3d<T> rotationToDirection(const vector3d<T> & forwards = vector3d<T>(0, 0, 1)) const
|
||||
{
|
||||
|
|
|
@ -107,7 +107,7 @@ void CAnimatedMeshSceneNode::buildFrameNr(u32 timeMs)
|
|||
}
|
||||
}
|
||||
|
||||
if ((StartFrame==EndFrame) || (FramesPerSecond==0.f))
|
||||
if ((StartFrame==EndFrame))
|
||||
{
|
||||
CurrentFrameNr = (f32)StartFrame; //Support for non animated meshes
|
||||
}
|
||||
|
@ -210,7 +210,7 @@ IMesh * CAnimatedMeshSceneNode::getMeshForCurrentFrame(bool forceRecalcOfControl
|
|||
|
||||
if (JointMode == EJUOR_CONTROL)//write to mesh
|
||||
skinnedMesh->transferJointsToMesh(JointChildSceneNodes);
|
||||
else
|
||||
else
|
||||
skinnedMesh->animateMesh(getFrameNr(), 1.0f);
|
||||
|
||||
// Update the skinned mesh for the current joint transforms.
|
||||
|
@ -242,12 +242,12 @@ IMesh * CAnimatedMeshSceneNode::getMeshForCurrentFrame(bool forceRecalcOfControl
|
|||
//! OnAnimate() is called just before rendering the whole scene.
|
||||
void CAnimatedMeshSceneNode::OnAnimate(u32 timeMs)
|
||||
{
|
||||
buildFrameNr(timeMs-LastTimeMs);
|
||||
buildFrameNr(timeMs-LastTimeMs);
|
||||
|
||||
if ( Mesh )
|
||||
{
|
||||
scene::IMesh * mesh = getMeshForCurrentFrame( true );
|
||||
|
||||
|
||||
if ( mesh )
|
||||
Box = mesh->getBoundingBox();
|
||||
}
|
||||
|
@ -886,7 +886,7 @@ void CAnimatedMeshSceneNode::updateAbsolutePosition()
|
|||
SMD3QuaternionTag parent ( MD3Special->Tagname );
|
||||
if ( Parent && Parent->getType () == ESNT_ANIMATED_MESH)
|
||||
{
|
||||
const SMD3QuaternionTag * p = ((IAnimatedMeshSceneNode*) Parent)->getMD3TagTransformation
|
||||
const SMD3QuaternionTag * p = ((IAnimatedMeshSceneNode*) Parent)->getMD3TagTransformation
|
||||
( MD3Special->Tagname );
|
||||
|
||||
if ( p )
|
||||
|
|
|
@ -1692,9 +1692,9 @@ public:
|
|||
return L"string";
|
||||
}
|
||||
|
||||
virtual void getBinary(void* outdata, s32 maxLenght)
|
||||
virtual void getBinary(void* outdata, s32 maxLength)
|
||||
{
|
||||
s32 dataSize = maxLenght;
|
||||
s32 dataSize = maxLength;
|
||||
c8* datac8 = (c8*)(outdata);
|
||||
s32 p = 0;
|
||||
const c8* dataString = Value.c_str();
|
||||
|
@ -1714,9 +1714,9 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
virtual void setBinary(void* data, s32 maxLenght)
|
||||
virtual void setBinary(void* data, s32 maxLength)
|
||||
{
|
||||
s32 dataSize = maxLenght;
|
||||
s32 dataSize = maxLength;
|
||||
c8* datac8 = (c8*)(data);
|
||||
char tmp[3];
|
||||
tmp[2] = 0;
|
||||
|
|
|
@ -1366,6 +1366,12 @@ void CAttributes::readAttributeFromXML(io::IXMLReader* reader)
|
|||
Attributes.getLast()->setString(reader->getAttributeValue(L"value"));
|
||||
}
|
||||
else
|
||||
if (element == L"binary")
|
||||
{
|
||||
addBinary(name.c_str(), 0, 0);
|
||||
Attributes.getLast()->setString(reader->getAttributeValue(L"value"));
|
||||
}
|
||||
else
|
||||
if (element == L"color")
|
||||
{
|
||||
addColor(name.c_str(), video::SColor());
|
||||
|
|
|
@ -632,7 +632,7 @@ void CD3D8Driver::setTransform(E_TRANSFORMATION_STATE state,
|
|||
|
||||
|
||||
//! sets the current Texture
|
||||
bool CD3D8Driver::setTexture(s32 stage, const video::ITexture* texture)
|
||||
bool CD3D8Driver::setActiveTexture(u32 stage, const video::ITexture* texture)
|
||||
{
|
||||
if (CurrentTexture[stage] == texture)
|
||||
return true;
|
||||
|
@ -666,7 +666,7 @@ void CD3D8Driver::setMaterial(const SMaterial& material)
|
|||
|
||||
for (u32 i=0; i<MaxTextureUnits; ++i)
|
||||
{
|
||||
setTexture(i, Material.getTexture(i));
|
||||
setActiveTexture(i, Material.getTexture(i));
|
||||
setTransform((E_TRANSFORMATION_STATE) ( ETS_TEXTURE_0 + i ),
|
||||
material.getTextureMatrix(i));
|
||||
}
|
||||
|
@ -792,7 +792,9 @@ bool CD3D8Driver::setRenderTarget(video::ITexture* texture,
|
|||
|
||||
|
||||
//! Creates a render target texture.
|
||||
ITexture* CD3D8Driver::addRenderTargetTexture(const core::dimension2d<u32>& size, const core::string<c16>& name)
|
||||
ITexture* CD3D8Driver::addRenderTargetTexture(const core::dimension2d<u32>& size,
|
||||
const core::string<c16>& name,
|
||||
const ECOLOR_FORMAT format)
|
||||
{
|
||||
ITexture* tex = new CD3D8Texture(this, size, name);
|
||||
addTexture(tex);
|
||||
|
@ -923,7 +925,7 @@ void CD3D8Driver::draw2DImage(const video::ITexture* texture,
|
|||
if (!sourceRect.isValid())
|
||||
return;
|
||||
|
||||
if (!setTexture(0, texture))
|
||||
if (!setActiveTexture(0, texture))
|
||||
return;
|
||||
|
||||
core::position2d<s32> targetPos = pos;
|
||||
|
@ -1114,7 +1116,7 @@ void CD3D8Driver::draw2DImage(const video::ITexture* texture,
|
|||
useColor[2].getAlpha()<255 || useColor[3].getAlpha()<255,
|
||||
true, useAlphaChannelOfTexture);
|
||||
|
||||
setTexture(0, texture);
|
||||
setActiveTexture(0, texture);
|
||||
|
||||
setVertexShader(EVT_STANDARD);
|
||||
|
||||
|
@ -1154,7 +1156,7 @@ void CD3D8Driver::draw2DRectangle(const core::rect<s32>& position,
|
|||
colorLeftDown.getAlpha() < 255 ||
|
||||
colorRightDown.getAlpha() < 255, false, false);
|
||||
|
||||
setTexture(0,0);
|
||||
setActiveTexture(0,0);
|
||||
|
||||
setVertexShader(EVT_STANDARD);
|
||||
|
||||
|
@ -1179,7 +1181,7 @@ void CD3D8Driver::draw2DLine(const core::position2d<s32>& start,
|
|||
color, 0.0f, 0.0f);
|
||||
|
||||
setRenderStates2DMode(color.getAlpha() < 255, false, false);
|
||||
setTexture(0,0);
|
||||
setActiveTexture(0,0);
|
||||
|
||||
setVertexShader(EVT_STANDARD);
|
||||
|
||||
|
@ -1195,7 +1197,7 @@ void CD3D8Driver::drawPixel(u32 x, u32 y, const SColor & color)
|
|||
return;
|
||||
|
||||
setRenderStates2DMode(color.getAlpha() < 255, false, false);
|
||||
setTexture(0,0);
|
||||
setActiveTexture(0,0);
|
||||
|
||||
setVertexShader(EVT_STANDARD);
|
||||
|
||||
|
@ -1535,10 +1537,10 @@ void CD3D8Driver::setRenderStatesStencilShadowMode(bool zfail)
|
|||
|
||||
Transformation3DChanged = false;
|
||||
|
||||
setTexture(0,0);
|
||||
setTexture(1,0);
|
||||
setTexture(2,0);
|
||||
setTexture(3,0);
|
||||
setActiveTexture(0,0);
|
||||
setActiveTexture(1,0);
|
||||
setActiveTexture(2,0);
|
||||
setActiveTexture(3,0);
|
||||
|
||||
pID3DDevice->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_DISABLE);
|
||||
pID3DDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
|
||||
|
@ -1940,7 +1942,7 @@ void CD3D8Driver::drawStencilShadow(bool clearStencilBuffer, video::SColor leftU
|
|||
leftDownEdge.getAlpha() < 255 ||
|
||||
rightDownEdge.getAlpha() < 255);
|
||||
|
||||
setTexture(0,0);
|
||||
setActiveTexture(0,0);
|
||||
|
||||
setVertexShader(EVT_STANDARD);
|
||||
|
||||
|
|
|
@ -187,7 +187,7 @@ namespace video
|
|||
|
||||
//! Creates a render target texture.
|
||||
virtual ITexture* addRenderTargetTexture(const core::dimension2d<u32>& size,
|
||||
const core::string<c16>& name);
|
||||
const core::string<c16>& name, const ECOLOR_FORMAT format = ECF_UNKNOWN);
|
||||
|
||||
//! Clears the ZBuffer.
|
||||
virtual void clearZBuffer();
|
||||
|
@ -238,7 +238,7 @@ namespace video
|
|||
void setRenderStatesStencilShadowMode(bool zfail);
|
||||
|
||||
//! sets the current Texture
|
||||
bool setTexture(s32 stage, const video::ITexture* texture);
|
||||
bool setActiveTexture(u32 stage, const video::ITexture* texture);
|
||||
|
||||
//! resets the device
|
||||
bool reset();
|
||||
|
|
|
@ -670,7 +670,7 @@ void CD3D9Driver::setTransform(E_TRANSFORMATION_STATE state,
|
|||
|
||||
|
||||
//! sets the current Texture
|
||||
bool CD3D9Driver::setTexture(s32 stage, const video::ITexture* texture)
|
||||
bool CD3D9Driver::setActiveTexture(u32 stage, const video::ITexture* texture)
|
||||
{
|
||||
if (CurrentTexture[stage] == texture)
|
||||
return true;
|
||||
|
@ -704,7 +704,7 @@ void CD3D9Driver::setMaterial(const SMaterial& material)
|
|||
|
||||
for (u32 i=0; i<MaxTextureUnits; ++i)
|
||||
{
|
||||
setTexture(i, Material.getTexture(i));
|
||||
setActiveTexture(i, Material.getTexture(i));
|
||||
setTransform((E_TRANSFORMATION_STATE) ( ETS_TEXTURE_0 + i ),
|
||||
material.getTextureMatrix(i));
|
||||
}
|
||||
|
@ -1283,7 +1283,7 @@ void CD3D9Driver::draw2DImage(const video::ITexture* texture,
|
|||
useColor[2].getAlpha()<255 || useColor[3].getAlpha()<255,
|
||||
true, useAlphaChannelOfTexture);
|
||||
|
||||
setTexture(0, const_cast<video::ITexture*>(texture));
|
||||
setActiveTexture(0, const_cast<video::ITexture*>(texture));
|
||||
|
||||
setVertexShader(EVT_STANDARD);
|
||||
|
||||
|
@ -1320,7 +1320,7 @@ void CD3D9Driver::draw2DImage(const video::ITexture* texture,
|
|||
if (!sourceRect.isValid())
|
||||
return;
|
||||
|
||||
if (!setTexture(0, const_cast<video::ITexture*>(texture)))
|
||||
if (!setActiveTexture(0, const_cast<video::ITexture*>(texture)))
|
||||
return;
|
||||
|
||||
core::position2d<s32> targetPos = pos;
|
||||
|
@ -1470,7 +1470,7 @@ void CD3D9Driver::draw2DRectangle(const core::rect<s32>& position,
|
|||
colorLeftDown.getAlpha() < 255 ||
|
||||
colorRightDown.getAlpha() < 255, false, false);
|
||||
|
||||
setTexture(0,0);
|
||||
setActiveTexture(0,0);
|
||||
|
||||
setVertexShader(EVT_STANDARD);
|
||||
|
||||
|
@ -1495,7 +1495,7 @@ void CD3D9Driver::draw2DLine(const core::position2d<s32>& start,
|
|||
color, 0.0f, 0.0f);
|
||||
|
||||
setRenderStates2DMode(color.getAlpha() < 255, false, false);
|
||||
setTexture(0,0);
|
||||
setActiveTexture(0,0);
|
||||
|
||||
setVertexShader(EVT_STANDARD);
|
||||
|
||||
|
@ -1512,7 +1512,7 @@ void CD3D9Driver::drawPixel(u32 x, u32 y, const SColor & color)
|
|||
return;
|
||||
|
||||
setRenderStates2DMode(color.getAlpha() < 255, false, false);
|
||||
setTexture(0,0);
|
||||
setActiveTexture(0,0);
|
||||
|
||||
setVertexShader(EVT_STANDARD);
|
||||
|
||||
|
@ -1885,10 +1885,10 @@ void CD3D9Driver::setRenderStatesStencilShadowMode(bool zfail)
|
|||
|
||||
Transformation3DChanged = false;
|
||||
|
||||
setTexture(0,0);
|
||||
setTexture(1,0);
|
||||
setTexture(2,0);
|
||||
setTexture(3,0);
|
||||
setActiveTexture(0,0);
|
||||
setActiveTexture(1,0);
|
||||
setActiveTexture(2,0);
|
||||
setActiveTexture(3,0);
|
||||
|
||||
pID3DDevice->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_DISABLE);
|
||||
pID3DDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
|
||||
|
@ -2293,7 +2293,7 @@ void CD3D9Driver::drawStencilShadow(bool clearStencilBuffer, video::SColor leftU
|
|||
leftDownEdge.getAlpha() < 255 ||
|
||||
rightDownEdge.getAlpha() < 255);
|
||||
|
||||
setTexture(0,0);
|
||||
setActiveTexture(0,0);
|
||||
|
||||
setVertexShader(EVT_STANDARD);
|
||||
|
||||
|
@ -2595,11 +2595,11 @@ IVideoDriver* CD3D9Driver::getVideoDriver()
|
|||
|
||||
|
||||
//! Creates a render target texture.
|
||||
ITexture* CD3D9Driver::addRenderTargetTexture(
|
||||
const core::dimension2d<u32>& size,
|
||||
const core::string<c16>& name)
|
||||
ITexture* CD3D9Driver::addRenderTargetTexture(const core::dimension2d<u32>& size,
|
||||
const core::string<c16>& name,
|
||||
const ECOLOR_FORMAT format)
|
||||
{
|
||||
ITexture* tex = new CD3D9Texture(this, size, name);
|
||||
ITexture* tex = new CD3D9Texture(this, size, name, format);
|
||||
if (tex)
|
||||
{
|
||||
checkDepthBuffer(tex);
|
||||
|
@ -2774,6 +2774,20 @@ D3DFORMAT CD3D9Driver::getD3DFormatFromColorFormat(ECOLOR_FORMAT format) const
|
|||
return D3DFMT_R8G8B8;
|
||||
case ECF_A8R8G8B8:
|
||||
return D3DFMT_A8R8G8B8;
|
||||
|
||||
// Floating Point formats. Thanks to Patryk "Nadro" Nadrowski.
|
||||
case ECF_R16F:
|
||||
return D3DFMT_R16F;
|
||||
case ECF_G16R16F:
|
||||
return D3DFMT_G16R16F;
|
||||
case ECF_A16B16G16R16F:
|
||||
return D3DFMT_A16B16G16R16F;
|
||||
case ECF_R32F:
|
||||
return D3DFMT_R32F;
|
||||
case ECF_G32R32F:
|
||||
return D3DFMT_G32R32F;
|
||||
case ECF_A32B32G32R32F:
|
||||
return D3DFMT_A32B32G32R32F;
|
||||
}
|
||||
return D3DFMT_UNKNOWN;
|
||||
}
|
||||
|
@ -2783,19 +2797,33 @@ ECOLOR_FORMAT CD3D9Driver::getColorFormatFromD3DFormat(D3DFORMAT format) const
|
|||
{
|
||||
switch(format)
|
||||
{
|
||||
case D3DFMT_X1R5G5B5:
|
||||
case D3DFMT_A1R5G5B5:
|
||||
return ECF_A1R5G5B5;
|
||||
case D3DFMT_A8B8G8R8:
|
||||
case D3DFMT_A8R8G8B8:
|
||||
case D3DFMT_X8R8G8B8:
|
||||
return ECF_A8R8G8B8;
|
||||
case D3DFMT_R5G6B5:
|
||||
return ECF_R5G6B5;
|
||||
case D3DFMT_R8G8B8:
|
||||
return ECF_R8G8B8;
|
||||
default:
|
||||
return (ECOLOR_FORMAT)0;
|
||||
case D3DFMT_X1R5G5B5:
|
||||
case D3DFMT_A1R5G5B5:
|
||||
return ECF_A1R5G5B5;
|
||||
case D3DFMT_A8B8G8R8:
|
||||
case D3DFMT_A8R8G8B8:
|
||||
case D3DFMT_X8R8G8B8:
|
||||
return ECF_A8R8G8B8;
|
||||
case D3DFMT_R5G6B5:
|
||||
return ECF_R5G6B5;
|
||||
case D3DFMT_R8G8B8:
|
||||
return ECF_R8G8B8;
|
||||
|
||||
// Floating Point formats. Thanks to Patryk "Nadro" Nadrowski.
|
||||
case D3DFMT_R16F:
|
||||
return ECF_R16F;
|
||||
case D3DFMT_G16R16F:
|
||||
return ECF_G16R16F;
|
||||
case D3DFMT_A16B16G16R16F:
|
||||
return ECF_A16B16G16R16F;
|
||||
case D3DFMT_R32F:
|
||||
return ECF_R32F;
|
||||
case D3DFMT_G32R32F:
|
||||
return ECF_G32R32F;
|
||||
case D3DFMT_A32B32G32R32F:
|
||||
return ECF_A32B32G32R32F;
|
||||
default:
|
||||
return (ECOLOR_FORMAT)0;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -228,7 +228,7 @@ namespace video
|
|||
|
||||
//! Creates a render target texture.
|
||||
virtual ITexture* addRenderTargetTexture(const core::dimension2d<u32>& size,
|
||||
const core::string<c16>& name);
|
||||
const core::string<c16>& name, const ECOLOR_FORMAT format = ECF_UNKNOWN);
|
||||
|
||||
//! Clears the ZBuffer.
|
||||
virtual void clearZBuffer();
|
||||
|
@ -294,7 +294,7 @@ namespace video
|
|||
void setRenderStatesStencilShadowMode(bool zfail);
|
||||
|
||||
//! sets the current Texture
|
||||
bool setTexture(s32 stage, const video::ITexture* texture);
|
||||
bool setActiveTexture(u32 stage, const video::ITexture* texture);
|
||||
|
||||
//! resets the device
|
||||
bool reset();
|
||||
|
|
|
@ -30,10 +30,11 @@ namespace video
|
|||
{
|
||||
|
||||
//! rendertarget constructor
|
||||
CD3D9Texture::CD3D9Texture(CD3D9Driver* driver, const core::dimension2d<u32>& size, const core::string<c16>& name)
|
||||
CD3D9Texture::CD3D9Texture(CD3D9Driver* driver, const core::dimension2d<u32>& size,
|
||||
const core::string<c16>& name, const ECOLOR_FORMAT format)
|
||||
: ITexture(name), Texture(0), RTTSurface(0), Driver(driver), DepthSurface(0),
|
||||
TextureSize(size), ImageSize(size), Pitch(0),
|
||||
HasMipMaps(false), HardwareMipMaps(false), IsRenderTarget(true)
|
||||
HasMipMaps(false), HardwareMipMaps(false), IsRenderTarget(true), ColorFormat(ECF_UNKNOWN)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
setDebugName("CD3D9Texture");
|
||||
|
@ -43,7 +44,7 @@ CD3D9Texture::CD3D9Texture(CD3D9Driver* driver, const core::dimension2d<u32>& si
|
|||
if (Device)
|
||||
Device->AddRef();
|
||||
|
||||
createRenderTarget();
|
||||
createRenderTarget(format);
|
||||
}
|
||||
|
||||
|
||||
|
@ -115,7 +116,7 @@ CD3D9Texture::~CD3D9Texture()
|
|||
}
|
||||
|
||||
|
||||
void CD3D9Texture::createRenderTarget()
|
||||
void CD3D9Texture::createRenderTarget(const ECOLOR_FORMAT format)
|
||||
{
|
||||
// are texture size restrictions there ?
|
||||
if(!Driver->queryFeature(EVDF_TEXTURE_NPOT))
|
||||
|
@ -126,10 +127,27 @@ void CD3D9Texture::createRenderTarget()
|
|||
os::Printer::log("RenderTarget size has to be a power of two", ELL_INFORMATION);
|
||||
}
|
||||
|
||||
// get irrlicht format from backbuffer
|
||||
ColorFormat = Driver->getColorFormat();
|
||||
D3DFORMAT d3dformat = Driver->getD3DColorFormat();
|
||||
setPitch(d3dformat);
|
||||
|
||||
if(ColorFormat == ECF_UNKNOWN)
|
||||
{
|
||||
// get irrlicht format from backbuffer
|
||||
// (This will get overwritten by the custom format if it is provided, else kept.)
|
||||
ColorFormat = Driver->getColorFormat();
|
||||
setPitch(d3dformat);
|
||||
|
||||
// Use color format if provided.
|
||||
if(format != ECF_UNKNOWN)
|
||||
{
|
||||
ColorFormat = format;
|
||||
d3dformat = Driver->getD3DFormatFromColorFormat(format);
|
||||
setPitch(d3dformat); // This will likely set pitch to 0 for now.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
d3dformat = Driver->getD3DFormatFromColorFormat(ColorFormat);
|
||||
}
|
||||
|
||||
// create texture
|
||||
HRESULT hr;
|
||||
|
|
|
@ -32,7 +32,8 @@ public:
|
|||
u32 flags, const core::string<c16>& name);
|
||||
|
||||
//! rendertarget constructor
|
||||
CD3D9Texture(CD3D9Driver* driver, const core::dimension2d<u32>& size, const core::string<c16>& name);
|
||||
CD3D9Texture(CD3D9Driver* driver, const core::dimension2d<u32>& size, const core::string<c16>& name,
|
||||
const ECOLOR_FORMAT format = ECF_UNKNOWN);
|
||||
|
||||
//! destructor
|
||||
virtual ~CD3D9Texture();
|
||||
|
@ -77,7 +78,7 @@ public:
|
|||
private:
|
||||
friend class CD3D9Driver;
|
||||
|
||||
void createRenderTarget();
|
||||
void createRenderTarget(const ECOLOR_FORMAT format = ECF_UNKNOWN);
|
||||
|
||||
//! returns the size of a texture which would be the optimize size for rendering it
|
||||
inline s32 getTextureSizeFromSurfaceSize(s32 size) const;
|
||||
|
|
|
@ -398,10 +398,14 @@ core::string<c16> CFileSystem::getFileBasename(const core::string<c16>& filename
|
|||
s32 lastSlash = filename.findLast('/');
|
||||
const s32 lastBackSlash = filename.findLast('\\');
|
||||
lastSlash = core::max_(lastSlash, lastBackSlash);
|
||||
|
||||
// get number of chars after last dot
|
||||
s32 end = 0;
|
||||
if (!keepExtension)
|
||||
{
|
||||
end = filename.findLast('.');
|
||||
// take care to search only after last slash to check only for
|
||||
// dots in the filename
|
||||
end = filename.findLast('.', lastSlash);
|
||||
if (end == -1)
|
||||
end=0;
|
||||
else
|
||||
|
|
|
@ -273,7 +273,7 @@ void CGUIButton::draw()
|
|||
if (Text.size())
|
||||
{
|
||||
rect = AbsoluteRect;
|
||||
if (Pressed)
|
||||
if (Pressed)
|
||||
rect.UpperLeftCorner.Y += 2;
|
||||
|
||||
if (font)
|
||||
|
@ -305,6 +305,8 @@ void CGUIButton::setOverrideFont(IGUIFont* font)
|
|||
//! Sets an image which should be displayed on the button when it is in normal state.
|
||||
void CGUIButton::setImage(video::ITexture* image)
|
||||
{
|
||||
if (image)
|
||||
image->grab();
|
||||
if (Image)
|
||||
Image->drop();
|
||||
|
||||
|
@ -315,9 +317,6 @@ void CGUIButton::setImage(video::ITexture* image)
|
|||
ImageRect = core::rect<s32>(core::position2d<s32>(0,0), signedSize);
|
||||
}
|
||||
|
||||
if (Image)
|
||||
Image->grab();
|
||||
|
||||
if (!PressedImage)
|
||||
setPressedImage(Image);
|
||||
}
|
||||
|
@ -326,15 +325,14 @@ void CGUIButton::setImage(video::ITexture* image)
|
|||
//! Sets the image which should be displayed on the button when it is in its normal state.
|
||||
void CGUIButton::setImage(video::ITexture* image, const core::rect<s32>& pos)
|
||||
{
|
||||
if (image)
|
||||
image->grab();
|
||||
if (Image)
|
||||
Image->drop();
|
||||
|
||||
Image = image;
|
||||
ImageRect = pos;
|
||||
|
||||
if (Image)
|
||||
Image->grab();
|
||||
|
||||
if (!PressedImage)
|
||||
setPressedImage(Image, pos);
|
||||
}
|
||||
|
@ -343,32 +341,31 @@ void CGUIButton::setImage(video::ITexture* image, const core::rect<s32>& pos)
|
|||
//! Sets an image which should be displayed on the button when it is in pressed state.
|
||||
void CGUIButton::setPressedImage(video::ITexture* image)
|
||||
{
|
||||
if (image)
|
||||
image->grab();
|
||||
|
||||
if (PressedImage)
|
||||
PressedImage->drop();
|
||||
|
||||
PressedImage = image;
|
||||
if (image)
|
||||
{
|
||||
core::dimension2di signedSize(image->getOriginalSize());
|
||||
const core::dimension2di signedSize(image->getOriginalSize());
|
||||
PressedImageRect = core::rect<s32>(core::position2d<s32>(0,0), signedSize);
|
||||
}
|
||||
|
||||
if (PressedImage)
|
||||
PressedImage->grab();
|
||||
}
|
||||
|
||||
|
||||
//! Sets the image which should be displayed on the button when it is in its pressed state.
|
||||
void CGUIButton::setPressedImage(video::ITexture* image, const core::rect<s32>& pos)
|
||||
{
|
||||
if (image)
|
||||
image->grab();
|
||||
if (PressedImage)
|
||||
PressedImage->drop();
|
||||
|
||||
PressedImage = image;
|
||||
PressedImageRect = pos;
|
||||
|
||||
if (PressedImage)
|
||||
PressedImage->grab();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -90,6 +90,8 @@ void CGUIContextMenu::setSubMenu(u32 index, CGUIContextMenu* menu)
|
|||
if (index >= Items.size())
|
||||
return;
|
||||
|
||||
if (menu)
|
||||
menu->grab();
|
||||
if (Items[index].SubMenu)
|
||||
Items[index].SubMenu->drop();
|
||||
|
||||
|
@ -98,7 +100,6 @@ void CGUIContextMenu::setSubMenu(u32 index, CGUIContextMenu* menu)
|
|||
|
||||
if (Items[index].SubMenu)
|
||||
{
|
||||
menu->grab();
|
||||
menu->AllowFocus = false;
|
||||
if ( Environment->getFocus() == menu )
|
||||
{
|
||||
|
|
|
@ -67,6 +67,7 @@ CGUIEditBox::CGUIEditBox(const wchar_t* text, bool border,
|
|||
}
|
||||
|
||||
breakText();
|
||||
|
||||
calculateScrollPos();
|
||||
}
|
||||
|
||||
|
@ -132,8 +133,12 @@ void CGUIEditBox::setWordWrap(bool enable)
|
|||
|
||||
void CGUIEditBox::updateAbsolutePosition()
|
||||
{
|
||||
core::rect<s32> oldAbsoluteRect(AbsoluteRect);
|
||||
IGUIElement::updateAbsolutePosition();
|
||||
breakText();
|
||||
if ( oldAbsoluteRect != AbsoluteRect )
|
||||
{
|
||||
breakText();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -202,8 +207,7 @@ bool CGUIEditBox::OnEvent(const SEvent& event)
|
|||
if (event.GUIEvent.Caller == this)
|
||||
{
|
||||
MouseMarking = false;
|
||||
MarkBegin = 0;
|
||||
MarkEnd = 0;
|
||||
setTextMarkers(0,0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -230,6 +234,8 @@ bool CGUIEditBox::processKey(const SEvent& event)
|
|||
return false;
|
||||
|
||||
bool textChanged = false;
|
||||
s32 newMarkBegin = MarkBegin;
|
||||
s32 newMarkEnd = MarkEnd;
|
||||
|
||||
// control shortcut handling
|
||||
|
||||
|
@ -245,8 +251,8 @@ bool CGUIEditBox::processKey(const SEvent& event)
|
|||
{
|
||||
case KEY_KEY_A:
|
||||
// select all
|
||||
MarkBegin = 0;
|
||||
MarkEnd = Text.size();
|
||||
newMarkBegin = 0;
|
||||
newMarkEnd = Text.size();
|
||||
break;
|
||||
case KEY_KEY_C:
|
||||
// copy to clipboard
|
||||
|
@ -281,8 +287,8 @@ bool CGUIEditBox::processKey(const SEvent& event)
|
|||
Text = s;
|
||||
|
||||
CursorPos = realmbgn;
|
||||
MarkBegin = 0;
|
||||
MarkEnd = 0;
|
||||
newMarkBegin = 0;
|
||||
newMarkEnd = 0;
|
||||
textChanged = true;
|
||||
}
|
||||
}
|
||||
|
@ -332,8 +338,8 @@ bool CGUIEditBox::processKey(const SEvent& event)
|
|||
}
|
||||
}
|
||||
|
||||
MarkBegin = 0;
|
||||
MarkEnd = 0;
|
||||
newMarkBegin = 0;
|
||||
newMarkEnd = 0;
|
||||
textChanged = true;
|
||||
}
|
||||
break;
|
||||
|
@ -341,30 +347,30 @@ bool CGUIEditBox::processKey(const SEvent& event)
|
|||
// move/highlight to start of text
|
||||
if (event.KeyInput.Shift)
|
||||
{
|
||||
MarkEnd = CursorPos;
|
||||
MarkBegin = 0;
|
||||
newMarkEnd = CursorPos;
|
||||
newMarkBegin = 0;
|
||||
CursorPos = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
CursorPos = 0;
|
||||
MarkBegin = 0;
|
||||
MarkEnd = 0;
|
||||
newMarkBegin = 0;
|
||||
newMarkEnd = 0;
|
||||
}
|
||||
break;
|
||||
case KEY_END:
|
||||
// move/highlight to end of text
|
||||
if (event.KeyInput.Shift)
|
||||
{
|
||||
MarkBegin = CursorPos;
|
||||
MarkEnd = Text.size();
|
||||
newMarkBegin = CursorPos;
|
||||
newMarkEnd = Text.size();
|
||||
CursorPos = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
CursorPos = Text.size();
|
||||
MarkBegin = 0;
|
||||
MarkEnd = 0;
|
||||
newMarkBegin = 0;
|
||||
newMarkEnd = 0;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -389,14 +395,14 @@ bool CGUIEditBox::processKey(const SEvent& event)
|
|||
if (event.KeyInput.Shift)
|
||||
{
|
||||
if (MarkBegin == MarkEnd)
|
||||
MarkBegin = CursorPos;
|
||||
newMarkBegin = CursorPos;
|
||||
|
||||
MarkEnd = p;
|
||||
newMarkEnd = p;
|
||||
}
|
||||
else
|
||||
{
|
||||
MarkBegin = 0;
|
||||
MarkEnd = 0;
|
||||
newMarkBegin = 0;
|
||||
newMarkEnd = 0;
|
||||
}
|
||||
CursorPos = p;
|
||||
BlinkStartTime = os::Timer::getTime();
|
||||
|
@ -415,13 +421,13 @@ bool CGUIEditBox::processKey(const SEvent& event)
|
|||
if (event.KeyInput.Shift)
|
||||
{
|
||||
if (MarkBegin == MarkEnd)
|
||||
MarkBegin = CursorPos;
|
||||
MarkEnd = p;
|
||||
newMarkBegin = CursorPos;
|
||||
newMarkEnd = p;
|
||||
}
|
||||
else
|
||||
{
|
||||
MarkBegin = 0;
|
||||
MarkEnd = 0;
|
||||
newMarkBegin = 0;
|
||||
newMarkEnd = 0;
|
||||
}
|
||||
CursorPos = p;
|
||||
BlinkStartTime = os::Timer::getTime();
|
||||
|
@ -434,13 +440,7 @@ bool CGUIEditBox::processKey(const SEvent& event)
|
|||
}
|
||||
else
|
||||
{
|
||||
SEvent e;
|
||||
e.EventType = EET_GUI_EVENT;
|
||||
e.GUIEvent.Caller = this;
|
||||
e.GUIEvent.Element = 0;
|
||||
e.GUIEvent.EventType = EGET_EDITBOX_ENTER;
|
||||
if (Parent)
|
||||
Parent->OnEvent(e);
|
||||
sendGuiEvent( EGET_EDITBOX_ENTER );
|
||||
}
|
||||
break;
|
||||
case KEY_LEFT:
|
||||
|
@ -450,15 +450,15 @@ bool CGUIEditBox::processKey(const SEvent& event)
|
|||
if (CursorPos > 0)
|
||||
{
|
||||
if (MarkBegin == MarkEnd)
|
||||
MarkBegin = CursorPos;
|
||||
newMarkBegin = CursorPos;
|
||||
|
||||
MarkEnd = CursorPos-1;
|
||||
newMarkEnd = CursorPos-1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MarkBegin = 0;
|
||||
MarkEnd = 0;
|
||||
newMarkBegin = 0;
|
||||
newMarkEnd = 0;
|
||||
}
|
||||
|
||||
if (CursorPos > 0) CursorPos--;
|
||||
|
@ -471,15 +471,15 @@ bool CGUIEditBox::processKey(const SEvent& event)
|
|||
if (Text.size() > (u32)CursorPos)
|
||||
{
|
||||
if (MarkBegin == MarkEnd)
|
||||
MarkBegin = CursorPos;
|
||||
newMarkBegin = CursorPos;
|
||||
|
||||
MarkEnd = CursorPos+1;
|
||||
newMarkEnd = CursorPos+1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MarkBegin = 0;
|
||||
MarkEnd = 0;
|
||||
newMarkBegin = 0;
|
||||
newMarkEnd = 0;
|
||||
}
|
||||
|
||||
if (Text.size() > (u32)CursorPos) CursorPos++;
|
||||
|
@ -501,13 +501,13 @@ bool CGUIEditBox::processKey(const SEvent& event)
|
|||
|
||||
if (event.KeyInput.Shift)
|
||||
{
|
||||
MarkBegin = mb;
|
||||
MarkEnd = CursorPos;
|
||||
newMarkBegin = mb;
|
||||
newMarkEnd = CursorPos;
|
||||
}
|
||||
else
|
||||
{
|
||||
MarkBegin = 0;
|
||||
MarkEnd = 0;
|
||||
newMarkBegin = 0;
|
||||
newMarkEnd = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -532,13 +532,13 @@ bool CGUIEditBox::processKey(const SEvent& event)
|
|||
|
||||
if (event.KeyInput.Shift)
|
||||
{
|
||||
MarkBegin = mb;
|
||||
MarkEnd = CursorPos;
|
||||
newMarkBegin = mb;
|
||||
newMarkEnd = CursorPos;
|
||||
}
|
||||
else
|
||||
{
|
||||
MarkBegin = 0;
|
||||
MarkEnd = 0;
|
||||
newMarkBegin = 0;
|
||||
newMarkEnd = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -583,8 +583,8 @@ bool CGUIEditBox::processKey(const SEvent& event)
|
|||
if (CursorPos < 0)
|
||||
CursorPos = 0;
|
||||
BlinkStartTime = os::Timer::getTime();
|
||||
MarkBegin = 0;
|
||||
MarkEnd = 0;
|
||||
newMarkBegin = 0;
|
||||
newMarkEnd = 0;
|
||||
textChanged = true;
|
||||
}
|
||||
break;
|
||||
|
@ -620,8 +620,8 @@ bool CGUIEditBox::processKey(const SEvent& event)
|
|||
CursorPos = (s32)Text.size();
|
||||
|
||||
BlinkStartTime = os::Timer::getTime();
|
||||
MarkBegin = 0;
|
||||
MarkEnd = 0;
|
||||
newMarkBegin = 0;
|
||||
newMarkEnd = 0;
|
||||
textChanged = true;
|
||||
}
|
||||
break;
|
||||
|
@ -661,9 +661,15 @@ bool CGUIEditBox::processKey(const SEvent& event)
|
|||
break;
|
||||
}
|
||||
|
||||
// Set new text markers
|
||||
setTextMarkers( newMarkBegin, newMarkEnd );
|
||||
|
||||
// break the text if it has changed
|
||||
if (textChanged)
|
||||
{
|
||||
breakText();
|
||||
sendGuiEvent(EGET_EDITBOX_CHANGED);
|
||||
}
|
||||
|
||||
calculateScrollPos();
|
||||
|
||||
|
@ -712,7 +718,9 @@ void CGUIEditBox::draw()
|
|||
if (font)
|
||||
{
|
||||
if (LastBreakFont != font)
|
||||
{
|
||||
breakText();
|
||||
}
|
||||
|
||||
// calculate cursor pos
|
||||
|
||||
|
@ -862,8 +870,6 @@ void CGUIEditBox::setText(const wchar_t* text)
|
|||
Text = text;
|
||||
CursorPos = 0;
|
||||
HScrollPos = 0;
|
||||
MarkBegin = 0;
|
||||
MarkEnd = 0;
|
||||
breakText();
|
||||
}
|
||||
|
||||
|
@ -933,7 +939,9 @@ bool CGUIEditBox::processMouse(const SEvent& event)
|
|||
{
|
||||
CursorPos = getCursorPos(event.MouseInput.X, event.MouseInput.Y);
|
||||
if (MouseMarking)
|
||||
MarkEnd = CursorPos;
|
||||
{
|
||||
setTextMarkers( MarkBegin, CursorPos );
|
||||
}
|
||||
MouseMarking = false;
|
||||
calculateScrollPos();
|
||||
return true;
|
||||
|
@ -944,7 +952,7 @@ bool CGUIEditBox::processMouse(const SEvent& event)
|
|||
if (MouseMarking)
|
||||
{
|
||||
CursorPos = getCursorPos(event.MouseInput.X, event.MouseInput.Y);
|
||||
MarkEnd = CursorPos;
|
||||
setTextMarkers( MarkBegin, CursorPos );
|
||||
calculateScrollPos();
|
||||
return true;
|
||||
}
|
||||
|
@ -956,8 +964,7 @@ bool CGUIEditBox::processMouse(const SEvent& event)
|
|||
BlinkStartTime = os::Timer::getTime();
|
||||
MouseMarking = true;
|
||||
CursorPos = getCursorPos(event.MouseInput.X, event.MouseInput.Y);
|
||||
MarkBegin = CursorPos;
|
||||
MarkEnd = CursorPos;
|
||||
setTextMarkers(CursorPos, CursorPos );
|
||||
calculateScrollPos();
|
||||
return true;
|
||||
}
|
||||
|
@ -973,11 +980,12 @@ bool CGUIEditBox::processMouse(const SEvent& event)
|
|||
// move cursor
|
||||
CursorPos = getCursorPos(event.MouseInput.X, event.MouseInput.Y);
|
||||
|
||||
s32 newMarkBegin = MarkBegin;
|
||||
if (!MouseMarking)
|
||||
MarkBegin = CursorPos;
|
||||
newMarkBegin = CursorPos;
|
||||
|
||||
MouseMarking = true;
|
||||
MarkEnd = CursorPos;
|
||||
setTextMarkers( newMarkBegin, CursorPos);
|
||||
calculateScrollPos();
|
||||
return true;
|
||||
}
|
||||
|
@ -1273,11 +1281,11 @@ void CGUIEditBox::inputChar(wchar_t c)
|
|||
}
|
||||
|
||||
BlinkStartTime = os::Timer::getTime();
|
||||
MarkBegin = 0;
|
||||
MarkEnd = 0;
|
||||
setTextMarkers(0, 0);
|
||||
}
|
||||
}
|
||||
breakText();
|
||||
sendGuiEvent(EGET_EDITBOX_CHANGED);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1331,6 +1339,31 @@ void CGUIEditBox::calculateScrollPos()
|
|||
// todo: adjust scrollbar
|
||||
}
|
||||
|
||||
//! set text markers
|
||||
void CGUIEditBox::setTextMarkers(s32 begin, s32 end)
|
||||
{
|
||||
if ( begin != MarkBegin || end != MarkEnd )
|
||||
{
|
||||
MarkBegin = begin;
|
||||
MarkEnd = end;
|
||||
sendGuiEvent(EGET_EDITBOX_MARKING_CHANGED);
|
||||
}
|
||||
}
|
||||
|
||||
//! send some gui event to parent
|
||||
void CGUIEditBox::sendGuiEvent(EGUI_EVENT_TYPE type)
|
||||
{
|
||||
if ( Parent )
|
||||
{
|
||||
SEvent e;
|
||||
e.EventType = EET_GUI_EVENT;
|
||||
e.GUIEvent.Caller = this;
|
||||
e.GUIEvent.Element = 0;
|
||||
e.GUIEvent.EventType = type;
|
||||
|
||||
Parent->OnEvent(e);
|
||||
}
|
||||
}
|
||||
|
||||
//! Writes attributes of the element.
|
||||
void CGUIEditBox::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const
|
||||
|
|
|
@ -117,6 +117,10 @@ namespace gui
|
|||
void inputChar(wchar_t c);
|
||||
//! calculates the current scroll position
|
||||
void calculateScrollPos();
|
||||
//! send some gui event to parent
|
||||
void sendGuiEvent(EGUI_EVENT_TYPE type);
|
||||
//! set text markers
|
||||
void setTextMarkers(s32 begin, s32 end);
|
||||
|
||||
bool processKey(const SEvent& event);
|
||||
bool processMouse(const SEvent& event);
|
||||
|
|
|
@ -1441,6 +1441,7 @@ IGUISpriteBank* CGUIEnvironment::addEmptySpriteBank(const core::string<c16>& nam
|
|||
|
||||
SSpriteBank b;
|
||||
b.Filename = name;
|
||||
b.Filename.make_lower();
|
||||
|
||||
const s32 index = Banks.binary_search(b);
|
||||
if (index != -1)
|
||||
|
|
|
@ -597,6 +597,8 @@ u32 CGUIListBox::addItem(const wchar_t* text, s32 icon)
|
|||
|
||||
void CGUIListBox::setSpriteBank(IGUISpriteBank* bank)
|
||||
{
|
||||
if ( bank == IconBank )
|
||||
return;
|
||||
if (IconBank)
|
||||
IconBank->drop();
|
||||
|
||||
|
@ -884,6 +886,13 @@ void CGUIListBox::setItemHeight( s32 height )
|
|||
}
|
||||
|
||||
|
||||
//! Sets whether to draw the background
|
||||
void CGUIListBox::setDrawBackground(bool draw)
|
||||
{
|
||||
DrawBack = draw;
|
||||
}
|
||||
|
||||
|
||||
} // end namespace gui
|
||||
} // end namespace irr
|
||||
|
||||
|
|
|
@ -125,6 +125,10 @@ namespace gui
|
|||
//! set global itemHeight
|
||||
virtual void setItemHeight( s32 height );
|
||||
|
||||
//! Sets whether to draw the background
|
||||
virtual void setDrawBackground(bool draw);
|
||||
|
||||
|
||||
private:
|
||||
|
||||
struct ListItem
|
||||
|
|
|
@ -142,19 +142,35 @@ bool CGUIMenu::OnEvent(const SEvent& event)
|
|||
if (!AbsoluteClippingRect.isPointInside(p))
|
||||
{
|
||||
shouldCloseSubMenu = false;
|
||||
}
|
||||
highlight(core::position2d<s32>(event.MouseInput.X, event.MouseInput.Y), true);
|
||||
if ( shouldCloseSubMenu )
|
||||
{
|
||||
Environment->removeFocus(this);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
case EMIE_LMOUSE_LEFT_UP:
|
||||
{
|
||||
core::position2d<s32> p(event.MouseInput.X, event.MouseInput.Y);
|
||||
if (!AbsoluteClippingRect.isPointInside(p))
|
||||
{
|
||||
s32 t = sendClick(p);
|
||||
if ((t==0 || t==1) && Environment->hasFocus(this))
|
||||
Environment->removeFocus(this);
|
||||
}
|
||||
highlight(core::position2d<s32>(event.MouseInput.X, event.MouseInput.Y), true);
|
||||
if ( shouldCloseSubMenu )
|
||||
closeAllSubMenus();
|
||||
|
||||
return true;
|
||||
|
||||
return true;
|
||||
}
|
||||
case EMIE_MOUSE_MOVED:
|
||||
if (Environment->hasFocus(this))
|
||||
highlight(core::position2d<s32>(event.MouseInput.X, event.MouseInput.Y), hasOpenSubMenu());
|
||||
if (Environment->hasFocus(this) && HighLighted >= 0)
|
||||
{
|
||||
s32 oldHighLighted = HighLighted;
|
||||
highlight(core::position2d<s32>(event.MouseInput.X, event.MouseInput.Y), true);
|
||||
if ( HighLighted < 0 )
|
||||
HighLighted = oldHighLighted; // keep last hightlight active when moving outside the area
|
||||
}
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -40,14 +40,12 @@ CGUIMeshViewer::~CGUIMeshViewer()
|
|||
//! sets the mesh to be shown
|
||||
void CGUIMeshViewer::setMesh(scene::IAnimatedMesh* mesh)
|
||||
{
|
||||
if (mesh)
|
||||
mesh->grab();
|
||||
if (Mesh)
|
||||
Mesh->drop();
|
||||
|
||||
Mesh = mesh;
|
||||
if (!Mesh)
|
||||
return;
|
||||
else
|
||||
Mesh->grab();
|
||||
|
||||
/* This might be used for proper transformation etc.
|
||||
core::vector3df center(0.0f,0.0f,0.0f);
|
||||
|
|
|
@ -29,24 +29,71 @@ CGUIModalScreen::CGUIModalScreen(IGUIEnvironment* environment, IGUIElement* pare
|
|||
setTabGroup(true);
|
||||
}
|
||||
|
||||
bool CGUIModalScreen::canTakeFocus(IGUIElement* target) const
|
||||
{
|
||||
return (target && (target == this // this element can take it
|
||||
|| isMyChild(target) // own childs also
|
||||
|| (target->getType() == EGUIET_MODAL_SCREEN )// other modals also fine
|
||||
|| (target->getParent() && target->getParent()->getType() == EGUIET_MODAL_SCREEN ))) // childs of other modals will do
|
||||
;
|
||||
}
|
||||
|
||||
bool CGUIModalScreen::isVisible() const
|
||||
{
|
||||
// any parent invisible?
|
||||
IGUIElement * parentElement = getParent();
|
||||
while ( parentElement )
|
||||
{
|
||||
if ( !parentElement->isVisible() )
|
||||
return false;
|
||||
parentElement = parentElement->getParent();
|
||||
}
|
||||
|
||||
// if we have no children then the modal is probably abused as a way to block input
|
||||
if ( Children.empty() )
|
||||
{
|
||||
return IGUIElement::isVisible();
|
||||
}
|
||||
|
||||
// any child visible?
|
||||
bool visible = false;
|
||||
core::list<IGUIElement*>::ConstIterator it = Children.begin();
|
||||
for (; it != Children.end(); ++it)
|
||||
{
|
||||
if ( (*it)->isVisible() )
|
||||
{
|
||||
visible = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return visible;
|
||||
}
|
||||
|
||||
bool CGUIModalScreen::isPointInside(const core::position2d<s32>& point) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//! called if an event happened.
|
||||
bool CGUIModalScreen::OnEvent(const SEvent& event)
|
||||
{
|
||||
if (!IsEnabled || !isVisible() )
|
||||
return IGUIElement::OnEvent(event);
|
||||
|
||||
switch(event.EventType)
|
||||
{
|
||||
case EET_GUI_EVENT:
|
||||
switch(event.GUIEvent.EventType)
|
||||
{
|
||||
case EGET_ELEMENT_FOCUSED:
|
||||
// only children are allowed the focus
|
||||
if (event.GUIEvent.Caller != this && !isMyChild(event.GUIEvent.Caller))
|
||||
if ( !canTakeFocus(event.GUIEvent.Caller))
|
||||
{
|
||||
Environment->setFocus(this);
|
||||
}
|
||||
return false;
|
||||
case EGET_ELEMENT_FOCUS_LOST:
|
||||
// only children are allowed the focus
|
||||
if (!(isMyChild(event.GUIEvent.Element) || event.GUIEvent.Element == this))
|
||||
{
|
||||
if ( !canTakeFocus(event.GUIEvent.Element))
|
||||
{
|
||||
MouseDownTime = os::Timer::getTime();
|
||||
return true;
|
||||
}
|
||||
|
@ -116,7 +163,9 @@ void CGUIModalScreen::removeChild(IGUIElement* child)
|
|||
IGUIElement::removeChild(child);
|
||||
|
||||
if (Children.empty())
|
||||
{
|
||||
remove();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -148,13 +197,13 @@ void CGUIModalScreen::updateAbsolutePosition()
|
|||
//! Writes attributes of the element.
|
||||
void CGUIModalScreen::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const
|
||||
{
|
||||
// these don't get serialized, their status is added to their children.
|
||||
IGUIElement::serializeAttributes(out,options);
|
||||
}
|
||||
|
||||
//! Reads attributes of the element
|
||||
void CGUIModalScreen::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)
|
||||
{
|
||||
// these don't get deserialized. children create them if required
|
||||
IGUIElement::deserializeAttributes(in, options);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -38,12 +38,23 @@ namespace gui
|
|||
//! Updates the absolute position.
|
||||
virtual void updateAbsolutePosition();
|
||||
|
||||
//! Modalscreen is not a typical element, but rather acts like a state for it's children.
|
||||
//! isVisible is overriden to give this a useful behaviour, so that a modal will no longer
|
||||
//! be active when its parent is invisible or all its children are invisible.
|
||||
virtual bool isVisible() const;
|
||||
|
||||
//! Modals are infinite so every point is inside
|
||||
virtual bool isPointInside(const core::position2d<s32>& point) const;
|
||||
|
||||
//! Writes attributes of the element.
|
||||
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const;
|
||||
|
||||
//! Reads attributes of the element
|
||||
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options);
|
||||
|
||||
protected:
|
||||
virtual bool canTakeFocus(IGUIElement* target) const;
|
||||
|
||||
private:
|
||||
|
||||
u32 MouseDownTime;
|
||||
|
|
|
@ -205,13 +205,12 @@ void CGUISkin::setFont(IGUIFont* font, EGUI_DEFAULT_FONT which)
|
|||
if ((u32)which >= EGDS_COUNT)
|
||||
return;
|
||||
|
||||
if (font)
|
||||
font->grab();
|
||||
if (Fonts[which])
|
||||
Fonts[which]->drop();
|
||||
|
||||
Fonts[which] = font;
|
||||
|
||||
if (Fonts[which])
|
||||
Fonts[which]->grab();
|
||||
}
|
||||
|
||||
|
||||
|
@ -225,12 +224,12 @@ IGUISpriteBank* CGUISkin::getSpriteBank() const
|
|||
//! set a new sprite bank or remove one by passing 0
|
||||
void CGUISkin::setSpriteBank(IGUISpriteBank* bank)
|
||||
{
|
||||
if (SpriteBank)
|
||||
SpriteBank->drop();
|
||||
|
||||
if (bank)
|
||||
bank->grab();
|
||||
|
||||
if (SpriteBank)
|
||||
SpriteBank->drop();
|
||||
|
||||
SpriteBank = bank;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,10 @@ CGUISpinBox::CGUISpinBox(const wchar_t* text, bool border,IGUIEnvironment* envir
|
|||
RangeMin(-FLT_MAX), RangeMax(FLT_MAX), FormatString(L"%f"),
|
||||
DecimalPlaces(-1)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
setDebugName("CGUISpinBox");
|
||||
#endif
|
||||
|
||||
s32 ButtonWidth = 16;
|
||||
IGUISpriteBank *sb = 0;
|
||||
if (environment && environment->getSkin())
|
||||
|
@ -199,7 +203,7 @@ bool CGUISpinBox::OnEvent(const SEvent& event)
|
|||
changeEvent = true;
|
||||
}
|
||||
}
|
||||
if ( event.GUIEvent.EventType == EGET_EDITBOX_ENTER )
|
||||
if ( event.GUIEvent.EventType == EGET_EDITBOX_CHANGED )
|
||||
{
|
||||
if (event.GUIEvent.Caller == EditBox)
|
||||
{
|
||||
|
|
|
@ -17,6 +17,10 @@ namespace gui
|
|||
CGUISpriteBank::CGUISpriteBank(IGUIEnvironment* env) :
|
||||
Environment(env), Driver(0)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
setDebugName("CGUISpriteBank");
|
||||
#endif
|
||||
|
||||
if (Environment)
|
||||
{
|
||||
Driver = Environment->getVideoDriver();
|
||||
|
@ -80,12 +84,12 @@ void CGUISpriteBank::setTexture(u32 index, video::ITexture* texture)
|
|||
while (index >= Textures.size())
|
||||
Textures.push_back(0);
|
||||
|
||||
if (Textures[index])
|
||||
Textures[index]->drop();
|
||||
|
||||
if (texture)
|
||||
texture->grab();
|
||||
|
||||
if (Textures[index])
|
||||
Textures[index]->drop();
|
||||
|
||||
Textures[index] = texture;
|
||||
}
|
||||
|
||||
|
|
|
@ -353,6 +353,7 @@ void* CGUITable::getCellData(u32 rowIndex, u32 columnIndex ) const
|
|||
//! clears the list
|
||||
void CGUITable::clear()
|
||||
{
|
||||
Selected = -1;
|
||||
Rows.clear();
|
||||
Columns.clear();
|
||||
|
||||
|
@ -368,6 +369,7 @@ void CGUITable::clear()
|
|||
|
||||
void CGUITable::clearRows()
|
||||
{
|
||||
Selected = -1;
|
||||
Rows.clear();
|
||||
|
||||
if (VerticalScrollBar)
|
||||
|
|
|
@ -74,8 +74,8 @@ void CGUITreeViewNode::clearChilds()
|
|||
}
|
||||
|
||||
IGUITreeViewNode* CGUITreeViewNode::addChildBack(
|
||||
const wchar_t* text,
|
||||
const wchar_t* icon /*= 0*/,
|
||||
const wchar_t* text,
|
||||
const wchar_t* icon /*= 0*/,
|
||||
s32 imageIndex /*= -1*/,
|
||||
s32 selectedImageIndex /*= -1*/,
|
||||
void* data /*= 0*/,
|
||||
|
@ -97,9 +97,9 @@ IGUITreeViewNode* CGUITreeViewNode::addChildBack(
|
|||
return newChild;
|
||||
}
|
||||
|
||||
IGUITreeViewNode* CGUITreeViewNode::addChildFront(
|
||||
const wchar_t* text,
|
||||
const wchar_t* icon /*= 0*/,
|
||||
IGUITreeViewNode* CGUITreeViewNode::addChildFront(
|
||||
const wchar_t* text,
|
||||
const wchar_t* icon /*= 0*/,
|
||||
s32 imageIndex /*= -1*/,
|
||||
s32 selectedImageIndex /*= -1*/,
|
||||
void* data /*= 0*/,
|
||||
|
@ -121,10 +121,10 @@ IGUITreeViewNode* CGUITreeViewNode::addChildFront(
|
|||
return newChild;
|
||||
}
|
||||
|
||||
IGUITreeViewNode* CGUITreeViewNode::insertChildAfter(
|
||||
IGUITreeViewNode* other,
|
||||
const wchar_t* text,
|
||||
const wchar_t* icon /*= 0*/,
|
||||
IGUITreeViewNode* CGUITreeViewNode::insertChildAfter(
|
||||
IGUITreeViewNode* other,
|
||||
const wchar_t* text,
|
||||
const wchar_t* icon /*= 0*/,
|
||||
s32 imageIndex /*= -1*/,
|
||||
s32 selectedImageIndex /*= -1*/,
|
||||
void* data /*= 0*/,
|
||||
|
@ -155,10 +155,10 @@ IGUITreeViewNode* CGUITreeViewNode::insertChildAfter(
|
|||
return newChild;
|
||||
}
|
||||
|
||||
IGUITreeViewNode* CGUITreeViewNode::insertChildBefore(
|
||||
IGUITreeViewNode* other,
|
||||
const wchar_t* text,
|
||||
const wchar_t* icon /*= 0*/,
|
||||
IGUITreeViewNode* CGUITreeViewNode::insertChildBefore(
|
||||
IGUITreeViewNode* other,
|
||||
const wchar_t* text,
|
||||
const wchar_t* icon /*= 0*/,
|
||||
s32 imageIndex /*= -1*/,
|
||||
s32 selectedImageIndex /*= -1*/,
|
||||
void* data /*= 0*/,
|
||||
|
@ -421,10 +421,10 @@ bool CGUITreeViewNode::isVisible() const
|
|||
|
||||
|
||||
//! constructor
|
||||
CGUITreeView::CGUITreeView(IGUIEnvironment* environment, IGUIElement* parent,
|
||||
CGUITreeView::CGUITreeView(IGUIEnvironment* environment, IGUIElement* parent,
|
||||
s32 id, core::rect<s32> rectangle, bool clip,
|
||||
bool drawBack,bool scrollBarVertical, bool scrollBarHorizontal)
|
||||
: IGUITreeView( environment, parent, id, rectangle ),
|
||||
: IGUITreeView( environment, parent, id, rectangle ),
|
||||
Root(0), Selected(0),
|
||||
ItemHeight( 0 ),
|
||||
IndentWidth( 0 ),
|
||||
|
@ -452,7 +452,7 @@ CGUITreeView::CGUITreeView(IGUIEnvironment* environment, IGUIElement* parent,
|
|||
if ( scrollBarVertical )
|
||||
{
|
||||
ScrollBarV = new CGUIScrollBar( false, Environment, this, 0,
|
||||
core::rect<s32>( RelativeRect.getWidth() - s,
|
||||
core::rect<s32>( RelativeRect.getWidth() - s,
|
||||
0,
|
||||
RelativeRect.getWidth(),
|
||||
RelativeRect.getHeight() - (scrollBarHorizontal ? s : 0 )
|
||||
|
@ -539,7 +539,7 @@ void CGUITreeView::recalculateItemHeight()
|
|||
|
||||
if( IconFont )
|
||||
{
|
||||
s32 height = IconFont->getDimension( L" " ).Height;
|
||||
s32 height = IconFont->getDimension( L" " ).Height;
|
||||
if( height > ItemHeight )
|
||||
{
|
||||
ItemHeight = height;
|
||||
|
@ -658,7 +658,7 @@ bool CGUITreeView::OnEvent( const SEvent &event )
|
|||
}
|
||||
|
||||
Selecting = false;
|
||||
Environment->removeFocus( this );
|
||||
Environment->removeFocus( this );
|
||||
mouseAction( event.MouseInput.X, event.MouseInput.Y );
|
||||
return true;
|
||||
break;
|
||||
|
@ -728,7 +728,7 @@ void CGUITreeView::mouseAction( s32 xpos, s32 ypos, bool onlyHover /*= false*/ )
|
|||
Selected = hitNode;
|
||||
}
|
||||
|
||||
if( hitNode && !onlyHover
|
||||
if( hitNode && !onlyHover
|
||||
&& xpos < hitNode->getLevel() * IndentWidth
|
||||
&& xpos > ( hitNode->getLevel() - 1 ) * IndentWidth
|
||||
&& hitNode->hasChilds() )
|
||||
|
@ -804,7 +804,7 @@ void CGUITreeView::draw()
|
|||
clipRect );
|
||||
}
|
||||
|
||||
// draw the border
|
||||
// draw the border
|
||||
frameRect.LowerRightCorner.Y = frameRect.UpperLeftCorner.Y + 1;
|
||||
driver->draw2DRectangle( skin->getColor( EGDC_3D_SHADOW ), frameRect,
|
||||
clipRect );
|
||||
|
@ -953,10 +953,10 @@ void CGUITreeView::draw()
|
|||
index = node->getImageIndex();
|
||||
}
|
||||
ImageList->draw(
|
||||
index,
|
||||
core::position2d<s32>(
|
||||
textRect.UpperLeftCorner.X,
|
||||
textRect.UpperLeftCorner.Y + ( ( textRect.getHeight() - ImageList->getImageSize().Height ) >> 1 ) ),
|
||||
index,
|
||||
core::position2d<s32>(
|
||||
textRect.UpperLeftCorner.X,
|
||||
textRect.UpperLeftCorner.Y + ( ( textRect.getHeight() - ImageList->getImageSize().Height ) >> 1 ) ),
|
||||
&clientClip );
|
||||
iconWidth += ImageList->getImageSize().Width + 3;
|
||||
textRect.UpperLeftCorner.X += ImageList->getImageSize().Width + 3;
|
||||
|
@ -976,7 +976,7 @@ void CGUITreeView::draw()
|
|||
textRect.UpperLeftCorner.X -= iconWidth;
|
||||
}
|
||||
|
||||
// draw the lines if neccessary
|
||||
// draw the lines if neccessary
|
||||
if( LinesVisible )
|
||||
{
|
||||
core::rect<s32> rc;
|
||||
|
@ -997,7 +997,7 @@ void CGUITreeView::draw()
|
|||
clipRect );
|
||||
|
||||
if( node->getParent() != Root )
|
||||
{
|
||||
{
|
||||
// vertical line
|
||||
if( node == node->getParent()->getFirstChild() )
|
||||
{
|
||||
|
@ -1012,7 +1012,7 @@ void CGUITreeView::draw()
|
|||
clipRect );
|
||||
|
||||
// the vertical lines of all parents
|
||||
IGUITreeViewNode* nodeTmp = node->getParent();
|
||||
IGUITreeViewNode* nodeTmp = node->getParent();
|
||||
rc.UpperLeftCorner.Y = frameRect.UpperLeftCorner.Y - ( frameRect.getHeight() >> 1 );
|
||||
for( s32 n = 0; n < node->getLevel() - 2; ++n )
|
||||
{
|
||||
|
@ -1046,7 +1046,9 @@ void CGUITreeView::setIconFont( IGUIFont* font )
|
|||
{
|
||||
s32 height;
|
||||
|
||||
if( IconFont )
|
||||
if ( font )
|
||||
font->grab();
|
||||
if ( IconFont )
|
||||
{
|
||||
IconFont->drop();
|
||||
}
|
||||
|
@ -1054,12 +1056,11 @@ void CGUITreeView::setIconFont( IGUIFont* font )
|
|||
IconFont = font;
|
||||
if( IconFont )
|
||||
{
|
||||
height = IconFont->getDimension( L" " ).Height;
|
||||
height = IconFont->getDimension( L" " ).Height;
|
||||
if( height > ItemHeight )
|
||||
{
|
||||
ItemHeight = height;
|
||||
}
|
||||
IconFont->grab();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1067,6 +1068,8 @@ void CGUITreeView::setIconFont( IGUIFont* font )
|
|||
//! The default is 0 (no images).
|
||||
void CGUITreeView::setImageList( IGUIImageList* imageList )
|
||||
{
|
||||
if (imageList )
|
||||
imageList->grab();
|
||||
if( ImageList )
|
||||
{
|
||||
ImageList->drop();
|
||||
|
@ -1079,7 +1082,6 @@ void CGUITreeView::setImageList( IGUIImageList* imageList )
|
|||
{
|
||||
ItemHeight = ImageList->getImageSize().Height + 1;
|
||||
}
|
||||
ImageList->grab();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace gui
|
|||
|
||||
//! constructor
|
||||
CGUIWindow::CGUIWindow(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
|
||||
: IGUIWindow(environment, parent, id, rectangle), Dragging(false), IsDraggable(true)
|
||||
: IGUIWindow(environment, parent, id, rectangle), Dragging(false), IsDraggable(true), DrawBackground(true), DrawTitlebar(true)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
setDebugName("CGUIWindow");
|
||||
|
@ -216,22 +216,25 @@ void CGUIWindow::draw()
|
|||
core::rect<s32> rect = AbsoluteRect;
|
||||
|
||||
// draw body fast
|
||||
rect = skin->draw3DWindowBackground(this, true, skin->getColor(EGDC_ACTIVE_BORDER),
|
||||
AbsoluteRect, &AbsoluteClippingRect);
|
||||
if ( DrawBackground )
|
||||
{
|
||||
rect = skin->draw3DWindowBackground(this, DrawTitlebar, skin->getColor(EGDC_ACTIVE_BORDER),
|
||||
AbsoluteRect, &AbsoluteClippingRect);
|
||||
|
||||
if (Text.size())
|
||||
{
|
||||
rect.UpperLeftCorner.X += skin->getSize(EGDS_TEXT_DISTANCE_X);
|
||||
rect.UpperLeftCorner.Y += skin->getSize(EGDS_TEXT_DISTANCE_Y);
|
||||
rect.LowerRightCorner.X -= skin->getSize(EGDS_WINDOW_BUTTON_WIDTH) + 5;
|
||||
if (DrawTitlebar && Text.size())
|
||||
{
|
||||
rect.UpperLeftCorner.X += skin->getSize(EGDS_TEXT_DISTANCE_X);
|
||||
rect.UpperLeftCorner.Y += skin->getSize(EGDS_TEXT_DISTANCE_Y);
|
||||
rect.LowerRightCorner.X -= skin->getSize(EGDS_WINDOW_BUTTON_WIDTH) + 5;
|
||||
|
||||
IGUIFont* font = skin->getFont(EGDF_WINDOW);
|
||||
if (font)
|
||||
{
|
||||
font->draw(Text.c_str(), rect,
|
||||
skin->getColor(EGDC_ACTIVE_CAPTION), false, true, &AbsoluteClippingRect);
|
||||
}
|
||||
}
|
||||
IGUIFont* font = skin->getFont(EGDF_WINDOW);
|
||||
if (font)
|
||||
{
|
||||
font->draw(Text.c_str(), rect,
|
||||
skin->getColor(EGDC_ACTIVE_CAPTION), false, true, &AbsoluteClippingRect);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IGUIElement::draw();
|
||||
|
@ -273,7 +276,65 @@ void CGUIWindow::setDraggable(bool draggable)
|
|||
Dragging = false;
|
||||
}
|
||||
|
||||
//! Set if the window background will be drawn
|
||||
void CGUIWindow::setDrawBackground(bool draw)
|
||||
{
|
||||
DrawBackground = draw;
|
||||
}
|
||||
|
||||
//! Get if the window background will be drawn
|
||||
bool CGUIWindow::getDrawBackground() const
|
||||
{
|
||||
return DrawBackground;
|
||||
}
|
||||
|
||||
//! Set if the window titlebar will be drawn
|
||||
void CGUIWindow::setDrawTitlebar(bool draw)
|
||||
{
|
||||
DrawTitlebar = draw;
|
||||
}
|
||||
|
||||
//! Get if the window titlebar will be drawn
|
||||
bool CGUIWindow::getDrawTitlebar() const
|
||||
{
|
||||
return DrawTitlebar;
|
||||
}
|
||||
|
||||
//! Writes attributes of the element.
|
||||
void CGUIWindow::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const
|
||||
{
|
||||
IGUIWindow::serializeAttributes(out,options);
|
||||
|
||||
out->addBool("IsDraggable", IsDraggable);
|
||||
out->addBool("DrawBackground", DrawBackground);
|
||||
out->addBool("DrawTitlebar", DrawTitlebar);
|
||||
|
||||
// Currently we can't just serialize attributes of sub-elements.
|
||||
// To do this we either
|
||||
// a) allow further serialization after attribute serialiation (second function, callback or event)
|
||||
// b) add an IGUIElement attribute
|
||||
// c) extend the attribute system to allow attributes to have sub-attributes
|
||||
// We just serialize the most important info for now until we can do one of the above solutions.
|
||||
out->addBool("IsCloseVisible", CloseButton->isVisible());
|
||||
out->addBool("IsMinVisible", MinButton->isVisible());
|
||||
out->addBool("IsRestoreVisible", RestoreButton->isVisible());
|
||||
}
|
||||
|
||||
|
||||
//! Reads attributes of the element
|
||||
void CGUIWindow::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)
|
||||
{
|
||||
IGUIWindow::deserializeAttributes(in,options);
|
||||
|
||||
Dragging = false;
|
||||
IsDraggable = in->getAttributeAsBool("IsDraggable");
|
||||
DrawBackground = in->getAttributeAsBool("DrawBackground");
|
||||
DrawTitlebar = in->getAttributeAsBool("DrawTitlebar");
|
||||
|
||||
CloseButton->setVisible( in->getAttributeAsBool("IsCloseVisible") );
|
||||
MinButton->setVisible( in->getAttributeAsBool("IsMinVisible") );
|
||||
RestoreButton->setVisible( in->getAttributeAsBool("IsRestoreVisible") );
|
||||
}
|
||||
|
||||
} // end namespace gui
|
||||
} // end namespace irr
|
||||
|
|
|
@ -50,6 +50,25 @@ namespace gui
|
|||
//! Sets whether the window is draggable
|
||||
virtual void setDraggable(bool draggable);
|
||||
|
||||
//! Set if the window background will be drawn
|
||||
virtual void setDrawBackground(bool draw);
|
||||
|
||||
//! Get if the window background will be drawn
|
||||
virtual bool getDrawBackground() const;
|
||||
|
||||
//! Set if the window titlebar will be drawn
|
||||
//! Note: If the background is not drawn, then the titlebar is automatically also not drawn
|
||||
virtual void setDrawTitlebar(bool draw);
|
||||
|
||||
//! Get if the window titlebar will be drawn
|
||||
virtual bool getDrawTitlebar() const;
|
||||
|
||||
//! Writes attributes of the element.
|
||||
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const;
|
||||
|
||||
//! Reads attributes of the element
|
||||
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options);
|
||||
|
||||
protected:
|
||||
|
||||
IGUIButton* CloseButton;
|
||||
|
@ -58,6 +77,8 @@ namespace gui
|
|||
|
||||
core::position2d<s32> DragStart;
|
||||
bool Dragging, IsDraggable;
|
||||
bool DrawBackground;
|
||||
bool DrawTitlebar;
|
||||
};
|
||||
|
||||
} // end namespace gui
|
||||
|
|
|
@ -173,6 +173,24 @@ inline void GetClip(AbsRectangle &clipping, video::IImage * t)
|
|||
clipping.y1 = t->getDimension().Height - 1;
|
||||
}
|
||||
|
||||
/*
|
||||
return alpha in [0;256] Granularity from 32-Bit ARGB
|
||||
add highbit alpha ( alpha > 127 ? + 1 )
|
||||
*/
|
||||
static inline u32 extractAlpha ( const u32 c )
|
||||
{
|
||||
return ( c >> 24 ) + ( c >> 31 );
|
||||
}
|
||||
|
||||
/*
|
||||
return alpha in [0;255] Granularity and 32-Bit ARGB
|
||||
add highbit alpha ( alpha > 127 ? + 1 )
|
||||
*/
|
||||
static inline u32 packAlpha ( const u32 c )
|
||||
{
|
||||
return (c > 127 ? c - 1 : c) << 24;
|
||||
}
|
||||
|
||||
/*
|
||||
*/
|
||||
static void RenderLine32_Decal(video::IImage *t,
|
||||
|
@ -1020,6 +1038,9 @@ namespace video
|
|||
CImage::CImage(ECOLOR_FORMAT format, const core::dimension2d<u32>& size)
|
||||
:Data(0), Size(size), Format(format), DeleteMemory(true)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
setDebugName("CImage");
|
||||
#endif
|
||||
initData();
|
||||
}
|
||||
|
||||
|
@ -1389,14 +1410,17 @@ void CImage::copyToScaling(void* target, u32 width, u32 height, ECOLOR_FORMAT fo
|
|||
else
|
||||
{
|
||||
u8* tgtpos = (u8*) target;
|
||||
u8* dstpos = (u8*) Data;
|
||||
u8* srcpos = (u8*) Data;
|
||||
const u32 bwidth = width*bpp;
|
||||
const u32 rest = pitch-bwidth;
|
||||
for (u32 y=0; y<height; ++y)
|
||||
{
|
||||
memcpy(target, Data, height*pitch);
|
||||
memset(tgtpos+width, 0, pitch-bwidth);
|
||||
// copy scanline
|
||||
memcpy(tgtpos, srcpos, bwidth);
|
||||
// clear pitch
|
||||
memset(tgtpos+bwidth, 0, rest);
|
||||
tgtpos += pitch;
|
||||
dstpos += Pitch;
|
||||
srcpos += Pitch;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "SIrrCreationParameters.h"
|
||||
#include "SExposedVideoData.h"
|
||||
#include <X11/XKBlib.h>
|
||||
#include <X11/Xatom.h>
|
||||
|
||||
#if defined _IRR_COMPILE_WITH_JOYSTICK_EVENTS_
|
||||
#include <fcntl.h>
|
||||
|
@ -48,7 +49,13 @@ namespace irr
|
|||
}
|
||||
} // end namespace irr
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
Atom X_ATOM_CLIPBOARD;
|
||||
Atom X_ATOM_TARGETS;
|
||||
Atom X_ATOM_UTF8_STRING;
|
||||
Atom X_ATOM_TEXT;
|
||||
};
|
||||
|
||||
namespace irr
|
||||
{
|
||||
|
@ -87,7 +94,7 @@ CIrrDeviceLinux::CIrrDeviceLinux(const SIrrlichtCreationParameters& param)
|
|||
linuxversion += " ";
|
||||
linuxversion += LinuxInfo.machine;
|
||||
|
||||
Operator = new COSOperator(linuxversion.c_str());
|
||||
Operator = new COSOperator(linuxversion.c_str(), this);
|
||||
os::Printer::log(linuxversion.c_str(), ELL_INFORMATION);
|
||||
|
||||
// create keymap
|
||||
|
@ -320,8 +327,13 @@ bool CIrrDeviceLinux::createWindow()
|
|||
GLX_DEPTH_SIZE, CreationParams.ZBufferBits,
|
||||
GLX_DOUBLEBUFFER, CreationParams.Doublebuffer?True:False,
|
||||
GLX_STENCIL_SIZE, CreationParams.Stencilbuffer?1:0,
|
||||
#ifdef GLX_ARB_multisample
|
||||
GLX_SAMPLE_BUFFERS_ARB, 1,
|
||||
GLX_SAMPLES_ARB, CreationParams.AntiAlias,
|
||||
#elif defined(GLX_SAMPLE_BUFFERS)
|
||||
GLX_SAMPLE_BUFFERS, 1,
|
||||
GLX_SAMPLES, CreationParams.AntiAlias,
|
||||
#endif
|
||||
GLX_STEREO, CreationParams.Stereobuffer?True:False,
|
||||
None
|
||||
};
|
||||
|
@ -584,7 +596,8 @@ bool CIrrDeviceLinux::createWindow()
|
|||
XMapRaised(display, window);
|
||||
}
|
||||
WindowMinimized=false;
|
||||
XkbSetDetectableAutoRepeat(display, True, &AutorepeatSupport);
|
||||
// Currently broken in X, see Bug ID 2795321
|
||||
// XkbSetDetectableAutoRepeat(display, True, &AutorepeatSupport);
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_OPENGL_
|
||||
|
||||
|
@ -662,6 +675,8 @@ bool CIrrDeviceLinux::createWindow()
|
|||
SoftwareImage->data = (char*) malloc(SoftwareImage->bytes_per_line * SoftwareImage->height * sizeof(char));
|
||||
}
|
||||
|
||||
initXAtoms();
|
||||
|
||||
#endif // #ifdef _IRR_COMPILE_WITH_X11_
|
||||
return true;
|
||||
}
|
||||
|
@ -804,6 +819,13 @@ bool CIrrDeviceLinux::run()
|
|||
irrevent.MouseInput.Event = irr::EMIE_MOUSE_MOVED;
|
||||
irrevent.MouseInput.X = event.xbutton.x;
|
||||
irrevent.MouseInput.Y = event.xbutton.y;
|
||||
irrevent.MouseInput.Control = (event.xkey.state & ControlMask) != 0;
|
||||
irrevent.MouseInput.Shift = (event.xkey.state & ShiftMask) != 0;
|
||||
|
||||
// mouse button states
|
||||
irrevent.MouseInput.ButtonStates = (event.xbutton.state & Button1Mask) ? irr::EMBSM_LEFT : 0;
|
||||
irrevent.MouseInput.ButtonStates |= (event.xbutton.state & Button3Mask) ? irr::EMBSM_RIGHT : 0;
|
||||
irrevent.MouseInput.ButtonStates |= (event.xbutton.state & Button2Mask) ? irr::EMBSM_MIDDLE : 0;
|
||||
|
||||
postEventFromUser(irrevent);
|
||||
break;
|
||||
|
@ -814,6 +836,16 @@ bool CIrrDeviceLinux::run()
|
|||
irrevent.EventType = irr::EET_MOUSE_INPUT_EVENT;
|
||||
irrevent.MouseInput.X = event.xbutton.x;
|
||||
irrevent.MouseInput.Y = event.xbutton.y;
|
||||
irrevent.MouseInput.Control = (event.xkey.state & ControlMask) != 0;
|
||||
irrevent.MouseInput.Shift = (event.xkey.state & ShiftMask) != 0;
|
||||
|
||||
// mouse button states
|
||||
// This sets the state which the buttons had _prior_ to the event.
|
||||
// So unlike on Windows the button which just got changed has still the old state here.
|
||||
// We handle that below by flipping the corresponding bit later.
|
||||
irrevent.MouseInput.ButtonStates = (event.xbutton.state & Button1Mask) ? irr::EMBSM_LEFT : 0;
|
||||
irrevent.MouseInput.ButtonStates |= (event.xbutton.state & Button3Mask) ? irr::EMBSM_RIGHT : 0;
|
||||
irrevent.MouseInput.ButtonStates |= (event.xbutton.state & Button2Mask) ? irr::EMBSM_MIDDLE : 0;
|
||||
|
||||
irrevent.MouseInput.Event = irr::EMIE_COUNT;
|
||||
|
||||
|
@ -822,16 +854,19 @@ bool CIrrDeviceLinux::run()
|
|||
case Button1:
|
||||
irrevent.MouseInput.Event =
|
||||
(event.type == ButtonPress) ? irr::EMIE_LMOUSE_PRESSED_DOWN : irr::EMIE_LMOUSE_LEFT_UP;
|
||||
irrevent.MouseInput.ButtonStates ^= irr::EMBSM_LEFT;
|
||||
break;
|
||||
|
||||
case Button3:
|
||||
irrevent.MouseInput.Event =
|
||||
(event.type == ButtonPress) ? irr::EMIE_RMOUSE_PRESSED_DOWN : irr::EMIE_RMOUSE_LEFT_UP;
|
||||
irrevent.MouseInput.ButtonStates ^= irr::EMBSM_RIGHT;
|
||||
break;
|
||||
|
||||
case Button2:
|
||||
irrevent.MouseInput.Event =
|
||||
(event.type == ButtonPress) ? irr::EMIE_MMOUSE_PRESSED_DOWN : irr::EMIE_MMOUSE_LEFT_UP;
|
||||
irrevent.MouseInput.ButtonStates ^= irr::EMBSM_MIDDLE;
|
||||
break;
|
||||
|
||||
case Button4:
|
||||
|
@ -854,7 +889,7 @@ bool CIrrDeviceLinux::run()
|
|||
break;
|
||||
|
||||
case KeyRelease:
|
||||
if (0 == AutorepeatSupport)
|
||||
if (0 == AutorepeatSupport && (XPending( display ) > 0) )
|
||||
{
|
||||
// check for Autorepeat manually
|
||||
// We'll do the same as Windows does: Only send KeyPressed
|
||||
|
@ -915,6 +950,49 @@ bool CIrrDeviceLinux::run()
|
|||
}
|
||||
break;
|
||||
|
||||
case SelectionRequest:
|
||||
{
|
||||
XEvent respond;
|
||||
XSelectionRequestEvent *req = &(event.xselectionrequest);
|
||||
if ( req->target == XA_STRING)
|
||||
{
|
||||
XChangeProperty (display,
|
||||
req->requestor,
|
||||
req->property, req->target,
|
||||
8, // format
|
||||
PropModeReplace,
|
||||
(unsigned char*) Clipboard.c_str(),
|
||||
Clipboard.size());
|
||||
respond.xselection.property = req->property;
|
||||
}
|
||||
else if ( req->target == X_ATOM_TARGETS )
|
||||
{
|
||||
long data[2];
|
||||
|
||||
data[0] = X_ATOM_TEXT;
|
||||
data[1] = XA_STRING;
|
||||
|
||||
XChangeProperty (display, req->requestor,
|
||||
req->property, req->target,
|
||||
8, PropModeReplace, (unsigned char *) &data,
|
||||
sizeof (data));
|
||||
respond.xselection.property = req->property;
|
||||
}
|
||||
else
|
||||
{
|
||||
respond.xselection.property= None;
|
||||
}
|
||||
respond.xselection.type= SelectionNotify;
|
||||
respond.xselection.display= req->display;
|
||||
respond.xselection.requestor= req->requestor;
|
||||
respond.xselection.selection=req->selection;
|
||||
respond.xselection.target= req->target;
|
||||
respond.xselection.time = req->time;
|
||||
XSendEvent (display, req->requestor,0,0,&respond);
|
||||
XFlush (display);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
} // end switch
|
||||
|
@ -1493,6 +1571,79 @@ void CIrrDeviceLinux::pollJoysticks()
|
|||
#endif // _IRR_COMPILE_WITH_JOYSTICK_EVENTS_
|
||||
}
|
||||
|
||||
//! gets text from the clipboard
|
||||
//! \return Returns 0 if no string is in there.
|
||||
const c8* CIrrDeviceLinux::getTextFromClipboard() const
|
||||
{
|
||||
#if defined(_IRR_COMPILE_WITH_X11_)
|
||||
Window ownerWindow = XGetSelectionOwner (display, X_ATOM_CLIPBOARD);
|
||||
if ( ownerWindow == window )
|
||||
{
|
||||
return Clipboard.c_str();
|
||||
}
|
||||
Clipboard = "";
|
||||
if (ownerWindow != None )
|
||||
{
|
||||
XConvertSelection (display, X_ATOM_CLIPBOARD, XA_STRING, None, ownerWindow, CurrentTime);
|
||||
XFlush (display);
|
||||
|
||||
// check for data
|
||||
Atom type;
|
||||
int format;
|
||||
unsigned long numItems, bytesLeft, dummy;
|
||||
unsigned char *data;
|
||||
XGetWindowProperty (display, ownerWindow,
|
||||
XA_STRING, // property name
|
||||
0, // offset
|
||||
0, // length (we only check for data, so 0)
|
||||
0, // Delete 0==false
|
||||
AnyPropertyType, // AnyPropertyType or property identifier
|
||||
&type, // return type
|
||||
&format, // return format
|
||||
&numItems, // number items
|
||||
&bytesLeft, // remaining bytes for partial reads
|
||||
&data); // data
|
||||
if ( bytesLeft > 0 )
|
||||
{
|
||||
// there is some data to get
|
||||
int result = XGetWindowProperty (display, ownerWindow, XA_STRING, 0,
|
||||
bytesLeft, 0, AnyPropertyType, &type, &format,
|
||||
&numItems, &dummy, &data);
|
||||
if (result == Success)
|
||||
Clipboard = (irr::c8*)data;
|
||||
XFree (data);
|
||||
}
|
||||
}
|
||||
|
||||
return Clipboard.c_str();
|
||||
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
//! copies text to the clipboard
|
||||
void CIrrDeviceLinux::copyToClipboard(const c8* text) const
|
||||
{
|
||||
#if defined(_IRR_COMPILE_WITH_X11_)
|
||||
// Actually there is no clipboard on X but applications just say they own the clipboard and return text when asked.
|
||||
// Which btw. also means that on X you lose clipboard content when closing applications.
|
||||
Clipboard = text;
|
||||
XSetSelectionOwner (display, X_ATOM_CLIPBOARD, window, CurrentTime);
|
||||
XFlush (display);
|
||||
#endif
|
||||
}
|
||||
|
||||
void CIrrDeviceLinux::initXAtoms()
|
||||
{
|
||||
#ifdef _IRR_COMPILE_WITH_X11_
|
||||
X_ATOM_CLIPBOARD = XInternAtom(display, "CLIPBOARD", False);
|
||||
X_ATOM_TARGETS = XInternAtom(display, "TARGETS", False);
|
||||
X_ATOM_UTF8_STRING = XInternAtom (display, "UTF8_STRING", False);
|
||||
X_ATOM_TEXT = XInternAtom (display, "TEXT", False);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
extern "C" IRRLICHT_API IrrlichtDevice* IRRCALLCONV createDeviceEx(const SIrrlichtCreationParameters& param)
|
||||
{
|
||||
|
|
|
@ -96,6 +96,14 @@ namespace irr
|
|||
//! Activate any joysticks, and generate events for them.
|
||||
virtual bool activateJoysticks(core::array<SJoystickInfo> & joystickInfo);
|
||||
|
||||
//! gets text from the clipboard
|
||||
//! \return Returns 0 if no string is in there.
|
||||
virtual const c8* getTextFromClipboard() const;
|
||||
|
||||
//! copies text to the clipboard
|
||||
//! This sets the clipboard selection and _not_ the primary selection which you have on X on the middle mouse button.
|
||||
virtual void copyToClipboard(const c8* text) const;
|
||||
|
||||
private:
|
||||
|
||||
//! create the driver
|
||||
|
@ -105,7 +113,9 @@ namespace irr
|
|||
|
||||
void createKeyMap();
|
||||
|
||||
void pollJoysticks();
|
||||
void pollJoysticks();
|
||||
|
||||
void initXAtoms();
|
||||
|
||||
//! Implementation of the linux cursor control
|
||||
class CCursorControl : public gui::ICursorControl
|
||||
|
@ -310,6 +320,7 @@ namespace irr
|
|||
XSetWindowAttributes attributes;
|
||||
XSizeHints* StdHints;
|
||||
XImage* SoftwareImage;
|
||||
mutable core::stringc Clipboard;
|
||||
#ifdef _IRR_LINUX_X11_VIDMODE_
|
||||
XF86VidModeModeInfo oldVideoMode;
|
||||
#endif
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace irr
|
|||
|
||||
//! constructor
|
||||
CIrrDeviceStub::CIrrDeviceStub(const SIrrlichtCreationParameters& params)
|
||||
: IrrlichtDevice(), VideoDriver(0), GUIEnvironment(0), SceneManager(0),
|
||||
: IrrlichtDevice(), VideoDriver(0), GUIEnvironment(0), SceneManager(0),
|
||||
Timer(0), CursorControl(0), UserReceiver(params.EventReceiver), Logger(0), Operator(0),
|
||||
FileSystem(0), InputReceivingSceneManager(0), CreationParams(params)
|
||||
{
|
||||
|
@ -82,7 +82,7 @@ void CIrrDeviceStub::createGUIAndScene()
|
|||
#ifdef _IRR_COMPILE_WITH_GUI_
|
||||
// create gui environment
|
||||
GUIEnvironment = gui::createGUIEnvironment(FileSystem, VideoDriver, Operator);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// create Scene manager
|
||||
SceneManager = scene::createSceneManager(VideoDriver, FileSystem, CursorControl, GUIEnvironment);
|
||||
|
@ -130,7 +130,7 @@ ITimer* CIrrDeviceStub::getTimer()
|
|||
}
|
||||
|
||||
|
||||
//! Returns the version of the engine.
|
||||
//! Returns the version of the engine.
|
||||
const char* CIrrDeviceStub::getVersion() const
|
||||
{
|
||||
return IRRLICHT_SDK_VERSION;
|
||||
|
@ -225,16 +225,15 @@ IOSOperator* CIrrDeviceStub::getOSOperator()
|
|||
}
|
||||
|
||||
|
||||
//! Sets the input receiving scene manager.
|
||||
//! Sets the input receiving scene manager.
|
||||
void CIrrDeviceStub::setInputReceivingSceneManager(scene::ISceneManager* sceneManager)
|
||||
{
|
||||
if (sceneManager)
|
||||
sceneManager->grab();
|
||||
if (InputReceivingSceneManager)
|
||||
InputReceivingSceneManager->drop();
|
||||
|
||||
InputReceivingSceneManager = sceneManager;
|
||||
|
||||
if (InputReceivingSceneManager)
|
||||
InputReceivingSceneManager->grab();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -139,6 +139,8 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
event.MouseInput.Event = (irr::EMOUSE_INPUT_EVENT) m->irrMessage;
|
||||
event.MouseInput.X = (short)LOWORD(lParam);
|
||||
event.MouseInput.Y = (short)HIWORD(lParam);
|
||||
event.MouseInput.Shift = ((LOWORD(wParam) & MK_SHIFT) != 0);
|
||||
event.MouseInput.Control = ((LOWORD(wParam) & MK_CONTROL) != 0);
|
||||
// left and right mouse buttons
|
||||
event.MouseInput.ButtonStates = wParam & ( MK_LBUTTON | MK_RBUTTON);
|
||||
// middle and extra buttons
|
||||
|
@ -182,16 +184,6 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
case WM_ERASEBKGND:
|
||||
return 0;
|
||||
|
||||
case WM_SETCURSOR:
|
||||
{
|
||||
SEnvMapper* envm = getEnvMapperFromHWnd(hWnd);
|
||||
if (envm && !envm->irrDev->getWin32CursorControl()->isVisible())
|
||||
{
|
||||
SetCursor(NULL);
|
||||
return 0;
|
||||
}
|
||||
} break;
|
||||
|
||||
case WM_KEYDOWN:
|
||||
case WM_KEYUP:
|
||||
{
|
||||
|
@ -596,8 +588,8 @@ void CIrrDeviceWin32::setWindowCaption(const wchar_t* text)
|
|||
if (IsNonNTWindows)
|
||||
{
|
||||
const core::stringc s = text;
|
||||
#ifdef WIN64
|
||||
SetWindowTextA(HWnd, s.c_str());
|
||||
#ifdef WIN64
|
||||
SetWindowTextA(HWnd, s.c_str());
|
||||
#else
|
||||
SendMessageTimeout(HWnd, WM_SETTEXT, 0,
|
||||
reinterpret_cast<LPARAM>(s.c_str()),
|
||||
|
@ -606,9 +598,9 @@ void CIrrDeviceWin32::setWindowCaption(const wchar_t* text)
|
|||
}
|
||||
else
|
||||
{
|
||||
#ifdef WIN64
|
||||
SetWindowTextW(HWnd, text);
|
||||
#else
|
||||
#ifdef WIN64
|
||||
SetWindowTextW(HWnd, text);
|
||||
#else
|
||||
SendMessageTimeoutW(HWnd, WM_SETTEXT, 0,
|
||||
reinterpret_cast<LPARAM>(text),
|
||||
SMTO_ABORTIFHUNG, 2000, &dwResult);
|
||||
|
|
|
@ -106,13 +106,34 @@ namespace irr
|
|||
//! Changes the visible state of the mouse cursor.
|
||||
virtual void setVisible(bool visible)
|
||||
{
|
||||
if(visible != IsVisible)
|
||||
CURSORINFO info;
|
||||
info.cbSize = sizeof(CURSORINFO);
|
||||
|
||||
if ( visible )
|
||||
{
|
||||
IsVisible = visible;
|
||||
updateInternalCursorPosition();
|
||||
setPosition(CursorPos.X, CursorPos.Y);
|
||||
while ( GetCursorInfo(&info) )
|
||||
{
|
||||
if ( info.flags == CURSOR_SHOWING )
|
||||
{
|
||||
IsVisible = visible;
|
||||
break;
|
||||
}
|
||||
ShowCursor(true); // this only increases an internal display counter in windows, so it might have to be called some more
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while ( GetCursorInfo(&info) )
|
||||
{
|
||||
if ( info.flags == 0 ) // cursor hidden
|
||||
{
|
||||
IsVisible = visible;
|
||||
break;
|
||||
}
|
||||
ShowCursor(false); // this only decreases an internal display counter in windows, so it might have to be called some more
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//! Returns if the cursor is currently visible.
|
||||
virtual bool isVisible() const
|
||||
|
|
|
@ -48,8 +48,8 @@ void CMeshSceneNode::OnRegisterSceneNode()
|
|||
{
|
||||
if (IsVisible)
|
||||
{
|
||||
// because this node supports rendering of mixed mode meshes consisting of
|
||||
// transparent and solid material at the same time, we need to go through all
|
||||
// because this node supports rendering of mixed mode meshes consisting of
|
||||
// transparent and solid material at the same time, we need to go through all
|
||||
// materials, check of what type they are and register this node for the right
|
||||
// render pass according to that.
|
||||
|
||||
|
@ -62,16 +62,16 @@ void CMeshSceneNode::OnRegisterSceneNode()
|
|||
// count transparent and solid materials in this scene node
|
||||
if (ReadOnlyMaterials && Mesh)
|
||||
{
|
||||
// count mesh materials
|
||||
// count mesh materials
|
||||
|
||||
for (u32 i=0; i<Mesh->getMeshBufferCount(); ++i)
|
||||
{
|
||||
scene::IMeshBuffer* mb = Mesh->getMeshBuffer(i);
|
||||
video::IMaterialRenderer* rnd = mb ? driver->getMaterialRenderer(mb->getMaterial().MaterialType) : 0;
|
||||
|
||||
if (rnd && rnd->isTransparent())
|
||||
if (rnd && rnd->isTransparent())
|
||||
++transparentCount;
|
||||
else
|
||||
else
|
||||
++solidCount;
|
||||
|
||||
if (solidCount && transparentCount)
|
||||
|
@ -80,21 +80,21 @@ void CMeshSceneNode::OnRegisterSceneNode()
|
|||
}
|
||||
else
|
||||
{
|
||||
// count copied materials
|
||||
// count copied materials
|
||||
|
||||
for (u32 i=0; i<Materials.size(); ++i)
|
||||
{
|
||||
video::IMaterialRenderer* rnd =
|
||||
video::IMaterialRenderer* rnd =
|
||||
driver->getMaterialRenderer(Materials[i].MaterialType);
|
||||
|
||||
if (rnd && rnd->isTransparent())
|
||||
if (rnd && rnd->isTransparent())
|
||||
++transparentCount;
|
||||
else
|
||||
else
|
||||
++solidCount;
|
||||
|
||||
if (solidCount && transparentCount)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// register according to material types counted
|
||||
|
@ -119,7 +119,7 @@ void CMeshSceneNode::render()
|
|||
if (!Mesh || !driver)
|
||||
return;
|
||||
|
||||
bool isTransparentPass =
|
||||
bool isTransparentPass =
|
||||
SceneManager->getSceneNodeRenderPass() == scene::ESNRP_TRANSPARENT;
|
||||
|
||||
++PassCount;
|
||||
|
@ -162,7 +162,7 @@ void CMeshSceneNode::render()
|
|||
|
||||
// only render transparent buffer if this is the transparent render pass
|
||||
// and solid only in solid pass
|
||||
if (transparent == isTransparentPass)
|
||||
if (transparent == isTransparentPass)
|
||||
{
|
||||
driver->setMaterial(material);
|
||||
driver->drawMeshBuffer(mb);
|
||||
|
@ -295,14 +295,12 @@ void CMeshSceneNode::setMesh(IMesh* mesh)
|
|||
if (!mesh)
|
||||
return; // won't set null mesh
|
||||
|
||||
mesh->grab();
|
||||
if (Mesh)
|
||||
Mesh->drop();
|
||||
|
||||
Mesh = mesh;
|
||||
copyMaterials();
|
||||
|
||||
if (Mesh)
|
||||
Mesh->grab();
|
||||
}
|
||||
|
||||
|
||||
|
@ -358,7 +356,7 @@ void CMeshSceneNode::deserializeAttributes(io::IAttributes* in, io::SAttributeRe
|
|||
}
|
||||
|
||||
//! Sets if the scene node should not copy the materials of the mesh but use them in a read only style.
|
||||
/* In this way it is possible to change the materials a mesh causing all mesh scene nodes
|
||||
/* In this way it is possible to change the materials a mesh causing all mesh scene nodes
|
||||
referencing this mesh to change too. */
|
||||
void CMeshSceneNode::setReadOnlyMaterials(bool readonly)
|
||||
{
|
||||
|
@ -378,7 +376,7 @@ ISceneNode* CMeshSceneNode::clone(ISceneNode* newParent, ISceneManager* newManag
|
|||
if (!newParent) newParent = Parent;
|
||||
if (!newManager) newManager = SceneManager;
|
||||
|
||||
CMeshSceneNode* nb = new CMeshSceneNode(Mesh, newParent,
|
||||
CMeshSceneNode* nb = new CMeshSceneNode(Mesh, newParent,
|
||||
newManager, ID, RelativeTranslation, RelativeRotation, RelativeScale);
|
||||
|
||||
nb->cloneMembers(this, newManager);
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
// For conditions of distribution and use, see copyright notice in irrlicht.h
|
||||
|
||||
#include "CNullDriver.h"
|
||||
#include "CSoftwareTexture.h"
|
||||
#include "os.h"
|
||||
#include "CImage.h"
|
||||
#include "CAttributes.h"
|
||||
|
@ -509,6 +508,12 @@ ITexture* CNullDriver::addTexture(const core::string<c16>& name, IImage* image)
|
|||
ITexture* CNullDriver::addTexture(const core::dimension2d<u32>& size,
|
||||
const core::string<c16>& name, ECOLOR_FORMAT format)
|
||||
{
|
||||
if(getRenderTargetOnlyFormat(format))
|
||||
{
|
||||
os::Printer::log("Could not create ITexture, format only supported for render target textures.", ELL_WARNING);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ( 0 == name.size () )
|
||||
return 0;
|
||||
|
||||
|
@ -529,11 +534,7 @@ ITexture* CNullDriver::addTexture(const core::dimension2d<u32>& size,
|
|||
//! THIS METHOD HAS TO BE OVERRIDDEN BY DERIVED DRIVERS WITH OWN TEXTURES
|
||||
ITexture* CNullDriver::createDeviceDependentTexture(IImage* surface, const core::string<c16>& name)
|
||||
{
|
||||
#ifdef _IRR_COMPILE_WITH_SOFTWARE_
|
||||
return new CSoftwareTexture(surface, name);
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
return new SDummyTexture(name);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1024,7 +1025,7 @@ void CNullDriver::makeColorKeyTexture(video::ITexture* texture,
|
|||
|
||||
if (texture->getColorFormat() == ECF_A1R5G5B5)
|
||||
{
|
||||
u16 *p = (u16*)texture->lock();
|
||||
u16 *p = (u16*)texture->lock(true);
|
||||
|
||||
if (!p)
|
||||
{
|
||||
|
@ -1040,7 +1041,7 @@ void CNullDriver::makeColorKeyTexture(video::ITexture* texture,
|
|||
}
|
||||
else
|
||||
{
|
||||
u32 *p = (u32*)texture->lock();
|
||||
u32 *p = (u32*)texture->lock(true);
|
||||
|
||||
if (!p)
|
||||
{
|
||||
|
@ -1326,6 +1327,12 @@ IImage* CNullDriver::createImageFromData(ECOLOR_FORMAT format,
|
|||
void *data, bool ownForeignMemory,
|
||||
bool deleteMemory)
|
||||
{
|
||||
if(getRenderTargetOnlyFormat(format))
|
||||
{
|
||||
os::Printer::log("Could not create IImage, format only supported for render target textures.", ELL_WARNING);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return new CImage(format, size, data, ownForeignMemory, deleteMemory);
|
||||
}
|
||||
|
||||
|
@ -1333,14 +1340,26 @@ IImage* CNullDriver::createImageFromData(ECOLOR_FORMAT format,
|
|||
//! Creates an empty software image.
|
||||
IImage* CNullDriver::createImage(ECOLOR_FORMAT format, const core::dimension2d<u32>& size)
|
||||
{
|
||||
return new CImage(format, size);
|
||||
if(getRenderTargetOnlyFormat(format))
|
||||
{
|
||||
os::Printer::log("Could not create IImage, format only supported for render target textures.", ELL_WARNING);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return new CImage(format, size);
|
||||
}
|
||||
|
||||
|
||||
//! Creates a software image from another image.
|
||||
IImage* CNullDriver::createImage(ECOLOR_FORMAT format, IImage *imageToCopy)
|
||||
{
|
||||
return new CImage(format, imageToCopy);
|
||||
if(getRenderTargetOnlyFormat(format))
|
||||
{
|
||||
os::Printer::log("Could not create IImage, format only supported for render target textures.", ELL_WARNING);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return new CImage(format, imageToCopy);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1932,7 +1951,7 @@ s32 CNullDriver::addShaderMaterialFromFiles(const core::string<c16>& vertexShade
|
|||
|
||||
//! Creates a render target texture.
|
||||
ITexture* CNullDriver::addRenderTargetTexture(const core::dimension2d<u32>& size,
|
||||
const core::string<c16>&name)
|
||||
const core::string<c16>&name, const ECOLOR_FORMAT format)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -293,7 +293,7 @@ namespace video
|
|||
|
||||
//! Creates a render target texture.
|
||||
virtual ITexture* addRenderTargetTexture(const core::dimension2d<u32>& size,
|
||||
const core::string<c16>& name);
|
||||
const core::string<c16>& name, const ECOLOR_FORMAT format = ECF_UNKNOWN);
|
||||
|
||||
//! Creates an 1bit alpha channel of the texture based of an color key.
|
||||
virtual void makeColorKeyTexture(video::ITexture* texture, video::SColor color, bool zeroTexels) const;
|
||||
|
@ -571,6 +571,20 @@ namespace video
|
|||
//! THIS METHOD HAS TO BE OVERRIDDEN BY DERIVED DRIVERS WITH OWN TEXTURES
|
||||
virtual video::ITexture* createDeviceDependentTexture(IImage* surface, const core::string<c16>& name);
|
||||
|
||||
virtual bool getRenderTargetOnlyFormat(const ECOLOR_FORMAT format) const
|
||||
{
|
||||
switch(format)
|
||||
{
|
||||
case ECF_A1R5G5B5:
|
||||
case ECF_R5G6B5:
|
||||
case ECF_R8G8B8:
|
||||
case ECF_A8R8G8B8:
|
||||
return false;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//! checks triangle count and print warning if wrong
|
||||
bool checkPrimitiveCount(u32 prmcnt) const;
|
||||
|
||||
|
|
|
@ -32,6 +32,10 @@ static const u32 WORD_BUFFER_LENGTH = 512;
|
|||
COBJMeshFileLoader::COBJMeshFileLoader(scene::ISceneManager* smgr, io::IFileSystem* fs)
|
||||
: SceneManager(smgr), FileSystem(fs)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
setDebugName("COBJMeshFileLoader");
|
||||
#endif
|
||||
|
||||
if (FileSystem)
|
||||
FileSystem->grab();
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
// For conditions of distribution and use, see copyright notice in irrlicht.h
|
||||
|
||||
#include "COSOperator.h"
|
||||
#include "IrrCompileConfig.h"
|
||||
|
||||
#ifdef _IRR_WINDOWS_API_
|
||||
#ifdef _IRR_XBOX_PLATFORM_
|
||||
|
@ -22,10 +21,21 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(_IRR_USE_LINUX_DEVICE_)
|
||||
#include "CIrrDeviceLinux.h"
|
||||
#endif
|
||||
|
||||
namespace irr
|
||||
{
|
||||
|
||||
#if defined(_IRR_USE_LINUX_DEVICE_)
|
||||
// constructor linux
|
||||
COSOperator::COSOperator(const c8* osversion, CIrrDeviceLinux* device)
|
||||
: IrrDeviceLinux(device)
|
||||
{
|
||||
}
|
||||
|
||||
#else // not linux
|
||||
// constructor
|
||||
COSOperator::COSOperator(const c8* osVersion) : OperatingSystem(osVersion)
|
||||
{
|
||||
|
@ -33,7 +43,7 @@ COSOperator::COSOperator(const c8* osVersion) : OperatingSystem(osVersion)
|
|||
setDebugName("COSOperator");
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//! returns the current operating system version as string.
|
||||
const wchar_t* COSOperator::getOperationSystemVersion() const
|
||||
|
@ -72,23 +82,26 @@ void COSOperator::copyToClipboard(const c8* text) const
|
|||
#elif defined(_IRR_USE_OSX_DEVICE_)
|
||||
|
||||
OSXCopyToClipboard(text);
|
||||
|
||||
#elif defined(_IRR_USE_LINUX_DEVICE_)
|
||||
if ( IrrDeviceLinux )
|
||||
IrrDeviceLinux->copyToClipboard(text);
|
||||
#else
|
||||
|
||||
// todo: Linux version
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
//! gets text from the clipboard
|
||||
//! \return Returns 0 if no string is in there.
|
||||
c8* COSOperator::getTextFromClipboard() const
|
||||
const c8* COSOperator::getTextFromClipboard() const
|
||||
{
|
||||
#if defined(_IRR_XBOX_PLATFORM_)
|
||||
return 0;
|
||||
#elif defined(_IRR_WINDOWS_API_)
|
||||
if (!OpenClipboard(NULL))
|
||||
return 0;
|
||||
|
||||
|
||||
char * buffer = 0;
|
||||
|
||||
HANDLE hData = GetClipboardData( CF_TEXT );
|
||||
|
@ -99,9 +112,13 @@ c8* COSOperator::getTextFromClipboard() const
|
|||
|
||||
#elif defined(_IRR_USE_OSX_DEVICE_)
|
||||
return (OSXCopyFromClipboard());
|
||||
#else
|
||||
|
||||
// todo: Linux version
|
||||
#elif defined(_IRR_USE_LINUX_DEVICE_)
|
||||
if ( IrrDeviceLinux )
|
||||
return IrrDeviceLinux->getTextFromClipboard();
|
||||
return 0;
|
||||
|
||||
#else
|
||||
|
||||
return 0;
|
||||
#endif
|
||||
|
@ -112,7 +129,7 @@ bool COSOperator::getProcessorSpeedMHz(u32* MHz) const
|
|||
{
|
||||
#if defined(_IRR_WINDOWS_API_) && !defined(_WIN32_WCE ) && !defined (_IRR_XBOX_PLATFORM_)
|
||||
LONG Error;
|
||||
|
||||
|
||||
HKEY Key;
|
||||
Error = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
|
||||
"HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0",
|
||||
|
@ -163,7 +180,7 @@ bool COSOperator::getSystemMemory(u32* Total, u32* Avail) const
|
|||
*Total = (u32)(MemoryStatus.dwTotalPhys>>10);
|
||||
if (Avail)
|
||||
*Avail = (u32)(MemoryStatus.dwAvailPhys>>10);
|
||||
|
||||
|
||||
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
|
||||
return true;
|
||||
|
||||
|
@ -172,7 +189,7 @@ bool COSOperator::getSystemMemory(u32* Total, u32* Avail) const
|
|||
long ps = sysconf(_SC_PAGESIZE);
|
||||
long pp = sysconf(_SC_PHYS_PAGES);
|
||||
long ap = sysconf(_SC_AVPHYS_PAGES);
|
||||
|
||||
|
||||
if ((ps==-1)||(pp==-1)||(ap==-1))
|
||||
return false;
|
||||
|
||||
|
@ -186,7 +203,7 @@ bool COSOperator::getSystemMemory(u32* Total, u32* Avail) const
|
|||
return false;
|
||||
#endif
|
||||
#else
|
||||
// TODO: implement for OSX
|
||||
// TODO: implement for OSX
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -7,17 +7,24 @@
|
|||
|
||||
#include "IOSOperator.h"
|
||||
#include "irrString.h"
|
||||
#include "IrrCompileConfig.h"
|
||||
|
||||
namespace irr
|
||||
{
|
||||
|
||||
class CIrrDeviceLinux;
|
||||
|
||||
//! The Operating system operator provides operation system specific methods and informations.
|
||||
class COSOperator : public IOSOperator
|
||||
{
|
||||
public:
|
||||
|
||||
// constructor
|
||||
COSOperator(const c8* osversion);
|
||||
#if defined(_IRR_USE_LINUX_DEVICE_)
|
||||
COSOperator(const c8* osversion, CIrrDeviceLinux* device);
|
||||
#else
|
||||
COSOperator(const c8* osversion);
|
||||
#endif
|
||||
|
||||
//! returns the current operation system version as string.
|
||||
virtual const wchar_t* getOperationSystemVersion() const;
|
||||
|
@ -27,7 +34,7 @@ public:
|
|||
|
||||
//! gets text from the clipboard
|
||||
//! \return Returns 0 if no string is in there.
|
||||
virtual c8* getTextFromClipboard() const;
|
||||
virtual const c8* getTextFromClipboard() const;
|
||||
|
||||
//! gets the processor speed in megahertz
|
||||
//! \param Mhz:
|
||||
|
@ -43,6 +50,11 @@ public:
|
|||
private:
|
||||
|
||||
core::stringw OperatingSystem;
|
||||
|
||||
#if defined(_IRR_USE_LINUX_DEVICE_)
|
||||
CIrrDeviceLinux * IrrDeviceLinux;
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
} // end namespace
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue