Browse Source

Add `TerminalListener` to `Application`

master
Krisjanis Rijnieks 9 years ago
parent
commit
4ceb87f014
  1. 9
      src/Application/Application.cpp
  2. 6
      src/Application/Application.h

9
src/Application/Application.cpp

@ -24,6 +24,8 @@ void Application::setup(){
ofLogWarning("Application::setup()") << "Failed to load default settings" << endl;
}
}
consoleListener.setup(this);
}
ApplicationBaseState * Application::getState(){
@ -124,6 +126,13 @@ bool Application::isShiftKeyDown(){
return _shiftKeyDown;
}
void Application::onCharacterReceived(KeyListenerEventData & e){
ofKeyEventArgs args;
args.key = (int)e.character;
cout << "TermListener: " << e.character << endl;
onKeyPressed(args);
};
bool Application::loadXmlSettings(string fileName){
if(!ofFile::doesFileExist(fileName)){
ofLogError("Application::loadXmlSettings()") << fileName << " does not exist";

6
src/Application/Application.h

@ -19,6 +19,7 @@
#include "GuiMode.h"
#include "Gui.h"
#include "TerminalListener.h"
#define PIMAPPER_DEF_SURFACES_XML_FILE "defaultSurfaces.xml"
#define PIMAPPER_USER_SURFACES_XML_FILE "surfaces.xml"
@ -28,7 +29,7 @@ namespace piMapper {
class ApplicationBaseState;
class Application {
class Application : public KeyListener {
public:
Application();
@ -56,6 +57,9 @@ class Application {
SurfaceManager * getSurfaceManager(){ return &_surfaceManager; };
CmdManager * getCmdManager(){ return &_cmdManager; };
void onCharacterReceived(KeyListenerEventData & e);
TerminalListener consoleListener;
protected:
void setState(ApplicationBaseState * st);

Loading…
Cancel
Save