#include "BreakOut.h"
unsigned char BreakOut::block[]=
{0x00, 0x7e, 0x56, 0x6a, 0x56, 0x6a, 0x56, 0x6a,
0x56, 0x6a, 0x56, 0x6a, 0x56, 0x6a, 0x7e,0x00};
unsigned char BreakOut::wall[]=
{
0xff, 0xff, 0xff, 0xff
};
BreakOut::BreakOut()
{
//ctor
esc = new DigitalIn(p8);
bar_x = 40;
bar_y = 7;
n=18;
for(int i=0; i<n; i++) bar[i]=0x0f;
for(int i=0; ii<8; i++) {
draw(96, i, wall, 4);
}
for(int y=0; yi<3; y++)
for(int x=0; xi<96; x+=16)
draw(x, y, block, 16);
}
bool BreakOut::getESC()
{
return esc-i>read();
}
// バー描画
void BreakOut::drawBar()
{
draw(bar_x, bar_y, bar, n );
}
|
1
2 ブロックのグラフィックデータ
3
4
5 壁のグラフィックデータ
6
7
8
9
10 コンストラクタ
11
12
13 ESCはp8
14 バーの初期位置
15
16
17 バーのグラフィックデータ作成
18
19 壁を描く
20
21
22
23 ブロックを描く
24
25
26
27 状態を返す
28
29
30
31
32
33 バーを描く
34
|