-
Notifications
You must be signed in to change notification settings - Fork 7
/
Bitmap.h
69 lines (52 loc) · 1.24 KB
/
Bitmap.h
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#pragma once
#include <vector>
#include"fssimplewindow.h"
struct car {
int xpos;
int ypos;
int heading;
int velocity;
car() {
}
car(int xpos, int ypos, int heading, int velocity) {
this->xpos = xpos;
this->ypos = ypos;
this->heading = heading;
this->velocity = velocity;
}
};
using namespace std;
class CharBitmap
{
public:
int width, height;
int scale=2;
char *pixels;
char *trans_pixels;
//creates the bitmap
void create(int w, int h);
//sets the value of pixels in the map
void setPixel(int x, int y, unsigned char p);
//draws the bitmap on screen
void draw() const;
//draws the transformed map on screen
void drawTransform() const;
// saves the bitmap in a text file
void save(const string fName) const;
void cleanUp();
// loads the map from text file
void load(const string fName);
// draws the car on the screen
void DrawCar(int, int, int,string);
bool getPixel(int x, int y);
void setTransPixel(int x, int y, unsigned char p);
// draws the generated path on the screen
void DrawTrajectory(int, int, int ,int);
//checks if the map free
bool isFree(int x, int y);
bool isBlocked(int x, int y);
//checks if the transformed map is free
bool isTransFree(int x, int y);
CharBitmap();
~CharBitmap();
};