From 9530ae05267ec86887be535f1d46a1531bf4273b Mon Sep 17 00:00:00 2001 From: nkorslund Date: Thu, 5 Feb 2009 14:11:59 +0000 Subject: [PATCH] More work on the MyGUI skins and layouts git-svn-id: https://openmw.svn.sourceforge.net/svnroot/openmw/trunk@86 ea6a568a-9f4f-0410-981a-c910a81bb256 --- core/config.d | 1 + core/resource.d | 74 +- input/events.d | 10 +- input/keys.d | 2 + media_mygui/core.skin | 1347 ----------------- media_mygui/core.xml | 17 +- media_mygui/{openmw.font => openmw.font.xml} | 9 +- .../{openmw.pointer => openmw.pointer.xml} | 0 ...nmw_button.skin => openmw_button.skin.xml} | 2 +- media_mygui/openmw_hud_box.skin.xml | 22 + media_mygui/openmw_hud_energybar.skin.xml | 85 ++ media_mygui/openmw_hud_layout.xml | 47 + media_mygui/openmw_layers.xml | 12 + media_mygui/openmw_text.skin.xml | 19 + ...w_windows.skin => openmw_windows.skin.xml} | 13 +- ogre/bindings.d | 4 +- ogre/cpp_framelistener.cpp | 11 +- ogre/cpp_mygui.cpp | 301 +++- 18 files changed, 511 insertions(+), 1465 deletions(-) rename media_mygui/{openmw.font => openmw.font.xml} (83%) rename media_mygui/{openmw.pointer => openmw.pointer.xml} (100%) rename media_mygui/{openmw_button.skin => openmw_button.skin.xml} (97%) create mode 100644 media_mygui/openmw_hud_box.skin.xml create mode 100644 media_mygui/openmw_hud_energybar.skin.xml create mode 100644 media_mygui/openmw_hud_layout.xml create mode 100644 media_mygui/openmw_layers.xml create mode 100644 media_mygui/openmw_text.skin.xml rename media_mygui/{openmw_windows.skin => openmw_windows.skin.xml} (95%) diff --git a/core/config.d b/core/config.d index ae07e61008..989beda859 100644 --- a/core/config.d +++ b/core/config.d @@ -237,6 +237,7 @@ struct ConfigManager bind(Keys.ToggleBattleMusic, KC.SPACE); bind(Keys.PhysMode, KC.T); bind(Keys.Nighteye, KC.N); + bind(Keys.ToggleGui, KC.Mouse1); bind(Keys.Debug, KC.G); bind(Keys.Pause, KC.PAUSE, KC.P); diff --git a/core/resource.d b/core/resource.d index b723308090..62a5410402 100644 --- a/core/resource.d +++ b/core/resource.d @@ -266,21 +266,11 @@ struct ResourceManager // Create a new resource locator ti = esmRegion.newT!(TextureResource); - + ti.name = esmRegion.copyz(id); ti.newName = ti.name; ti.type = ti.name[$-3..$]; - char tmp[]; - if(id.length < 70) - { - // See comment in lookupMesh - texBuffer[9..9+id.length] = id; - tmp = texBuffer[0..9+id.length]; - } - else - tmp = "textures\\" ~ id; - void searchBSAs(char[] search) { // Look it up in the BSA @@ -297,30 +287,54 @@ struct ResourceManager } } - searchBSAs(tmp); - - // If we can't find it, try the same filename but with .dds as the - // extension. Bethesda did at some point convert all their - // textures to dds to improve loading times. However, they did not - // update their esm-files or require them to use the correct - // extention (if they had, it would have broken a lot of user - // mods). So we must support files that are referenced as eg .tga - // but stored as .dds. - if(ti.bsaIndex == -1 && ti.type != "dds") + void searchWithDDS(char[] search) { - tmp[$-3..$] = "dds"; - searchBSAs(tmp); - if(ti.bsaIndex != -1) - { - // Store the real name in newName. - ti.newName = esmRegion.copyz(ti.name); + searchBSAs(search); - // Get a slice of the extension and overwrite it. - ti.type = ti.newName[$-3..$]; - ti.type[] = "dds"; + // If we can't find it, try the same filename but with .dds as + // the extension. Bethesda did at some point convert all their + // textures to dds to improve loading times. However, they did + // not update their esm-files or require them to use the + // correct extention (if they had, it would have broken a lot + // of user mods). So we must support files that are referenced + // as eg .tga but stored as .dds. + if(ti.bsaIndex == -1 && ti.type != "dds") + { + search[$-3..$] = "dds"; + searchBSAs(search); + if(ti.bsaIndex != -1) + { + // Store the real name in newName. + ti.newName = esmRegion.copyz(ti.name); + + // Get a slice of the extension and overwrite it. + ti.type = ti.newName[$-3..$]; + ti.type[] = "dds"; + } } } + // Search for 'texture\name' first + char[] tmp; + if(id.length < 70) + { + tmp = texBuffer[0..9+id.length]; + tmp[9..$] = id; + } + else + tmp = "textures\\" ~ id; + + searchWithDDS(tmp); + + // Not found? If so, try without the 'texture\' + if(ti.bsaIndex == -1) + { + tmp = tmp[9..$]; + tmp[] = id; // Reset the name (replace .dds with the original) + + searchWithDDS(tmp); + } + // Check that extensions match, to be on the safe side assert(ti.type == ti.newName[$-3..$]); diff --git a/input/events.d b/input/events.d index 431b0e0bd2..856026aa82 100644 --- a/input/events.d +++ b/input/events.d @@ -186,6 +186,7 @@ extern(C) void d_handleKey(KC keycode, dchar text = 0) case Keys.PhysMode: bullet_nextMode(); break; case Keys.Nighteye: ogre_toggleLight(); break; + case Keys.ToggleGui: gui_toggleGui(); break; case Keys.Debug: break; case Keys.ScreenShot: takeScreenShot(); break; @@ -237,7 +238,7 @@ bool isPressed(Keys key) return false; } -extern(C) int d_frameStarted(float time) +extern(C) int d_frameStarted(float time, int guiMode) { if(doExit) return 0; @@ -251,8 +252,8 @@ extern(C) int d_frameStarted(float time) musCumTime -= musRefresh; } - // The rest is ignored in pause mode - if(pause) return 1; + // The rest is ignored in pause or GUI mode + if(pause || guiMode == 1) return 1; // Walking / floating speed, in points per second. const float speed = 300; @@ -267,7 +268,7 @@ extern(C) int d_frameStarted(float time) if(isPressed(Keys.MoveBackward)) moveZ += speed; // TODO: These should be enabled for floating modes (like swimming - // and levitation) only. + // and levitation) and disabled for everything else. if(isPressed(Keys.MoveUp)) moveY += speed; if(isPressed(Keys.MoveDown)) moveY -= speed; @@ -300,6 +301,7 @@ extern(C) int d_frameStarted(float time) bullet_getPlayerPos(&x, &y, &z); ogre_moveCamera(x,y,z); + // Tell the sound scene that the player has moved sndCumTime += time; if(sndCumTime > sndRefresh) { diff --git a/input/keys.d b/input/keys.d index c988472af8..deae120797 100644 --- a/input/keys.d +++ b/input/keys.d @@ -67,6 +67,7 @@ enum Keys ToggleBattleMusic, PhysMode, // Toggle physics mode between walking, flying and ghost Nighteye, // Full ambient lighting + ToggleGui, // Turn the GUI on/off Debug, // Misc @@ -252,6 +253,7 @@ struct KeyBindings keyToString[Keys.ToggleBattleMusic] = "Toggle Battle Music"; keyToString[Keys.PhysMode] = "Toggle Physics Mode"; keyToString[Keys.Nighteye] = "Toggle Nighteye"; + keyToString[Keys.ToggleGui] = "Toggle GUI"; keyToString[Keys.Debug] = "OGRE Test Action"; keyToString[Keys.Pause] = "Pause"; diff --git a/media_mygui/core.skin b/media_mygui/core.skin index 82d6cab39b..ccd44a3396 100644 --- a/media_mygui/core.skin +++ b/media_mygui/core.skin @@ -2,647 +2,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_BasisSkin type="SubSkin" offset = "3 0 18 30" align = "ALIGN_HSTRETCH ALIGN_TOP"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -655,714 +18,4 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_BasisSkin type="MainSkin" offset = "0 0 50 50" align = "ALIGN_LEFT ALIGN_TOP"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_BasisSkin type="SubSkin" offset = "8 0 27 28" align = "ALIGN_HSTRETCH ALIGN_TOP"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_BasisSkin type="SubSkin" offset = "3 3 10 16" align = "ALIGN_STRETCH"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_BasisSkin type="MainSkin" offset = "0 0 0 0" align = "ALIGN_LEFT ALIGN_TOP"/> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/media_mygui/core.xml b/media_mygui/core.xml index f7439be0bb..1972c2372d 100644 --- a/media_mygui/core.xml +++ b/media_mygui/core.xml @@ -3,16 +3,19 @@ - - + + - - - - - + + + + + + + + diff --git a/media_mygui/openmw.font b/media_mygui/openmw.font.xml similarity index 83% rename from media_mygui/openmw.font rename to media_mygui/openmw.font.xml index 9baccc7c5c..30c8612544 100644 --- a/media_mygui/openmw.font +++ b/media_mygui/openmw.font.xml @@ -1,7 +1,6 @@ - diff --git a/media_mygui/openmw.pointer b/media_mygui/openmw.pointer.xml similarity index 100% rename from media_mygui/openmw.pointer rename to media_mygui/openmw.pointer.xml diff --git a/media_mygui/openmw_button.skin b/media_mygui/openmw_button.skin.xml similarity index 97% rename from media_mygui/openmw_button.skin rename to media_mygui/openmw_button.skin.xml index 036202485e..8bbbdd6a5c 100644 --- a/media_mygui/openmw_button.skin +++ b/media_mygui/openmw_button.skin.xml @@ -60,7 +60,7 @@ - + diff --git a/media_mygui/openmw_hud_box.skin.xml b/media_mygui/openmw_hud_box.skin.xml new file mode 100644 index 0000000000..7b2890a56a --- /dev/null +++ b/media_mygui/openmw_hud_box.skin.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/media_mygui/openmw_hud_energybar.skin.xml b/media_mygui/openmw_hud_energybar.skin.xml new file mode 100644 index 0000000000..28c7a29284 --- /dev/null +++ b/media_mygui/openmw_hud_energybar.skin.xml @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/media_mygui/openmw_hud_layout.xml b/media_mygui/openmw_hud_layout.xml new file mode 100644 index 0000000000..38ff254408 --- /dev/null +++ b/media_mygui/openmw_hud_layout.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/media_mygui/openmw_layers.xml b/media_mygui/openmw_layers.xml new file mode 100644 index 0000000000..7540cab75a --- /dev/null +++ b/media_mygui/openmw_layers.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/media_mygui/openmw_text.skin.xml b/media_mygui/openmw_text.skin.xml new file mode 100644 index 0000000000..874a5b8048 --- /dev/null +++ b/media_mygui/openmw_text.skin.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/media_mygui/openmw_windows.skin b/media_mygui/openmw_windows.skin.xml similarity index 95% rename from media_mygui/openmw_windows.skin rename to media_mygui/openmw_windows.skin.xml index 10ea2bec9e..1c6a27cc9d 100644 --- a/media_mygui/openmw_windows.skin +++ b/media_mygui/openmw_windows.skin.xml @@ -1,8 +1,8 @@ - - + + @@ -159,7 +159,11 @@ - + + + + + @@ -209,8 +213,7 @@ - - + diff --git a/ogre/bindings.d b/ogre/bindings.d index 64c378af9b..6542ccef8c 100644 --- a/ogre/bindings.d +++ b/ogre/bindings.d @@ -163,7 +163,7 @@ void ogre_moveCameraRel(float x, float y, float z); // Insert a raw RGBA image into the texture system. //void ogre_insertTexture(char *name, int width, int height, void *data); -void gui_setupGUI(); - // Test +void gui_setupGUI(); +void gui_toggleGui(); void gui_setFpsText(char *str); diff --git a/ogre/cpp_framelistener.cpp b/ogre/cpp_framelistener.cpp index a2baa276e9..18a9fd2f90 100644 --- a/ogre/cpp_framelistener.cpp +++ b/ogre/cpp_framelistener.cpp @@ -25,12 +25,13 @@ // Callbacks to D code. // Called once each frame -extern "C" int32_t d_frameStarted(float time); +extern "C" int32_t d_frameStarted(float time, int guiMode); // Handle events extern "C" void d_handleKey(int keycode, uint32_t text); extern "C" void d_handleMouseMove(const OIS::MouseState *state); -extern "C" void d_handleMouseButton(const OIS::MouseState *state, int32_t button); +extern "C" void d_handleMouseButton(const OIS::MouseState *state, + int32_t button); // Frame listener, passed to Ogre. The only thing we use this for is // to capture input and pass control to D code. @@ -52,7 +53,7 @@ public: mGUI->injectFrameEntered(evt.timeSinceLastFrame); // Turn over control to the D code - return d_frameStarted(evt.timeSinceLastFrame); + return d_frameStarted(evt.timeSinceLastFrame, guiMode); } }; @@ -98,8 +99,8 @@ public: */ if(guiMode) mGUI->injectMousePress(arg, id); - else - d_handleMouseButton(&arg.state, id); + + d_handleMouseButton(&arg.state, id); return true; } diff --git a/ogre/cpp_mygui.cpp b/ogre/cpp_mygui.cpp index f78a26d6fb..200aadc7a0 100644 --- a/ogre/cpp_mygui.cpp +++ b/ogre/cpp_mygui.cpp @@ -1,24 +1,204 @@ MyGUI::WidgetPtr FPSText; -MyGUI::WindowPtr window; MyGUI::WindowPtr mwindow; +OIS::MouseState state; + +extern "C" void gui_toggleGui() +{ + if(guiMode == 1) + { + guiMode = 0; + mGUI->hidePointer(); + if(mwindow) + mwindow->setVisible(false); + state = mMouse->getMouseState(); + } + else + { + // Restore the GUI mouse position. This is a hack because silly + // OIS doesn't allow us to set the mouse position ourselves. + *((OIS::MouseState*)&(mMouse->getMouseState())) = state; + mGUI->injectMouseMove(state.X.abs, state.Y.abs, 0); + + guiMode = 1; + mGUI->showPointer(); + if(mwindow) + mwindow->setVisible(true); + } +} + void turnGuiOff(MyGUI::WidgetPtr sender) { - guiMode = 0; - mGUI->hidePointer(); - if(window) - { - window->destroySmooth(); - window = NULL; - } - if(mwindow) - { - mwindow->destroySmooth(); - mwindow = NULL; - } + guiMode = 1; + gui_toggleGui(); } +// Copied from MyGUI demo code, with a few modifications +class Layout +{ +public: + Layout(const std::string & _layout, MyGUI::WidgetPtr _parent = nullptr) + : mMainWidget(nullptr) + { + initialise(_layout, _parent); + } + + template + void getWidget(T * & _widget, const std::string & _name, bool _throw = true) + { + _widget = nullptr; + for (MyGUI::VectorWidgetPtr::iterator iter=mListWindowRoot.begin(); + iter!=mListWindowRoot.end(); ++iter) + { + MyGUI::WidgetPtr find = (*iter)->findWidget(mPrefix + _name); + if (nullptr != find) + { + T * cast = find->castType(false); + if (nullptr != cast) + _widget = cast; + else if (_throw) + { + MYGUI_EXCEPT("Error cast : dest type = '" << T::getClassTypeName() + << "' source name = '" << find->getName() + << "' source type = '" << find->getTypeName() << "' in layout '" << mLayoutName << "'"); + } + return; + } + } + MYGUI_ASSERT( ! _throw, "widget name '" << _name << "' in layout '" << mLayoutName << "' not found."); + } + + void initialise(const std::string & _layout, + MyGUI::WidgetPtr _parent = nullptr) + { + const std::string MAIN_WINDOW = "_Main"; + mLayoutName = _layout; + + if (mLayoutName.empty()) + mMainWidget = _parent; + else + { + mPrefix = MyGUI::utility::toString(this, "_"); + mListWindowRoot = MyGUI::LayoutManager::getInstance().loadLayout(mLayoutName, mPrefix, _parent); + + const std::string main_name = mPrefix + MAIN_WINDOW; + for (MyGUI::VectorWidgetPtr::iterator iter=mListWindowRoot.begin(); iter!=mListWindowRoot.end(); ++iter) { + if ((*iter)->getName() == main_name) + { + mMainWidget = (*iter); + break; + } + } + MYGUI_ASSERT(mMainWidget, "root widget name '" << MAIN_WINDOW << "' in layout '" << mLayoutName << "' not found."); + } + } + + void shutdown() + { + for (VectorBasePtr::iterator iter=mListBase.begin(); iter!=mListBase.end(); ++iter) { + delete (*iter); + } + mListBase.clear(); + + MyGUI::LayoutManager::getInstance().unloadLayout(mListWindowRoot); + mListWindowRoot.clear(); + } + + void setCoord(int x, int y, int w, int h) + { + mMainWidget->setCoord(x,y,w,h); + } + + virtual ~Layout() + { + shutdown(); + } + +protected: + + MyGUI::WidgetPtr mMainWidget; + + std::string mPrefix; + std::string mLayoutName; + MyGUI::VectorWidgetPtr mListWindowRoot; + typedef std::vector VectorBasePtr; + VectorBasePtr mListBase; +}; + +class HUD : public Layout +{ +public: + HUD() + : Layout("openmw_hud_layout.xml") + { + setCoord(0,0, + mWindow->getWidth(), + mWindow->getHeight()); + + // Energy bars + getWidget(health, "Health"); + getWidget(magicka, "Magicka"); + getWidget(stamina, "Stamina"); + + // Item and spell images and status bars + getWidget(weapImage, "WeapImage"); + getWidget(weapStatus, "WeapStatus"); + getWidget(spellImage, "SpellImage"); + getWidget(spellStatus, "SpellStatus"); + + getWidget(effectBox, "EffectBox"); + getWidget(effect1, "Effect1"); + + getWidget(minimap, "MiniMap"); + getWidget(compass, "Compass"); + + compass->setImageTexture("compass.dds"); + } + + void setStats(int h, int hmax, int m, int mmax, int s, int smax) + { + health->setProgressRange(hmax); + health->setProgressPosition(h); + magicka->setProgressRange(mmax); + magicka->setProgressPosition(m); + stamina->setProgressRange(smax); + stamina->setProgressPosition(s); + } + + void setWeapIcon(const char *str) + { weapImage->setImageTexture(str); } + void setSpellIcon(const char *str) + { spellImage->setImageTexture(str); } + + void setWeapStatus(int s, int smax) + { + weapStatus->setProgressRange(smax); + weapStatus->setProgressPosition(s); + } + void setSpellStatus(int s, int smax) + { + spellStatus->setProgressRange(smax); + spellStatus->setProgressPosition(s); + } + + void setEffect(const char *img) + { effect1->setImageTexture(img); } + + MyGUI::ProgressPtr health, magicka, stamina; + + MyGUI::StaticImagePtr weapImage, spellImage; + MyGUI::ProgressPtr weapStatus, spellStatus; + + MyGUI::WidgetPtr effectBox; + MyGUI::StaticImagePtr effect1; + + MyGUI::StaticImagePtr minimap; + MyGUI::StaticImagePtr compass; +}; + +HUD *hud; + extern "C" void gui_setupGUI() { ResourceGroupManager::getSingleton(). @@ -41,69 +221,66 @@ extern "C" void gui_setupGUI() "Statistic"); FPSText->setTextAlign(MyGUI::ALIGN_RIGHT); FPSText->setNeedMouseFocus(false); + FPSText->setTextColour(Ogre::ColourValue::White); - guiMode = 1; - MyGUI::WidgetPtr tmp; - /* - // TESTING WINDOW WITH BUTTON - width = 300; - height = 200; - window = mGUI->createWidget - ("WindowCS", - (mWidth-width)/4, (mHeight-height)/4, // Position - width, height, // Size - MyGUI::ALIGN_DEFAULT, "Overlapped"); - //window->setFontName("ManualFont"); - window->setCaption("GUI Demo"); - window->setAlpha(0.7); - - width = 150; - height = 30; - tmp = window->createWidget - ("ButtonSmall", - 40, 100, // Position - width, height, // Size - MyGUI::ALIGN_LEFT | MyGUI::ALIGN_TOP, - "QuitButton"); - tmp->setCaption("Press this button"); - tmp->eventMouseButtonClick = MyGUI::newDelegate(&turnGuiOff); - */ - - // TESTING MORROWIND SKIN - width = 300; - height = 190; + // Window with Morrowind skin mwindow = mGUI->createWidget ("MW_Window", (mWidth-width)/4, (mHeight-height)/4, // Position - width, height, // Size - MyGUI::ALIGN_DEFAULT, "Overlapped"); + 300, 190, // Size + MyGUI::ALIGN_DEFAULT, "Windows"); mwindow->setCaption("Skin test"); - mwindow->setMinMax(100, 140, 1000, 1000); - mwindow->setAlpha(1); + mwindow->setMinSize(120, 140); + mwindow->getClientWidget()->setAlpha(0.6); - width = 45; - height = 24; + MyGUI::WidgetPtr tmp; tmp = mwindow->createWidget ("MW_Button", 10, 32, // Position - width, height, // Size + 45, 24, // Size MyGUI::ALIGN_LEFT | MyGUI::ALIGN_TOP, "MWButton1"); tmp->setCaption("Close"); tmp->eventMouseButtonClick = MyGUI::newDelegate(&turnGuiOff); + tmp->setInheritsAlpha(false); - // TESTING BITMAP FONT - /* - tmp = mGUI->createWidget - ("StaticText", - 10, mHeight - height, // Position - width, height, // Size - MyGUI::ALIGN_LEFT | MyGUI::ALIGN_BOTTOM, - "Statistic"); - tmp->setTextAlign(MyGUI::ALIGN_LEFT); - tmp->setFontName("ManualFont"); - tmp->setCaption("ABC"); - //*/ + tmp = mwindow->createWidget + ("DaedricText_orig", + 10,70, + 300, 20, + MyGUI::ALIGN_LEFT | MyGUI::ALIGN_TOP, + "Daed1"); + tmp->setCaption("ABCDEFGHIJKLMNOPQRSTUVWXYZ"); + + tmp = mwindow->createWidget + ("DaedricText", + 10,100, + 300, 20, + MyGUI::ALIGN_LEFT | MyGUI::ALIGN_TOP, + "Daed2"); + tmp->setCaption("ABCDEFGHIJKLMNOPQRSTUVWXYZ"); + + // Turn the GUI off at startup + turnGuiOff(NULL); + // Start the mouse in the middle of the screen + state.X.abs = mWidth / 2; + state.Y.abs = mHeight / 2; + + MyGUI::ProgressPtr prog; + + // Set up the HUD + hud = new HUD(); + + hud->setStats(60, 100, + 30, 100, + 80, 100); + + hud->setWeapIcon("icons\\w\\tx_knife_iron.dds"); + hud->setWeapStatus(90, 100); + hud->setSpellIcon("icons\\s\\b_tx_s_rstor_health.dds"); + hud->setSpellStatus(65, 100); + + hud->setEffect("icons\\s\\tx_s_chameleon.dds"); } extern "C" void gui_setFpsText(char *str)