src/Graphics/Graphics.hh
author Tero Marttila <terom@fixme.fi>
Thu, 22 Jan 2009 02:47:53 +0200
branchnew_graphics
changeset 419 9cd4e54693b6
parent 414 cede5463b845
child 423 947ab54de4b7
permissions -rw-r--r--
fix Engine <-> NetworkClient interaction
#ifndef GRAPHICS_GRAPHICS_HH
#define GRAPHICS_GRAPHICS_HH

namespace graphics
{

class Graphics;

}

#include "../Engine.hh"
#include "Display.hh"
#include "FontManager.hh"
#include "Input.hh"
#include "GameView.hh"

namespace graphics
{

/**
 * Core class that ties everything else together
 */
class Graphics {
public:
    /**
     * Our reference to the engine
     */
    Engine &engine;

    /**
     * Our primary display
     */
    Display display;

    /**
     * For loading fonts
     */
    FontManager fonts;

    /**
     * Input handling
     *
     * XXX: move Input class into this?
     */
    Input input;
   
    /**
     * Initialize the graphics subsystem
     */
    Graphics (Engine &engine, CL_ResourceManager &resources, const DisplayConfig &display_config);

    /**
     * Display a new GameView
     */
    GameView* displayGameView (GameState &state, LocalPlayer *player) {
        // allocate a new GameView
        GameView *view = new GameView(state, player);

        // assign it to the display
        display.setView(view);
        
        // return it
        return view;
    }

};

/**
 * The global Graphics instance
 */
extern Graphics *graphics;

}

#endif