diff options
author | epoch <epoch@hacking.allowed.org> | 2017-03-19 04:51:01 -0500 |
---|---|---|
committer | epoch <epoch@hacking.allowed.org> | 2017-03-19 04:51:01 -0500 |
commit | 781ecd6529505e4bf1fd400634ee83bcb9a07c81 (patch) | |
tree | a5f51756d54dff5ebb47f5435198e1db15ce345d /src/graphics_c2.c | |
parent | 17347b2e23292aad11c879d3df4a0e73c31e2ae8 (diff) | |
download | hackvr-781ecd6529505e4bf1fd400634ee83bcb9a07c81.tar.gz hackvr-781ecd6529505e4bf1fd400634ee83bcb9a07c81.zip |
I have no idea why I am doing this...
Diffstat (limited to 'src/graphics_c2.c')
-rw-r--r-- | src/graphics_c2.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/graphics_c2.c b/src/graphics_c2.c new file mode 100644 index 0000000..17f1828 --- /dev/null +++ b/src/graphics_c2.c @@ -0,0 +1,41 @@ +#include "graphics_cs.h" +#include "graphics_c3.h" + +extern struct gra_global gra_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; } + +int c2sY(real y) { return gra_global.height * ((TOP-y) / (TOP*2)); } +int s2cY(real y) { return -((y/gra_global.height) * (TOP*2) - TOP); } + +cs_t c2_to_cs(c2_t p) { + return (cs_t){c2sX(p.x),c2sY(p.y)}; +} +c2_t cs_to_c2(cs_t p) { + return (c2_t){s2cX(p.x),s2cY(p.y)}; +} + +void draw_c2_line(c2_t p1,c2_t p2) { + draw_cs_line(c2_to_cs(p1),c2_to_cs(p2)); +} + +void draw_c2_shape(c2_s_t s) { + int i; + cs_s_t ss; + ss.len=s.len; + ss.id=s.id; + for(i=0;i<s.len;i++) { + ss.p[i]=c2_to_cs(s.p[i]); + } + draw_cs_shape(ss); +} + +void draw_c2_filled_shape(c2_s_t s) { + draw_c2_shape(s);//heh. TODO: fixme +} + +void draw_c2_text(c2_t p,char *text) { + cs_t p2=c2_to_cs(p); + draw_cs_text(p2,text); +} |