Added some defineable types

This commit is contained in:
2021-02-23 08:28:20 +11:00
parent 4f02128553
commit 700a1b8c7f
7 changed files with 55 additions and 33 deletions

View File

@ -13,7 +13,11 @@ int32_t main() {
platform_t platform = {
.name = "glfw",
.screenWidth = WINDOW_WIDTH_DEFAULT,
.screenHeight = WINDOW_HEIGHT_DEFAULT
.screenHeight = WINDOW_HEIGHT_DEFAULT,
.inputSourceCount = 0,
.inputValues = NULL,
.inputSource = NULL
};
// Attempt to init GLFW
@ -38,6 +42,10 @@ int32_t main() {
runningGame = gameInit(&platform);
if(runningGame == NULL) return 1;
// Update the window title.
engine_t *engine = gameGetEngine(runningGame);
glfwSetWindowTitle(window, engine->name);
// Main Render Loop
while(!glfwWindowShouldClose(window)) {
gameUpdate(runningGame);
@ -65,11 +73,8 @@ void glfwOnResize(GLFWwindow *window, int32_t width, int32_t height) {
void glfwOnKey(GLFWwindow *window,
int32_t key, int32_t scancode, int32_t action, int32_t mods
) {
char *title = glfwGetKeyName(key, scancode);
if(title == NULL) {
printf("Unknown Key %d", scancode);
} else {
printf(title);
}
printf("\n");
float force = action == GLFW_PRESS ? 1 : 0;
engine_t *engine = gameGetEngine(runningGame);
engine->input->current[scancode] = force;
}

View File

@ -5,6 +5,8 @@
#pragma once
#define PLATFORMINPUT_T uint32_t
// I load GLAD and GLFW Here because they need to be included in specific orders
#include <glad/glad.h>
#include <GLFW/glfw3.h>