changeset 29:d2e627af7f61

fix.
author koba <koba@cr.ie.u-ryukyu.ac.jp>
date Tue, 28 Dec 2010 16:22:22 +0900
parents 813f5461daab
children 427e1aac0bd7
files TaskDandy.cc
diffstat 1 files changed, 10 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/TaskDandy.cc	Tue Dec 28 15:50:04 2010 +0900
+++ b/TaskDandy.cc	Tue Dec 28 16:22:22 2010 +0900
@@ -531,16 +531,13 @@
     m->color = (color & 32);
     m->mx = w / 2;
     m->my = h / 2;
-    m->tex_w = power_of_two(sptable[number].w);
-    m->tex_h = power_of_two(sptable[number].h);
-    //texMinX[number] = 0.0f;
-    //texMinY[number] = 0.0f;
-    //texMaxX[number] = (GLfloat)sptable[number].w / sptable[number].tex_w;
-    //texMaxY[number] = (GLfloat)sptable[number].h / sptable[number].tex_h;  
-    // printf("texMaxX = %f, w = %d, tex_w = %d\n", texMaxX[number], sptable[number].w, sptable[number].tex_w);
+    m->tex_w = power_of_two(m->w);
+    m->tex_h = power_of_two(m->h);
+
     m->texture = (int *)name;
+}
 
-}
+static float my_scale = 5;
 
 void
 PutSprite(int zorder, short x, short y, int number)
@@ -552,12 +549,12 @@
 	return;
     }
     SceneGraphPtr object = sgroot->createSceneGraph(name);
-    object->xyz[0] = x;
-    object->xyz[1] = y;
+    object->xyz[0] = x - object->c_xyz[0]*my_scale;
+    object->xyz[1] = y - object->c_xyz[1]*my_scale;
     object->xyz[2] = 0;
     root->addChild(object);
     
-    float scale[] = {5,5,1};
+    float scale[] = {my_scale,my_scale,1};
     /*親の回転、座標から、子の回転、座標を算出*/
     get_matrix(object->matrix, object->angle, object->xyz, scale, root->matrix);
     /*法線用の行列。Cameraの行列を抜いている(Cameraのコンストラクタで、単位行列にしている)*/
@@ -575,8 +572,8 @@
 	return;
     }
     SceneGraphPtr object = sgroot->createSceneGraph(name);
-    object->xyz[0] = x;
-    object->xyz[1] = y;
+    object->xyz[0] = x  - object->c_xyz[0]*my_scale - m->w*my_scale;
+    object->xyz[1] = y  - object->c_xyz[0]*my_scale - m->w*my_scale;
     object->xyz[2] = 0;
     object->c_xyz[0] = m->mx;
     object->c_xyz[1] = m->my;