Mercurial > hg > Members > koba > t_dandy
diff Dandy.cc @ 33:39e643fc4f90
moving stage1.
author | koba <koba@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 05 Jan 2011 14:41:26 +0900 |
parents | 00c3272a801f |
children | 6626e451a09d |
line wrap: on
line diff
--- a/Dandy.cc Fri Dec 31 19:28:31 2010 +0900 +++ b/Dandy.cc Wed Jan 05 14:41:26 2011 +0900 @@ -530,33 +530,31 @@ 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) { SpriteTable *m = &sptable[number]; char *name = (char *) m->texture; -if (!name) { - printf("PutSprite %d unknown\n",number); - return; -} + if (!name) { + printf("PutSprite %d unknown\n",number); + 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のコンストラクタで、単位行列にしている)*/ @@ -574,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;