From 718d9ea67196aa7e56c84261e0a8c134492023ad Mon Sep 17 00:00:00 2001 From: epoch Date: Tue, 24 Jan 2017 01:23:45 -0600 Subject: changed a couple things about how graphics stuff is abstracted and separated into different files. --- src/graphics_x11.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'src/graphics_x11.c') diff --git a/src/graphics_x11.c b/src/graphics_x11.c index dad8b05..9839169 100644 --- a/src/graphics_x11.c +++ b/src/graphics_x11.c @@ -20,6 +20,7 @@ #include "common.h" #include "graphics.h" #include "graphics_x11.h" +#include "graphics_backend.h" //typedef float real; //think this conflicts? @@ -141,6 +142,14 @@ void set_color() { XSetForeground(x11_global.dpy,x11_global.backgc,x11_global.green.pixel); } +void set_color_red() { + XSetForeground(x11_global.dpy,x11_global.backgc,x11_global.red.pixel); +} + +void set_color_blue() { + XSetForeground(x11_global.dpy,x11_global.backgc,x11_global.blue.pixel); +} + void flipscreen() { XCopyArea(x11_global.dpy,x11_global.backbuffer,x11_global.w,x11_global.gc,0,0,gra_global.width,gra_global.height,0,0); } @@ -384,22 +393,22 @@ int graphics_event_handler() { // if(e.xexpose.count == 0) redraw=1; // break; case MotionNotify: - printf("# MotionNotify\n"); + if(global.debug >= 2) printf("# MotionNotify\n"); XQueryPointer(x11_global.dpy,x11_global.w,&root,&child,&gra_global.rmousex,&gra_global.rmousey,&gra_global.mousex,&gra_global.mousey,&mask); redraw=1; break; case ButtonPress: - printf("# ButtonPress\n"); + if(global.debug >= 2) printf("# ButtonPress\n"); redraw=1; gra_global.buttonpressed=e.xbutton.button;//what's this for? mouse? break; case ButtonRelease: - printf("# ButtonRelease\n"); + if(global.debug >= 2) printf("# ButtonRelease\n"); redraw=1; gra_global.buttonpressed=0;//what's this for??? break; case ConfigureNotify: - printf("# ConfigureNotify\n"); + if(global.debug >= 2) printf("# ConfigureNotify\n"); redraw=1; XGetGeometry(x11_global.dpy,x11_global.w,&root,&global.x,&global.y,&gra_global.width,&gra_global.height,&gra_global.border_width,&gra_global.depth); if(gra_global.height * AR_W / AR_H != gra_global.width / (gra_global.split_screen / (gra_global.red_and_blue ? gra_global.split_screen : 1))) { @@ -416,7 +425,7 @@ int graphics_event_handler() { gra_global.mapyoff=gra_global.height/2; break; case KeyPress: - printf("# KeyPress\n"); + if(global.debug >= 2) printf("# KeyPress\n"); redraw=1; if(keypress_handler(XLookupKeysym(&e.xkey,0)) == -1) { printf("# exiting\n"); -- cgit v1.2.3