Typedef struct

This commit is contained in:
Joseph Ferano 2023-10-16 09:23:19 +07:00
parent e214539fe0
commit 7383129a51

8
main.c
View File

@ -12,12 +12,12 @@
int SCREEN_WIDTH = 1024; int SCREEN_WIDTH = 1024;
int SCREEN_HEIGHT = 768; int SCREEN_HEIGHT = 768;
struct State { typedef struct State {
float camX; float camX;
float camY; float camY;
float px; float px;
float py; float py;
}; } State;
void framebuffer_size_callback(GLFWwindow* window, int width, int height) { void framebuffer_size_callback(GLFWwindow* window, int width, int height) {
(void)window; (void)window;
@ -26,7 +26,7 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) {
SCREEN_HEIGHT = height; SCREEN_HEIGHT = height;
} }
void processInput(GLFWwindow *window, struct State* state) { void processInput(GLFWwindow *window, State* state) {
if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS) { if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS) {
glfwSetWindowShouldClose(window, true); glfwSetWindowShouldClose(window, true);
} }
@ -141,7 +141,7 @@ int main(void) {
// float deltaTime = 0.0f; // float deltaTime = 0.0f;
// float lastFrame = 0.0f; // float lastFrame = 0.0f;
struct State state = {0}; State state = {0};
int frameCount = 0; int frameCount = 0;
float elapsed = 0.0f; float elapsed = 0.0f;
float lastFrame; float lastFrame;