annotate Renderer/Test/panel.cc @ 1767:1a68c05eeadf draft

minor fix
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sat, 23 Nov 2013 01:28:59 +0900
parents 91e2c96be77b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 #include "SceneGraphRoot.h"
557
764772be1e3c fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 540
diff changeset
2 #include "panel.h"
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
3
653
7a311860a76e remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 563
diff changeset
4 static void panel_move(SceneGraphPtr node, void *sgroot_, int screen_w, int screen_h);
7a311860a76e remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 563
diff changeset
5 static void panel_collision(SceneGraphPtr node, void *sgroot_, int screen_w, int screen_h,
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 SceneGraphPtr tree);
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
7
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 static void
653
7a311860a76e remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 563
diff changeset
9 panel_move(SceneGraphPtr node, void *sgroot_, int screen_w, int screen_h)
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
12
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 static void
653
7a311860a76e remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 563
diff changeset
14 panel_collision(SceneGraphPtr node, void *sgroot_, int screen_w, int screen_h,
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 SceneGraphPtr tree)
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
18
557
764772be1e3c fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 540
diff changeset
19 int bg = 0;
764772be1e3c fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 540
diff changeset
20
764772be1e3c fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 540
diff changeset
21 MainLoopPtr
764772be1e3c fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 540
diff changeset
22 panel::init(Viewer *sgroot, int screen_w, int screen_h)
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 SceneGraphPtr panel;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
25
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 if (bg == 2) {
563
338ad9c856fc all exmple on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 557
diff changeset
27 sgroot->createFromXMLfile( "xml_file/panel_512.xml");
338ad9c856fc all exmple on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 557
diff changeset
28 panel = sgroot->createSceneGraph("PANEL_512");
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
29 } else if (bg == 3) {
563
338ad9c856fc all exmple on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 557
diff changeset
30 sgroot->createFromXMLfile( "xml_file/panel_1024.xml");
338ad9c856fc all exmple on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 557
diff changeset
31 panel = sgroot->createSceneGraph("PANEL_1024");
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
32 } else {
563
338ad9c856fc all exmple on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 557
diff changeset
33 sgroot->createFromXMLfile( "xml_file/panel_2048.xml");
338ad9c856fc all exmple on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 557
diff changeset
34 panel = sgroot->createSceneGraph("PANEL_2048");
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
35 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
36
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
37 panel->set_move_collision(panel_move, panel_collision);
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
38 panel->xyz[2] = 30.0f;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
39 sgroot->setSceneData(panel);
557
764772be1e3c fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 540
diff changeset
40 return sgroot;
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
41 }
557
764772be1e3c fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 540
diff changeset
42
764772be1e3c fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 540
diff changeset
43 extern Application *
764772be1e3c fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 540
diff changeset
44 application() {
764772be1e3c fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 540
diff changeset
45 return new panel();
764772be1e3c fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 540
diff changeset
46 }
764772be1e3c fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 540
diff changeset
47
764772be1e3c fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 540
diff changeset
48 const char *usr_help_str = "Usage: ./test_nogl -sg [123] [OPTION]\n";
764772be1e3c fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 540
diff changeset
49
764772be1e3c fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 540
diff changeset
50 extern int init(TaskManager *manager, int argc, char *argv[]);
764772be1e3c fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 540
diff changeset
51 extern void task_initialize();
764772be1e3c fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 540
diff changeset
52 static void TMend(TaskManager *manager);
764772be1e3c fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 540
diff changeset
53
764772be1e3c fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 540
diff changeset
54 int
764772be1e3c fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 540
diff changeset
55 TMmain(TaskManager *manager, int argc, char *argv[])
764772be1e3c fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 540
diff changeset
56 {
764772be1e3c fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 540
diff changeset
57 task_initialize();
764772be1e3c fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 540
diff changeset
58 manager->set_TMend(TMend);
764772be1e3c fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 540
diff changeset
59 for(int i=0;i<argc;i++) {
563
338ad9c856fc all exmple on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 557
diff changeset
60 if (strcmp(argv[i],"-sg")==0) {
557
764772be1e3c fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 540
diff changeset
61 bg = atoi(argv[i+1]);
764772be1e3c fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 540
diff changeset
62 }
764772be1e3c fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 540
diff changeset
63 }
764772be1e3c fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 540
diff changeset
64 return init(manager, argc, argv);
764772be1e3c fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 540
diff changeset
65
764772be1e3c fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 540
diff changeset
66 }
764772be1e3c fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 540
diff changeset
67
764772be1e3c fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 540
diff changeset
68 void
764772be1e3c fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 540
diff changeset
69 TMend(TaskManager *manager)
764772be1e3c fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 540
diff changeset
70 {
764772be1e3c fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 540
diff changeset
71 printf("test_nogl end\n");
764772be1e3c fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 540
diff changeset
72 }
764772be1e3c fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 540
diff changeset
73
764772be1e3c fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 540
diff changeset
74 /* end */
764772be1e3c fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 540
diff changeset
75