src/Graphics/Graphics.hh
author Tero Marttila <terom@fixme.fi>
Wed, 21 Jan 2009 23:07:22 +0200
branchnew_graphics
changeset 412 721c60072091
parent 411 106aaf6eadfe
child 413 7dddc163489a
permissions -rw-r--r--
new graphics code compiles... no, it doesn't work yet
411
106aaf6eadfe there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     1
#ifndef GRAPHICS_GRAPHICS_HH
106aaf6eadfe there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     2
#define GRAPHICS_GRAPHICS_HH
106aaf6eadfe there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     3
412
721c60072091 new graphics code compiles... no, it doesn't work yet
Tero Marttila <terom@fixme.fi>
parents: 411
diff changeset
     4
namespace graphics
721c60072091 new graphics code compiles... no, it doesn't work yet
Tero Marttila <terom@fixme.fi>
parents: 411
diff changeset
     5
{
721c60072091 new graphics code compiles... no, it doesn't work yet
Tero Marttila <terom@fixme.fi>
parents: 411
diff changeset
     6
721c60072091 new graphics code compiles... no, it doesn't work yet
Tero Marttila <terom@fixme.fi>
parents: 411
diff changeset
     7
class Graphics;
721c60072091 new graphics code compiles... no, it doesn't work yet
Tero Marttila <terom@fixme.fi>
parents: 411
diff changeset
     8
721c60072091 new graphics code compiles... no, it doesn't work yet
Tero Marttila <terom@fixme.fi>
parents: 411
diff changeset
     9
}
721c60072091 new graphics code compiles... no, it doesn't work yet
Tero Marttila <terom@fixme.fi>
parents: 411
diff changeset
    10
411
106aaf6eadfe there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    11
#include "../Engine.hh"
106aaf6eadfe there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    12
#include "Display.hh"
106aaf6eadfe there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    13
#include "FontManager.hh"
106aaf6eadfe there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    14
#include "GameView.hh"
106aaf6eadfe there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    15
106aaf6eadfe there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    16
namespace graphics
106aaf6eadfe there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    17
{
106aaf6eadfe there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    18
106aaf6eadfe there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    19
/**
106aaf6eadfe there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    20
 * Core class that ties everything else together
106aaf6eadfe there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    21
 */
106aaf6eadfe there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    22
class Graphics {
106aaf6eadfe there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    23
public:
106aaf6eadfe there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    24
    /**
106aaf6eadfe there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    25
     * Our reference to the engine
106aaf6eadfe there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    26
     */
106aaf6eadfe there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    27
    Engine &engine;
106aaf6eadfe there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    28
106aaf6eadfe there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    29
    /**
412
721c60072091 new graphics code compiles... no, it doesn't work yet
Tero Marttila <terom@fixme.fi>
parents: 411
diff changeset
    30
     * Our primary display
721c60072091 new graphics code compiles... no, it doesn't work yet
Tero Marttila <terom@fixme.fi>
parents: 411
diff changeset
    31
     */
721c60072091 new graphics code compiles... no, it doesn't work yet
Tero Marttila <terom@fixme.fi>
parents: 411
diff changeset
    32
    Display display;
721c60072091 new graphics code compiles... no, it doesn't work yet
Tero Marttila <terom@fixme.fi>
parents: 411
diff changeset
    33
721c60072091 new graphics code compiles... no, it doesn't work yet
Tero Marttila <terom@fixme.fi>
parents: 411
diff changeset
    34
    /**
411
106aaf6eadfe there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    35
     * For loading fonts
106aaf6eadfe there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    36
     */
106aaf6eadfe there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    37
    FontManager fonts;
412
721c60072091 new graphics code compiles... no, it doesn't work yet
Tero Marttila <terom@fixme.fi>
parents: 411
diff changeset
    38
   
411
106aaf6eadfe there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    39
    /**
106aaf6eadfe there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    40
     * Initialize the graphics subsystem
106aaf6eadfe there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    41
     */
106aaf6eadfe there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    42
    Graphics (Engine &engine, CL_ResourceManager &resources, const DisplayConfig &display_config);
106aaf6eadfe there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    43
106aaf6eadfe there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    44
    /**
106aaf6eadfe there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    45
     * Display a new GameView
106aaf6eadfe there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    46
     */
106aaf6eadfe there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    47
    void displayGameView (GameState &state, LocalPlayer *player) {
106aaf6eadfe there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    48
        // allocate a new GameView
106aaf6eadfe there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    49
        GameView *view = new GameView(state, player);
106aaf6eadfe there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    50
106aaf6eadfe there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    51
        // assign it to the display
106aaf6eadfe there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    52
        display.setTarget(view);
106aaf6eadfe there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    53
    }
106aaf6eadfe there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    54
106aaf6eadfe there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    55
};
106aaf6eadfe there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    56
106aaf6eadfe there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    57
/**
106aaf6eadfe there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    58
 * The global Graphics instance
106aaf6eadfe there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    59
 */
106aaf6eadfe there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    60
extern Graphics *graphics;
106aaf6eadfe there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    61
106aaf6eadfe there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    62
}
106aaf6eadfe there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    63
106aaf6eadfe there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    64
#endif