mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-28 18:29:49 +02:00
Search and stamps scolling with mouse wheel, Esc to exit
This commit is contained in:
@@ -97,6 +97,8 @@ public:
|
|||||||
{
|
{
|
||||||
cc->gameModel->SetStamp(cc->stamps->GetStamp());
|
cc->gameModel->SetStamp(cc->stamps->GetStamp());
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
cc->gameModel->SetStamp(NULL);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -717,6 +717,10 @@ void GameView::OnKeyRelease(int key, Uint16 character, bool shift, bool ctrl, bo
|
|||||||
|
|
||||||
void GameView::OnTick(float dt)
|
void GameView::OnTick(float dt)
|
||||||
{
|
{
|
||||||
|
if(selectMode==PlaceStamp && !stampThumb)
|
||||||
|
selectMode = SelectNone;
|
||||||
|
if(selectMode==PlaceClipboard&& !clipboardThumb)
|
||||||
|
selectMode = SelectNone;
|
||||||
if(zoomEnabled && !zoomCursorFixed)
|
if(zoomEnabled && !zoomCursorFixed)
|
||||||
c->SetZoomPosition(currentMouse);
|
c->SetZoomPosition(currentMouse);
|
||||||
if(drawMode == DrawPoints)
|
if(drawMode == DrawPoints)
|
||||||
|
@@ -9,6 +9,7 @@
|
|||||||
#define KEY_TAB SDLK_TAB
|
#define KEY_TAB SDLK_TAB
|
||||||
#define KEY_RETURN SDLK_RETURN
|
#define KEY_RETURN SDLK_RETURN
|
||||||
#define KEY_ENTER SDLK_KP_ENTER
|
#define KEY_ENTER SDLK_KP_ENTER
|
||||||
|
#define KEY_ESCAPE SDLK_ESCAPE
|
||||||
|
|
||||||
#define KEY_CTRL SDLK_LCTRL
|
#define KEY_CTRL SDLK_LCTRL
|
||||||
#define KEY_ALT SDLK_LALT
|
#define KEY_ALT SDLK_LALT
|
||||||
|
@@ -241,3 +241,19 @@ void SearchView::OnTick(float dt)
|
|||||||
{
|
{
|
||||||
c->Update();
|
c->Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SearchView::OnMouseWheel(int x, int y, int d)
|
||||||
|
{
|
||||||
|
if(!d)
|
||||||
|
return;
|
||||||
|
if(d<0)
|
||||||
|
c->NextPage();
|
||||||
|
else
|
||||||
|
c->PrevPage();
|
||||||
|
}
|
||||||
|
void SearchView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool alt)
|
||||||
|
{
|
||||||
|
if(key==KEY_ESCAPE)
|
||||||
|
c->Exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -37,6 +37,9 @@ public:
|
|||||||
virtual ~SearchView();
|
virtual ~SearchView();
|
||||||
void AttachController(SearchController * _c) { c = _c; }
|
void AttachController(SearchController * _c) { c = _c; }
|
||||||
virtual void OnTick(float dt);
|
virtual void OnTick(float dt);
|
||||||
|
virtual void OnMouseWheel(int x, int y, int d);
|
||||||
|
virtual void OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool alt);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SEARCHVIEW_H
|
#endif // SEARCHVIEW_H
|
||||||
|
@@ -133,6 +133,21 @@ void StampsView::NotifyStampsListChanged(StampsModel * sender)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void StampsView::OnMouseWheel(int x, int y, int d)
|
||||||
|
{
|
||||||
|
if(!d)
|
||||||
|
return;
|
||||||
|
if(d<0)
|
||||||
|
c->NextPage();
|
||||||
|
else
|
||||||
|
c->PrevPage();
|
||||||
|
}
|
||||||
|
void StampsView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool alt)
|
||||||
|
{
|
||||||
|
if(key==KEY_ESCAPE)
|
||||||
|
c->Exit();
|
||||||
|
}
|
||||||
|
|
||||||
StampsView::~StampsView() {
|
StampsView::~StampsView() {
|
||||||
// TODO Auto-generated destructor stub
|
// TODO Auto-generated destructor stub
|
||||||
}
|
}
|
||||||
|
@@ -29,6 +29,8 @@ public:
|
|||||||
void AttachController(StampsController * c_) { c = c_; };
|
void AttachController(StampsController * c_) { c = c_; };
|
||||||
void NotifyPageChanged(StampsModel * sender);
|
void NotifyPageChanged(StampsModel * sender);
|
||||||
void NotifyStampsListChanged(StampsModel * sender);
|
void NotifyStampsListChanged(StampsModel * sender);
|
||||||
|
virtual void OnMouseWheel(int x, int y, int d);
|
||||||
|
virtual void OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool alt);
|
||||||
virtual ~StampsView();
|
virtual ~StampsView();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user