Mercurial > hg > Members > kono > Cerium
diff Renderer/Engine/SgChange.h @ 656:d0b8860c17f8
remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
author | hiroki@henri.cr.ie.u-ryukyu.ac.jp |
---|---|
date | Wed, 25 Nov 2009 21:56:14 +0900 |
parents | |
children | 9d1bcc07734b b7376415fa5f |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Renderer/Engine/SgChange.h Wed Nov 25 21:56:14 2009 +0900 @@ -0,0 +1,106 @@ +#ifndef INCLUDED_SG_CHANGE +#define INCLUDED_SG_CHANGE + +#include <SDL.h> + +#include "viewer_types.h" +#include "TaskManager.h" +#include "KeyStat.h" +#include "MainLoop.h" +#include "Application.h" +#include "SceneGraphRoot.h" + +class SceneGraphRoot; + +class Application; + +class SgChange : public MainLoop { + +public: + + SgChange(int bpp, int width, int height, int spenum); + + virtual ~SgChange() {} + + Application *app; + + TaskManager *manager; + key_stat *keyPtr; + HTaskPtr draw_dummy; + + SceneGraphRoot *sgroot_A; + SceneGraphRoot *sgroot_B; + + /* screen info */ + int width; + int height; + int bpp; + + int spe_num; + + int rgb_size[3]; + Uint32 video_flags; + Uint32 *pixels; + + void init(); + + int get_ticks(); + bool quit_check(); + void quit(); + + virtual void swap_buffers(); + virtual void clean_pixels() {} + + virtual void run_init(TaskManager *manager, Application *app); + virtual void run_loop(HTaskPtr task_next); + virtual void run_finish(); + virtual void exchange_sgroot(); + void mainLoop(); + + void createFromXMLfile(const char *file) + { + sgroot_A->createFromXMLfile(manager, file); + } + + SceneGraph * createSceneGraph(int id) + { + return sgroot_A->createSceneGraph(id); + } + + SceneGraph * createSceneGraph(const char *id) + { + return sgroot_A->createSceneGraph(id); + } + + int getSgid(const char *id) + { + return sgroot_A->getSgid(id); + } + + SceneGraph * createSceneGraph() + { + return sgroot_A->createSceneGraph(); + } + + void setSceneData(SceneGraph *g) + { + sgroot_A->setSceneData(g); + } + + int getLast() + { + return sgroot_A->getLast(); + } + + + + +private: + HTaskPtr initLoop(); +}; + +#define default_sdl_flag SDL_INIT_TIMER | SDL_INIT_JOYSTICK + + +#endif +