File: CTetrisGame.h

package info (click to toggle)
blocks-of-the-undead 1.0-7
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, sid, trixie
  • size: 4,084 kB
  • sloc: cpp: 6,224; sh: 3,356; makefile: 171
file content (52 lines) | stat: -rw-r--r-- 1,286 bytes parent folder | download | duplicates (2)
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
#ifndef _CTETRISGAME_
#define _CTETRISGAME_

#include "oodle.h"
#include "CPlayingField.h"
#include "CTetrisTheme.h"
#include "CBlockSet.h"

class CTetrisGame : public CSDLGame
{
public:
	CTetrisGame(int screenX, int screenY, int bitDepth, bool fullscreen, CTetrisTheme *theme, const list<CVector> &fieldOffsets);
	CTetrisGame(int screenX, int screenY, int bitDepth, bool fullscreen, const string &title = "");
	~CTetrisGame();

	void setTheme(CTetrisTheme* t, const list<CVector> &fieldOffsets);
	CSprite* addSprite(CVector velocity, CVector pos, const string &filename, CImgLoader::GraphicFileType fileType);
	CSprite* addSprite(CSprite* sprite);
	//CBlock* addBlock(
	enum State
	{
		Splash,
		Loading,
		Win,
		SinglePlayer,
		SinglePlayerPuzzle,
		TwoPlayerHumanVsHuman,
		TwoPlayerHumanVsComp
	};

protected:
	bool gameLoop(bool infinite = true);

private:
	void animateSprites();
	void handleEvent(const SDL_Event &e);
	void handleKeypress(const SDL_KeyboardEvent &e);
	void handleMouseMotion(const SDL_MouseMotionEvent &e);
	void handleMouseButton(const SDL_MouseButtonEvent &e);
	void startGame();

	vector<CPlayingField*> fields;
	list<CSprite*> sprites;
	CTetrisTheme* theme;
//	/CSoundSystem sound;
	CSurface *splash;
	State state; 
	bool done;
	CVector mouseloc;
};

#endif