diff options
author | epoch <epoch@hacking.allowed.org> | 2020-10-11 01:39:06 -0500 |
---|---|---|
committer | epoch <epoch@hacking.allowed.org> | 2020-10-11 01:39:06 -0500 |
commit | 16ee776dc021c8fa20bc6d344d7f585d371e9553 (patch) | |
tree | e62efaa3b665302527fc13af19021742645d6a41 /src/graphics_c2.c | |
parent | c27f40e7f2d20b0a576ece53e9bdeacc7b40da9e (diff) | |
download | hackvr-16ee776dc021c8fa20bc6d344d7f585d371e9553.tar.gz hackvr-16ee776dc021c8fa20bc6d344d7f585d371e9553.zip |
moved the bounding-box checking-code from driver-specific files into math.c, moved the check and hilighting to driver-agnostic place.
Diffstat (limited to 'src/graphics_c2.c')
-rw-r--r-- | src/graphics_c2.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/graphics_c2.c b/src/graphics_c2.c index d78f87b..65d139f 100644 --- a/src/graphics_c2.c +++ b/src/graphics_c2.c @@ -1,7 +1,11 @@ +#include "common.h" +#include "math.h" #include "graphics_cs.h" #include "graphics_c3.h" +#include "mouse.h" extern struct gra_global gra_global; +extern struct hvr_global global; int c2sX(real x) { return (gra_global.width/(gra_global.split_screen / (gra_global.red_and_blue ? gra_global.split_screen: 1))) * ((x + RIGHT) / (RIGHT *2)) + gra_global.xoff; } int s2cX(real x) { return (x/(gra_global.width/(gra_global.split_screen / (gra_global.red_and_blue?gra_global.split_screen :1))))*(RIGHT*2)-RIGHT; } @@ -29,6 +33,16 @@ void draw_c2_shape(c2_s_t s) { ss.p[i]=c2_to_cs(s.p[i]); } draw_cs_shape(ss); +// if(cn_PnPoly(gra_global.mouse,s.p,s.len+(s.len==1))) {//if the mouse is inside the shape, we're going to draw a different outline. + if(epoch_PnPoly(gra_global.mouse,s.p,s.len+(s.len==1))) {//if the mouse is inside the shape, we're going to draw a different outline. + set_ansi_color(7); + if(gra_global.mousemap[MOUSE_PRIMARY]==1) { + printf("%s action %s\n",global.user,s.id); + gra_global.mousemap[MOUSE_PRIMARY]=0; + } + //I need to debounce probably + draw_cs_shape(ss);//draw over. dunno. + } } void draw_c2_filled_shape(c2_s_t s) { @@ -40,6 +54,7 @@ void draw_c2_filled_shape(c2_s_t s) { ss.p[i]=c2_to_cs(s.p[i]); } draw_cs_filled_shape(ss); + draw_cs_shape(ss);//redraw outline last } void draw_c2_text(c2_t p,char *text) { |