-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGrPainter.cpp
38 lines (33 loc) · 948 Bytes
/
GrPainter.cpp
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
#include "GrPainter.h"
void GrPainter::setGr(Graphics^ _g) {
g = _g;
}
void GrPainter::initIcons() {
names = { "Wall", "Moneta", "EmptyCell", "Monster", "Hero" };
for each (string name in names) {
String^ tmp = gcnew String((name + ".ico").c_str());
gcroot<Icon^> newIcon = gcnew Icon(tmp);
icons[name] = newIcon;
}
}
void GrPainter::paintCell(string fileName, int x, int y) {
int drawX = x * cellPixelSize;
int drawY = y * cellPixelSize;
rect = Drawing::Rectangle(drawX, drawY, cellPixelSize, cellPixelSize);
g->DrawIcon(icons[fileName], rect);
}
void GrPainter::Wall(int x, int y) {
paintCell("Wall", x, y);
}
void GrPainter::Moneta(int x, int y) {
paintCell("Moneta", x, y);
}
void GrPainter::EmptyCell(int x, int y) {
paintCell("EmptyCell", x, y);
}
void GrPainter::Monster(int x, int y) {
paintCell("Monster", x, y);
}
void GrPainter::Hero(int x, int y) {
paintCell("Hero", x, y);
}