diff --git a/example-camera/example-camera.xcodeproj/project.pbxproj b/example-camera/example-camera.xcodeproj/project.pbxproj index 51cdcb7..4f98ad7 100644 --- a/example-camera/example-camera.xcodeproj/project.pbxproj +++ b/example-camera/example-camera.xcodeproj/project.pbxproj @@ -80,7 +80,6 @@ 0166319C1DC8E8010081F28F /* CircleJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0166314B1DC8E8010081F28F /* CircleJoint.cpp */; }; 0166319D1DC8E8010081F28F /* RadioList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0166314F1DC8E8010081F28F /* RadioList.cpp */; }; 0166319E1DC8E8010081F28F /* HomographyHelper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 016631521DC8E8010081F28F /* HomographyHelper.cpp */; }; - 0166319F1DC8E8010081F28F /* TerminalListener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 016631541DC8E8010081F28F /* TerminalListener.cpp */; }; 3926483B192224DA0008A7F5 /* ofxXmlSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 39264839192224DA0008A7F5 /* ofxXmlSettings.cpp */; }; 39264841192224F90008A7F5 /* tinyxml.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3926483D192224F90008A7F5 /* tinyxml.cpp */; }; 39264842192224F90008A7F5 /* tinyxmlerror.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3926483F192224F90008A7F5 /* tinyxmlerror.cpp */; }; @@ -297,8 +296,6 @@ 016631501DC8E8010081F28F /* RadioList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RadioList.h; sourceTree = ""; }; 016631521DC8E8010081F28F /* HomographyHelper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HomographyHelper.cpp; sourceTree = ""; }; 016631531DC8E8010081F28F /* HomographyHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HomographyHelper.h; sourceTree = ""; }; - 016631541DC8E8010081F28F /* TerminalListener.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TerminalListener.cpp; sourceTree = ""; }; - 016631551DC8E8010081F28F /* TerminalListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TerminalListener.h; sourceTree = ""; }; 39264839192224DA0008A7F5 /* ofxXmlSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ofxXmlSettings.cpp; path = ../../ofxXmlSettings/src/ofxXmlSettings.cpp; sourceTree = ""; }; 3926483A192224DA0008A7F5 /* ofxXmlSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ofxXmlSettings.h; path = ../../ofxXmlSettings/src/ofxXmlSettings.h; sourceTree = ""; }; 3926483D192224F90008A7F5 /* tinyxml.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = tinyxml.cpp; sourceTree = ""; }; @@ -621,8 +618,6 @@ children = ( 016631521DC8E8010081F28F /* HomographyHelper.cpp */, 016631531DC8E8010081F28F /* HomographyHelper.h */, - 016631541DC8E8010081F28F /* TerminalListener.cpp */, - 016631551DC8E8010081F28F /* TerminalListener.h */, ); path = Utils; sourceTree = ""; @@ -892,7 +887,6 @@ 016631881DC8E8010081F28F /* TextureEditorWidget.cpp in Sources */, 016631841DC8E8010081F28F /* ProjectionEditorWidget.cpp in Sources */, 0166315B1DC8E8010081F28F /* TextureMappingMode.cpp in Sources */, - 0166319F1DC8E8010081F28F /* TerminalListener.cpp in Sources */, 0166318D1DC8E8010081F28F /* ofxPiMapper.cpp in Sources */, 0166318A1DC8E8010081F28F /* Info.cpp in Sources */, 016631931DC8E8010081F28F /* BaseSurface.cpp in Sources */, diff --git a/example-custom-shortcuts/example-custom-shortcuts.xcodeproj/project.pbxproj b/example-custom-shortcuts/example-custom-shortcuts.xcodeproj/project.pbxproj index 9b9d03f..deb2adc 100644 --- a/example-custom-shortcuts/example-custom-shortcuts.xcodeproj/project.pbxproj +++ b/example-custom-shortcuts/example-custom-shortcuts.xcodeproj/project.pbxproj @@ -80,7 +80,6 @@ 013E62451E2E2FAE00FACF28 /* CircleJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 013E61F41E2E2FAE00FACF28 /* CircleJoint.cpp */; }; 013E62461E2E2FAE00FACF28 /* RadioList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 013E61F81E2E2FAE00FACF28 /* RadioList.cpp */; }; 013E62471E2E2FAE00FACF28 /* HomographyHelper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 013E61FB1E2E2FAE00FACF28 /* HomographyHelper.cpp */; }; - 013E62481E2E2FAE00FACF28 /* TerminalListener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 013E61FD1E2E2FAE00FACF28 /* TerminalListener.cpp */; }; 3926483B192224DA0008A7F5 /* ofxXmlSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 39264839192224DA0008A7F5 /* ofxXmlSettings.cpp */; }; 39264841192224F90008A7F5 /* tinyxml.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3926483D192224F90008A7F5 /* tinyxml.cpp */; }; 39264842192224F90008A7F5 /* tinyxmlerror.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3926483F192224F90008A7F5 /* tinyxmlerror.cpp */; }; @@ -296,8 +295,6 @@ 013E61F91E2E2FAE00FACF28 /* RadioList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RadioList.h; sourceTree = ""; }; 013E61FB1E2E2FAE00FACF28 /* HomographyHelper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HomographyHelper.cpp; sourceTree = ""; }; 013E61FC1E2E2FAE00FACF28 /* HomographyHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HomographyHelper.h; sourceTree = ""; }; - 013E61FD1E2E2FAE00FACF28 /* TerminalListener.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TerminalListener.cpp; sourceTree = ""; }; - 013E61FE1E2E2FAE00FACF28 /* TerminalListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TerminalListener.h; sourceTree = ""; }; 013E62491E2E38EC00FACF28 /* SourceTypeHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SourceTypeHelper.h; sourceTree = ""; }; 39264839192224DA0008A7F5 /* ofxXmlSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ofxXmlSettings.cpp; path = ../../ofxXmlSettings/src/ofxXmlSettings.cpp; sourceTree = ""; }; 3926483A192224DA0008A7F5 /* ofxXmlSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ofxXmlSettings.h; path = ../../ofxXmlSettings/src/ofxXmlSettings.h; sourceTree = ""; }; @@ -620,8 +617,6 @@ children = ( 013E61FB1E2E2FAE00FACF28 /* HomographyHelper.cpp */, 013E61FC1E2E2FAE00FACF28 /* HomographyHelper.h */, - 013E61FD1E2E2FAE00FACF28 /* TerminalListener.cpp */, - 013E61FE1E2E2FAE00FACF28 /* TerminalListener.h */, ); path = Utils; sourceTree = ""; @@ -916,7 +911,6 @@ 013E620F1E2E2FAE00FACF28 /* MvLayerDnCmd.cpp in Sources */, 013E62181E2E2FAE00FACF28 /* ScaleSurfaceFromToCmd.cpp in Sources */, 013E62201E2E2FAE00FACF28 /* SelTexCoordCmd.cpp in Sources */, - 013E62481E2E2FAE00FACF28 /* TerminalListener.cpp in Sources */, 013E62101E2E2FAE00FACF28 /* MvLayerUpCmd.cpp in Sources */, 39264841192224F90008A7F5 /* tinyxml.cpp in Sources */, 013E62171E2E2FAE00FACF28 /* SaveTexCoordPosCmd.cpp in Sources */, diff --git a/example-gamepad/example-gamepad.xcodeproj/project.pbxproj b/example-gamepad/example-gamepad.xcodeproj/project.pbxproj index 9e0493f..604d75a 100644 --- a/example-gamepad/example-gamepad.xcodeproj/project.pbxproj +++ b/example-gamepad/example-gamepad.xcodeproj/project.pbxproj @@ -80,7 +80,6 @@ 0166319C1DC8E8010081F28F /* CircleJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0166314B1DC8E8010081F28F /* CircleJoint.cpp */; }; 0166319D1DC8E8010081F28F /* RadioList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0166314F1DC8E8010081F28F /* RadioList.cpp */; }; 0166319E1DC8E8010081F28F /* HomographyHelper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 016631521DC8E8010081F28F /* HomographyHelper.cpp */; }; - 0166319F1DC8E8010081F28F /* TerminalListener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 016631541DC8E8010081F28F /* TerminalListener.cpp */; }; 01DC7EDE1E452858003137B7 /* InputHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 01DC7EDC1E452858003137B7 /* InputHandler.cpp */; }; 01DC7EE01E45289C003137B7 /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01DC7EDF1E45289C003137B7 /* SDL2.framework */; }; 3926483B192224DA0008A7F5 /* ofxXmlSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 39264839192224DA0008A7F5 /* ofxXmlSettings.cpp */; }; @@ -298,8 +297,6 @@ 016631501DC8E8010081F28F /* RadioList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RadioList.h; sourceTree = ""; }; 016631521DC8E8010081F28F /* HomographyHelper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HomographyHelper.cpp; sourceTree = ""; }; 016631531DC8E8010081F28F /* HomographyHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HomographyHelper.h; sourceTree = ""; }; - 016631541DC8E8010081F28F /* TerminalListener.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TerminalListener.cpp; sourceTree = ""; }; - 016631551DC8E8010081F28F /* TerminalListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TerminalListener.h; sourceTree = ""; }; 01DC7EDC1E452858003137B7 /* InputHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InputHandler.cpp; sourceTree = ""; }; 01DC7EDD1E452858003137B7 /* InputHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InputHandler.h; sourceTree = ""; }; 01DC7EDF1E45289C003137B7 /* SDL2.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL2.framework; path = ../../../../../../../../Library/Frameworks/SDL2.framework; sourceTree = ""; }; @@ -624,8 +621,6 @@ children = ( 016631521DC8E8010081F28F /* HomographyHelper.cpp */, 016631531DC8E8010081F28F /* HomographyHelper.h */, - 016631541DC8E8010081F28F /* TerminalListener.cpp */, - 016631551DC8E8010081F28F /* TerminalListener.h */, ); path = Utils; sourceTree = ""; @@ -896,7 +891,6 @@ 016631881DC8E8010081F28F /* TextureEditorWidget.cpp in Sources */, 016631841DC8E8010081F28F /* ProjectionEditorWidget.cpp in Sources */, 0166315B1DC8E8010081F28F /* TextureMappingMode.cpp in Sources */, - 0166319F1DC8E8010081F28F /* TerminalListener.cpp in Sources */, 0166318D1DC8E8010081F28F /* ofxPiMapper.cpp in Sources */, 0166318A1DC8E8010081F28F /* Info.cpp in Sources */, 016631931DC8E8010081F28F /* BaseSurface.cpp in Sources */, diff --git a/example/example.xcodeproj/project.pbxproj b/example/example.xcodeproj/project.pbxproj index 8641961..3eaea39 100644 --- a/example/example.xcodeproj/project.pbxproj +++ b/example/example.xcodeproj/project.pbxproj @@ -43,7 +43,6 @@ 0115A6C01DBF93BA00C51732 /* CircleJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0115A6701DBF93BA00C51732 /* CircleJoint.cpp */; }; 0115A6C11DBF93BA00C51732 /* RadioList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0115A6741DBF93BA00C51732 /* RadioList.cpp */; }; 0115A6C21DBF93BA00C51732 /* HomographyHelper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0115A6771DBF93BA00C51732 /* HomographyHelper.cpp */; }; - 0115A6C31DBF93BA00C51732 /* TerminalListener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0115A6791DBF93BA00C51732 /* TerminalListener.cpp */; }; 016630881DC66DAB0081F28F /* AddGridColCmd.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0166303D1DC66DAB0081F28F /* AddGridColCmd.cpp */; }; 016630891DC66DAB0081F28F /* AddGridRowCmd.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0166303F1DC66DAB0081F28F /* AddGridRowCmd.cpp */; }; 0166308A1DC66DAB0081F28F /* AddSurfaceCmd.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 016630411DC66DAB0081F28F /* AddSurfaceCmd.cpp */; }; @@ -224,8 +223,6 @@ 0115A6751DBF93BA00C51732 /* RadioList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RadioList.h; sourceTree = ""; }; 0115A6771DBF93BA00C51732 /* HomographyHelper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HomographyHelper.cpp; sourceTree = ""; }; 0115A6781DBF93BA00C51732 /* HomographyHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HomographyHelper.h; sourceTree = ""; }; - 0115A6791DBF93BA00C51732 /* TerminalListener.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TerminalListener.cpp; sourceTree = ""; }; - 0115A67A1DBF93BA00C51732 /* TerminalListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TerminalListener.h; sourceTree = ""; }; 0166303D1DC66DAB0081F28F /* AddGridColCmd.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AddGridColCmd.cpp; sourceTree = ""; }; 0166303E1DC66DAB0081F28F /* AddGridColCmd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AddGridColCmd.h; sourceTree = ""; }; 0166303F1DC66DAB0081F28F /* AddGridRowCmd.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AddGridRowCmd.cpp; sourceTree = ""; }; @@ -545,8 +542,6 @@ children = ( 0115A6771DBF93BA00C51732 /* HomographyHelper.cpp */, 0115A6781DBF93BA00C51732 /* HomographyHelper.h */, - 0115A6791DBF93BA00C51732 /* TerminalListener.cpp */, - 0115A67A1DBF93BA00C51732 /* TerminalListener.h */, ); path = Utils; sourceTree = ""; @@ -966,7 +961,6 @@ 0115A6C21DBF93BA00C51732 /* HomographyHelper.cpp in Sources */, 0115A6B81DBF93BA00C51732 /* GridWarpSurface.cpp in Sources */, 39264842192224F90008A7F5 /* tinyxmlerror.cpp in Sources */, - 0115A6C31DBF93BA00C51732 /* TerminalListener.cpp in Sources */, 3926483B192224DA0008A7F5 /* ofxXmlSettings.cpp in Sources */, 016630881DC66DAB0081F28F /* AddGridColCmd.cpp in Sources */, 397EFC821A09047C0009286E /* CustomSource.cpp in Sources */, diff --git a/src/Application/Application.cpp b/src/Application/Application.cpp index a514d0c..8182004 100644 --- a/src/Application/Application.cpp +++ b/src/Application/Application.cpp @@ -30,13 +30,6 @@ Application::Application(){ ofAddListener(Gui::instance()->backgroundPressedEvent, this, &Application::onBackgroundPressed); ofAddListener(Gui::instance()->guiEvent, this, &Application::onGuiEvent); - - string SSHConnection = ofSystem("if [ -z $SSH_CONNECTION ]; then echo no; else echo yes; fi"); - if(SSHConnection == "yes"){ - _isSSHConnection = true; - }else{ - _isSSHConnection = false; - } _lastSaveTime = 0.0f; _autoSaveInterval = 60.0f; @@ -57,10 +50,6 @@ void Application::setup(){ } } - if(_isSSHConnection){ - consoleListener.setup(this); - } - // Setup all states. PresentationMode::instance()->setup(this); TextureMappingMode::instance()->setup(this); @@ -256,36 +245,6 @@ bool Application::isShiftKeyDown(){ return _shiftKeyDown; } -void Application::onCharacterReceived(KeyListenerEventData & e){ - ofKeyEventArgs args; - args.key = (int)e.character; - - // These if's have been added because we get - // capital letters A, B, C and D when pressing - // arrows on the keyboard via terminal. - - switch(args.key){ - case 'A': - args.key = OF_KEY_UP; - break; - case 'B': - args.key = OF_KEY_DOWN; - break; - case 'C': - args.key = OF_KEY_RIGHT; - break; - case 'D': - args.key = OF_KEY_LEFT; - break; - case '\\': - args.key = OF_KEY_BACKSPACE; - break; - } - - cout << "TermListener: " << e.character << endl; - onKeyPressed(args); -} - void Application::setPreset(unsigned int i){ _cmdManager.exec(new SetPresetCmd(this, i)); } diff --git a/src/Application/Application.h b/src/Application/Application.h index cada457..fdeab10 100644 --- a/src/Application/Application.h +++ b/src/Application/Application.h @@ -9,7 +9,6 @@ #include "Info.h" #include "SurfaceStack.h" #include "Gui.h" -#include "TerminalListener.h" // Commands #include "SetApplicationModeCmd.h" @@ -56,7 +55,7 @@ namespace piMapper { class ApplicationBaseMode; -class Application : public KeyListener { +class Application { public: Application(); @@ -98,9 +97,6 @@ class Application : public KeyListener { CmdManager * getCmdManager(){ return &_cmdManager; } MediaServer * getMediaServer(){ return &_mediaServer; } - void onCharacterReceived(KeyListenerEventData & e); - TerminalListener consoleListener; - // Command executors void selectSurface(int i); void selectNextSurface(); @@ -158,7 +154,6 @@ class Application : public KeyListener { Info _info; bool _shiftKeyDown; - bool _isSSHConnection; float _lastSaveTime; float _autoSaveInterval; diff --git a/src/Utils/TerminalListener.cpp b/src/Utils/TerminalListener.cpp deleted file mode 100644 index 2ecd9b0..0000000 --- a/src/Utils/TerminalListener.cpp +++ /dev/null @@ -1,74 +0,0 @@ -#include "TerminalListener.h" - -namespace ofx { -namespace piMapper { - -KeyListenerEventData::KeyListenerEventData(char character, void * listener){ - this->character = character; - this->listener = listener; -} - -TerminalListener::TerminalListener(){ - sleepTime = 100; - listener = 0; -} - -TerminalListener::~TerminalListener(){ - close(); -} - -void TerminalListener::setup(KeyListener * listener_, int sleepTime_){ - listener = listener_; - - if(sleepTime_ > 0){ - sleepTime = sleepTime_; - } - - struct termios new_termios; - - tcgetattr(STDIN_FILENO, &orig_termios); - - new_termios = orig_termios; - new_termios.c_lflag &= ~(ICANON | ECHO | ECHOCTL | ECHONL); - new_termios.c_cflag |= HUPCL; - new_termios.c_cc[VMIN] = 0; - - tcsetattr(STDIN_FILENO, TCSANOW, &new_termios); - thread.start(*this); -} - -void TerminalListener::run(){ - while (thread.isRunning()){ - if (listener != 0){ - int ch[8]; - int chnum = 0; - - while ((ch[chnum] = getchar()) != EOF){ - chnum++; - } - - if (chnum > 1){ - ch[0] = ch[chnum - 1]; - }else{ - (ch[chnum - 2] << 8); - } - - if (chnum > 0){ - //ofLog(OF_LOG_VERBOSE, "TerminalListener: character %c", ch[0]); - KeyListenerEventData eventData(ch[0], (void *)this); - listener->onCharacterReceived(eventData); - } - - thread.sleep(sleepTime); - } - } -} - -void TerminalListener::close(){ - tcsetattr(STDIN_FILENO, TCSANOW, &orig_termios); - thread.tryJoin(50); - listener = 0; -} - -} // namespace piMapper -} // namespace ofx \ No newline at end of file diff --git a/src/Utils/TerminalListener.h b/src/Utils/TerminalListener.h deleted file mode 100644 index 26c080b..0000000 --- a/src/Utils/TerminalListener.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * TerminalListener - * Helper for capturing keyboard input when via SSH - * Author: Jason Van Cleave / https://github.com/jvcleave - * Adaptor: Krisjanis Rijnieks / https://github.com/kr15h - */ - -#pragma once - -#include "ofMain.h" -#include - -namespace ofx { -namespace piMapper { - -class KeyListenerEventData { - public: - KeyListenerEventData(char character, void * listener); - void * listener; - char character; -}; - -class KeyListener { - public: - virtual void onCharacterReceived(KeyListenerEventData & e) = 0; -}; - - -class TerminalListener : public Poco::Runnable { - private: - struct termios orig_termios; - - public: - TerminalListener(); - ~TerminalListener(); - - void setup(KeyListener * listener_, int sleepTime_ = 0); - void run(); - void close(); - - KeyListener * listener; - Poco::Thread thread; - int sleepTime; -}; - -} // namespace piMapper -} // namespace ofx \ No newline at end of file