aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/vulkan/viewer/InputHandler.h
diff options
context:
space:
mode:
Diffstat (limited to 'tools/vulkan/viewer/InputHandler.h')
-rw-r--r--tools/vulkan/viewer/InputHandler.h84
1 files changed, 0 insertions, 84 deletions
diff --git a/tools/vulkan/viewer/InputHandler.h b/tools/vulkan/viewer/InputHandler.h
deleted file mode 100644
index 05d69428e7..0000000000
--- a/tools/vulkan/viewer/InputHandler.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
-* Copyright 2016 Google Inc.
-*
-* Use of this source code is governed by a BSD-style license that can be
-* found in the LICENSE file.
-*/
-
-#ifndef InputHandler_DEFINED
-#define InputHandler_DEFINED
-
-#include <string.h>
-
-class InputHandler
-{
-public:
- InputHandler();
-
- void onKeyDown(unsigned char key); // Handle key down event
- void onKeyUp(unsigned char key); // Handle key up event
- void onMouseDown(unsigned int h, unsigned int v); // Handle mouse down event
- void onMouseUp(); // Handle mouse up event
-
- bool isKeyDown(unsigned char key) const {
- return fKeys[key];
- }
- bool isKeyUp(unsigned char key) const {
- return !fKeys[key];
- }
- bool isKeyPressed(unsigned char key) const {
- return fKeyPressed[key];
- }
-
- bool isKeyReleased(unsigned char key) const {
- return fKeyReleased[key];
- }
-
- bool isMouseDown(unsigned int* h, unsigned int* v) const {
- if (fMouseDown)
- {
- *h = fMouseX;
- *v = fMouseY;
- return true;
- }
- return false;
- }
-
- bool isMousePressed(unsigned int* h, unsigned int* v) const {
- if (fMousePressed)
- {
- *h = fMouseX;
- *v = fMouseY;
- return true;
- }
- return false;
- }
-
- bool IsMouseReleased() const {
- return fMouseReleased;
- }
-
- inline void Update() {
- memset(fKeyPressed, 0, sizeof(bool) * 256);
- memset(fKeyReleased, 0, sizeof(bool) * 256);
- fMousePressed = false;
- fMouseReleased = false;
- }
-
-private:
- // assumes ASCII keystrokes only
- bool fKeys[256];
- bool fKeyPressed[256];
- bool fKeyReleased[256];
-
- bool fMouseDown;
- bool fMousePressed;
- bool fMouseReleased;
- unsigned int fMouseX;
- unsigned int fMouseY;
-
- InputHandler(const InputHandler& other);
- InputHandler& operator=(const InputHandler& other);
-};
-
-#endif