Commit 26c3f036 authored by hybrid's avatar hybrid

Add an example for how to use the 2d material settings.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@3079 dfc29bdd-3216-0410-991c-e03cc46cb475
parent d4620f37
...@@ -89,6 +89,12 @@ int main() ...@@ -89,6 +89,12 @@ int main()
core::rect<s32> imp1(349,15,385,78); core::rect<s32> imp1(349,15,385,78);
core::rect<s32> imp2(387,15,423,78); core::rect<s32> imp2(387,15,423,78);
/*
Prepare a nicely filtering 2d render mode for special cases.
*/
driver->getMaterial2D().TextureLayer[0].BilinearFilter=true;
driver->getMaterial2D().AntiAliasing=video::EAAM_FULL_BASIC;
/* /*
Everything is prepared, now we can draw everything in the draw loop, Everything is prepared, now we can draw everything in the draw loop,
between the begin scene and end scene calls. In this example, we are between the begin scene and end scene calls. In this example, we are
...@@ -148,16 +154,18 @@ int main() ...@@ -148,16 +154,18 @@ int main()
video::SColor(255,time % 255,time % 255,255)); video::SColor(255,time % 255,time % 255,255));
/* /*
At last, we draw the Irrlicht Engine logo (without Next, we draw the Irrlicht Engine logo (without
using a color or an alpha channel) and a transparent 2d using a color or an alpha channel). Since we slightly scale
Rectangle at the position of the mouse cursor. the image we use the prepared filter mode.
*/ */
driver->enableMaterial2D();
// draw logo driver->draw2DImage(images, core::rect<s32>(10,10,108,48),
driver->draw2DImage(images, core::position2d<s32>(10,10),
core::rect<s32>(354,87,442,118)); core::rect<s32>(354,87,442,118));
driver->enableMaterial2D(false);
// draw transparent rect under cursor /*
Finally draw a half-transparent rect under the mouse cursor.
*/
core::position2d<s32> m = device->getCursorControl()->getPosition(); core::position2d<s32> m = device->getCursorControl()->getPosition();
driver->draw2DRectangle(video::SColor(100,255,255,255), driver->draw2DRectangle(video::SColor(100,255,255,255),
core::rect<s32>(m.X-20, m.Y-20, m.X+20, m.Y+20)); core::rect<s32>(m.X-20, m.Y-20, m.X+20, m.Y+20));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment