~ubuntu-branches/ubuntu/quantal/zaz/quantal

« back to all changes in this revision

Viewing changes to src/gameloop.h

  • Committer: Bazaar Package Importer
  • Author(s): Miriam Ruiz
  • Date: 2009-08-31 20:08:58 UTC
  • Revision ID: james.westby@ubuntu.com-20090831200858-54lcmcrna6dwk3wr
Tags: upstream-0.2.9+dfsg1
ImportĀ upstreamĀ versionĀ 0.2.9+dfsg1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Zaz
 
3
 * Copyright (C) Remigiusz Dybka 2009 <remigiusz.dybka@gmail.com>
 
4
 *
 
5
 Zaz is free software: you can redistribute it and/or modify it
 
6
 under the terms of the GNU General Public License as published by the
 
7
 Free Software Foundation, either version 3 of the License, or
 
8
 (at your option) any later version.
 
9
 
 
10
 Zaz is distributed in the hope that it will be useful, but
 
11
 WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
13
 See the GNU General Public License for more details.
 
14
 
 
15
 You should have received a copy of the GNU General Public License along
 
16
 with this program.  If not, see <http://www.gnu.org/licenses/>.
 
17
 */
 
18
 
 
19
#ifndef __GAMELOOP_H__
 
20
#define __GAMELOOP_H__
 
21
 
 
22
#include <vector>
 
23
#include <string>
 
24
#include <sstream>
 
25
 
 
26
#include "common.h"
 
27
#include "scene.h"
 
28
#include "game.h"
 
29
#include "menu.h"
 
30
#include "lineeditor.h"
 
31
 
 
32
class GameLoop : public Scenes::Scene
 
33
{
 
34
        friend void pauseMenuContinueHandler(void *ptr);
 
35
        friend void pauseMenuEndGameHandler(void *ptr);
 
36
        friend void nextLevelMenuNextLevelHandler(void *ptr);
 
37
        friend void nextLevelMenuViewReplayHandler(void *ptr);
 
38
        friend void nextLevelMenuExportVideoHandler(void *ptr);
 
39
        friend void gameOverMenuRestartHandler(void *ptr);
 
40
        friend void lifeLostMenuRetryLevelHandler(void *ptr);
 
41
 
 
42
        static const uint nLives = 3;
 
43
        static const uint screenShotTextureSize = 512;
 
44
 
 
45
        uint score;
 
46
        uint lastscore;
 
47
        uint currentLevelName;
 
48
        uint randomSeed;
 
49
 
 
50
        GLuint *gameTextures;
 
51
 
 
52
        vector<string>levelNames;
 
53
 
 
54
        double vwidth;
 
55
        double vleft;
 
56
        double vheight;
 
57
 
 
58
        bool showMenu;
 
59
        bool gameOver;
 
60
        bool showPauseMenu;
 
61
        bool continueGame;
 
62
        bool showLifeLostMenu;
 
63
        bool pwned;
 
64
        bool hiScore;
 
65
        Game *game;
 
66
        Level *level;
 
67
 
 
68
        GLuint logoTexture;
 
69
        GLuint screenShotTexture;
 
70
 
 
71
        double pwnedr;
 
72
 
 
73
        Menu pauseMenu;
 
74
        Menu nextLevelMenu;
 
75
        Menu gameOverMenu;
 
76
        Menu lifeLostMenu;
 
77
        LineEditor editor;
 
78
 
 
79
        stringstream tempRecording;
 
80
        string recording;
 
81
 
 
82
        uint pausedFrame;
 
83
 
 
84
        int livesLeft;
 
85
        int livesLeftInReplay;
 
86
 
 
87
        void CenterMsg(string msg, double y, FTFont *font);
 
88
 
 
89
    public:
 
90
        GameLoop(Scenes::Settings *settings, SDL_Surface *surf, GLuint *gameTextures, uint startLevel, uint fps = Scenes::DEFAULT_FPS);
 
91
        ~GameLoop();
 
92
        void GenScreenShotTexture();
 
93
        void GLSetup();
 
94
        void Render(ulong frame);
 
95
        void Logic(ulong frame);
 
96
        void ViewReplay();
 
97
        void ExportReplay();
 
98
        void NextLevel();
 
99
        void ClearGame();
 
100
        void CenterMsg();
 
101
};
 
102
 
 
103
void pauseMenuContinueHandler(void *ptr);
 
104
void pauseMenuEndGameHandler(void *ptr);
 
105
void nextLevelMenuNextLevelHandler(void *ptr);
 
106
void nextLevelMenuViewReplayHandler(void *ptr);
 
107
void nextLevelMenuExportVideoHandler(void *ptr);
 
108
void gameOverMenuRestartHandler(void *ptr);
 
109
void lifeLostMenuRetryLevelHandler(void *ptr);
 
110
 
 
111
#endif //__GAMELOOP_H__