Browse Source

Make TextureEditingState responsible for TextureEditor key events

master
Krisjanis Rijnieks 9 years ago
parent
commit
5df8202ad6
  1. 6
      src/Application/States/TextureMappingState.cpp
  2. 1
      src/Application/States/TextureMappingState.h
  3. 8
      src/UserInterface/TextureEditor.cpp

6
src/Application/States/TextureMappingState.cpp

@ -61,6 +61,8 @@ void TextureMappingState::draw(Application * app){
} }
void TextureMappingState::onKeyPressed(Application * app, ofKeyEventArgs & args){ void TextureMappingState::onKeyPressed(Application * app, ofKeyEventArgs & args){
app->getGui()->getTextureEditor()->keyPressed(args);
switch(args.key){ switch(args.key){
case '>': case '>':
@ -108,6 +110,10 @@ 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,6 +25,7 @@ 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);

8
src/UserInterface/TextureEditor.cpp

@ -14,13 +14,13 @@ TextureEditor::~TextureEditor(){
} }
void TextureEditor::registerKeyEvents(){ void TextureEditor::registerKeyEvents(){
ofAddListener(ofEvents().keyPressed, this, &TextureEditor::keyPressed); //ofAddListener(ofEvents().keyPressed, this, &TextureEditor::keyPressed);
ofAddListener(ofEvents().keyReleased, this, &TextureEditor::keyReleased); //ofAddListener(ofEvents().keyReleased, this, &TextureEditor::keyReleased);
} }
void TextureEditor::unregisterKeyEvents(){ void TextureEditor::unregisterKeyEvents(){
ofRemoveListener(ofEvents().keyPressed, this, &TextureEditor::keyPressed); //ofRemoveListener(ofEvents().keyPressed, this, &TextureEditor::keyPressed);
ofRemoveListener(ofEvents().keyReleased, this, &TextureEditor::keyReleased); //ofRemoveListener(ofEvents().keyReleased, this, &TextureEditor::keyReleased);
} }
void TextureEditor::enable(){ void TextureEditor::enable(){

Loading…
Cancel
Save