File: menumanager.h

package info (click to toggle)
qonk 0.3.1-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 2,076 kB
  • ctags: 2,026
  • sloc: cpp: 14,978; sh: 3,464; makefile: 200
file content (80 lines) | stat: -rw-r--r-- 1,641 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
// menumanager.h
//
// (c) Robert Schuster, 2007
//
// Licensed under GNU GPL version 2 or, at your option, any later version.

#ifndef MENUMANAGER_H
#define MENUMANAGER_H

class Main;

class ControlOptions;
class VideoOptions;
class GameOptions;

class MenuSystem;

/**
 * MenuManager forms the facade for interacting with the game's menus.
 * 
 * It speaks to MenuSystem and builds up the menus and their menu entries. However
 * it does not touch any of the guichan internal.
 *
 * This is done to keep the guichan integration low and give the menu
 * construction a dedicated place that is not polluted with low-level stuff.
 *
 */
class MenuManager
{
  Main &main;

  ControlOptions *controlOptions;
  VideoOptions *videoOptions;
  GameOptions *gameOptions;

  MenuSystem *menuSystem;

  public:
    MenuManager(Main &);

    ~MenuManager();

    void showSinglePlayerMenu();
    void show();
    void hide();
    bool isVisible() const;

    void resize();

    void render();

    bool update();

    /** Indicate that input sensing should be finished.
     * 
     * If a new input has been determined and the operation should
     * end as succeeded the argument's value is <code>true</code>.
     * 
     * If the operation should end as cancelled the argument's value
     * is <code>false</code>.
     * */
    void senseFinished(bool);

    GameOptions &getGameOptions() const { return *gameOptions; };

    VideoOptions &getVideoOptions() const { return *videoOptions; };
};

class QuitAction : public MenuAction
{
  Main &main;

  public:
    QuitAction(Main &newMain)
      : main(newMain) { }

    void invoke();
};

#endif