Update some things.
This commit is contained in:
parent
f215bc3742
commit
f9d6e7a70a
35 changed files with 575 additions and 905 deletions
|
|
@ -6,6 +6,7 @@
|
|||
namespace Artifact {
|
||||
|
||||
static std::array<Key, GLFW_KEY_LAST + 1> GLFWToArtifact {};
|
||||
static std::array<int, static_cast<size_t>(Key::Last) + 1> ArtifactToGLFW {};
|
||||
|
||||
namespace {
|
||||
// Ensure that GLFW is transparently initialized prior to window creation.
|
||||
|
|
@ -15,7 +16,8 @@ static struct _glfwInit {
|
|||
|
||||
// Populate the global GLFW-to-Artifact keycode mapping.
|
||||
GLFWToArtifact.fill(Key::Unknown);
|
||||
#define X(glfw, artifact) GLFWToArtifact[glfw] = Key::artifact
|
||||
#define X(glfw, artifact) GLFWToArtifact[glfw] = Key::artifact;\
|
||||
ArtifactToGLFW[static_cast<int>(Key::artifact)] = glfw
|
||||
X(GLFW_KEY_A, A);
|
||||
X(GLFW_KEY_B, B);
|
||||
X(GLFW_KEY_C, C);
|
||||
|
|
@ -160,4 +162,16 @@ bool Window::shouldClose() {
|
|||
return glfwWindowShouldClose(window);
|
||||
}
|
||||
|
||||
void Window::setPointerLock() {
|
||||
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
|
||||
}
|
||||
|
||||
void Window::releasePointerLock() {
|
||||
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
|
||||
}
|
||||
|
||||
bool Window::isKeyDown(Key key) {
|
||||
return glfwGetKey(window, ArtifactToGLFW[static_cast<int>(key)]) == GLFW_PRESS;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue