代码精简
This commit is contained in:
parent
333bec0a12
commit
c5b37f9835
@ -1,11 +1,9 @@
|
|||||||
#ifndef HGL_IO_MOUSE_EVENT_INCLUDE
|
#pragma once
|
||||||
#define HGL_IO_MOUSE_EVENT_INCLUDE
|
|
||||||
|
|
||||||
#include<hgl/io/event/InputEvent.h>
|
#include<hgl/io/event/InputEvent.h>
|
||||||
namespace hgl
|
#include<hgl/math/Vector.h>
|
||||||
|
namespace hgl::io
|
||||||
{
|
{
|
||||||
namespace io
|
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* 鼠标按钮枚举
|
* 鼠标按钮枚举
|
||||||
*/
|
*/
|
||||||
@ -48,7 +46,7 @@ namespace hgl
|
|||||||
{
|
{
|
||||||
MouseEventData *med;
|
MouseEventData *med;
|
||||||
|
|
||||||
int x,y;
|
Vector2i position;
|
||||||
|
|
||||||
bool pressed_statues[size_t(MouseButton::RANGE_SIZE)];
|
bool pressed_statues[size_t(MouseButton::RANGE_SIZE)];
|
||||||
|
|
||||||
@ -57,7 +55,8 @@ namespace hgl
|
|||||||
MouseEvent():InputEvent(InputEventSource::Mouse)
|
MouseEvent():InputEvent(InputEventSource::Mouse)
|
||||||
{
|
{
|
||||||
med=nullptr;
|
med=nullptr;
|
||||||
x=y=0;
|
position.x=0;
|
||||||
|
position.y=0;;
|
||||||
hgl_zero(pressed_statues);
|
hgl_zero(pressed_statues);
|
||||||
}
|
}
|
||||||
virtual ~MouseEvent()=default;
|
virtual ~MouseEvent()=default;
|
||||||
@ -74,7 +73,8 @@ namespace hgl
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
x=med->x;y=med->y;
|
position.x=med->x;
|
||||||
|
position.y=med->y;
|
||||||
|
|
||||||
switch(MouseEventID(header.id))
|
switch(MouseEventID(header.id))
|
||||||
{
|
{
|
||||||
@ -113,9 +113,6 @@ namespace hgl
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
const int GetX()const{return x;}
|
const Vector2i &GetMouseCoord()const{return position;}
|
||||||
const int GetY()const{return y;}
|
|
||||||
};//class MouseEvent
|
};//class MouseEvent
|
||||||
}//namespace io
|
}//namespace hgl::io
|
||||||
}//namespace hgl
|
|
||||||
#endif//HGL_IO_MOUSE_EVENT_INCLUDE
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user