-
Notifications
You must be signed in to change notification settings - Fork 1
/
renderer_twbt.h
106 lines (85 loc) · 2.7 KB
/
renderer_twbt.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#ifndef _RENDERER_TWBT_H
#define _RENDERER_TWBT_H
#include "df/zoom_commands.h"
// This is from g_src/renderer_opengl.hpp
struct _renderer_opengl : public df::renderer
{
void *sdlscreen;
int dispx, dispy;
float *vertexes, *fg, *bg, *tex;
int zoom_steps, forced_steps;
int natural_w, natural_h;
int off_x, off_y, size_x, size_y;
virtual void allocate(int tiles) {};
virtual void init_opengl() {};
virtual void uninit_opengl() {};
virtual void draw(int vertex_count) {};
virtual ~_renderer_opengl() {};
virtual void reshape_gl() {};
};
typedef _renderer_opengl renderer_opengl; // This is to make Linux happy
struct renderer_cool : renderer_opengl
{
uint32_t dummy;
float *gvertexes, *gfg, *gtex;
int gdimx, gdimy, gdimxfull, gdimyfull;
int gdispx, gdispy;
float goff_x, goff_y, gsize_x, gsize_y;
bool needs_reshape;
int needs_zoom;
bool needs_full_update;
unsigned char *gscreen;
long *gscreentexpos;
float goff_y_gl;
renderer_cool();
void reshape_graphics();
void display_new(bool update_graphics);
void display_map();
void gswap_arrays();
void allocate_buffers(int tiles, int extra_tiles);
void update_map_tile(int x, int y);
void reshape_zoom_swap();
virtual void update_tile(int x, int y);
virtual void update_all();
virtual void draw(int vertex_count);
virtual void reshape_gl();
virtual void zoom(df::zoom_commands cmd);
virtual bool get_mouse_coords(int32_t *x, int32_t *y);
virtual void update_tile_old(int x, int y) {}; //17
virtual void reshape_gl_old() {}; //18
virtual bool get_mouse_coords_old(int32_t *x, int32_t *y) { return false; };
virtual void zoom_old(df::zoom_commands cmd) {};
virtual void _last_vmethod() {};
bool is_twbt() {
return (this->dummy == 'TWBT');
};
void output_string(int8_t color, int x, int y, std::string str)
{
};
void output_char(int8_t color, int x, int y, unsigned char ch)
{
if (x < 1 || x > gdimx || y < 1 || y > gdimy)
return;
const int tile = (x-1) * gdimy + (y-1);
unsigned char *s = gscreen + tile*4;
s[0] = ch;
s[1] = color % 8;
s[2] = 0;
s[3] = (color / 8) | (s[3]&0xf0);
gscreentexpos[tile] = 0;
};
int depth_at(int x, int y)
{
if (x < 1 || x > gdimx || y < 1 || y > gdimy)
return 0;
const int tile = (x-1) * gdimy + (y-1);
unsigned char *s = gscreen + tile*4;
return ((s[3]&0xf0)>>4);
}
DFHack::Gui::DwarfmodeDims map_dims()
{
DFHack::Gui::DwarfmodeDims dims = { 1, gdimx, 0, 0, 0, 0, 1, gdimy };
return dims;
};
};
#endif