diff options
| author | iamcheeseman <[email protected]> | 2026-05-12 16:41:37 -0400 |
|---|---|---|
| committer | iamcheeseman <[email protected]> | 2026-05-12 16:41:37 -0400 |
| commit | 897a153d290ed4d3647ad9e0100d1b717f580b5f (patch) | |
| tree | 844dee0b3b2b7d869cd8e1ba27ffb403e8d51d99 /platform/gl/gl.c | |
| parent | c1dd3ce9850fb2906aa5937b4374d1c0fc74ccf7 (diff) | |
typedef all structs and rename to Ada_Case
There isn't really a technical reason that I made this change. I just
wanted to use Ada_Case. All types were prefixed with ty_, e.g. ty_Image.
Diffstat (limited to 'platform/gl/gl.c')
| -rw-r--r-- | platform/gl/gl.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/platform/gl/gl.c b/platform/gl/gl.c index acfa0c5..30ea49d 100644 --- a/platform/gl/gl.c +++ b/platform/gl/gl.c @@ -36,16 +36,16 @@ static char frag[] = "}\n" ; -struct gl_platform { +typedef struct { GLFWwindow *win; GLuint vao; GLuint vbo; GLuint program; GLint uniform_tex_loc; GLuint screen_handle; -}; +} Gl_Platform; -struct gl_platform p; +Gl_Platform p; static GLuint compile_shader(GLenum type, const char *src) @@ -65,7 +65,7 @@ GLuint compile_shader(GLenum type, const char *src) return shader; } -void ty_platform_init(struct ty_ctx *ctx) +void ty_platform_init(ty_Ctx *ctx) { ty_log_info("initializing GLFW..."); if (glfwInit() < 0) @@ -92,7 +92,7 @@ void ty_platform_init(struct ty_ctx *ctx) if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress)) ty_log_fatal(TY_PLATFORM_ERR, "could not init GLAD"); - struct ty_vec2 vertices[] = { + ty_Vec2 vertices[] = { ty_vec2(-1, -1), ty_vec2(0, 1), ty_vec2( 1, -1), ty_vec2(1, 1), ty_vec2( 1, 1), ty_vec2(1, 0), @@ -119,14 +119,14 @@ void ty_platform_init(struct ty_ctx *ctx) 0, 2, GL_FLOAT, GL_FALSE, - sizeof(struct ty_vec2) * 2, (void*)0 + sizeof(ty_Vec2) * 2, (void*)0 ); glEnableVertexAttribArray(0); glVertexAttribPointer( 1, 2, GL_FLOAT, GL_FALSE, - sizeof(struct ty_vec2) * 2, (void*)sizeof(struct ty_vec2) + sizeof(ty_Vec2) * 2, (void*)sizeof(ty_Vec2) ); glEnableVertexAttribArray(1); @@ -167,7 +167,7 @@ void ty_platform_deinit(void) glfwTerminate(); } -void ty_platform_frame(struct ty_image img) +void ty_platform_frame(ty_Image img) { glfwPollEvents(); @@ -216,7 +216,7 @@ double ty_platform_get_time(void) return glfwGetTime(); } -struct ty_vec2i ty_platform_get_mouse(void) +ty_Vec2i ty_platform_get_mouse(void) { double x, y; glfwGetCursorPos(p.win, &x, &y); @@ -224,7 +224,7 @@ struct ty_vec2i ty_platform_get_mouse(void) } static -int button_to_glfw_key(enum ty_button btn) +int button_to_glfw_key(ty_Button btn) { switch (btn) { case TY_BTN_LEFT_UP: return GLFW_KEY_W; @@ -245,7 +245,7 @@ int button_to_glfw_key(enum ty_button btn) return 0; } -bool ty_platform_is_button_down(enum ty_button btn) +bool ty_platform_is_button_down(ty_Button btn) { return glfwGetKey(p.win, button_to_glfw_key(btn)) == GLFW_PRESS; } |
