Browse Source

Replace deselect on SPACE with toggle pause

master
Krisjanis Rijnieks 9 years ago
parent
commit
2a8a7c0fbc
  1. 7
      src/Application/ProjectionMappingState.cpp
  2. 1
      src/Application/ProjectionMappingState.h
  3. 8
      src/Application/TextureMappingState.cpp
  4. 1
      src/Application/TextureMappingState.h
  5. 1
      src/Sources/BaseSource.h
  6. 8
      src/Sources/VideoSource.cpp
  7. 1
      src/Sources/VideoSource.h

7
src/Application/ProjectionMappingState.cpp

@ -170,7 +170,12 @@ void ProjectionMappingState::onKeyPressed(Application * app, ofKeyEventArgs & ar
break;
case ' ':
app->getCmdManager()->exec(new DeselectSurfaceCmd(app->getSurfaceManager()));
if(app->getSurfaceManager()->getSelectedSurface()->getSource()->getType() ==
SourceType::SOURCE_TYPE_VIDEO){
app->getCmdManager()->exec(
new ToggleAnimatedSourceCmd(
app->getSurfaceManager()->getSelectedSurface()));
}
break;
case OF_KEY_TAB:

1
src/Application/ProjectionMappingState.h

@ -22,6 +22,7 @@
#include "DeselectSurfaceCmd.h"
#include "SetNextSourceCmd.h"
#include "DuplicateSurfaceCmd.h"
#include "ToggleAnimatedSourceCmd.h"
#include "SurfaceType.h"
#include "Gui.h"

8
src/Application/TextureMappingState.cpp

@ -30,8 +30,12 @@ void TextureMappingState::onKeyPressed(Application * app, ofKeyEventArgs & args)
break;
case ' ':
app->getCmdManager()->exec(
new DeselectTexCoordCmd(app->getGui()->getTextureEditor()));
if(app->getSurfaceManager()->getSelectedSurface()->getSource()->getType() ==
SourceType::SOURCE_TYPE_VIDEO){
app->getCmdManager()->exec(
new ToggleAnimatedSourceCmd(
app->getSurfaceManager()->getSelectedSurface()));
}
break;
case OF_KEY_TAB:

1
src/Application/TextureMappingState.h

@ -9,6 +9,7 @@
#include "DeselectTexCoordCmd.h"
#include "SetNextSourceCmd.h"
#include "SelNextSurfaceCmd.h"
#include "ToggleAnimatedSourceCmd.h"
namespace ofx {
namespace piMapper {

1
src/Sources/BaseSource.h

@ -20,6 +20,7 @@ class BaseSource {
int getType();
string & getPath();
virtual void clear(){}
virtual void togglePause(){}
// TODO: add virtual increaseReferenceCount and decreaseReferenceCount methods
// and make the variable protected

8
src/Sources/VideoSource.cpp

@ -51,6 +51,14 @@ void VideoSource::clear(){
loaded = false;
}
void VideoSource::togglePause(){
#ifdef TARGET_RASPBERRY_PI
omxPlayer->togglePause();
#else
videoPlayer->setPaused(!videoPlayer->isPaused());
#endif
}
#ifndef TARGET_RASPBERRY_PI
void VideoSource::update(ofEventArgs & args){
if(videoPlayer != 0){

1
src/Sources/VideoSource.h

@ -25,6 +25,7 @@ class VideoSource : public BaseSource {
string & getPath();
void loadVideo(string & path);
void clear();
void togglePause();
#ifndef TARGET_RASPBERRY_PI
void update(ofEventArgs & args);

Loading…
Cancel
Save