Mercurial > hg > Members > kono > Cerium
annotate Renderer/Engine/viewer.h @ 589:f674ca0fb76d
add viwer.cc
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 30 Oct 2009 18:39:12 +0900 |
parents | a5fda4e51498 |
children | f42b303044f7 |
rev | line source |
---|---|
283 | 1 #ifndef INCLUDED_VIEWER |
2 #define INCLUDED_VIEWER | |
3 | |
4 #include <SDL.h> | |
5 | |
507 | 6 #include "viewer_types.h" |
7 #include "TaskManager.h" | |
8 #include "KeyStat.h" | |
510 | 9 #include "MainLoop.h" |
507 | 10 #include "Application.h" |
558 | 11 #include "SceneGraphRoot.h" |
507 | 12 |
562 | 13 class SceneGraphRoot; |
14 | |
511 | 15 class Application; |
283 | 16 |
511 | 17 class Viewer : public MainLoop { |
510 | 18 |
283 | 19 public: |
510 | 20 |
283 | 21 Viewer(int bpp, int width, int height, int spenum); |
22 | |
510 | 23 virtual ~Viewer() {} |
283 | 24 |
507 | 25 Application *app; |
26 | |
27 TaskManager *manager; | |
28 key_stat *keyPtr; | |
29 HTaskPtr draw_dummy; | |
30 | |
283 | 31 /* screen info */ |
32 int width; | |
33 int height; | |
34 int bpp; | |
35 | |
36 int spe_num; | |
37 | |
38 int rgb_size[3]; | |
39 Uint32 video_flags; | |
40 Uint32 *pixels; | |
41 | |
558 | 42 SceneGraphRoot *sgroot; |
43 | |
507 | 44 virtual void video_init(TaskManager *manager) = 0; |
283 | 45 void init(); |
46 | |
47 int get_ticks(); | |
48 bool quit_check(); | |
49 void quit(); | |
50 | |
51 virtual void swap_buffers(); | |
52 virtual void clean_pixels() {} | |
53 | |
509
8148c81d2660
Cerium Rendering Library
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
507
diff
changeset
|
54 virtual void run_init(TaskManager *manager, Application *app); |
507 | 55 virtual void run_loop(HTaskPtr task_next); |
56 virtual void run_draw(HTaskPtr task_next); | |
57 virtual void run_finish(); | |
58 virtual void run_move(HTaskPtr task_next); | |
59 virtual void run_collision(); | |
60 virtual void rendering(HTaskPtr task_next); | |
61 virtual void common_draw(HTaskPtr task_next); | |
62 virtual void common_rendering(HTaskPtr task_next); | |
63 | |
64 virtual void spe_rendering(HTaskPtr task_next); | |
65 virtual void spe_draw(HTaskPtr task_next); | |
66 //virtual void exchange_sgroot(TaskManager *manager); | |
67 | |
68 void getKey(); | |
69 void get_send_controll(); | |
511 | 70 |
558 | 71 // void createFromXMLfile(const char *file); |
72 // SceneGraph *createSceneGraph(int id); | |
73 // SceneGraph *createSceneGraph(); | |
74 // void setSceneData(SceneGraph *g); | |
512 | 75 void mainLoop(); |
511 | 76 |
558 | 77 void createFromXMLfile(const char *file) |
78 { | |
79 sgroot->createFromXMLfile(manager, file); | |
80 } | |
81 | |
82 SceneGraph * createSceneGraph(int id) | |
83 { | |
84 return sgroot->createSceneGraph(id); | |
85 } | |
86 | |
562 | 87 SceneGraph * createSceneGraph(const char *id) |
88 { | |
89 return sgroot->createSceneGraph(id); | |
90 } | |
91 | |
92 int getSgid(const char *id) | |
93 { | |
94 return sgroot->getSgid(id); | |
95 } | |
96 | |
558 | 97 SceneGraph * createSceneGraph() |
98 { | |
99 return sgroot->createSceneGraph(); | |
100 } | |
101 | |
102 void setSceneData(SceneGraph *g) | |
103 { | |
104 sgroot->setSceneData(g); | |
105 } | |
106 | |
589 | 107 int getLast() |
108 { | |
109 return sgroot->getLast(); | |
110 } | |
111 | |
112 | |
558 | 113 |
114 | |
507 | 115 private: |
116 HTaskPtr initLoop(); | |
117 void speLoop(); | |
118 | |
283 | 119 }; |
120 | |
507 | 121 #define default_sdl_flag SDL_INIT_TIMER | SDL_INIT_JOYSTICK |
122 | |
123 | |
283 | 124 #endif |
125 |