From 6f9e8f3002a7e87adb51070fb10112a36ab2926a Mon Sep 17 00:00:00 2001 From: baldurk Date: Sun, 14 Sep 2014 16:49:17 +0100 Subject: [PATCH] Linux compile fixes --- renderdoc/core/core.h | 8 ++++---- renderdoc/os/linux/linux_stringio.cpp | 7 ++++--- renderdoc/os/os_specific.h | 4 +--- renderdoc/os/win32/win32_stringio.cpp | 6 +++--- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/renderdoc/core/core.h b/renderdoc/core/core.h index 83fad9ad5..21ce1c029 100644 --- a/renderdoc/core/core.h +++ b/renderdoc/core/core.h @@ -235,14 +235,14 @@ class RenderDoc void SetFocusKeys(KeyButton *keys, int num) { m_FocusKeys.resize(num); - if(keys && num > 0) - memcpy(&m_FocusKeys[0], keys, num*sizeof(KeyButton)); + for(int i=0; i < num && keys; i++) + m_FocusKeys[i] = keys[i]; } void SetCaptureKeys(KeyButton *keys, int num) { m_CaptureKeys.resize(num); - if(keys && num > 0) - memcpy(&m_CaptureKeys[0], keys, num*sizeof(KeyButton)); + for(int i=0; i < num && keys; i++) + m_CaptureKeys[i] = keys[i]; } const vector &GetFocusKeys() { return m_FocusKeys; } diff --git a/renderdoc/os/linux/linux_stringio.cpp b/renderdoc/os/linux/linux_stringio.cpp index 1713bce33..ff3e5fbd9 100644 --- a/renderdoc/os/linux/linux_stringio.cpp +++ b/renderdoc/os/linux/linux_stringio.cpp @@ -24,6 +24,7 @@ #include "os/os_specific.h" +#include "api/app/renderdoc_app.h" #include #include @@ -58,14 +59,14 @@ namespace Keyboard { } - bool GetKeyState(KeyButton key) + bool GetKeyState(int key) { KeySym ks = 0; if(CurrentXDisplay == NULL) return false; - if(key >= eKey_A && key <= eKey_Z) ks = (int)key; - if(key >= eKey_0 && key <= eKey_9) ks = (int)key; + if(key >= eKey_A && key <= eKey_Z) ks = key; + if(key >= eKey_0 && key <= eKey_9) ks = key; switch(key) { diff --git a/renderdoc/os/os_specific.h b/renderdoc/os/os_specific.h index b47739359..2ada76bd7 100644 --- a/renderdoc/os/os_specific.h +++ b/renderdoc/os/os_specific.h @@ -188,14 +188,12 @@ namespace FileIO int fclose(FILE *f); }; -enum KeyButton; - namespace Keyboard { void Init(); void AddInputWindow(void *wnd); void RemoveInputWindow(void *wnd); - bool GetKeyState(KeyButton key); + bool GetKeyState(int key); }; namespace StringFormat diff --git a/renderdoc/os/win32/win32_stringio.cpp b/renderdoc/os/win32/win32_stringio.cpp index e786dac98..87d6cce0c 100644 --- a/renderdoc/os/win32/win32_stringio.cpp +++ b/renderdoc/os/win32/win32_stringio.cpp @@ -71,12 +71,12 @@ namespace Keyboard inputWindows.erase((HWND)wnd); } - bool GetKeyState(KeyButton key) + bool GetKeyState(int key) { int vk = 0; - if(key >= eKey_A && key <= eKey_Z) vk = (int)key; - if(key >= eKey_0 && key <= eKey_9) vk = (int)key; + if(key >= eKey_A && key <= eKey_Z) vk = key; + if(key >= eKey_0 && key <= eKey_9) vk = key; switch(key) {