summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/config.h1
-rw-r--r--src/graphics_c2.c9
-rw-r--r--src/graphics_c3.c1
-rw-r--r--src/graphics_cs_x11.c17
-rw-r--r--src/hackvr.c18
-rwxr-xr-xsrc/testit.sh11
6 files changed, 28 insertions, 29 deletions
diff --git a/src/config.h b/src/config.h
index 2ef2d1a..613f458 100644
--- a/src/config.h
+++ b/src/config.h
@@ -18,5 +18,6 @@
#define DEFAULT_MINIMAP 0
#define FORCE_REDRAW 1
#define MAXSHAPES 3000
+#define ROTATE_STEP 5
#endif
diff --git a/src/graphics_c2.c b/src/graphics_c2.c
index 17f1828..00d3d70 100644
--- a/src/graphics_c2.c
+++ b/src/graphics_c2.c
@@ -32,7 +32,14 @@ void draw_c2_shape(c2_s_t s) {
}
void draw_c2_filled_shape(c2_s_t s) {
- draw_c2_shape(s);//heh. TODO: fixme
+ 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_filled_shape(ss);
}
void draw_c2_text(c2_t p,char *text) {
diff --git a/src/graphics_c3.c b/src/graphics_c3.c
index 5d18db3..b1d0bd7 100644
--- a/src/graphics_c3.c
+++ b/src/graphics_c3.c
@@ -482,7 +482,6 @@ void draw_screen() {
}
int graphics_init() {
-
global.zoom=30.0l;
global.camera.r.x.d=270;
global.camera.r.y.d=90;
diff --git a/src/graphics_cs_x11.c b/src/graphics_cs_x11.c
index ab80368..37faeb1 100644
--- a/src/graphics_cs_x11.c
+++ b/src/graphics_cs_x11.c
@@ -217,27 +217,27 @@ void x11_keypress_handler(int sym,int x,int y) {
selfcommand(line);
break;
case XK_r:
- snprintf(line,sizeof(line)-1,"%s rotate %d 0 0\n",global.user,global.camera.r.x.d+5);
+ snprintf(line,sizeof(line)-1,"%s rotate %d 0 0\n",global.user,global.camera.r.x.d+ROTATE_STEP);
selfcommand(line);
break;
case XK_y:
- snprintf(line,sizeof(line)-1,"%s rotate %d 0 0\n",global.user,global.camera.r.x.d-5);
+ snprintf(line,sizeof(line)-1,"%s rotate %d 0 0\n",global.user,global.camera.r.x.d-ROTATE_STEP);
selfcommand(line);
break;
case XK_q:
- snprintf(line,sizeof(line)-1,"%s rotate 0 %d 0\n",global.user,global.camera.r.y.d+5);
+ snprintf(line,sizeof(line)-1,"%s rotate 0 %d 0\n",global.user,global.camera.r.y.d+ROTATE_STEP);
selfcommand(line);
break;
case XK_e:
- snprintf(line,sizeof(line)-1,"%s rotate 0 %d 0\n",global.user,global.camera.r.y.d-5);
+ snprintf(line,sizeof(line)-1,"%s rotate 0 %d 0\n",global.user,global.camera.r.y.d-ROTATE_STEP);
selfcommand(line);
break;
case XK_u:
- snprintf(line,sizeof(line)-1,"%s rotate 0 0 %d\n",global.user,global.camera.r.z.d+5);
+ snprintf(line,sizeof(line)-1,"%s rotate 0 0 %d\n",global.user,global.camera.r.z.d+ROTATE_STEP);
selfcommand(line);
break;
case XK_o:
- snprintf(line,sizeof(line)-1,"%s rotate 0 0 %d\n",global.user,global.camera.r.z.d-5);
+ snprintf(line,sizeof(line)-1,"%s rotate 0 0 %d\n",global.user,global.camera.r.z.d-ROTATE_STEP);
selfcommand(line);
break;
case XK_p:
@@ -359,11 +359,10 @@ int graphics_sub_init() {
}
printf("done.\n");
*/
-
return 0;//we're fine
}
-int graphics_event_handler() {
+int graphics_event_handler() { //should calling draw_screen be in here?
int redraw=0;
XEvent e;
Window child,root;
@@ -419,5 +418,7 @@ int graphics_event_handler() {
break;
}
}
+ redraw=1;//meh.
+ if(redraw) { draw_screen(); }
return redraw;
}
diff --git a/src/hackvr.c b/src/hackvr.c
index c8e3899..d97417a 100644
--- a/src/hackvr.c
+++ b/src/hackvr.c
@@ -81,7 +81,7 @@ char **line_splitter(char *line,int *rlen) {
return a;
}
-int load_stdin() {
+int load_stdin() {//what is this returning?
struct c3_shape s;
// struct c3_line l;
char *command;
@@ -385,20 +385,10 @@ int main(int argc,char *argv[]) {
setbuf(stdout,0);
global.debug=DEBUG;
#ifdef GRAPHICAL
- int redraw;
graphics_init();
#endif
printf("# entering main loop\n");
for(;;) {
-#ifdef GRAPHICAL
- if((redraw=graphics_event_handler()) == -1) {
- return 0;
- }
-// printf("redraw=%d gra_global.force_redraw=%d global.headless=%d\n",redraw,gra_global.force_redraw,global.headless);
- //if((redraw || gra_global.force_redraw) && !global.headless) {
- // draw_screen();
- //}
-#endif
switch(load_stdin()) {
case -1:
return 0;
@@ -406,11 +396,11 @@ int main(int argc,char *argv[]) {
case 0:
break;
default:
-#ifdef GRAPHICAL
- redraw=1;
-#endif
break;
}
+#ifdef GRAPHICAL
+ graphics_event_handler();//this thing should call draw_screen when it needs to.
+#endif
}
return 0;
}
diff --git a/src/testit.sh b/src/testit.sh
index ceb7698..a96acb4 100755
--- a/src/testit.sh
+++ b/src/testit.sh
@@ -1,7 +1,8 @@
#!/bin/bash
-cat <(sort -R ../meshes/female_basemesh1_2.hackvr) \
- <(echo "woman move 10 0 -50") \
- <(sort -R ../meshes/female_basemesh1_2.hackvr | sed 's/woman/woman2/g') \
- <(echo "woman2 move -10 0 -200") \
- <(sort -R ../meshes/female_basemesh1_2.hackvr | sed 's/woman/woamn3/g') | ./slowcat 10000 | ./hackvr_opengl $USER
+#cat <(sort -R ../meshes/female_basemesh1_2.hackvr) \
+# <(echo "woman move 10 0 -50") \
+# <(sort -R ../meshes/female_basemesh1_2.hackvr | sed 's/woman/woman2/g') \
+# <(echo "woman2 move -10 0 -200") \
+# <(sort -R ../meshes/female_basemesh1_2.hackvr | sed 's/woman/woamn3/g') | ./slowcat 10000 | ./hackvr_opengl $USER
#../tools/obj2hackvr.pl woman ../meshes/female_basemesh1_2.obj | ./hackvr_opengl epoch
+../tools/obj2hackvr2.pl woman ../meshes/female_basemesh1_2.obj | ./hackvr_x11 epoch