Merge branch 'master' of https://github.com/zinnschlag/openmw into inputsystem
commit
39f87bee0e
@ -0,0 +1,210 @@
|
|||||||
|
#ifndef GAME_MWBASE_WINDOWMANAGER_H
|
||||||
|
#define GAME_MWBASE_WINDOWMANAGER_H
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
#include <map>
|
||||||
|
|
||||||
|
#include <components/settings/settings.hpp>
|
||||||
|
|
||||||
|
#include "../mwmechanics/stat.hpp"
|
||||||
|
|
||||||
|
#include "../mwgui/mode.hpp"
|
||||||
|
|
||||||
|
namespace MyGUI
|
||||||
|
{
|
||||||
|
class Gui;
|
||||||
|
class Widget;
|
||||||
|
class UString;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace OEngine
|
||||||
|
{
|
||||||
|
namespace GUI
|
||||||
|
{
|
||||||
|
class Layout;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace ESM
|
||||||
|
{
|
||||||
|
struct Class;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace MWWorld
|
||||||
|
{
|
||||||
|
class CellStore;
|
||||||
|
class Ptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace MWGui
|
||||||
|
{
|
||||||
|
class Console;
|
||||||
|
class SpellWindow;
|
||||||
|
class TradeWindow;
|
||||||
|
class ConfirmationDialog;
|
||||||
|
class CountDialog;
|
||||||
|
class ScrollWindow;
|
||||||
|
class BookWindow;
|
||||||
|
class InventoryWindow;
|
||||||
|
class ContainerWindow;
|
||||||
|
class DialogueWindow;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace MWBase
|
||||||
|
{
|
||||||
|
/// \brief Interface for widnow manager (implemented in MWGui)
|
||||||
|
class WindowManager
|
||||||
|
{
|
||||||
|
WindowManager (const WindowManager&);
|
||||||
|
///< not implemented
|
||||||
|
|
||||||
|
WindowManager& operator= (const WindowManager&);
|
||||||
|
///< not implemented
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
typedef std::vector<int> SkillList;
|
||||||
|
|
||||||
|
WindowManager() {}
|
||||||
|
|
||||||
|
virtual ~WindowManager() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Should be called each frame to update windows/gui elements.
|
||||||
|
* This could mean updating sizes of gui elements or opening
|
||||||
|
* new dialogs.
|
||||||
|
*/
|
||||||
|
virtual void update() = 0;
|
||||||
|
|
||||||
|
virtual void pushGuiMode (MWGui::GuiMode mode) = 0;
|
||||||
|
virtual void popGuiMode() = 0;
|
||||||
|
|
||||||
|
virtual void removeGuiMode (MWGui::GuiMode mode) = 0;
|
||||||
|
///< can be anywhere in the stack
|
||||||
|
|
||||||
|
virtual MWGui::GuiMode getMode() const = 0;
|
||||||
|
|
||||||
|
virtual bool isGuiMode() const = 0;
|
||||||
|
|
||||||
|
virtual void toggleVisible (MWGui::GuiWindow wnd) = 0;
|
||||||
|
|
||||||
|
/// Disallow all inventory mode windows
|
||||||
|
virtual void disallowAll() = 0;
|
||||||
|
|
||||||
|
/// Allow one or more windows
|
||||||
|
virtual void allow (MWGui::GuiWindow wnd) = 0;
|
||||||
|
|
||||||
|
virtual bool isAllowed (MWGui::GuiWindow wnd) const = 0;
|
||||||
|
|
||||||
|
/// \todo investigate, if we really need to expose every single lousy UI element to the outside world
|
||||||
|
virtual MWGui::DialogueWindow* getDialogueWindow() = 0;
|
||||||
|
virtual MWGui::ContainerWindow* getContainerWindow() = 0;
|
||||||
|
virtual MWGui::InventoryWindow* getInventoryWindow() = 0;
|
||||||
|
virtual MWGui::BookWindow* getBookWindow() = 0;
|
||||||
|
virtual MWGui::ScrollWindow* getScrollWindow() = 0;
|
||||||
|
virtual MWGui::CountDialog* getCountDialog() = 0;
|
||||||
|
virtual MWGui::ConfirmationDialog* getConfirmationDialog() = 0;
|
||||||
|
virtual MWGui::TradeWindow* getTradeWindow() = 0;
|
||||||
|
virtual MWGui::SpellWindow* getSpellWindow() = 0;
|
||||||
|
virtual MWGui::Console* getConsole() = 0;
|
||||||
|
|
||||||
|
virtual MyGUI::Gui* getGui() const = 0;
|
||||||
|
|
||||||
|
virtual void wmUpdateFps(float fps, unsigned int triangleCount, unsigned int batchCount) = 0;
|
||||||
|
|
||||||
|
/// Set value for the given ID.
|
||||||
|
virtual void setValue (const std::string& id, const MWMechanics::Stat<int>& value) = 0;
|
||||||
|
virtual void setValue (int parSkill, const MWMechanics::Stat<float>& value) = 0;
|
||||||
|
virtual void setValue (const std::string& id, const MWMechanics::DynamicStat<int>& value) = 0;
|
||||||
|
virtual void setValue (const std::string& id, const std::string& value) = 0;
|
||||||
|
virtual void setValue (const std::string& id, int value) = 0;
|
||||||
|
|
||||||
|
virtual void setPlayerClass (const ESM::Class &class_) = 0;
|
||||||
|
///< set current class of player
|
||||||
|
|
||||||
|
virtual void configureSkills (const SkillList& major, const SkillList& minor) = 0;
|
||||||
|
///< configure skill groups, each set contains the skill ID for that group.
|
||||||
|
|
||||||
|
virtual void setReputation (int reputation) = 0;
|
||||||
|
///< set the current reputation value
|
||||||
|
|
||||||
|
virtual void setBounty (int bounty) = 0;
|
||||||
|
///< set the current bounty value
|
||||||
|
|
||||||
|
virtual void updateSkillArea() = 0;
|
||||||
|
///< update display of skills, factions, birth sign, reputation and bounty
|
||||||
|
|
||||||
|
virtual void changeCell(MWWorld::CellStore* cell) = 0;
|
||||||
|
///< change the active cell
|
||||||
|
|
||||||
|
virtual void setPlayerPos(const float x, const float y) = 0;
|
||||||
|
///< set player position in map space
|
||||||
|
|
||||||
|
virtual void setPlayerDir(const float x, const float y) = 0;
|
||||||
|
///< set player view direction in map space
|
||||||
|
|
||||||
|
virtual void setFocusObject(const MWWorld::Ptr& focus) = 0;
|
||||||
|
virtual void setFocusObjectScreenCoords(float min_x, float min_y, float max_x, float max_y) = 0;
|
||||||
|
|
||||||
|
virtual void setMouseVisible(bool visible) = 0;
|
||||||
|
virtual void getMousePosition(int &x, int &y) = 0;
|
||||||
|
virtual void getMousePosition(float &x, float &y) = 0;
|
||||||
|
virtual void setDragDrop(bool dragDrop) = 0;
|
||||||
|
virtual bool getWorldMouseOver() = 0;
|
||||||
|
|
||||||
|
virtual void toggleFogOfWar() = 0;
|
||||||
|
|
||||||
|
virtual void toggleFullHelp() = 0;
|
||||||
|
///< show extra info in item tooltips (owner, script)
|
||||||
|
|
||||||
|
virtual bool getFullHelp() const = 0;
|
||||||
|
|
||||||
|
virtual void setInteriorMapTexture(const int x, const int y) = 0;
|
||||||
|
///< set the index of the map texture that should be used (for interiors)
|
||||||
|
|
||||||
|
/// sets the visibility of the hud health/magicka/stamina bars
|
||||||
|
virtual void setHMSVisibility(bool visible) = 0;
|
||||||
|
|
||||||
|
/// sets the visibility of the hud minimap
|
||||||
|
virtual void setMinimapVisibility(bool visible) = 0;
|
||||||
|
virtual void setWeaponVisibility(bool visible) = 0;
|
||||||
|
virtual void setSpellVisibility(bool visible) = 0;
|
||||||
|
|
||||||
|
virtual void setSelectedSpell(const std::string& spellId, int successChancePercent) = 0;
|
||||||
|
virtual void setSelectedEnchantItem(const MWWorld::Ptr& item, int chargePercent) = 0;
|
||||||
|
virtual void setSelectedWeapon(const MWWorld::Ptr& item, int durabilityPercent) = 0;
|
||||||
|
virtual void unsetSelectedSpell() = 0;
|
||||||
|
virtual void unsetSelectedWeapon() = 0;
|
||||||
|
|
||||||
|
virtual void removeDialog(OEngine::GUI::Layout* dialog) = 0;
|
||||||
|
///< Hides dialog and schedules dialog to be deleted.
|
||||||
|
|
||||||
|
virtual void messageBox (const std::string& message, const std::vector<std::string>& buttons) = 0;
|
||||||
|
virtual int readPressedButton() = 0;
|
||||||
|
///< returns the index of the pressed button or -1 if no button was pressed (->MessageBoxmanager->InteractiveMessageBox)
|
||||||
|
|
||||||
|
virtual void onFrame (float frameDuration) = 0;
|
||||||
|
|
||||||
|
/// \todo get rid of this stuff. Move it to the respective UI element classes, if needed.
|
||||||
|
virtual std::map<int, MWMechanics::Stat<float> > getPlayerSkillValues() = 0;
|
||||||
|
virtual std::map<int, MWMechanics::Stat<int> > getPlayerAttributeValues() = 0;
|
||||||
|
virtual SkillList getPlayerMinorSkills() = 0;
|
||||||
|
virtual SkillList getPlayerMajorSkills() = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetches a GMST string from the store, if there is no setting with the given
|
||||||
|
* ID or it is not a string the default string is returned.
|
||||||
|
*
|
||||||
|
* @param id Identifier for the GMST setting, e.g. "aName"
|
||||||
|
* @param default Default value if the GMST setting cannot be used.
|
||||||
|
*/
|
||||||
|
virtual const std::string &getGameSettingString(const std::string &id, const std::string &default_) = 0;
|
||||||
|
|
||||||
|
virtual void processChangedSettings(const Settings::CategorySettingVector& changed) = 0;
|
||||||
|
|
||||||
|
virtual void executeInConsole (const std::string& path) = 0;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -1,317 +0,0 @@
|
|||||||
#ifndef MWGUI_WINDOWMANAGER_H
|
|
||||||
#define MWGUI_WINDOWMANAGER_H
|
|
||||||
|
|
||||||
/**
|
|
||||||
This class owns and controls all the MW specific windows in the
|
|
||||||
GUI. It can enable/disable Gui mode, and is responsible for sending
|
|
||||||
and retrieving information from the Gui.
|
|
||||||
|
|
||||||
MyGUI should be initialized separately before creating instances of
|
|
||||||
this class.
|
|
||||||
**/
|
|
||||||
|
|
||||||
#include "MyGUI_UString.h"
|
|
||||||
|
|
||||||
#include <components/esm_store/store.hpp>
|
|
||||||
#include <components/settings/settings.hpp>
|
|
||||||
#include <openengine/ogre/renderer.hpp>
|
|
||||||
#include <openengine/gui/manager.hpp>
|
|
||||||
|
|
||||||
#include "../mwmechanics/stat.hpp"
|
|
||||||
|
|
||||||
#include "mode.hpp"
|
|
||||||
|
|
||||||
namespace MyGUI
|
|
||||||
{
|
|
||||||
class Gui;
|
|
||||||
class Widget;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Compiler
|
|
||||||
{
|
|
||||||
class Extensions;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace MWWorld
|
|
||||||
{
|
|
||||||
class Ptr;
|
|
||||||
class CellStore;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace MWMechanics
|
|
||||||
{
|
|
||||||
class MechanicsManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace OEngine
|
|
||||||
{
|
|
||||||
namespace GUI
|
|
||||||
{
|
|
||||||
class Layout;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace MWGui
|
|
||||||
{
|
|
||||||
class WindowBase;
|
|
||||||
class HUD;
|
|
||||||
class MapWindow;
|
|
||||||
class MainMenu;
|
|
||||||
class StatsWindow;
|
|
||||||
class InventoryWindow;
|
|
||||||
class Console;
|
|
||||||
class JournalWindow;
|
|
||||||
class CharacterCreation;
|
|
||||||
class ContainerWindow;
|
|
||||||
class DragAndDrop;
|
|
||||||
class InventoryWindow;
|
|
||||||
class ToolTips;
|
|
||||||
class ScrollWindow;
|
|
||||||
class BookWindow;
|
|
||||||
class TextInputDialog;
|
|
||||||
class InfoBoxDialog;
|
|
||||||
class DialogueWindow;
|
|
||||||
class MessageBoxManager;
|
|
||||||
class CountDialog;
|
|
||||||
class TradeWindow;
|
|
||||||
class SettingsWindow;
|
|
||||||
class ConfirmationDialog;
|
|
||||||
class AlchemyWindow;
|
|
||||||
class SpellWindow;
|
|
||||||
|
|
||||||
struct ClassPoint
|
|
||||||
{
|
|
||||||
const char *id;
|
|
||||||
// Specialization points to match, in order: Stealth, Combat, Magic
|
|
||||||
// Note: Order is taken from http://www.uesp.net/wiki/Morrowind:Class_Quiz
|
|
||||||
unsigned int points[3];
|
|
||||||
};
|
|
||||||
|
|
||||||
class WindowManager
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
typedef std::pair<std::string, int> Faction;
|
|
||||||
typedef std::vector<Faction> FactionList;
|
|
||||||
typedef std::vector<int> SkillList;
|
|
||||||
|
|
||||||
WindowManager(const Compiler::Extensions& extensions, int fpsLevel, bool newGame, OEngine::Render::OgreRenderer *mOgre, const std::string& logpath, bool consoleOnlyScripts);
|
|
||||||
virtual ~WindowManager();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Should be called each frame to update windows/gui elements.
|
|
||||||
* This could mean updating sizes of gui elements or opening
|
|
||||||
* new dialogs.
|
|
||||||
*/
|
|
||||||
void update();
|
|
||||||
|
|
||||||
void pushGuiMode(GuiMode mode);
|
|
||||||
void popGuiMode();
|
|
||||||
void removeGuiMode(GuiMode mode); ///< can be anywhere in the stack
|
|
||||||
|
|
||||||
GuiMode getMode() const
|
|
||||||
{
|
|
||||||
if (mGuiModes.empty())
|
|
||||||
throw std::runtime_error ("getMode() called, but there is no active mode");
|
|
||||||
return mGuiModes.back();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isGuiMode() const { return !mGuiModes.empty(); }
|
|
||||||
|
|
||||||
void toggleVisible(GuiWindow wnd)
|
|
||||||
{
|
|
||||||
mShown = (mShown & wnd) ? (GuiWindow) (mShown & ~wnd) : (GuiWindow) (mShown | wnd);
|
|
||||||
updateVisible();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Disallow all inventory mode windows
|
|
||||||
void disallowAll()
|
|
||||||
{
|
|
||||||
mAllowed = GW_None;
|
|
||||||
updateVisible();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Allow one or more windows
|
|
||||||
void allow(GuiWindow wnd)
|
|
||||||
{
|
|
||||||
mAllowed = (GuiWindow)(mAllowed | wnd);
|
|
||||||
updateVisible();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isAllowed(GuiWindow wnd) const
|
|
||||||
{
|
|
||||||
return mAllowed & wnd;
|
|
||||||
}
|
|
||||||
|
|
||||||
MWGui::DialogueWindow* getDialogueWindow() {return mDialogueWindow;}
|
|
||||||
MWGui::ContainerWindow* getContainerWindow() {return mContainerWindow;}
|
|
||||||
MWGui::InventoryWindow* getInventoryWindow() {return mInventoryWindow;}
|
|
||||||
MWGui::BookWindow* getBookWindow() {return mBookWindow;}
|
|
||||||
MWGui::ScrollWindow* getScrollWindow() {return mScrollWindow;}
|
|
||||||
MWGui::CountDialog* getCountDialog() {return mCountDialog;}
|
|
||||||
MWGui::ConfirmationDialog* getConfirmationDialog() {return mConfirmationDialog;}
|
|
||||||
MWGui::TradeWindow* getTradeWindow() {return mTradeWindow;}
|
|
||||||
MWGui::SpellWindow* getSpellWindow() {return mSpellWindow;}
|
|
||||||
MWGui::Console* getConsole() {return mConsole;}
|
|
||||||
|
|
||||||
MyGUI::Gui* getGui() const { return mGui; }
|
|
||||||
|
|
||||||
void wmUpdateFps(float fps, unsigned int triangleCount, unsigned int batchCount)
|
|
||||||
{
|
|
||||||
mFPS = fps;
|
|
||||||
mTriangleCount = triangleCount;
|
|
||||||
mBatchCount = batchCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
// MWMechanics::DynamicStat<int> getValue(const std::string& id);
|
|
||||||
|
|
||||||
///< Set value for the given ID.
|
|
||||||
void setValue (const std::string& id, const MWMechanics::Stat<int>& value);
|
|
||||||
void setValue(const ESM::Skill::SkillEnum parSkill, const MWMechanics::Stat<float>& value);
|
|
||||||
void setValue (const std::string& id, const MWMechanics::DynamicStat<int>& value);
|
|
||||||
void setValue (const std::string& id, const std::string& value);
|
|
||||||
void setValue (const std::string& id, int value);
|
|
||||||
|
|
||||||
void setPlayerClass (const ESM::Class &class_); ///< set current class of player
|
|
||||||
void configureSkills (const SkillList& major, const SkillList& minor); ///< configure skill groups, each set contains the skill ID for that group.
|
|
||||||
void setReputation (int reputation); ///< set the current reputation value
|
|
||||||
void setBounty (int bounty); ///< set the current bounty value
|
|
||||||
void updateSkillArea(); ///< update display of skills, factions, birth sign, reputation and bounty
|
|
||||||
|
|
||||||
void changeCell(MWWorld::CellStore* cell); ///< change the active cell
|
|
||||||
void setPlayerPos(const float x, const float y); ///< set player position in map space
|
|
||||||
void setPlayerDir(const float x, const float y); ///< set player view direction in map space
|
|
||||||
|
|
||||||
void setFocusObject(const MWWorld::Ptr& focus);
|
|
||||||
void setFocusObjectScreenCoords(float min_x, float min_y, float max_x, float max_y);
|
|
||||||
|
|
||||||
void setMouseVisible(bool visible);
|
|
||||||
void getMousePosition(int &x, int &y);
|
|
||||||
void getMousePosition(float &x, float &y);
|
|
||||||
void setDragDrop(bool dragDrop);
|
|
||||||
bool getWorldMouseOver();
|
|
||||||
|
|
||||||
void toggleFogOfWar();
|
|
||||||
void toggleFullHelp(); ///< show extra info in item tooltips (owner, script)
|
|
||||||
bool getFullHelp() const;
|
|
||||||
|
|
||||||
void setInteriorMapTexture(const int x, const int y);
|
|
||||||
///< set the index of the map texture that should be used (for interiors)
|
|
||||||
|
|
||||||
// sets the visibility of the hud health/magicka/stamina bars
|
|
||||||
void setHMSVisibility(bool visible);
|
|
||||||
// sets the visibility of the hud minimap
|
|
||||||
void setMinimapVisibility(bool visible);
|
|
||||||
void setWeaponVisibility(bool visible);
|
|
||||||
void setSpellVisibility(bool visible);
|
|
||||||
|
|
||||||
void setSelectedSpell(const std::string& spellId, int successChancePercent);
|
|
||||||
void setSelectedEnchantItem(const MWWorld::Ptr& item, int chargePercent);
|
|
||||||
void setSelectedWeapon(const MWWorld::Ptr& item, int durabilityPercent);
|
|
||||||
void unsetSelectedSpell();
|
|
||||||
void unsetSelectedWeapon();
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
void removeDialog(T*& dialog); ///< Casts to OEngine::GUI::Layout and calls removeDialog, then resets pointer to nullptr.
|
|
||||||
void removeDialog(OEngine::GUI::Layout* dialog); ///< Hides dialog and schedules dialog to be deleted.
|
|
||||||
|
|
||||||
void messageBox (const std::string& message, const std::vector<std::string>& buttons);
|
|
||||||
int readPressedButton (); ///< returns the index of the pressed button or -1 if no button was pressed (->MessageBoxmanager->InteractiveMessageBox)
|
|
||||||
|
|
||||||
void onFrame (float frameDuration);
|
|
||||||
|
|
||||||
std::map<ESM::Skill::SkillEnum, MWMechanics::Stat<float> > getPlayerSkillValues() { return mPlayerSkillValues; }
|
|
||||||
std::map<ESM::Attribute::AttributeID, MWMechanics::Stat<int> > getPlayerAttributeValues() { return mPlayerAttributes; }
|
|
||||||
SkillList getPlayerMinorSkills() { return mPlayerMinorSkills; }
|
|
||||||
SkillList getPlayerMajorSkills() { return mPlayerMajorSkills; }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Fetches a GMST string from the store, if there is no setting with the given
|
|
||||||
* ID or it is not a string the default string is returned.
|
|
||||||
*
|
|
||||||
* @param id Identifier for the GMST setting, e.g. "aName"
|
|
||||||
* @param default Default value if the GMST setting cannot be used.
|
|
||||||
*/
|
|
||||||
const std::string &getGameSettingString(const std::string &id, const std::string &default_);
|
|
||||||
|
|
||||||
const ESMS::ESMStore& getStore() const;
|
|
||||||
|
|
||||||
void processChangedSettings(const Settings::CategorySettingVector& changed);
|
|
||||||
|
|
||||||
void executeInConsole (const std::string& path);
|
|
||||||
|
|
||||||
private:
|
|
||||||
OEngine::GUI::MyGUIManager *mGuiManager;
|
|
||||||
HUD *mHud;
|
|
||||||
MapWindow *mMap;
|
|
||||||
MainMenu *mMenu;
|
|
||||||
ToolTips *mToolTips;
|
|
||||||
StatsWindow *mStatsWindow;
|
|
||||||
MessageBoxManager *mMessageBoxManager;
|
|
||||||
Console *mConsole;
|
|
||||||
JournalWindow* mJournal;
|
|
||||||
DialogueWindow *mDialogueWindow;
|
|
||||||
ContainerWindow *mContainerWindow;
|
|
||||||
DragAndDrop* mDragAndDrop;
|
|
||||||
InventoryWindow *mInventoryWindow;
|
|
||||||
ScrollWindow* mScrollWindow;
|
|
||||||
BookWindow* mBookWindow;
|
|
||||||
CountDialog* mCountDialog;
|
|
||||||
TradeWindow* mTradeWindow;
|
|
||||||
SettingsWindow* mSettingsWindow;
|
|
||||||
ConfirmationDialog* mConfirmationDialog;
|
|
||||||
AlchemyWindow* mAlchemyWindow;
|
|
||||||
SpellWindow* mSpellWindow;
|
|
||||||
|
|
||||||
CharacterCreation* mCharGen;
|
|
||||||
|
|
||||||
// Various stats about player as needed by window manager
|
|
||||||
ESM::Class mPlayerClass;
|
|
||||||
std::string mPlayerName;
|
|
||||||
std::string mPlayerRaceId;
|
|
||||||
std::map<ESM::Attribute::AttributeID, MWMechanics::Stat<int> > mPlayerAttributes;
|
|
||||||
SkillList mPlayerMajorSkills, mPlayerMinorSkills;
|
|
||||||
std::map<ESM::Skill::SkillEnum, MWMechanics::Stat<float> > mPlayerSkillValues;
|
|
||||||
MWMechanics::DynamicStat<int> mPlayerHealth, mPlayerMagicka, mPlayerFatigue;
|
|
||||||
|
|
||||||
|
|
||||||
MyGUI::Gui *mGui; // Gui
|
|
||||||
std::vector<GuiMode> mGuiModes;
|
|
||||||
|
|
||||||
std::vector<OEngine::GUI::Layout*> mGarbageDialogs;
|
|
||||||
void cleanupGarbage();
|
|
||||||
|
|
||||||
GuiWindow mShown; // Currently shown windows in inventory mode
|
|
||||||
|
|
||||||
/* Currently ALLOWED windows in inventory mode. This is used at
|
|
||||||
the start of the game, when windows are enabled one by one
|
|
||||||
through script commands. You can manipulate this through using
|
|
||||||
allow() and disableAll().
|
|
||||||
*/
|
|
||||||
GuiWindow mAllowed;
|
|
||||||
|
|
||||||
void updateVisible(); // Update visibility of all windows based on mode, shown and allowed settings
|
|
||||||
|
|
||||||
int mShowFPSLevel;
|
|
||||||
float mFPS;
|
|
||||||
unsigned int mTriangleCount;
|
|
||||||
unsigned int mBatchCount;
|
|
||||||
|
|
||||||
void onDialogueWindowBye();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when MyGUI tries to retrieve a tag. This usually corresponds to a GMST string,
|
|
||||||
* so this method will retrieve the GMST with the name \a _tag and place the result in \a _result
|
|
||||||
*/
|
|
||||||
void onRetrieveTag(const MyGUI::UString& _tag, MyGUI::UString& _result);
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
void WindowManager::removeDialog(T*& dialog)
|
|
||||||
{
|
|
||||||
OEngine::GUI::Layout *d = static_cast<OEngine::GUI::Layout*>(dialog);
|
|
||||||
removeDialog(d);
|
|
||||||
dialog = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
@ -0,0 +1,254 @@
|
|||||||
|
#ifndef MWGUI_WINDOWMANAGERIMP_H
|
||||||
|
#define MWGUI_WINDOWMANAGERIMP_H
|
||||||
|
|
||||||
|
/**
|
||||||
|
This class owns and controls all the MW specific windows in the
|
||||||
|
GUI. It can enable/disable Gui mode, and is responsible for sending
|
||||||
|
and retrieving information from the Gui.
|
||||||
|
|
||||||
|
MyGUI should be initialized separately before creating instances of
|
||||||
|
this class.
|
||||||
|
**/
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include <components/esm/loadclas.hpp>
|
||||||
|
|
||||||
|
#include "../mwbase/windowmanager.hpp"
|
||||||
|
|
||||||
|
namespace MyGUI
|
||||||
|
{
|
||||||
|
class Gui;
|
||||||
|
class Widget;
|
||||||
|
class UString;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace Compiler
|
||||||
|
{
|
||||||
|
class Extensions;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace OEngine
|
||||||
|
{
|
||||||
|
namespace GUI
|
||||||
|
{
|
||||||
|
class Layout;
|
||||||
|
class MyGUIManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace Render
|
||||||
|
{
|
||||||
|
class OgreRenderer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace MWGui
|
||||||
|
{
|
||||||
|
class WindowBase;
|
||||||
|
class HUD;
|
||||||
|
class MapWindow;
|
||||||
|
class MainMenu;
|
||||||
|
class StatsWindow;
|
||||||
|
class InventoryWindow;
|
||||||
|
class JournalWindow;
|
||||||
|
class CharacterCreation;
|
||||||
|
class DragAndDrop;
|
||||||
|
class ToolTips;
|
||||||
|
class TextInputDialog;
|
||||||
|
class InfoBoxDialog;
|
||||||
|
class MessageBoxManager;
|
||||||
|
class SettingsWindow;
|
||||||
|
class AlchemyWindow;
|
||||||
|
|
||||||
|
class WindowManager : public MWBase::WindowManager
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef std::pair<std::string, int> Faction;
|
||||||
|
typedef std::vector<Faction> FactionList;
|
||||||
|
|
||||||
|
WindowManager(const Compiler::Extensions& extensions, int fpsLevel, bool newGame, OEngine::Render::OgreRenderer *mOgre, const std::string& logpath, bool consoleOnlyScripts);
|
||||||
|
virtual ~WindowManager();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Should be called each frame to update windows/gui elements.
|
||||||
|
* This could mean updating sizes of gui elements or opening
|
||||||
|
* new dialogs.
|
||||||
|
*/
|
||||||
|
virtual void update();
|
||||||
|
|
||||||
|
virtual void pushGuiMode(GuiMode mode);
|
||||||
|
virtual void popGuiMode();
|
||||||
|
virtual void removeGuiMode(GuiMode mode); ///< can be anywhere in the stack
|
||||||
|
|
||||||
|
virtual GuiMode getMode() const;
|
||||||
|
|
||||||
|
virtual bool isGuiMode() const;
|
||||||
|
|
||||||
|
virtual void toggleVisible(GuiWindow wnd);
|
||||||
|
|
||||||
|
// Disallow all inventory mode windows
|
||||||
|
virtual void disallowAll();
|
||||||
|
|
||||||
|
// Allow one or more windows
|
||||||
|
virtual void allow(GuiWindow wnd);
|
||||||
|
|
||||||
|
virtual bool isAllowed(GuiWindow wnd) const;
|
||||||
|
|
||||||
|
/// \todo investigate, if we really need to expose every single lousy UI element to the outside world
|
||||||
|
virtual MWGui::DialogueWindow* getDialogueWindow();
|
||||||
|
virtual MWGui::ContainerWindow* getContainerWindow();
|
||||||
|
virtual MWGui::InventoryWindow* getInventoryWindow();
|
||||||
|
virtual MWGui::BookWindow* getBookWindow();
|
||||||
|
virtual MWGui::ScrollWindow* getScrollWindow();
|
||||||
|
virtual MWGui::CountDialog* getCountDialog();
|
||||||
|
virtual MWGui::ConfirmationDialog* getConfirmationDialog();
|
||||||
|
virtual MWGui::TradeWindow* getTradeWindow();
|
||||||
|
virtual MWGui::SpellWindow* getSpellWindow();
|
||||||
|
virtual MWGui::Console* getConsole();
|
||||||
|
|
||||||
|
virtual MyGUI::Gui* getGui() const;
|
||||||
|
|
||||||
|
virtual void wmUpdateFps(float fps, unsigned int triangleCount, unsigned int batchCount);
|
||||||
|
|
||||||
|
///< Set value for the given ID.
|
||||||
|
virtual void setValue (const std::string& id, const MWMechanics::Stat<int>& value);
|
||||||
|
virtual void setValue (int parSkill, const MWMechanics::Stat<float>& value);
|
||||||
|
virtual void setValue (const std::string& id, const MWMechanics::DynamicStat<int>& value);
|
||||||
|
virtual void setValue (const std::string& id, const std::string& value);
|
||||||
|
virtual void setValue (const std::string& id, int value);
|
||||||
|
|
||||||
|
virtual void setPlayerClass (const ESM::Class &class_); ///< set current class of player
|
||||||
|
virtual void configureSkills (const SkillList& major, const SkillList& minor); ///< configure skill groups, each set contains the skill ID for that group.
|
||||||
|
virtual void setReputation (int reputation); ///< set the current reputation value
|
||||||
|
virtual void setBounty (int bounty); ///< set the current bounty value
|
||||||
|
virtual void updateSkillArea(); ///< update display of skills, factions, birth sign, reputation and bounty
|
||||||
|
|
||||||
|
virtual void changeCell(MWWorld::CellStore* cell); ///< change the active cell
|
||||||
|
virtual void setPlayerPos(const float x, const float y); ///< set player position in map space
|
||||||
|
virtual void setPlayerDir(const float x, const float y); ///< set player view direction in map space
|
||||||
|
|
||||||
|
virtual void setFocusObject(const MWWorld::Ptr& focus);
|
||||||
|
virtual void setFocusObjectScreenCoords(float min_x, float min_y, float max_x, float max_y);
|
||||||
|
|
||||||
|
virtual void setMouseVisible(bool visible);
|
||||||
|
virtual void getMousePosition(int &x, int &y);
|
||||||
|
virtual void getMousePosition(float &x, float &y);
|
||||||
|
virtual void setDragDrop(bool dragDrop);
|
||||||
|
virtual bool getWorldMouseOver();
|
||||||
|
|
||||||
|
virtual void toggleFogOfWar();
|
||||||
|
virtual void toggleFullHelp(); ///< show extra info in item tooltips (owner, script)
|
||||||
|
virtual bool getFullHelp() const;
|
||||||
|
|
||||||
|
virtual void setInteriorMapTexture(const int x, const int y);
|
||||||
|
///< set the index of the map texture that should be used (for interiors)
|
||||||
|
|
||||||
|
// sets the visibility of the hud health/magicka/stamina bars
|
||||||
|
virtual void setHMSVisibility(bool visible);
|
||||||
|
// sets the visibility of the hud minimap
|
||||||
|
virtual void setMinimapVisibility(bool visible);
|
||||||
|
virtual void setWeaponVisibility(bool visible);
|
||||||
|
virtual void setSpellVisibility(bool visible);
|
||||||
|
|
||||||
|
virtual void setSelectedSpell(const std::string& spellId, int successChancePercent);
|
||||||
|
virtual void setSelectedEnchantItem(const MWWorld::Ptr& item, int chargePercent);
|
||||||
|
virtual void setSelectedWeapon(const MWWorld::Ptr& item, int durabilityPercent);
|
||||||
|
virtual void unsetSelectedSpell();
|
||||||
|
virtual void unsetSelectedWeapon();
|
||||||
|
|
||||||
|
virtual void removeDialog(OEngine::GUI::Layout* dialog); ///< Hides dialog and schedules dialog to be deleted.
|
||||||
|
|
||||||
|
virtual void messageBox (const std::string& message, const std::vector<std::string>& buttons);
|
||||||
|
virtual int readPressedButton (); ///< returns the index of the pressed button or -1 if no button was pressed (->MessageBoxmanager->InteractiveMessageBox)
|
||||||
|
|
||||||
|
virtual void onFrame (float frameDuration);
|
||||||
|
|
||||||
|
/// \todo get rid of this stuff. Move it to the respective UI element classes, if needed.
|
||||||
|
virtual std::map<int, MWMechanics::Stat<float> > getPlayerSkillValues();
|
||||||
|
virtual std::map<int, MWMechanics::Stat<int> > getPlayerAttributeValues();
|
||||||
|
virtual SkillList getPlayerMinorSkills();
|
||||||
|
virtual SkillList getPlayerMajorSkills();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetches a GMST string from the store, if there is no setting with the given
|
||||||
|
* ID or it is not a string the default string is returned.
|
||||||
|
*
|
||||||
|
* @param id Identifier for the GMST setting, e.g. "aName"
|
||||||
|
* @param default Default value if the GMST setting cannot be used.
|
||||||
|
*/
|
||||||
|
virtual const std::string &getGameSettingString(const std::string &id, const std::string &default_);
|
||||||
|
|
||||||
|
virtual void processChangedSettings(const Settings::CategorySettingVector& changed);
|
||||||
|
|
||||||
|
virtual void executeInConsole (const std::string& path);
|
||||||
|
|
||||||
|
private:
|
||||||
|
OEngine::GUI::MyGUIManager *mGuiManager;
|
||||||
|
HUD *mHud;
|
||||||
|
MapWindow *mMap;
|
||||||
|
MainMenu *mMenu;
|
||||||
|
ToolTips *mToolTips;
|
||||||
|
StatsWindow *mStatsWindow;
|
||||||
|
MessageBoxManager *mMessageBoxManager;
|
||||||
|
Console *mConsole;
|
||||||
|
JournalWindow* mJournal;
|
||||||
|
DialogueWindow *mDialogueWindow;
|
||||||
|
ContainerWindow *mContainerWindow;
|
||||||
|
DragAndDrop* mDragAndDrop;
|
||||||
|
InventoryWindow *mInventoryWindow;
|
||||||
|
ScrollWindow* mScrollWindow;
|
||||||
|
BookWindow* mBookWindow;
|
||||||
|
CountDialog* mCountDialog;
|
||||||
|
TradeWindow* mTradeWindow;
|
||||||
|
SettingsWindow* mSettingsWindow;
|
||||||
|
ConfirmationDialog* mConfirmationDialog;
|
||||||
|
AlchemyWindow* mAlchemyWindow;
|
||||||
|
SpellWindow* mSpellWindow;
|
||||||
|
|
||||||
|
CharacterCreation* mCharGen;
|
||||||
|
|
||||||
|
/// \todo get rid of this stuff. Move it to the respective UI element classes, if needed.
|
||||||
|
// Various stats about player as needed by window manager
|
||||||
|
ESM::Class mPlayerClass;
|
||||||
|
std::string mPlayerName;
|
||||||
|
std::string mPlayerRaceId;
|
||||||
|
std::map<int, MWMechanics::Stat<int> > mPlayerAttributes;
|
||||||
|
SkillList mPlayerMajorSkills, mPlayerMinorSkills;
|
||||||
|
std::map<int, MWMechanics::Stat<float> > mPlayerSkillValues;
|
||||||
|
MWMechanics::DynamicStat<int> mPlayerHealth, mPlayerMagicka, mPlayerFatigue;
|
||||||
|
|
||||||
|
|
||||||
|
MyGUI::Gui *mGui; // Gui
|
||||||
|
std::vector<GuiMode> mGuiModes;
|
||||||
|
|
||||||
|
std::vector<OEngine::GUI::Layout*> mGarbageDialogs;
|
||||||
|
void cleanupGarbage();
|
||||||
|
|
||||||
|
GuiWindow mShown; // Currently shown windows in inventory mode
|
||||||
|
|
||||||
|
/* Currently ALLOWED windows in inventory mode. This is used at
|
||||||
|
the start of the game, when windows are enabled one by one
|
||||||
|
through script commands. You can manipulate this through using
|
||||||
|
allow() and disableAll().
|
||||||
|
*/
|
||||||
|
GuiWindow mAllowed;
|
||||||
|
|
||||||
|
void updateVisible(); // Update visibility of all windows based on mode, shown and allowed settings
|
||||||
|
|
||||||
|
int mShowFPSLevel;
|
||||||
|
float mFPS;
|
||||||
|
unsigned int mTriangleCount;
|
||||||
|
unsigned int mBatchCount;
|
||||||
|
|
||||||
|
void onDialogueWindowBye();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when MyGUI tries to retrieve a tag. This usually corresponds to a GMST string,
|
||||||
|
* so this method will retrieve the GMST with the name \a _tag and place the result in \a _result
|
||||||
|
*/
|
||||||
|
void onRetrieveTag(const MyGUI::UString& _tag, MyGUI::UString& _result);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in New Issue