# HG changeset patch # User aaa # Date 1246274922 -32400 # Node ID c3a6cd4fa8783a456cf96dce2900713930feda35 # Parent 15a89131907ca657e08b8abee468cb88f1f5db78 add param gid [SceneGraph.h], func [SceneGraphIterator] diff -r 15a89131907c -r c3a6cd4fa878 TaskManager/Test/test_render/SceneGraph.cpp --- a/TaskManager/Test/test_render/SceneGraph.cpp Mon Jun 29 16:30:20 2009 +0900 +++ b/TaskManager/Test/test_render/SceneGraph.cpp Mon Jun 29 20:28:42 2009 +0900 @@ -185,6 +185,7 @@ flag_remove = 0; flag_drawable = 1; sgid = -1; + gid = -1; frame = 0; } diff -r 15a89131907c -r c3a6cd4fa878 TaskManager/Test/test_render/SceneGraph.h --- a/TaskManager/Test/test_render/SceneGraph.h Mon Jun 29 16:30:20 2009 +0900 +++ b/TaskManager/Test/test_render/SceneGraph.h Mon Jun 29 20:28:42 2009 +0900 @@ -51,6 +51,9 @@ // anime frame num int frame; + // Group ID + int gid; + // 関数ポインタ move_func move; collision_func collision; diff -r 15a89131907c -r c3a6cd4fa878 TaskManager/Test/test_render/SceneGraphIterator.cpp --- a/TaskManager/Test/test_render/SceneGraphIterator.cpp Mon Jun 29 16:30:20 2009 +0900 +++ b/TaskManager/Test/test_render/SceneGraphIterator.cpp Mon Jun 29 20:28:42 2009 +0900 @@ -39,6 +39,26 @@ return 0; } +/*! + 指定したグループが以降存在するか + + @param id 検索したい Group の ID + @retval 1 next がある + @retval 0 next がない + */ +int +SceneGraphIterator::hasNextGroup(int id) +{ + SceneGraphPtr p; + for (p = cur->next; p; p = p->next) { + if (p->gid == id) { + return 1; + } + } + + return 0; +} + /** * iterator を次に進める */ @@ -68,6 +88,25 @@ cur = p; } +/*! + iterator を指定した Group ID を持つ SceneGraph まで進める + + @param id 検索したい SceneGraph の Group ID + */ +void +SceneGraphIterator::nextGroup(int id) +{ + SceneGraphPtr p; + + for (p = cur->next; p; p = p->next) { + if (p->gid == id) { + break; + } + } + + cur = p; +} + /** * 参照中の SceneGraph を削除する */ diff -r 15a89131907c -r c3a6cd4fa878 TaskManager/Test/test_render/SceneGraphIterator.h --- a/TaskManager/Test/test_render/SceneGraphIterator.h Mon Jun 29 16:30:20 2009 +0900 +++ b/TaskManager/Test/test_render/SceneGraphIterator.h Mon Jun 29 20:28:42 2009 +0900 @@ -16,8 +16,10 @@ void set(SceneGraphPtr list); int hasNext(void); int hasNext(int id); + int hasNextGroup(int id); void next(void); void next(int id); + void nextGroup(int id); void remove(void); SceneGraphPtr get(void); };