-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsnakeblock.cpp
More file actions
42 lines (34 loc) · 1.05 KB
/
snakeblock.cpp
File metadata and controls
42 lines (34 loc) · 1.05 KB
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
#include "snakeblock.h"
using namespace std;
void SnakeBlock::paint(XInfo &xinfo) {
/*
unsigned int retWidth = 20;
unsigned int retHeight = 20;
int depth = DefaultDepth(xinfo.display, DefaultScreen(xinfo.display));
Pixmap taytay = XCreatePixmap(xinfo.display, xinfo.pixmap, retWidth, retHeight, depth);
int *hotx, *hoty;
XReadBitmapFile(xinfo.display, xinfo.pixmap, "taytay.xmb", &retWidth, &retHeight,
&taytay, hotx, hoty);
XCopyArea(xinfo.display, taytay, xinfo.pixmap, xinfo.gc[1], 0, 0, retWidth, retHeight, 0, 0);*/
XFillRectangle(xinfo.display, xinfo.pixmap, xinfo.gc[0], x, y, blockSize, blockSize);
}
void SnakeBlock::unPaint(XInfo &xinfo) {
XFillRectangle(xinfo.display, xinfo.pixmap, xinfo.gc[1], x, y, blockSize, blockSize);
}
int SnakeBlock::getX() {
return this->x;
}
int SnakeBlock::getY() {
return this->y;
}
void SnakeBlock::setX(int x) {
//cout << "X: " << x << endl
this->x = x;
}
void SnakeBlock::setY(int y) {
//cout << "Y: " << y << endl;
this->y = y;
}
SnakeBlock::SnakeBlock(int x, int y): x(x), y(y) {
this->blockSize = 15;
}