Reshuffled

This commit is contained in:
2021-04-19 21:30:34 +10:00
parent cc94f7c775
commit ff8b84b542
45 changed files with 218 additions and 140 deletions

View File

@ -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;
}
}