Remove testing code

This commit is contained in:
Abdelrahman Said 2024-01-17 23:41:25 +00:00
parent aac10f24d1
commit f45fb04dff

View File

@ -8,7 +8,6 @@
#include <SDL2/SDL_render.h>
#include <SDL2/SDL_video.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#define MAX_WINDOWS 2
@ -28,7 +27,6 @@ struct compositor {
u64 last_clicked_mouse_y;
i64 node_hovered;
u64 count;
rect_t *rects;
node_t *nodes;
bool move_node;
ui_ctx_t ctx;
@ -46,7 +44,6 @@ i32 run_main_loop(void) {
init_ui_ctx(&(comp.ctx));
comp.rects = (rect_t *)malloc(sizeof(rect_t) * MAX_NODES);
comp.nodes = (node_t *)malloc(sizeof(node_t) * MAX_NODES);
window_t *main_window = &(comp.windows[0]);
@ -69,13 +66,6 @@ i32 run_main_loop(void) {
colour_t bg_colour = {.abgr = 0xffffffff};
comp.rects[0] = (rect_t){
.topleft.x = 150,
.topleft.y = 50,
.w = NODE_WIDTH,
.h = NODE_HEIGHT,
};
while (comp.running) {
while (SDL_PollEvent(&(comp.event))) {
handle_ui_events(&(comp.windows[comp.active_window - 1]), &(comp.ctx),
@ -122,24 +112,6 @@ i32 run_main_loop(void) {
clear_window(&(comp.windows[i]), bg_colour);
}
if (button(main_window, &(comp.ctx),
(rect_t){.topleft.x = 10,
.topleft.y = 10,
.w = BUTTON_WIDTH,
.h = BUTTON_HEIGHT})) {
printf("Button 1 pressed\n");
}
if (button(main_window, &(comp.ctx),
(rect_t){.topleft.x = 50,
.topleft.y = 50,
.w = BUTTON_WIDTH,
.h = BUTTON_HEIGHT})) {
printf("Button 2 pressed\n");
}
comp.rects[0] = node(main_window, &(comp.ctx), comp.rects[0]);
for (u64 i = 0; i < MAX_WINDOWS; ++i) {
swap_buffers(&(comp.windows[i]));
}