Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(225)

Unified Diff: tools/vulkan/viewer/InputHandler.h

Issue 1865553005: Clean up input handling in VulkanViewer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rename resize params Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/vulkan/Window.cpp ('k') | tools/vulkan/viewer/InputHandler.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/vulkan/viewer/InputHandler.h
diff --git a/tools/vulkan/viewer/InputHandler.h b/tools/vulkan/viewer/InputHandler.h
deleted file mode 100644
index 05d69428e74e59eb1097ee59938d4cd6a6336d7d..0000000000000000000000000000000000000000
--- 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
« no previous file with comments | « tools/vulkan/Window.cpp ('k') | tools/vulkan/viewer/InputHandler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698