@DeepErGo wrote:
I drew a slider bar using ofxSlider. The ofxSlider object is working well with my mouse button signal. What I want to implement is to make the slider bar interacting with my key pressed such as moving +1 when the right arrow key is pressed and -1 when the left arrow key is pressed. How do I implement this?
ofApp.cpp
void ofApp::setup(){ // ****** GUI Stuff slider.addListener(this, &ofApp::seekBarChanged); gui.setup(); gui.add(slider.setup("Frame", 0, 0, 0)); } ... void ofApp::seekBarChanged(int &pos) { // Something to do } ... void ofApp::keyPressed(int key){ if (key==OF_KEY_LEFT) { // left arrow key leftIsDown = true; } if (key == OF_KEY_RIGHT) { // right arrow key rightIsDown = true; } } void ofApp::keyReleased(int key){ if (key == OF_KEY_LEFT) { // left arrow key leftIsDown = false; } if (key == OF_KEY_RIGHT) { // right arrow key rightIsDown = false; } }
Posts: 1
Participants: 1