2010-04-21 14:48:36 +00:00
|
|
|
#ifndef USERINTERFACE_H
|
|
|
|
#define USERINTERFACE_H
|
|
|
|
|
2010-04-23 08:13:44 +00:00
|
|
|
#include "extlib/CGUITTFont.h"
|
2019-04-11 04:31:04 -04:00
|
|
|
#include <irrlicht/irrlicht.h>
|
2010-04-23 08:13:44 +00:00
|
|
|
|
2019-05-16 12:33:53 -04:00
|
|
|
#include <string>
|
2020-03-10 14:12:16 -04:00
|
|
|
#include <vector>
|
2019-05-16 12:33:53 -04:00
|
|
|
|
2019-03-09 15:42:40 -05:00
|
|
|
// Forward declaration of class Engine
|
|
|
|
class Engine;
|
|
|
|
|
2019-04-11 04:31:04 -04:00
|
|
|
enum UserInterfaceElements {
|
2010-04-23 09:00:07 +00:00
|
|
|
UIE_FILEMENU = 1003,
|
2021-02-18 09:31:03 -05:00
|
|
|
UIE_RECENTMENU = 1100, // this whole range (1100-1198) must stay free for generated submenus
|
|
|
|
UIE_RECENTMENU_LAST = 1198,
|
|
|
|
UIE_RECENTMENU_CLEAR = 1199,
|
|
|
|
UIE_LOADFILEDIALOG = 1200,
|
2019-04-11 02:30:48 -04:00
|
|
|
// UIE_LOADBUTTON = 1101,
|
2021-02-18 09:31:03 -05:00
|
|
|
UIE_LOADTEXTUREDIALOG = 1300,
|
|
|
|
UIE_SAVEFILEDIALOG = 1400,
|
2019-04-11 02:30:48 -04:00
|
|
|
|
2019-06-13 08:57:32 -04:00
|
|
|
UIE_PLAYBACKMENU = 2000,
|
2019-04-11 02:30:48 -04:00
|
|
|
|
2019-06-13 08:57:32 -04:00
|
|
|
UIE_VIEWMENU = 3000,
|
|
|
|
|
|
|
|
UIE_PLAYBACKWINDOW = 10000,
|
2020-07-30 23:40:17 -04:00
|
|
|
UIE_PLAYBACKSTARTFRAMESTATICTEXT= 10001,
|
|
|
|
UIE_PLAYBACKSTARTFRAMEEDITBOX = 10002,
|
|
|
|
UIE_PLAYBACKENDFRAMESTATICTEXT = 10003,
|
|
|
|
UIE_PLAYBACKENDFRAMEEDITBOX = 10004,
|
|
|
|
UIE_PLAYBACKSTARTSTOPBUTTON = 10005,
|
|
|
|
UIE_PLAYBACKSETFRAMEEDITBOX = 10006,
|
|
|
|
UIE_PLAYBACKINCREASEBUTTON = 10007,
|
|
|
|
UIE_PLAYBACKDECREASEBUTTON = 10008,
|
|
|
|
UIE_FPSEDITBOX = 10009,
|
|
|
|
UIE_TEXTUREPATHSTATICTEXT = 10010,
|
|
|
|
UIE_TEXTUREPATHEDITBOX = 10011,
|
|
|
|
UIE_AXISSIZESTATICTEXT = 10012,
|
|
|
|
UIE_AXISSIZEEDITBOX = 10013
|
2010-04-21 14:48:36 +00:00
|
|
|
};
|
|
|
|
|
2019-04-11 04:31:04 -04:00
|
|
|
enum UserInterfaceCommands {
|
2019-04-19 15:29:30 -04:00
|
|
|
UIC_FILE_OPEN = 1000,
|
2021-02-18 09:31:03 -05:00
|
|
|
UIC_FILE_RECENT = 1100, // this whole range (1100-1198) must stay free for generated submenus
|
|
|
|
UIC_FILE_RECENT_CLEAR = 1199,
|
|
|
|
UIC_FILE_QUIT = 1002,
|
|
|
|
UIC_FILE_OPEN_TEXTURE = 1003,
|
|
|
|
UIC_FILE_NEXT_TEXTURE = 1004,
|
|
|
|
UIC_FILE_PREVIOUS_TEXTURE = 1005,
|
|
|
|
UIC_FILE_EXPORT_DAE = 1006,
|
|
|
|
UIC_FILE_EXPORT_IRR = 1007,
|
|
|
|
UIC_FILE_EXPORT_IRRMESH = 1008,
|
|
|
|
UIC_FILE_EXPORT_OBJ = 1009,
|
|
|
|
UIC_FILE_EXPORT_STL = 1010,
|
2019-06-13 08:57:32 -04:00
|
|
|
UIC_PLAYBACK_PREVIOUS = 2001,
|
|
|
|
UIC_PLAYBACK_NEXT = 2002,
|
|
|
|
UIC_PLAYBACK_SLOWER = 2003,
|
|
|
|
UIC_PLAYBACK_FASTER = 2004,
|
|
|
|
UIC_VIEW_WIREFRAME = 3001,
|
|
|
|
UIC_VIEW_LIGHTING = 3002,
|
|
|
|
UIC_VIEW_AXIS_WIDGET = 3003,
|
|
|
|
UIC_VIEW_TARGET = 3004,
|
|
|
|
UIC_VIEW_TEXTURE_INTERPOLATION = 3005,
|
|
|
|
UIC_VIEW_Y_UP = 3006,
|
|
|
|
UIC_VIEW_Z_UP = 3007
|
2010-04-21 14:48:36 +00:00
|
|
|
};
|
|
|
|
|
2019-04-11 04:31:04 -04:00
|
|
|
class UserInterface : public irr::IEventReceiver {
|
2010-04-21 14:48:36 +00:00
|
|
|
private:
|
2019-04-11 04:31:04 -04:00
|
|
|
irr::s32 spacing_y;
|
2021-02-18 09:31:03 -05:00
|
|
|
irr::u32 uic_file_recent_first;
|
|
|
|
irr::u32 uic_file_recent_next;
|
|
|
|
irr::s32 m_file_recent_first_idx;
|
|
|
|
irr::s32 m_file_recent_last_idx;
|
2019-04-11 04:31:04 -04:00
|
|
|
Engine* m_Engine;
|
|
|
|
irr::gui::IGUIEnvironment* m_Gui;
|
|
|
|
irr::gui::CGUITTFont* m_GuiFont;
|
|
|
|
irr::gui::CGUITTFace* m_GuiFontFace;
|
2010-04-21 14:48:36 +00:00
|
|
|
|
|
|
|
void setupUserInterface();
|
|
|
|
void displayLoadFileDialog();
|
2019-05-02 21:17:24 -04:00
|
|
|
void displaySaveFileDialog();
|
2019-03-07 17:17:42 -05:00
|
|
|
void displayLoadTextureDialog();
|
2019-06-13 08:57:32 -04:00
|
|
|
void incrementFrame(irr::f32 frameCount, bool enableRound);
|
2019-04-11 04:31:04 -04:00
|
|
|
void handleMenuItemPressed(irr::gui::IGUIContextMenu* menu);
|
2019-07-03 15:15:44 -04:00
|
|
|
void updateSettingsDisplay();
|
2010-04-21 14:48:36 +00:00
|
|
|
|
2019-04-11 04:31:04 -04:00
|
|
|
irr::gui::IGUIWindow* playbackWindow;
|
|
|
|
irr::core::dimension2d<irr::u32> m_WindowSize; // previous size
|
2020-03-10 14:12:16 -04:00
|
|
|
std::vector<std::wstring> m_AllTextures;
|
|
|
|
std::vector<std::wstring> m_MatchingTextures;
|
2010-04-21 14:48:36 +00:00
|
|
|
public:
|
2019-04-11 04:31:04 -04:00
|
|
|
irr::gui::IGUIContextMenu* menu;
|
|
|
|
irr::gui::IGUIContextMenu* fileMenu;
|
2021-02-18 09:31:03 -05:00
|
|
|
irr::gui::IGUIContextMenu* recentMenu;
|
2019-06-13 08:57:32 -04:00
|
|
|
irr::gui::IGUIContextMenu* playbackMenu;
|
2019-04-11 04:31:04 -04:00
|
|
|
irr::gui::IGUIContextMenu* viewMenu;
|
2020-07-30 23:40:17 -04:00
|
|
|
irr::gui::IGUIStaticText* playbackStartFrameStaticText;
|
|
|
|
irr::gui::IGUIEditBox* playbackStartFrameEditBox;
|
|
|
|
irr::gui::IGUIStaticText* playbackEndFrameStaticText;
|
|
|
|
irr::gui::IGUIEditBox* playbackEndFrameEditBox;
|
2019-04-11 04:31:04 -04:00
|
|
|
irr::gui::IGUIButton* playbackStartStopButton;
|
2019-04-19 15:29:30 -04:00
|
|
|
irr::gui::IGUIEditBox* playbackSetFrameEditBox;
|
2019-04-11 04:31:04 -04:00
|
|
|
irr::gui::IGUIButton* playbackIncreaseButton;
|
|
|
|
irr::gui::IGUIButton* playbackDecreaseButton;
|
2019-04-19 15:29:30 -04:00
|
|
|
irr::gui::IGUIEditBox* playbackFPSEditBox;
|
2019-04-11 04:31:04 -04:00
|
|
|
irr::gui::IGUIStaticText* texturePathStaticText;
|
|
|
|
irr::gui::IGUIEditBox* texturePathEditBox;
|
2019-04-19 15:29:30 -04:00
|
|
|
irr::gui::IGUIStaticText* axisSizeStaticText;
|
|
|
|
irr::gui::IGUIEditBox* axisSizeEditBox;
|
2021-02-18 09:31:03 -05:00
|
|
|
irr::u32 fileRecentIdx;
|
|
|
|
std::vector<irr::u32> recentIndices;
|
2019-04-19 15:29:30 -04:00
|
|
|
irr::u32 viewTextureInterpolationIdx;
|
|
|
|
irr::u32 viewWireframeIdx;
|
2019-04-19 15:50:06 -04:00
|
|
|
irr::u32 viewAxisWidgetIdx;
|
2019-04-19 15:29:30 -04:00
|
|
|
irr::u32 viewLightingIdx;
|
|
|
|
irr::u32 viewTargetIdx;
|
|
|
|
irr::u32 viewYUpIdx;
|
|
|
|
irr::u32 viewZUpIdx;
|
2019-04-08 22:52:18 -04:00
|
|
|
|
2019-04-11 04:31:04 -04:00
|
|
|
void snapWidgets();
|
2019-03-08 00:52:29 -05:00
|
|
|
|
2019-04-11 04:31:04 -04:00
|
|
|
UserInterface(Engine* device);
|
2010-04-21 14:48:36 +00:00
|
|
|
~UserInterface();
|
2019-04-11 04:31:04 -04:00
|
|
|
irr::gui::IGUIEnvironment* getGUIEnvironment() const;
|
2010-04-23 07:28:59 +00:00
|
|
|
void drawStatusLine() const;
|
2019-03-08 02:30:06 -05:00
|
|
|
bool loadNextTexture(int direction);
|
2019-05-16 12:33:53 -04:00
|
|
|
void exportMeshToHome(std::string extension);
|
2021-02-18 09:31:03 -05:00
|
|
|
void clearRecent();
|
|
|
|
void addRecent(std::string path);
|
|
|
|
void addRecentPaths(std::vector<std::string> paths);
|
|
|
|
bool hasRecent(std::string path);
|
|
|
|
void openRecent(irr::s32 menuID, std::wstring menuText);
|
2020-03-10 14:12:16 -04:00
|
|
|
bool OnSelectMesh();
|
2020-07-30 23:40:17 -04:00
|
|
|
void setPlaybackText(irr::s32 id, const wchar_t* str);
|
2010-04-21 14:48:36 +00:00
|
|
|
|
|
|
|
// IEventReceiver
|
2019-04-11 04:31:04 -04:00
|
|
|
virtual bool OnEvent(const irr::SEvent& event);
|
2010-04-21 14:48:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // USERINTERFACE_H
|