Select Git revision
QWindow.hpp
QWindow.hpp 1.63 KiB
///
/// @file QWindow.hpp
/// @author Armin Co
///
#ifndef Q_WINDOW_HPP
#define Q_WINDOW_HPP
#include <thread>
#include <map>
#include <memory>
#include <gtkmm.h>
#include "Particle.hpp"
#include "ParticleImage.hpp"
#include "QDrawingArea.hpp"
/// @brief Definition of the QPong window
///
class QWindow : public Gtk::Window
{
public:
/// @brief Constructor of the window
///
QWindow();
/// @brief Virtual destructor of the window.
///
virtual ~QWindow(){}
/// @brief Sends a signal to GTK to update drawing areas.
void updateView();
protected:
/// @brief signal handlers
///
void onButtonPress();
bool onKeyPress(GdkEventKey* event);
private:
/// @brief Updates the QDrawingArea for position and momentum.
///
void updateImage();
/// @brief Update all labels from the gui.
///
void updateGui();
/// @brief Loop throug iteratins of the simulation
///
void simulation();
Gtk::Box m_box;
Gtk::VBox m_vBox;
Gtk::HBox m_hBox;
Gtk::Box m_fpsBox;
Gtk::Label m_label;
Gtk::Button m_button;
Gtk::Label m_renderRate;
Gtk::Label m_proppergatingRate;
Gtk::Box m_scoreBox;
Gtk::Label m_scorePlayerOne;
Gtk::Label m_scorePlayerTwo;
Glib::Dispatcher m_guiDispatcher;
Glib::Dispatcher m_areaDispatcher;
QDrawingArea m_positionArea;
QDrawingArea m_momentumArea;
QPong::Particle *m_particle;
std::thread m_propagatingThread;
ParticleImage *m_momentum;
ParticleImage *m_position;
ParticleImage *m_obstacle;
std::map<QPong::Player::Id, std::shared_ptr<QPong::Player>> m_players;
};
#endif