source: trunk/monsterz/piece.h @ 737

Last change on this file since 737 was 737, checked in by sam, 10 years ago

monsterz: some refactoring in the Piece and Board classes.

File size: 1.3 KB
Line 
1//
2// Monsterz
3//
4// Copyright: (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
5//   This program is free software; you can redistribute it and/or
6//   modify it under the terms of the Do What The Fuck You Want To
7//   Public License, Version 2, as published by Sam Hocevar. See
8//   http://sam.zoy.org/projects/COPYING.WTFPL for more details.
9//
10
11//
12// The Piece class
13// ---------------
14//
15
16#if !defined __MONSTERZ_PIECE_H__
17#define __MONSTERZ_PIECE_H__
18
19#include "core.h"
20
21class PieceData;
22
23class Piece : public WorldEntity
24{
25public:
26    typedef enum
27    {
28        PIECE_HUNT,
29        PIECE_FUSION,
30    }
31    piece_t;
32
33    Piece(piece_t, Emitter *emitter, vec2i cell, int id);
34    virtual ~Piece();
35
36    virtual char const *GetName();
37
38    void SetCell(vec2i cell);
39    vec2i GetCell() const;
40    void SetPos(vec2i pos);
41    vec2i GetPos() const;
42
43    vec2i GetOffset() const;
44    vec2i GetSize() const;
45    vec2i GetShift() const;
46
47    void SetAbove(Piece *below);
48    Piece *GetAbove() const;
49    void SetBelow(Piece *below);
50    Piece *GetBelow() const;
51
52    int IsDead() const;
53
54    int Pop();
55    int Grab(vec2i dir);
56    int Ungrab(vec2i pos);
57    int Move(vec2i pos);
58
59protected:
60    virtual void TickGame(float deltams);
61    virtual void TickDraw(float deltams);
62
63private:
64    PieceData *data;
65};
66
67#endif // __MONSTERZ_PIECE_H__
68
Note: See TracBrowser for help on using the repository browser.