2014-03-16 23:38:51 +01:00
|
|
|
#ifndef OPENMW_GAME_MWGUI_MAINMENU_H
|
|
|
|
#define OPENMW_GAME_MWGUI_MAINMENU_H
|
|
|
|
|
2022-08-31 19:05:32 +02:00
|
|
|
#include <memory>
|
2024-07-10 20:13:09 +02:00
|
|
|
#include <optional>
|
|
|
|
#include <thread>
|
2022-08-31 19:05:32 +02:00
|
|
|
|
2022-09-01 17:20:15 +02:00
|
|
|
#include "savegamedialog.hpp"
|
2017-09-22 20:46:08 +02:00
|
|
|
#include "windowbase.hpp"
|
2012-05-13 18:14:03 +02:00
|
|
|
|
2014-09-12 05:14:21 +02:00
|
|
|
namespace Gui
|
|
|
|
{
|
|
|
|
class ImageButton;
|
|
|
|
}
|
|
|
|
|
2015-05-02 18:14:53 +02:00
|
|
|
namespace VFS
|
|
|
|
{
|
|
|
|
class Manager;
|
|
|
|
}
|
|
|
|
|
2012-05-13 18:14:03 +02:00
|
|
|
namespace MWGui
|
|
|
|
{
|
|
|
|
|
2014-03-30 23:04:12 +02:00
|
|
|
class BackgroundImage;
|
2014-05-29 17:21:35 +02:00
|
|
|
class VideoWidget;
|
2024-07-10 20:13:09 +02:00
|
|
|
class MenuVideo
|
|
|
|
{
|
|
|
|
MyGUI::ImageBox* mVideoBackground;
|
|
|
|
VideoWidget* mVideo;
|
|
|
|
std::thread mThread;
|
|
|
|
bool mRunning;
|
|
|
|
|
|
|
|
void run();
|
|
|
|
|
|
|
|
public:
|
|
|
|
MenuVideo(const VFS::Manager* vfs);
|
|
|
|
void resize(int w, int h);
|
|
|
|
~MenuVideo();
|
|
|
|
};
|
2013-11-21 20:24:58 +01:00
|
|
|
|
2017-09-22 20:46:08 +02:00
|
|
|
class MainMenu : public WindowBase
|
2012-05-13 18:14:03 +02:00
|
|
|
{
|
2013-11-18 15:52:25 +01:00
|
|
|
int mWidth;
|
|
|
|
int mHeight;
|
2012-08-10 15:15:48 +02:00
|
|
|
|
2014-05-29 17:21:35 +02:00
|
|
|
bool mHasAnimatedMenu;
|
|
|
|
|
2013-11-18 15:52:25 +01:00
|
|
|
public:
|
2015-07-18 03:01:06 +02:00
|
|
|
MainMenu(int w, int h, const VFS::Manager* vfs, const std::string& versionDescription);
|
2012-08-11 17:26:01 +02:00
|
|
|
|
2015-07-18 03:01:06 +02:00
|
|
|
void onResChange(int w, int h) override;
|
2012-08-10 15:15:48 +02:00
|
|
|
|
2020-10-16 22:18:54 +04:00
|
|
|
void setVisible(bool visible) override;
|
2013-01-03 01:09:03 +01:00
|
|
|
|
2020-10-16 22:18:54 +04:00
|
|
|
bool exit() override;
|
2014-05-29 17:21:35 +02:00
|
|
|
|
2020-10-16 22:18:54 +04:00
|
|
|
private:
|
|
|
|
const VFS::Manager* mVFS;
|
2017-10-05 18:35:09 +02:00
|
|
|
|
2015-05-02 18:14:53 +02:00
|
|
|
MyGUI::Widget* mButtonBox;
|
|
|
|
MyGUI::TextBox* mVersionText;
|
2013-11-18 15:52:25 +01:00
|
|
|
|
|
|
|
BackgroundImage* mBackground;
|
|
|
|
|
2024-07-10 20:13:09 +02:00
|
|
|
std::optional<MenuVideo> mVideo; // For animated main menus
|
2014-03-27 04:15:47 +01:00
|
|
|
|
2023-05-21 16:39:32 +02:00
|
|
|
std::map<std::string, Gui::ImageButton*, std::less<>> mButtons;
|
2014-05-29 17:21:35 +02:00
|
|
|
|
2014-09-12 05:14:21 +02:00
|
|
|
void onButtonClicked(MyGUI::Widget* sender);
|
2014-03-26 21:11:39 +01:00
|
|
|
void onNewGameConfirmed();
|
2014-03-26 22:05:21 +01:00
|
|
|
void onExitConfirmed();
|
2013-11-18 15:52:25 +01:00
|
|
|
|
|
|
|
void showBackground(bool show);
|
|
|
|
|
2014-03-27 04:15:47 +01:00
|
|
|
void updateMenu();
|
|
|
|
|
2022-08-31 19:05:32 +02:00
|
|
|
std::unique_ptr<SaveGameDialog> mSaveGameDialog;
|
2012-05-13 18:14:03 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
2014-03-16 23:38:51 +01:00
|
|
|
|
|
|
|
#endif
|