~ubuntu-branches/ubuntu/hardy/codeblocks/hardy-backports

« back to all changes in this revision

Viewing changes to src/plugins/contrib/byogames/byocbtris.h

  • Committer: Bazaar Package Importer
  • Author(s): Michael Casadevall
  • Date: 2008-07-17 04:39:23 UTC
  • Revision ID: james.westby@ubuntu.com-20080717043923-gmsy5cwkdjswghkm
Tags: upstream-8.02
ImportĀ upstreamĀ versionĀ 8.02

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef BYOCBTRIS_H
 
2
#define BYOCBTRIS_H
 
3
 
 
4
#include <wx/font.h>
 
5
#include <wx/timer.h>
 
6
#include "byogamebase.h"
 
7
 
 
8
class wxPaintEvent;
 
9
class wxTimerEvent;
 
10
class wxEraseEvent;
 
11
class wxKeyEvent;
 
12
 
 
13
class byoCBTris: public byoGameBase
 
14
{
 
15
        public:
 
16
 
 
17
                byoCBTris(wxWindow* parent,const wxString& GameName);
 
18
 
 
19
        private:
 
20
 
 
21
        static const int bricksHoriz  = 15;
 
22
        static const int bricksMargin = 5;
 
23
        static const int bricksVert   = 30;
 
24
 
 
25
        typedef int ChunkConfig[16];
 
26
 
 
27
        void OnPaint(wxPaintEvent& event);
 
28
        void OnKeyDown(wxKeyEvent& event);
 
29
        void OnKeyUp(wxKeyEvent& event);
 
30
        void OnSpeedTimer(wxTimerEvent& event);
 
31
        void OnLeftRightTimer(wxTimerEvent& event);
 
32
        void OnUpTimer(wxTimerEvent& event);
 
33
        void OnDownTimer(wxTimerEvent& event);
 
34
        void OnEraseBack(wxEraseEvent& event);
 
35
        void OnKillFocus(wxFocusEvent& event);
 
36
 
 
37
        void DrawBrickField(wxDC* DC);
 
38
        void DrawCurrentChunk(wxDC* DC);
 
39
        void DrawNextChunk(wxDC* DC);
 
40
 
 
41
        void RandomizeChunk(ChunkConfig& chunk,int color=-1);
 
42
        void RotateChunkLeft(const ChunkConfig& chunk,ChunkConfig& newChunk);
 
43
        void RotateChunkRight(const ChunkConfig& chunk,ChunkConfig& newChunk);
 
44
        void AlignChunk(ChunkConfig& chunk);
 
45
        bool CheckChunkColision(const ChunkConfig& chunk,int posX,int posY);
 
46
        void SetSpeed();
 
47
        bool ChunkDown();
 
48
        void RemoveFullLines();
 
49
        bool GenerateNewChunk();
 
50
        void GameOver();
 
51
        void UpdateChunkPosLeftRight();
 
52
        void UpdateChunkPosUp();
 
53
        void UpdateChunkPosDown();
 
54
        void DrawStats(wxDC* DC);
 
55
        void AddRemovedLines(int removed);
 
56
        void StartTimerNow(wxTimer& timer);
 
57
        int GetScoreScale() const;
 
58
 
 
59
        wxTimer SpeedTimer;
 
60
        wxTimer LeftRightTimer;
 
61
        wxTimer UpTimer;
 
62
        wxTimer DownTimer;
 
63
 
 
64
        int m_Level;
 
65
        int m_Score;
 
66
 
 
67
        bool m_IsLeft;
 
68
        bool m_IsRight;
 
69
        bool m_IsUp;
 
70
        bool m_IsDown;
 
71
        int m_TotalRemovedLines;
 
72
 
 
73
        bool m_Guidelines;
 
74
 
 
75
        // Font used inside game
 
76
        wxFont m_Font;
 
77
 
 
78
        int m_Content[bricksHoriz][bricksVert];
 
79
 
 
80
        ChunkConfig m_CurrentChunk;
 
81
        int m_ChunkPosX;
 
82
        int m_ChunkPosY;
 
83
        ChunkConfig m_NextChunk;
 
84
 
 
85
                DECLARE_EVENT_TABLE()
 
86
};
 
87
 
 
88
#endif