delete range of x,y in windowsWidth and windowsHeight, simple draw do it

This commit is contained in:
Shaohua Tong 2019-12-06 14:49:05 +01:00
parent e0024999d7
commit 16c5ade815

View File

@ -3,18 +3,11 @@
/*Function to handle the input*/
auto GUI_Window::handle(int e) -> int {
int windowsWidth = vkvm::getWidth();
int windowsHeight = vkvm::getHeight();
switch (e) {
/*Mousebutton*/
case FL_PUSH:
x = Fl::event_x();
y = Fl::event_y();
x = x < 0 ? 0: x;
y = y < 30 ? 30 : y;
x = x > windowsWidth ? windowsWidth : x;
y = y > windowsHeight ? windowsHeight : y;
vkvm::setMousePosition(x,y);
if (Fl::event_button() == FL_LEFT_MOUSE) {
this->child(2)->label("Event:Mouse Left Down");
@ -31,10 +24,6 @@ auto GUI_Window::handle(int e) -> int {
case FL_RELEASE:
x = Fl::event_x();
y = Fl::event_y();
x = x < 0 ? 0: x;
y = y < 30 ? 30 : y;
x = x > windowsWidth ? windowsWidth : x;
y = y > windowsHeight ? windowsHeight : y;
vkvm::setMousePosition(x,y);
if (Fl::event_button() == FL_LEFT_MOUSE) {
this->child(2)->label("Event:Mouse Left Up");
@ -50,10 +39,6 @@ auto GUI_Window::handle(int e) -> int {
case FL_DRAG:
x = Fl::event_x();
y = Fl::event_y();
x = x < 0 ? 0: x;
y = y < 30 ? 30 : y;
x = x > windowsWidth ? windowsWidth : x;
y = y > windowsHeight ? windowsHeight : y;
vkvm::setMousePosition(x,y);
this->child(3)->label(position_to_string(x,y));
if (Fl::event_button() == FL_LEFT_MOUSE) {
@ -72,10 +57,6 @@ auto GUI_Window::handle(int e) -> int {
case FL_MOVE:
x = Fl::event_x();
y = Fl::event_y();
x = x < 0 ? 0: x;
y = y < 30 ? 30 : y;
x = x > windowsWidth ? windowsWidth : x;
y = y > windowsHeight ? windowsHeight : y;
vkvm::setMousePosition(x,y);
vkvm::callEvent(vkvm::EventType::MouseMove);
this->child(2)->label("Event:Mouse Move");