Skip to content
This repository has been archived by the owner on May 12, 2024. It is now read-only.

Commit

Permalink
Update windows.c
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinAlavik authored Feb 27, 2024
1 parent 8d39c59 commit 1294a64
Showing 1 changed file with 0 additions and 40 deletions.
40 changes: 0 additions & 40 deletions src/system/wm/windows.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,46 +38,6 @@ void spawn_window(window_t *window) {
}
}

#include "windows.h"

window_t windows[MAX_WINDOWS];
int num_windows = 0;

uint32_t w_old_pixels[MAX_WINDOWS][WIN_WIDTH][WIN_HEIGHT];
int old_window_x[MAX_WINDOWS];
int old_window_y[MAX_WINDOWS];
int last_updated_window_index = -1;

void spawn_window(window_t *window) {
if (num_windows < MAX_WINDOWS) {
window->buffer = malloc(window->width * window->height * sizeof(uint32_t));
window->old_buffer =
malloc(window->width * window->height * sizeof(uint32_t));
if (window->buffer == NULL || window->old_buffer == NULL) {
dprintf("Failed to allocate memory for window buffer\n");
return;
}

memset(window->buffer, 0xFFFFFFFF,
window->width * window->height * sizeof(uint32_t));
memcpy(window->old_buffer, window->buffer,
window->width * window->height * sizeof(uint32_t));

windows[num_windows] = *window;
num_windows++;

// // TODO: Make this not hardcoded to window id 0?
old_window_x[0] = window->x;
old_window_y[0] = window->y;
window->initialized = false;

render_window_gui(window);
update_window(window);
} else {
dprintf("Maximum number of windows reached\n");
}
}

void render_window_gui(window_t *window) {
bool buffer_changed = false;

Expand Down

0 comments on commit 1294a64

Please sign in to comment.