-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathWindow.h
More file actions
44 lines (37 loc) · 1.13 KB
/
Window.h
File metadata and controls
44 lines (37 loc) · 1.13 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
43
44
#ifndef WINDOW_H
#define WINDOW_H
#if VIEW >= 1
#include <X11/Xlib.h>
#include <iostream>
#include <string>
#include <map>
class Xwindow {
Display *d;
Window w;
int s;
GC gc;
unsigned long colours[10];
unsigned long customColours[10];
Pixmap i;
std::map<char, Pixmap> WoW;
std::map<char, Pixmap> WoB;
std::map<char, Pixmap> BoW;
std::map<char, Pixmap> BoB;
void initializeSprites();
public:
Xwindow(int width=500, int height=500); // Constructor; displays the window.
~Xwindow(); // Destructor; destroys the window.
Xwindow(const Xwindow&) = delete;
Xwindow &operator=(const Xwindow&) = delete;
// Available colours.
enum {White=0, Black, Red, Green, Blue, Cyan, Yellow, Magenta, Orange, Brown};
enum {customWhite=0, customBlack};
// Draws a rectangle
void fillRectangle(int x, int y, int width, int height, int colour=Black);
void fillRectangleCustom(int x, int y, int width, int height, int colour=0);
// Draws a string
void drawString(int x, int y, std::string msg);
void drawPiece(char p, bool isWhitePiece, bool isWhiteSquare, int row, int col);
};
#endif
#endif