Mercurial > hg > Members > kono > Cerium
view TaskManager/Test/test_render/universe.cpp @ 174:559b48b69b76
getScale()、getTapestry から、span->length に適切なテクスチャの選択に成功
author | gongo@localhost.localdomain |
---|---|
date | Fri, 12 Dec 2008 12:23:20 +0900 |
parents | 246881f0634b |
children | 8143bbade40d |
line wrap: on
line source
#include <stdlib.h> #include "SceneGraph.h" #include "xml_file/universe.h" static void cube_collision(SceneGraphPtr node, int screen_w, int screen_h, SceneGraphPtr tree) { } static void cube_move2(SceneGraphPtr node, int screen_w, int screen_h) { node->angle[1] += 1.0f; if (node->angle[1] > 360.0f) { node->angle[1] = 0.0f; } node->xyz[0] += node->stack_xyz[0]; if ((int)node->xyz[0] > screen_w || (int)node->xyz[0] < 0) { node->stack_xyz[0] = -node->stack_xyz[0]; } node->xyz[1] += node->stack_xyz[1]; if ((int)node->xyz[1] > screen_h || (int)node->xyz[1] < 0) { node->stack_xyz[1] = -node->stack_xyz[1]; } } static void cube_move(SceneGraphPtr node, int screen_w, int screen_h) { node->angle[1] += 1.0f; if (node->angle[1] > 360.0f) { node->angle[1] = 0.0f; } node->xyz[0] += node->stack_xyz[0]; if ((int)node->xyz[0] > screen_w || (int)node->xyz[0] < 0) { node->stack_xyz[0] = -node->stack_xyz[0]; } node->xyz[1] += node->stack_xyz[1]; if ((int)node->xyz[1] > screen_h || (int)node->xyz[1] < 0) { node->stack_xyz[1] = -node->stack_xyz[1]; } } static void moon_move(SceneGraphPtr node, int screen_w, int screen_h) { node->angle[1] += 1.0f; if (node->angle[0] > 360.0f) { node->angle[0] = 0.0f; } } void universe_init(void) { SceneGraph::createFromXMLfile("xml_file/universe.xml"); Earth->set_move_collision(cube_move, cube_collision); Earth->stack_xyz[0] = 3.0f; Earth->stack_xyz[1] = 3.0f; Moon->set_move_collision(moon_move, cube_collision); }