terom@185: #ifndef GRAPHICS_HH terom@185: #define GRAPHICS_HH terom@185: terom@233: #include "GraphicsPointer.hh" terom@185: terom@185: #include "GameState.hh" terom@233: #include "Input.hh" terom@205: #include "Timer.hh" terom@185: #include "Engine.hh" terom@266: #include "Config.hh" terom@185: terom@185: #include terom@185: #include terom@185: #include terom@185: terom@283: /** terom@283: * This handles drawing the GameState with an appropriate camera view each frame, loading fonts, and currently, terom@283: * handling the input from Input to GameState. terom@283: */ terom@233: class Graphics : public CL_DisplayWindow { terom@185: private: terom@185: Engine &engine; terom@185: GameState &state; terom@266: terom@266: PixelCoordinate resolution; terom@185: terom@185: CL_SlotContainer slots; terom@185: terom@205: Timer update_timer; terom@235: terom@235: Input input; terom@233: terom@233: // current GUI input state terom@233: GuiInput flags; terom@185: terom@233: // basic fonts terom@233: CL_Font simple_font; terom@233: terom@185: public: terom@389: Graphics (Engine &engine, GameState &state, PixelCoordinate resolution, bool fullscreen); terom@392: terom@392: /** terom@392: * Returns a CL_Font that can be used for drawing text terom@392: */ terom@233: CL_Font& getSimpleFont (void) { return simple_font; } terom@392: terom@392: /** terom@392: * Returns a vector of CL_DisplayModes that lists possible display modes to use for fullscreen mode. terom@392: */ terom@392: static const std::vector & getDisplayModes (void); terom@389: terom@392: /** terom@392: * Returns the "best" CL_DisplayMode to use for fullscreen mode. terom@392: * terom@392: * Currently, this just means the largest resolution. terom@392: */ terom@392: static const CL_DisplayMode getBestMode (void); terom@185: terom@185: private: terom@389: /** terom@389: * Reads current input events from Input and applies them, using LocalPlayer::handleInput and terom@389: * Graphics::handle_input. terom@389: */ terom@311: void check_input (void); terom@389: terom@389: /** terom@389: * Handles GuiInput flags read from Input. terom@389: */ terom@389: void handle_input (GuiInput flags); terom@389: terom@185: void do_redraw (void); terom@185: terom@205: void on_update (TimeMS tick_length); terom@185: nireco@315: void draw_player_info(CL_GraphicContext *gc, Player *p); terom@185: }; terom@185: terom@185: #endif /* GRAPHICS_HH */