2014-02-10 13:41:05 +01:00
|
|
|
#pragma once
|
|
|
|
#ifndef _VIEWERWINDOW_HPP_
|
|
|
|
#define _VIEWERWINDOW_HPP_
|
2015-04-18 02:11:17 +02:00
|
|
|
#include <engine/GameData.hpp>
|
2014-09-19 01:10:05 +02:00
|
|
|
#include <engine/GameWorld.hpp>
|
2015-04-13 02:48:29 +02:00
|
|
|
#include <core/Logger.hpp>
|
2016-05-15 21:25:20 +02:00
|
|
|
|
|
|
|
#include <QMainWindow>
|
2014-09-20 15:20:12 +02:00
|
|
|
#include <QStackedWidget>
|
2014-09-21 17:13:01 +02:00
|
|
|
#include <QVBoxLayout>
|
2014-02-10 13:41:05 +01:00
|
|
|
|
2016-05-15 21:25:20 +02:00
|
|
|
#include <array>
|
|
|
|
|
2014-02-10 13:41:05 +01:00
|
|
|
class ViewerWidget;
|
2016-05-15 21:25:20 +02:00
|
|
|
class ViewerInterface;
|
2015-04-13 02:48:29 +02:00
|
|
|
class GameRenderer;
|
2016-04-16 15:06:02 +02:00
|
|
|
class QGLContext;
|
2014-03-01 12:19:33 +01:00
|
|
|
|
2014-02-10 13:41:05 +01:00
|
|
|
class ViewerWindow : public QMainWindow
|
|
|
|
{
|
2014-02-10 16:34:09 +01:00
|
|
|
Q_OBJECT
|
2015-04-13 02:48:29 +02:00
|
|
|
|
2016-05-15 21:25:20 +02:00
|
|
|
enum ViewMode {
|
|
|
|
Object = 0,
|
|
|
|
Model = 1,
|
|
|
|
World = 2,
|
|
|
|
_Count
|
|
|
|
};
|
|
|
|
|
2015-04-13 02:48:29 +02:00
|
|
|
Logger engineLog;
|
2015-04-27 04:55:18 +02:00
|
|
|
WorkContext work;
|
2015-04-13 02:48:29 +02:00
|
|
|
|
2015-04-18 02:11:17 +02:00
|
|
|
GameData* gameData;
|
2014-09-19 01:10:05 +02:00
|
|
|
GameWorld* gameWorld;
|
2015-04-13 02:48:29 +02:00
|
|
|
GameRenderer* renderer;
|
2016-05-16 01:06:51 +02:00
|
|
|
GameState* state;
|
2014-09-19 01:10:05 +02:00
|
|
|
|
|
|
|
/** Contains the OGL context */
|
|
|
|
ViewerWidget* viewerWidget;
|
2014-09-21 17:13:01 +02:00
|
|
|
|
2016-05-15 21:25:20 +02:00
|
|
|
std::array<ViewerInterface*, ViewMode::_Count> m_views;
|
|
|
|
std::array<std::string, ViewMode::_Count> m_viewNames;
|
2014-09-21 17:13:01 +02:00
|
|
|
|
2014-09-20 15:20:12 +02:00
|
|
|
QStackedWidget* viewSwitcher;
|
2014-09-19 01:10:05 +02:00
|
|
|
|
|
|
|
QGLContext* context;
|
2014-02-10 13:41:05 +01:00
|
|
|
public:
|
2014-02-11 15:41:46 +01:00
|
|
|
|
2014-02-10 13:41:05 +01:00
|
|
|
ViewerWindow(QWidget* parent = 0, Qt::WindowFlags flags = 0);
|
2014-02-10 16:34:09 +01:00
|
|
|
|
2014-06-08 02:58:49 +02:00
|
|
|
/**
|
|
|
|
* @brief openGame Loads a game's dat file.
|
|
|
|
* @param datFile
|
|
|
|
*/
|
|
|
|
void openGame(const QString& datFile);
|
|
|
|
|
2014-09-19 01:10:05 +02:00
|
|
|
virtual void showEvent(QShowEvent*);
|
2014-02-12 08:12:40 +01:00
|
|
|
|
2014-09-19 01:10:05 +02:00
|
|
|
virtual void closeEvent(QCloseEvent*);
|
2014-02-11 06:46:29 +01:00
|
|
|
|
2014-02-10 16:34:09 +01:00
|
|
|
public slots:
|
|
|
|
|
2014-03-01 12:19:33 +01:00
|
|
|
void openAnimations();
|
|
|
|
|
2014-06-08 02:58:49 +02:00
|
|
|
void loadGame();
|
|
|
|
|
|
|
|
void loadGame( const QString& path );
|
|
|
|
|
2014-09-19 01:10:05 +02:00
|
|
|
signals:
|
|
|
|
|
|
|
|
void loadedData(GameWorld* world);
|
2016-05-15 21:25:20 +02:00
|
|
|
void loadAnimations(const QString& file);
|
2014-09-19 01:10:05 +02:00
|
|
|
|
2014-02-11 15:41:46 +01:00
|
|
|
private slots:
|
|
|
|
|
|
|
|
void openRecent();
|
|
|
|
|
2016-05-15 21:25:20 +02:00
|
|
|
void switchView(int mode);
|
2014-09-20 15:20:12 +02:00
|
|
|
|
2015-04-14 02:06:50 +02:00
|
|
|
void showObjectModel(uint16_t object);
|
|
|
|
|
2014-02-11 15:41:46 +01:00
|
|
|
private:
|
|
|
|
|
2014-06-08 02:58:49 +02:00
|
|
|
QList<QAction*> recentGames;
|
2014-02-11 15:41:46 +01:00
|
|
|
QAction* recentSep;
|
2014-06-08 02:58:49 +02:00
|
|
|
void updateRecentGames();
|
2014-02-10 13:41:05 +01:00
|
|
|
};
|
|
|
|
|
2014-03-01 12:19:33 +01:00
|
|
|
#endif
|