diff options
Diffstat (limited to 'libraries/irrlicht-1.8/tools/GUIEditor/main.cpp')
-rw-r--r-- | libraries/irrlicht-1.8/tools/GUIEditor/main.cpp | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/libraries/irrlicht-1.8/tools/GUIEditor/main.cpp b/libraries/irrlicht-1.8/tools/GUIEditor/main.cpp new file mode 100644 index 0000000..e8434b2 --- /dev/null +++ b/libraries/irrlicht-1.8/tools/GUIEditor/main.cpp | |||
@@ -0,0 +1,76 @@ | |||
1 | #include <irrlicht.h> | ||
2 | #include "driverChoice.h" | ||
3 | |||
4 | // include the gui creator element factory | ||
5 | #include "CGUIEditFactory.h" | ||
6 | |||
7 | using namespace irr; | ||
8 | using namespace gui; | ||
9 | |||
10 | #ifdef _MSC_VER | ||
11 | #pragma comment(lib, "Irrlicht.lib") | ||
12 | #endif | ||
13 | |||
14 | int main() | ||
15 | { | ||
16 | // ask user for driver | ||
17 | video::E_DRIVER_TYPE driverType=driverChoiceConsole(); | ||
18 | if (driverType==video::EDT_COUNT) | ||
19 | return 1; | ||
20 | |||
21 | IrrlichtDevice *device = createDevice(driverType, core::dimension2du(800, 600)); | ||
22 | video::IVideoDriver* driver = device->getVideoDriver(); | ||
23 | scene::ISceneManager* smgr = device->getSceneManager(); | ||
24 | gui::IGUIEnvironment *env = device->getGUIEnvironment(); | ||
25 | |||
26 | device->setResizable(true); | ||
27 | |||
28 | /* | ||
29 | first we create the factory which can make new GUI elements | ||
30 | and register it with the gui environment. | ||
31 | */ | ||
32 | |||
33 | IGUIElementFactory* factory = new CGUIEditFactory(env); | ||
34 | env->registerGUIElementFactory(factory); | ||
35 | // remember to drop since we created with a create call | ||
36 | factory->drop(); | ||
37 | |||
38 | IGUISkin *skin = env->createSkin(EGST_WINDOWS_METALLIC); | ||
39 | env->setSkin(skin); | ||
40 | |||
41 | IGUIFont *font = env->getFont("../../media/lucida.xml"); | ||
42 | if (font) | ||
43 | skin->setFont(font); | ||
44 | skin->drop(); | ||
45 | |||
46 | // change transparency of skin | ||
47 | for (s32 i=0; i<gui::EGDC_COUNT ; ++i) | ||
48 | { | ||
49 | video::SColor col = env->getSkin()->getColor((gui::EGUI_DEFAULT_COLOR)i); | ||
50 | col.setAlpha(250); | ||
51 | env->getSkin()->setColor((gui::EGUI_DEFAULT_COLOR)i, col); | ||
52 | } | ||
53 | |||
54 | /* | ||
55 | now we add the GUI Editor Workspace | ||
56 | */ | ||
57 | |||
58 | env->addGUIElement("GUIEditor"); | ||
59 | |||
60 | while(device->run()) | ||
61 | { | ||
62 | device->sleep(10); | ||
63 | |||
64 | if (device->isWindowActive()) | ||
65 | { | ||
66 | driver->beginScene(true, true, video::SColor(0,200,200,200)); | ||
67 | smgr->drawAll(); | ||
68 | env->drawAll(); | ||
69 | driver->endScene(); | ||
70 | } | ||
71 | } | ||
72 | |||
73 | device->drop(); | ||
74 | |||
75 | return 0; | ||
76 | } | ||