buttonPressed

This commit is contained in:
chenhuan 2019-11-20 12:44:13 +01:00
parent 9ce74862a2
commit 66f356c6a1
2 changed files with 6 additions and 3 deletions

View File

@ -19,7 +19,7 @@
*/ */
class GUI_Window : public Fl_Window { class GUI_Window : public Fl_Window {
int x, y, button; int x, y, button;
vkvm::KeyCode* keyCode;
int handle(int e); int handle(int e);
public: public:

View File

@ -41,12 +41,15 @@ auto GUI_Window::handle(int e) -> int {
case FL_KEYBOARD: case FL_KEYBOARD:
vkvm::callEvent(vkvm::EventType::KeyDown); vkvm::callEvent(vkvm::EventType::KeyDown);
button = Fl::event_button(); button = Fl::event_button();
std::cout << "Keyboard:" << (unsigned short) button << " down" << std::endl; keyCode = new vkvm::KeyCode(button);
vkvm::buttonPressed(*keyCode);
return 1; return 1;
case FL_KEYUP: case FL_KEYUP:
vkvm::callEvent(vkvm::EventType::KeyUp); vkvm::callEvent(vkvm::EventType::KeyUp);
button = Fl::event_button(); button = Fl::event_button();
std::cout << "Keyboard:" << (unsigned short) button << " up" << std::endl; std::cout<<button<<std::endl;
keyCode = new vkvm::KeyCode(button);
vkvm::buttonPressed(*keyCode);
return 1; return 1;
} }