Added AABB Point
This commit is contained in:
@ -17,8 +17,8 @@ int32_t main() {
|
||||
glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, false);
|
||||
|
||||
// Create Window
|
||||
window = glfwCreateWindow(WINDOW_WIDTH_DEFAULT, WINDOW_HEIGHT_DEFAULT,
|
||||
"", NULL, NULL
|
||||
window = glfwCreateWindow(
|
||||
WINDOW_WIDTH_DEFAULT, WINDOW_HEIGHT_DEFAULT, "", NULL, NULL
|
||||
);
|
||||
if(!window) {
|
||||
glfwTerminate();
|
||||
@ -33,8 +33,8 @@ int32_t main() {
|
||||
// Setup window listeners
|
||||
glfwSetWindowSizeCallback(window, &glfwOnResize);
|
||||
glfwSetKeyCallback(window, &glfwOnKey);
|
||||
|
||||
glfwSetErrorCallback(&glfwOnError);
|
||||
glfwSetCursorPosCallback(window, &glfwOnCursor);
|
||||
|
||||
// Prepare the game
|
||||
game_t *game = malloc(sizeof(game_t));
|
||||
@ -51,28 +51,33 @@ int32_t main() {
|
||||
// Init the game
|
||||
if(gameInit(game)) {
|
||||
// Bind initial keys
|
||||
inputBind(input, INPUT_NULL, (inputsource_t)GLFW_KEY_ESCAPE);
|
||||
inputBind(input, INPUT_DEBUG_UP, (inputsource_t)GLFW_KEY_W);
|
||||
inputBind(input, INPUT_DEBUG_DOWN, (inputsource_t)GLFW_KEY_S);
|
||||
inputBind(input, INPUT_DEBUG_LEFT, (inputsource_t)GLFW_KEY_A);
|
||||
inputBind(input, INPUT_DEBUG_RIGHT, (inputsource_t)GLFW_KEY_D);
|
||||
inputBind(input, INPUT_DEBUG_RAISE, (inputsource_t)GLFW_KEY_Q);
|
||||
inputBind(input, INPUT_DEBUG_LOWER, (inputsource_t)GLFW_KEY_E);
|
||||
inputBind(input, INPUT_DEBUG_FINE, (inputsource_t)GLFW_KEY_LEFT_CONTROL);
|
||||
inputBind(input, INPUT_DEBUG_PLUS, (inputsource_t)GLFW_KEY_EQUAL);
|
||||
inputBind(input, INPUT_DEBUG_MINUS, (inputsource_t)GLFW_KEY_MINUS);
|
||||
inputBind(input, INPUT_NULL, (inputsource_t)GLFW_KEY_ESCAPE);
|
||||
inputBind(input, INPUT_DEBUG_UP, (inputsource_t)GLFW_KEY_W);
|
||||
inputBind(input, INPUT_DEBUG_DOWN, (inputsource_t)GLFW_KEY_S);
|
||||
inputBind(input, INPUT_DEBUG_LEFT, (inputsource_t)GLFW_KEY_A);
|
||||
inputBind(input, INPUT_DEBUG_RIGHT, (inputsource_t)GLFW_KEY_D);
|
||||
inputBind(input, INPUT_DEBUG_RAISE, (inputsource_t)GLFW_KEY_Q);
|
||||
inputBind(input, INPUT_DEBUG_LOWER, (inputsource_t)GLFW_KEY_E);
|
||||
inputBind(input, INPUT_DEBUG_FINE, (inputsource_t)GLFW_KEY_LEFT_CONTROL);
|
||||
inputBind(input, INPUT_DEBUG_PLUS, (inputsource_t)GLFW_KEY_EQUAL);
|
||||
inputBind(input, INPUT_DEBUG_MINUS, (inputsource_t)GLFW_KEY_MINUS);
|
||||
|
||||
inputBind(input, INPUT_UP, (inputsource_t)GLFW_KEY_UP);
|
||||
inputBind(input, INPUT_DOWN, (inputsource_t)GLFW_KEY_DOWN);
|
||||
inputBind(input, INPUT_LEFT, (inputsource_t)GLFW_KEY_LEFT);
|
||||
inputBind(input, INPUT_RIGHT, (inputsource_t)GLFW_KEY_RIGHT);
|
||||
inputBind(input, INPUT_UP, (inputsource_t)GLFW_KEY_W);
|
||||
inputBind(input, INPUT_DOWN, (inputsource_t)GLFW_KEY_S);
|
||||
inputBind(input, INPUT_LEFT, (inputsource_t)GLFW_KEY_A);
|
||||
inputBind(input, INPUT_RIGHT, (inputsource_t)GLFW_KEY_D);
|
||||
inputBind(input, INPUT_ACCEPT, (inputsource_t)GLFW_KEY_E);
|
||||
inputBind(input, INPUT_ACCEPT, (inputsource_t)GLFW_KEY_ENTER);
|
||||
inputBind(input, INPUT_ACCEPT, (inputsource_t)GLFW_KEY_SPACE);
|
||||
inputBind(input, INPUT_UP, (inputsource_t)GLFW_KEY_UP);
|
||||
inputBind(input, INPUT_DOWN, (inputsource_t)GLFW_KEY_DOWN);
|
||||
inputBind(input, INPUT_LEFT, (inputsource_t)GLFW_KEY_LEFT);
|
||||
inputBind(input, INPUT_RIGHT, (inputsource_t)GLFW_KEY_RIGHT);
|
||||
inputBind(input, INPUT_UP, (inputsource_t)GLFW_KEY_W);
|
||||
inputBind(input, INPUT_DOWN, (inputsource_t)GLFW_KEY_S);
|
||||
inputBind(input, INPUT_LEFT, (inputsource_t)GLFW_KEY_A);
|
||||
inputBind(input, INPUT_RIGHT, (inputsource_t)GLFW_KEY_D);
|
||||
inputBind(input, INPUT_ACCEPT, (inputsource_t)GLFW_KEY_E);
|
||||
inputBind(input, INPUT_ACCEPT, (inputsource_t)GLFW_KEY_ENTER);
|
||||
inputBind(input, INPUT_ACCEPT, (inputsource_t)GLFW_KEY_SPACE);
|
||||
|
||||
// Bind the fake inputs
|
||||
inputBind(input, INPUT_MOUSE_X, (inputsource_t)INPUT_MOUSE_X);
|
||||
inputBind(input, INPUT_MOUSE_Y, (inputsource_t)INPUT_MOUSE_Y);
|
||||
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
|
||||
|
||||
// Update the window title.
|
||||
glfwSetWindowTitle(window, SETTING_GAME_NAME);
|
||||
@ -123,4 +128,10 @@ void glfwOnKey(GLFWwindow *window,
|
||||
|
||||
void glfwOnError(int error, const char* description) {
|
||||
fputs(description, stderr);
|
||||
}
|
||||
|
||||
void glfwOnCursor(GLFWwindow *window, double x, double y) {
|
||||
input_t *input = &GAME_STATE->engine.input;
|
||||
input->buffer[INPUT_MOUSE_X] = x;
|
||||
input->buffer[INPUT_MOUSE_Y] = y;
|
||||
}
|
@ -5,11 +5,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
// I load GLAD and GLFW Here because they need to be included in specific orders
|
||||
#if SETTING_USE_GLAD == 1
|
||||
#include <glad/glad.h>
|
||||
#endif
|
||||
#include <GLFW/glfw3.h>
|
||||
#include <dawn/dawn.h>
|
||||
#include "../../src/display/render.h"
|
||||
#include "../../src/game/game.h"
|
||||
@ -49,4 +44,5 @@ void glfwOnKey(GLFWwindow *window,
|
||||
);
|
||||
|
||||
|
||||
void glfwOnError(int error, const char* description);
|
||||
void glfwOnError(int error, const char* description);
|
||||
void glfwOnCursor(GLFWwindow *window, double x, double y);
|
Reference in New Issue
Block a user