Browse Source

Add arrow key detection to TextureMappingState

master
Krisjanis Rijnieks 9 years ago
parent
commit
af90cfea9d
  1. 31
      src/Application/States/TextureMappingState.cpp
  2. 1
      src/Application/States/TextureMappingState.h

31
src/Application/States/TextureMappingState.cpp

@ -61,10 +61,33 @@ void TextureMappingState::draw(Application * app){
} }
void TextureMappingState::onKeyPressed(Application * app, ofKeyEventArgs & args){ void TextureMappingState::onKeyPressed(Application * app, ofKeyEventArgs & args){
app->getGui()->getTextureEditor()->keyPressed(args); int key = args.key;
float moveStep;
if(app->isShiftKeyDown()){
moveStep = 10.0f;
}else{
moveStep = 1.0f;
}
switch(args.key){ switch(args.key){
case OF_KEY_LEFT:
app->getGui()->getTextureEditor()->moveSelection(ofVec2f(-moveStep, 0.0f));
break;
case OF_KEY_RIGHT:
app->getGui()->getTextureEditor()->moveSelection(ofVec2f(moveStep, 0.0f));
break;
case OF_KEY_UP:
app->getGui()->getTextureEditor()->moveSelection(ofVec2f(0.0f, -moveStep));
break;
case OF_KEY_DOWN:
app->getGui()->getTextureEditor()->moveSelection(ofVec2f(0.0f, moveStep));
break;
case '>': case '>':
app->getCmdManager()->exec( app->getCmdManager()->exec(
new SelNextTexCoordCmd(app->getGui()->getTextureEditor())); new SelNextTexCoordCmd(app->getGui()->getTextureEditor()));
@ -110,10 +133,6 @@ void TextureMappingState::onKeyPressed(Application * app, ofKeyEventArgs & args)
} }
} }
void TextureMappingState::onKeyReleased(Application * app, ofKeyEventArgs & args){
app->getGui()->getTextureEditor()->keyReleased(args);
}
void TextureMappingState::onBackgroundPressed(Application * app, GuiBackgroundEvent & e){ void TextureMappingState::onBackgroundPressed(Application * app, GuiBackgroundEvent & e){
// Exec the command only if a joint is selected. // Exec the command only if a joint is selected.
bool selected = false; bool selected = false;

1
src/Application/States/TextureMappingState.h

@ -25,7 +25,6 @@ class TextureMappingState : public ApplicationBaseState {
void update(Application * app); void update(Application * app);
void draw(Application * app); void draw(Application * app);
void onKeyPressed(Application * app, ofKeyEventArgs & args); void onKeyPressed(Application * app, ofKeyEventArgs & args);
void onKeyReleased(Application * app, ofKeyEventArgs & args);
void onBackgroundPressed(Application * app, GuiBackgroundEvent & e); void onBackgroundPressed(Application * app, GuiBackgroundEvent & e);
void onMousePressed(Application * app, ofMouseEventArgs & args); void onMousePressed(Application * app, ofMouseEventArgs & args);
void onMouseReleased(Application * app, ofMouseEventArgs & args); void onMouseReleased(Application * app, ofMouseEventArgs & args);

Loading…
Cancel
Save