Reshuffled
This commit is contained in:
@ -42,11 +42,12 @@ int32_t main() {
|
||||
if(runningGame == NULL) return 1;
|
||||
|
||||
// Update the window title.
|
||||
engine_t *engine = gameGetEngine(runningGame);
|
||||
glfwSetWindowTitle(window, engine->name);
|
||||
glfwSetWindowTitle(window, runningGame->engine->name);
|
||||
|
||||
// Bind inputs
|
||||
inputBind(engine->input, INPUT_NULL, (inputsource_t *)GLFW_KEY_ESCAPE);
|
||||
inputBind(runningGame->engine->input, INPUT_NULL,
|
||||
(inputsource_t *)GLFW_KEY_ESCAPE
|
||||
);
|
||||
|
||||
// Main Render Loop
|
||||
while(!glfwWindowShouldClose(window)) {
|
||||
@ -67,10 +68,9 @@ int32_t main() {
|
||||
}
|
||||
|
||||
void glfwOnResize(GLFWwindow *window, int32_t width, int32_t height) {
|
||||
engine_t *engine = gameGetEngine(runningGame);
|
||||
engine->platform->screenWidth = width;
|
||||
engine->platform->screenWidth = height;
|
||||
renderSetResolution(engine->render, width, height);
|
||||
runningGame->engine->platform->screenWidth = width;
|
||||
runningGame->engine->platform->screenWidth = height;
|
||||
renderSetResolution(runningGame->engine->render, width, height);
|
||||
}
|
||||
|
||||
void glfwOnKey(GLFWwindow *window,
|
||||
@ -78,10 +78,9 @@ void glfwOnKey(GLFWwindow *window,
|
||||
) {
|
||||
if(runningGame == NULL) return;
|
||||
|
||||
engine_t *engine = gameGetEngine(runningGame);
|
||||
if(action == GLFW_PRESS) {
|
||||
engine->input->buffer[key] = 1;
|
||||
runningGame->engine->input->buffer[key] = 1;
|
||||
} else if(action == GLFW_RELEASE) {
|
||||
engine->input->buffer[key] = 0;
|
||||
runningGame->engine->input->buffer[key] = 0;
|
||||
}
|
||||
}
|
@ -5,16 +5,17 @@
|
||||
|
||||
#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>
|
||||
#include <stdint.h>
|
||||
#include "../../engine/platform.h"
|
||||
#include "../../engine/game/game.h"
|
||||
#include "../../engine/input/input.h"
|
||||
#include "../../engine/display/render.h"
|
||||
|
||||
#define PLATFORMINPUT_T uint32_t
|
||||
|
||||
#include "../../platform.h"
|
||||
#include "../../game/game.h"
|
||||
#include "../../input/input.h"
|
||||
#include "../../display/render.h"
|
||||
|
||||
#define WINDOW_WIDTH_DEFAULT 480
|
||||
#define WINDOW_HEIGHT_DEFAULT 270
|
||||
@ -29,7 +30,6 @@ extern game_t *runningGame;
|
||||
*/
|
||||
int32_t main();
|
||||
|
||||
|
||||
/**
|
||||
* Resize callbacks.
|
||||
*
|
||||
@ -39,7 +39,6 @@ int32_t main();
|
||||
*/
|
||||
void glfwOnResize(GLFWwindow *window, int32_t width, int32_t height);
|
||||
|
||||
|
||||
/**
|
||||
* Keyboard Input callbacks.
|
||||
*
|
||||
|
Reference in New Issue
Block a user