Tic tac toe basically done
This commit is contained in:
@ -66,6 +66,7 @@ int32_t DawnHost::init(DawnGame *game) {
|
||||
game->inputManager.bind(INPUT_BIND_NEGATIVE_Y, GLFW_KEY_S);
|
||||
game->inputManager.bind(INPUT_BIND_POSITIVE_Y, GLFW_KEY_W);
|
||||
|
||||
game->inputManager.bind(INPUT_BIND_MOUSE_CLICK, INPUT_MANAGER_AXIS_MOUSE_0);
|
||||
game->inputManager.bind(INPUT_BIND_MOUSE_X, INPUT_MANAGER_AXIS_MOUSE_X);
|
||||
game->inputManager.bind(INPUT_BIND_MOUSE_Y, INPUT_MANAGER_AXIS_MOUSE_Y);
|
||||
|
||||
@ -85,6 +86,7 @@ int32_t DawnHost::init(DawnGame *game) {
|
||||
glfwSetFramebufferSizeCallback(this->data->window, &glfwOnResize);
|
||||
glfwSetKeyCallback(this->data->window, &glfwOnKey);
|
||||
glfwSetCursorPosCallback(this->data->window, &glfwOnCursor);
|
||||
glfwSetMouseButtonCallback(this->data->window, &glfwOnMouseButton);
|
||||
|
||||
return DAWN_HOST_INIT_RESULT_SUCCESS;
|
||||
}
|
||||
@ -195,4 +197,12 @@ void glfwOnCursor(GLFWwindow* window, double xpos, double ypos) {
|
||||
(float_t)(ypos / DAWN_HOST->game->renderManager.backBuffer.getHeight()),
|
||||
0, 1
|
||||
);
|
||||
}
|
||||
|
||||
void glfwOnMouseButton(GLFWwindow* window, int button, int action, int mods) {
|
||||
if(DAWN_HOST == nullptr) return;
|
||||
assertTrue(window == DAWN_HOST->data->window);
|
||||
|
||||
float_t value = action == GLFW_PRESS ? 1 : 0;
|
||||
DAWN_HOST->game->inputManager.rawInputValues[INPUT_MANAGER_AXIS_MOUSE_0 + button] = value;
|
||||
}
|
@ -31,4 +31,5 @@ void glfwOnKey(
|
||||
GLFWwindow *window,
|
||||
int32_t key, int32_t scancode, int32_t action, int32_t mods
|
||||
);
|
||||
void glfwOnCursor(GLFWwindow* window, double xpos, double ypos);
|
||||
void glfwOnCursor(GLFWwindow* window, double xpos, double ypos);
|
||||
void glfwOnMouseButton(GLFWwindow* window, int button, int action, int mods);
|
@ -8,6 +8,7 @@
|
||||
|
||||
#define INPUT_MANAGER_AXIS_MOUSE_X -580000
|
||||
#define INPUT_MANAGER_AXIS_MOUSE_Y -580001
|
||||
#define INPUT_MANAGER_AXIS_MOUSE_0 -590000
|
||||
|
||||
namespace Dawn {
|
||||
class InputManager : public IInputManager<int32_t> {
|
||||
|
Reference in New Issue
Block a user