forked from Nimdoc/pathfinder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathray_window.h
58 lines (42 loc) · 951 Bytes
/
ray_window.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
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xos.h>
#include <X11/keysym.h>
#include <stdlib.h>
#include <string>
#include <iostream>
#include "wall_object.h"
struct keyboard_input
{
bool W_FORWARD = false;
bool W_BACKWARD = false;
bool W_LEFT = false;
bool W_RIGHT = false;
bool W_QUIT = false;
};
class ray_window
{
public:
ray_window(int v_XRES, int v_YRES);
~ray_window();
void read_events(keyboard_input &inputs);
void line_cast_to_buffer(wall_object line_array[]);
void draw_rectangle_to_buffer(int X1, int Y1,
int X2, int Y2,
int color);
void draw_text(int x, int y, std::string text);
void draw_buffer();
void line_cast(wall_object line_array[]);
void clear();
private:
Display *current_display;
int screen;
Window current_window;
GC graphics_context;
XEvent event;
int XRES;
int YRES;
XImage *window_buffer;
void initialize();
void close();
};