Browse Source

Create a test case with `GuiEvent` in `Application`

master
Krisjanis Rijnieks 9 years ago
parent
commit
c9a2d066da
  1. 10
      src/Application/Application.cpp
  2. 9
      src/Application/Application.h

10
src/Application/Application.cpp

@ -13,6 +13,8 @@ Application::Application(){
setState(PresentationState::instance());
ofAddListener(ofEvents().keyPressed, this, &Application::onKeyPressed);
ofAddListener(ofEvents().keyReleased, this, &Application::onKeyReleased);
ofAddListener(ofEvents().mousePressed, this, &Application::onMousePressed);
ofAddListener(Gui::instance()->event, this, &Application::onGuiEvent);
}
void Application::setup(){
@ -102,6 +104,14 @@ void Application::onKeyReleased(ofKeyEventArgs & args){
}
}
void Application::onMousePressed(ofMouseEventArgs & args){
Gui::instance()->notifyEvent(args);
}
void Application::onGuiEvent(GuiEvent & e){
cout << "GUI EVENT: " << e.args.x << ", " << e.args.y << ", " << e.type << endl;
}
void Application::addFboSource(FboSource & fboSource){
_mediaServer.addFboSource(fboSource);
}

9
src/Application/Application.h

@ -18,6 +18,8 @@
// TODO: To be removed.
#include "GuiMode.h"
#include "Gui.h"
#define PIMAPPER_DEF_SURFACES_XML_FILE "defaultSurfaces.xml"
#define PIMAPPER_USER_SURFACES_XML_FILE "surfaces.xml"
@ -35,8 +37,15 @@ class Application {
void setup();
void draw();
void onKeyPressed(ofKeyEventArgs & args);
void onKeyReleased(ofKeyEventArgs & args);
// We use this to pass mouse events into the GUI layer
void onMousePressed(ofMouseEventArgs & args);
// Then we catch GUI events with this one and create commands
void onGuiEvent(GuiEvent & e);
void addFboSource(FboSource & fboSource);
bool loadXmlSettings(string fileName);

Loading…
Cancel
Save