ScreenManager: Add support for direct async touch events

This commit is contained in:
Henrik Rydgard
2012-11-22 18:39:39 +01:00
parent 42fcb79e87
commit 1968e8c529
3 changed files with 18 additions and 1 deletions
+1 -1
View File
@@ -19,7 +19,7 @@
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{E8B58922-9827-493D-81E0-4B6E6BD77171}</ProjectGuid>
<ProjectGuid>{C4DF647E-80EA-4111-A0A8-218B1B711E18}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>native</RootNamespace>
</PropertyGroup>
+12
View File
@@ -54,6 +54,18 @@ void ScreenManager::update(InputState &input) {
}
}
void ScreenManager::touch(int pointer, float x, float y, double time, TouchEvent event)
{
if (dialog_.size()) {
dialog_.back()->touch(pointer, x, y, time, event);
return;
}
if (currentScreen_)
{
currentScreen_->touch(pointer, x, y, time, event);
}
}
void ScreenManager::render() {
if (dialog_.size()) {
dialog_.back()->render();
+5
View File
@@ -17,6 +17,7 @@
#include "base/basictypes.h"
#include "base/display.h"
#include "base/NativeApp.h"
struct InputState;
@@ -37,6 +38,7 @@ public:
virtual void render() {}
virtual void deviceLost() {}
virtual void dialogFinished(const Screen *dialog, DialogResult result) {}
virtual void touch(int pointer, float x, float y, double time, TouchEvent event) {}
ScreenManager *screenManager() { return screenManager_; }
void setScreenManager(ScreenManager *sm) { screenManager_ = sm; }
@@ -68,6 +70,9 @@ public:
// Pops the dialog away.
void finishDialog(const Screen *dialog, DialogResult result = DR_OK);
// Instant touch, separate from the update() mechanism.
void touch(int pointer, float x, float y, double time, TouchEvent event);
private:
void pop();
Screen *topScreen();