From b062aa0323ed43590edf004648e43e703ff9089e Mon Sep 17 00:00:00 2001 From: epoch Date: Thu, 29 Mar 2018 18:29:59 -0500 Subject: fixed a bug that caused glitch art from uninitialized memory in the clean backbuffer and added mouse-over and actioning for circles. and commented out "move forward" because I don't have that yet. --- src/graphics_cs_x11.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/graphics_cs_x11.c b/src/graphics_cs_x11.c index df4df49..f17cc5c 100644 --- a/src/graphics_cs_x11.c +++ b/src/graphics_cs_x11.c @@ -91,6 +91,12 @@ void draw_cs_shape(cs_s_t s) {//this is implemented as draw_cs_line... hrm. it c //circle h=max(s.p[0].x,s.p[1].x)-min(s.p[0].x,s.p[1].x); XDrawArc(x11_global.dpy,x11_global.backbuffer,x11_global.backgc,s.p[0].x-h,s.p[0].y-h,h*2,h*2,0,360*64); + if(distance2((c2_t){s.p[0].x,s.p[1].y},(c2_t){gra_global.mousex,gra_global.mousey} ) < h) { + if(gra_global.buttonpressed) { + printf("%s action %s\n",global.user,s.id); + } + XDrawArc(x11_global.dpy,x11_global.backbuffer,x11_global.backgc,s.p[0].x-h-2,s.p[0].y-h-2,h*2+4,h*2+4,0,360*64); + } break; default: for(i=0;i