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){
app->getGui()->getTextureEditor()->keyPressed(args);
switch(args.key){
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){
// Exec the command only if a joint is selected.
bool selected = false;

1
src/Application/States/TextureMappingState.h

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

8
src/UserInterface/TextureEditor.cpp

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

Loading…
Cancel
Save