2024-05-03 11:18:50 +12:00
|
|
|
#include <gearlib.h>
|
2024-04-30 23:02:19 +12:00
|
|
|
#include <stdlib.h>
|
2024-05-03 11:18:50 +12:00
|
|
|
#include <raymath.h>
|
2024-04-29 19:32:59 +12:00
|
|
|
|
2024-04-29 22:41:13 +12:00
|
|
|
int main() {
|
|
|
|
init_gl(4, 6);
|
2024-04-30 23:02:19 +12:00
|
|
|
Window window = create_window(800, 600, "gearlib");
|
2024-05-03 11:18:50 +12:00
|
|
|
glfwSwapInterval(0);
|
2024-04-30 23:02:19 +12:00
|
|
|
|
2024-05-03 11:18:50 +12:00
|
|
|
enable_debugging();
|
|
|
|
setup_textures();
|
2024-04-30 23:02:19 +12:00
|
|
|
|
2024-05-03 11:18:50 +12:00
|
|
|
uint32_t cat = load_texture("assets/cat.png");
|
|
|
|
uint32_t cuddle = load_texture("assets/cuddle.png");
|
|
|
|
uint32_t parrots = load_texture("assets/parrots.png");
|
|
|
|
|
|
|
|
double time = glfwGetTime();
|
2024-04-29 19:32:59 +12:00
|
|
|
|
|
|
|
while (!glfwWindowShouldClose(window)) {
|
|
|
|
process_input(window);
|
|
|
|
|
|
|
|
glClearColor(0.2f, 0.3f, 0.3f, 1.0f);
|
|
|
|
glClear(GL_COLOR_BUFFER_BIT);
|
|
|
|
|
2024-05-03 11:18:50 +12:00
|
|
|
draw_texture(parrots, (vec3){ -0.4f, 0.4f, 0.0f }, (vec4){ 1.0f, 1.0f, 1.0f, 1.0f });
|
|
|
|
draw_texture(cat, (vec3){ 0.0f, 0.0f, 0.0f }, (vec4){ 1.0f, 1.0f, 1.0f, 1.0f });
|
|
|
|
draw_texture(cuddle, (vec3){ 0.0f, -0.4f, 0.0f }, (vec4){ 1.0f, 1.0f, 1.0f, 1.0f });
|
|
|
|
|
|
|
|
flush();
|
2024-04-30 23:02:19 +12:00
|
|
|
|
2024-05-03 11:18:50 +12:00
|
|
|
double end_time = glfwGetTime();
|
|
|
|
double frame_time = end_time - time;
|
|
|
|
double fps = 1 / frame_time;
|
|
|
|
time = end_time;
|
2024-04-30 23:02:19 +12:00
|
|
|
|
2024-05-03 11:18:50 +12:00
|
|
|
//printf("%lf, %lf" /*", %d, %d"*/ "\n", frame_time, fps/*, stats.draw_calls, stats.total_verts*/);
|
2024-04-29 22:41:13 +12:00
|
|
|
|
2024-04-29 19:32:59 +12:00
|
|
|
glfwSwapBuffers(window);
|
|
|
|
glfwPollEvents();
|
|
|
|
}
|
|
|
|
|
|
|
|
glfwTerminate();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|