Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

scene.h

Go to the documentation of this file.
00001 
00008 #ifndef _SCENE_H
00009 #define _SCENE_H
00010 
00011 #include <ClanLib/core.h>
00012 #include <ClanLib/gl.h>
00013 #include <ClanLib/application.h>
00014 #include <ClanLib/display.h>
00015 
00016 #include <ode/ode.h>
00017 
00018 #include "main.h"
00019 #include "object.h"
00020 #include "camera.h"
00021 #include "gamestate.h"
00022 
00023 #include <map>
00024 using namespace std;
00025 
00026 // since everyone else needs these, need to keep the variables static and the
00027 // associated accessors global
00028 dWorldID get_world_id( void );
00029 dSpaceID get_space_id( void );
00030 
00031 class SceneManager {
00032 public:
00033     static SceneManager* get_scene() { return _scene; }
00034 
00035     SceneManager( CL_GraphicContext* gc, GameState* gamestate );
00036     ~SceneManager( void );
00037 
00038     int register_signals( void );
00039 
00046     void tick( double t );
00047 
00051     void render( void );
00052 
00056     void draw_axes( Object* obj );
00057 
00064     void select_object( int *pos );
00065 
00069     void deselect_object( void );
00070 
00071     Object *get_selected_object( void ) { return _selected_obj; }
00072 
00073     Camera *get_camera() { return &_camera; }
00074 
00075     // HACK, see gui's on_mouse_down
00076     void on_mouse_down( const CL_InputEvent& event );
00077 
00078     bool is_editor_mode() { return _editor_mode; }
00079 
00080     void begin_level( void );
00081     void finish_level( void );
00082 
00083 private:
00084 
00085     void generate_handlers( void );
00086     
00087     void on_mouse_move( const CL_InputEvent& event );
00088     void on_key_down( const CL_InputEvent& event );
00089     void on_key_up( const CL_InputEvent& event );
00090 
00091     static void near_callback( void* data, dGeomID o1, dGeomID o2 );
00092 
00093     void _check_selected_colliding();
00094 
00096     void _update_mouse_pos();
00097 
00098     static SceneManager *_scene;
00099 
00100     GameState* _gamestate;
00101 
00102     CL_Slot _slot_click;
00103     CL_Slot _slot_move;
00104     CL_Slot _slot_keydown;
00105     CL_Slot _slot_keyup;
00106 
00107     void gl_init( void );
00108   
00109     CL_OpenGLState* _glstate;
00110 
00111     Object *_selected_obj;      
00112 
00113     Camera _camera;             
00114 
00115     int _ignore_move_signal;    
00116 
00117     int _prev_mouse_pos[ 2 ];
00118     
00119     int _current_level_id;
00120 
00121     bool _editor_mode;
00122 
00123     bool _show_movables;    // show movable objects in blue
00124 
00125     bool _selected_colliding; // is the selected object colliding
00126 
00127     enum AxesType {
00128         DRAW_ON_NONE,       // don't draw axes
00129         DRAW_ON_SELECTED,   // draw only on selected object
00130         DRAW_ON_ALL,        // draw on all objects
00131         DRAW_NUM_TYPES     // number of types
00132     } _axes_type;
00133 };
00134 
00135 #endif // header guard

Generated on Sat Mar 13 15:00:10 2004 by doxygen 1.3.5