added ReserveDirection

This commit is contained in:
2023-10-11 19:38:12 +08:00
parent ae88a65315
commit a5830e18cb
3 changed files with 17 additions and 3 deletions

View File

@@ -378,7 +378,9 @@ class CameraMouseControl:public MouseEvent
Vector2f mouse_pos;
Vector2f mouse_last_pos;
protected:
Vector2f ReverseDirection;
protected:
bool OnPressed(int x,int y,MouseButton) override
{
@@ -409,6 +411,8 @@ protected:
Vector2f pos(x,y);
Vector2f gap=pos-mouse_last_pos;
gap*=ReverseDirection;
if(left)
{
@@ -436,6 +440,15 @@ public:
{
camera=wc;
cur_time=0;
ReverseDirection.x=1;
ReverseDirection.y=1;
}
void SetReserveDirection(bool x,bool y)
{
ReverseDirection.x=x?-1:1;
ReverseDirection.y=y?-1:1;
}
const Vector2f &GetMouseCoord()const{return mouse_pos;}
@@ -448,7 +461,6 @@ public:
class CameraAppFramework:public VulkanApplicationFramework
{
protected:
Camera * camera =nullptr;