summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/main.c4
-rw-r--r--src/screen.c8
-rw-r--r--src/screen.h2
3 files changed, 9 insertions, 5 deletions
diff --git a/src/main.c b/src/main.c
index 385d0d1..8a4835a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -6,7 +6,7 @@
int main (void) {
Screen screen;
- init_screen(&screen, 2160, 1440);
+ init_screen(&screen, 2160, 1440, "Raycaster");
Camera camera;
init_camera(&camera);
@@ -14,6 +14,8 @@ int main (void) {
while (poll_screen(&screen)) {
render(&screen, &camera);
update_camera(&camera, &screen);
+
+ if(key_pressed(KEY_ESC)) break;
}
free_screen(&screen);
diff --git a/src/screen.c b/src/screen.c
index 6446357..762ecbc 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -49,7 +49,7 @@ static void init_x() {
memset(key_checked, 0, sizeof(bool) * key_count);
}
-static Window create_window(int x, int y, int w, int h, int d) {
+static Window create_window(int x, int y, int w, int h, int d, const char* t) {
XVisualInfo vis_info;
if(!XMatchVisualInfo(dpy, scr, d, TrueColor, &vis_info)) {
@@ -68,6 +68,8 @@ static Window create_window(int x, int y, int w, int h, int d) {
long wm = CWBackPixel | CWColormap | CWBorderPixel | CWEventMask;
Window window = XCreateWindow(dpy, root, x, y, w, h, 0, d, InputOutput, visual, wm, &xwa);
+ XStoreName(dpy, window, t);
+ XSetIconName(dpy, window, t);
return window;
}
@@ -88,7 +90,7 @@ static XImage* create_image(int width, int height, void* data) {
}
-void init_screen(struct Screen* screen, uint16_t width, uint16_t height) {
+void init_screen(struct Screen* screen, uint16_t width, uint16_t height, const char* title) {
if (dpy == NULL) {
init_x();
@@ -103,7 +105,7 @@ void init_screen(struct Screen* screen, uint16_t width, uint16_t height) {
screen->pixels = malloc(pixel_count * bit_depth / 8);
memset(screen->pixels, 0, pixel_count * bit_depth / 8);
- Window window = create_window(0, 0, width, height, bit_depth);
+ Window window = create_window(0, 0, width, height, bit_depth, title);
XMapWindow(dpy, window);
Pixmap pixel_map = XCreatePixmap(dpy, window, width, height, bit_depth);
diff --git a/src/screen.h b/src/screen.h
index c2165f9..e1d80d1 100644
--- a/src/screen.h
+++ b/src/screen.h
@@ -26,7 +26,7 @@ struct Screen {
#define KEY_EQUALS 13
#define KEY_ESC 1
-void init_screen(Screen* screen, uint16_t width, uint16_t height);
+void init_screen(Screen* screen, uint16_t width, uint16_t height, const char* title);
bool poll_screen(Screen* screen);
void free_screen(Screen* screen);