2014-02-10 13:41:05 +01:00
|
|
|
#ifndef _VIEWERWINDOW_HPP_
|
|
|
|
#define _VIEWERWINDOW_HPP_
|
2016-09-09 22:13:21 +02:00
|
|
|
#include <core/Logger.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>
|
2016-05-15 21:25:20 +02:00
|
|
|
|
2018-02-09 13:26:51 +01:00
|
|
|
// Prevent Qt from conflicting with glLoadGen on macOS
|
|
|
|
#include "OpenGLCompat.h"
|
|
|
|
|
2016-05-15 21:25:20 +02:00
|
|
|
#include <QMainWindow>
|
2018-01-16 02:05:23 +01:00
|
|
|
#include <QTabWidget>
|
2014-09-21 17:13:01 +02:00
|
|
|
#include <QVBoxLayout>
|
2018-01-16 02:05:23 +01:00
|
|
|
#include <QOpenGLContext>
|
|
|
|
#include <QOffscreenSurface>
|
2014-02-10 13:41:05 +01:00
|
|
|
|
2018-01-16 02:05:23 +01:00
|
|
|
#include <memory>
|
2016-05-15 21:25:20 +02:00
|
|
|
|
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;
|
2014-03-01 12:19:33 +01:00
|
|
|
|
2016-09-09 22:13:21 +02:00
|
|
|
class ViewerWindow : public QMainWindow {
|
|
|
|
Q_OBJECT
|
2018-01-16 02:05:23 +01:00
|
|
|
QOpenGLContext* context_;
|
|
|
|
QOffscreenSurface* hiddenSurface;
|
|
|
|
QTabWidget* views;
|
2015-04-13 02:48:29 +02:00
|
|
|
|
2016-09-09 22:13:21 +02:00
|
|
|
Logger engineLog;
|
2016-05-15 21:25:20 +02:00
|
|
|
|
2018-01-16 02:05:23 +01:00
|
|
|
std::unique_ptr<GameData> gameData;
|
|
|
|
std::unique_ptr<GameWorld> gameWorld;
|
|
|
|
std::unique_ptr<GameRenderer> renderer;
|
2014-09-19 01:10:05 +02:00
|
|
|
|
2014-02-10 13:41:05 +01:00
|
|
|
public:
|
2016-09-09 22:13:21 +02:00
|
|
|
ViewerWindow(QWidget* parent = 0, Qt::WindowFlags flags = 0);
|
2018-01-16 02:05:23 +01:00
|
|
|
~ViewerWindow();
|
2014-02-10 16:34:09 +01:00
|
|
|
|
2016-09-09 22:13:21 +02:00
|
|
|
virtual void showEvent(QShowEvent*);
|
|
|
|
virtual void closeEvent(QCloseEvent*);
|
2014-02-11 06:46:29 +01:00
|
|
|
|
2018-01-16 02:05:23 +01:00
|
|
|
ViewerWidget* createViewer();
|
2014-03-01 12:19:33 +01:00
|
|
|
|
2018-01-16 02:05:23 +01:00
|
|
|
public slots:
|
2016-09-09 22:13:21 +02:00
|
|
|
void loadGame();
|
2014-06-08 02:58:49 +02:00
|
|
|
|
2016-09-09 22:13:21 +02:00
|
|
|
void loadGame(const QString& path);
|
2014-06-08 02:58:49 +02:00
|
|
|
|
2014-09-19 01:10:05 +02:00
|
|
|
signals:
|
2018-01-16 02:05:23 +01:00
|
|
|
void gameLoaded(GameWorld*, GameRenderer*);
|
2014-09-19 01:10:05 +02:00
|
|
|
|
2014-02-11 15:41:46 +01:00
|
|
|
private slots:
|
2016-09-09 22:13:21 +02:00
|
|
|
void openRecent();
|
|
|
|
void showObjectModel(uint16_t object);
|
2015-04-14 02:06:50 +02:00
|
|
|
|
2014-02-11 15:41:46 +01:00
|
|
|
private:
|
2016-09-09 22:13:21 +02:00
|
|
|
QList<QAction*> recentGames;
|
|
|
|
QAction* recentSep;
|
|
|
|
void updateRecentGames();
|
2018-01-16 02:05:23 +01:00
|
|
|
|
|
|
|
void createMenus();
|
|
|
|
bool setupEngine();
|
|
|
|
void createDefaultViews();
|
|
|
|
|
|
|
|
bool makeCurrent();
|
2014-02-10 13:41:05 +01:00
|
|
|
};
|
|
|
|
|
2016-09-09 22:13:21 +02:00
|
|
|
#endif
|