author | Radek Brich <radek.brich@devl.cz> |
Tue, 08 Jan 2013 23:59:55 +0100 | |
changeset 59 | 729fcdfe6b57 |
parent 58 | 50308ed5e4f9 |
child 60 | fccca2a60492 |
permissions | -rw-r--r-- |
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
1 |
#include "sdlterm.h" |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
2 |
|
49
1611c462c3e3
Update sdlterm: Optimize commit() - use two cell buffers, redraw only dirty cells, not everything. Fix keypress event, filter mousemove.
Radek Brich <radek.brich@devl.cz>
parents:
48
diff
changeset
|
3 |
#include <algorithm> |
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
4 |
|
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
5 |
|
54
86b84535726e
DriverSDL: system font lookup.
Radek Brich <radek.brich@devl.cz>
parents:
53
diff
changeset
|
6 |
void ColorMap::index_to_rgb(int index, SDL_Color &color) const |
50
c5b8b9d2da95
DriverSDL: Implement colors.
Radek Brich <radek.brich@devl.cz>
parents:
49
diff
changeset
|
7 |
{ |
51
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
8 |
color.r = _map[index][0]; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
9 |
color.g = _map[index][1]; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
10 |
color.b = _map[index][2]; |
50
c5b8b9d2da95
DriverSDL: Implement colors.
Radek Brich <radek.brich@devl.cz>
parents:
49
diff
changeset
|
11 |
} |
c5b8b9d2da95
DriverSDL: Implement colors.
Radek Brich <radek.brich@devl.cz>
parents:
49
diff
changeset
|
12 |
|
c5b8b9d2da95
DriverSDL: Implement colors.
Radek Brich <radek.brich@devl.cz>
parents:
49
diff
changeset
|
13 |
|
52
50a1857557da
Update SDL driver: Enlarge char, attr to 32 bits, 64 bits per terminal cell. Colors and attributes are complete, only blink does not work.
Radek Brich <radek.brich@devl.cz>
parents:
51
diff
changeset
|
14 |
SDL_Surface *GlyphCache::lookup_glyph(Uint64 id) |
48
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
15 |
{ |
52
50a1857557da
Update SDL driver: Enlarge char, attr to 32 bits, 64 bits per terminal cell. Colors and attributes are complete, only blink does not work.
Radek Brich <radek.brich@devl.cz>
parents:
51
diff
changeset
|
16 |
auto iter = _glyph_map.find(id); |
51
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
17 |
if (iter == _glyph_map.end()) |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
18 |
{ |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
19 |
return NULL; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
20 |
} |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
21 |
return iter->second; |
48
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
22 |
} |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
23 |
|
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
24 |
|
52
50a1857557da
Update SDL driver: Enlarge char, attr to 32 bits, 64 bits per terminal cell. Colors and attributes are complete, only blink does not work.
Radek Brich <radek.brich@devl.cz>
parents:
51
diff
changeset
|
25 |
void GlyphCache::put_glyph(Uint64 id, SDL_Surface *srf) |
48
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
26 |
{ |
52
50a1857557da
Update SDL driver: Enlarge char, attr to 32 bits, 64 bits per terminal cell. Colors and attributes are complete, only blink does not work.
Radek Brich <radek.brich@devl.cz>
parents:
51
diff
changeset
|
27 |
_glyph_map[id] = srf; |
48
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
28 |
} |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
29 |
|
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
30 |
|
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
31 |
void GlyphCache::flush() |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
32 |
{ |
51
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
33 |
for (auto iter = _glyph_map.begin(); iter != _glyph_map.end(); iter++) |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
34 |
{ |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
35 |
SDL_FreeSurface(iter->second); |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
36 |
} |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
37 |
_glyph_map.clear(); |
48
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
38 |
} |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
39 |
|
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
40 |
|
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
41 |
GlyphRenderer::GlyphRenderer() |
50
c5b8b9d2da95
DriverSDL: Implement colors.
Radek Brich <radek.brich@devl.cz>
parents:
49
diff
changeset
|
42 |
: _font_regular(NULL), _font_bold(NULL), _cell_width(0), _cell_height(0), _cache(), _colormap() |
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
43 |
{ |
51
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
44 |
if (TTF_Init() == -1) |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
45 |
{ |
58
50308ed5e4f9
sdlterm: Cleanup exceptions.
Radek Brich <radek.brich@devl.cz>
parents:
57
diff
changeset
|
46 |
throw SDLTermError(std::string("TTF_Init: ") + TTF_GetError()); |
51
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
47 |
} |
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
48 |
} |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
49 |
|
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
50 |
|
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
51 |
GlyphRenderer::~GlyphRenderer() |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
52 |
{ |
51
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
53 |
_cache.flush(); |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
54 |
close_font(); |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
55 |
TTF_Quit(); |
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
56 |
} |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
57 |
|
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
58 |
|
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
59 |
void GlyphRenderer::open_font(const char *fname_regular, const char *fname_bold, int ptsize) |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
60 |
{ |
51
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
61 |
close_font(); |
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
62 |
|
51
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
63 |
// open regular font |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
64 |
_font_regular = TTF_OpenFont(fname_regular, ptsize); |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
65 |
if (!_font_regular) |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
66 |
{ |
58
50308ed5e4f9
sdlterm: Cleanup exceptions.
Radek Brich <radek.brich@devl.cz>
parents:
57
diff
changeset
|
67 |
throw SDLTermError(std::string("TTF_OpenFont: ") + TTF_GetError()); |
51
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
68 |
} |
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
69 |
|
51
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
70 |
// open bold font |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
71 |
_font_bold = TTF_OpenFont(fname_bold, ptsize); |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
72 |
if (!_font_bold) |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
73 |
{ |
58
50308ed5e4f9
sdlterm: Cleanup exceptions.
Radek Brich <radek.brich@devl.cz>
parents:
57
diff
changeset
|
74 |
throw SDLTermError(std::string("TTF_OpenFont: ") + TTF_GetError()); |
51
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
75 |
} |
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
76 |
|
51
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
77 |
// update metrics for regular font |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
78 |
int advance; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
79 |
if (TTF_GlyphMetrics(_font_regular, 'M', NULL, NULL, NULL, NULL, &advance) == -1) |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
80 |
{ |
58
50308ed5e4f9
sdlterm: Cleanup exceptions.
Radek Brich <radek.brich@devl.cz>
parents:
57
diff
changeset
|
81 |
throw SDLTermError(std::string("TTF_GlyphMetrics: ") + TTF_GetError()); |
51
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
82 |
} |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
83 |
_cell_width = advance; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
84 |
_cell_height = TTF_FontHeight(_font_regular); |
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
85 |
|
51
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
86 |
// read metrics for bold font |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
87 |
if (TTF_GlyphMetrics(_font_bold, 'M', NULL, NULL, NULL, NULL, &advance) == -1) |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
88 |
{ |
58
50308ed5e4f9
sdlterm: Cleanup exceptions.
Radek Brich <radek.brich@devl.cz>
parents:
57
diff
changeset
|
89 |
throw SDLTermError(std::string("TTF_GlyphMetrics: ") + TTF_GetError()); |
51
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
90 |
} |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
91 |
if (advance > _cell_width) |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
92 |
{ |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
93 |
_cell_width = advance; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
94 |
} |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
95 |
int height = TTF_FontHeight(_font_bold); |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
96 |
if (height > _cell_height) |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
97 |
{ |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
98 |
_cell_height = height; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
99 |
} |
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
100 |
} |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
101 |
|
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
102 |
|
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
103 |
void GlyphRenderer::close_font() |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
104 |
{ |
51
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
105 |
if (_font_regular) |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
106 |
{ |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
107 |
TTF_CloseFont(_font_regular); |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
108 |
_font_regular = NULL; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
109 |
} |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
110 |
if (_font_bold) |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
111 |
{ |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
112 |
TTF_CloseFont(_font_bold); |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
113 |
_font_bold = NULL; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
114 |
} |
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
115 |
} |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
116 |
|
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
117 |
|
52
50a1857557da
Update SDL driver: Enlarge char, attr to 32 bits, 64 bits per terminal cell. Colors and attributes are complete, only blink does not work.
Radek Brich <radek.brich@devl.cz>
parents:
51
diff
changeset
|
118 |
SDL_Surface *GlyphRenderer::render_cell(Uint32 ch, Uint32 attr) |
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
119 |
{ |
51
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
120 |
SDL_Surface *cell_surface; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
121 |
TTF_Font *font; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
122 |
SDL_Color fgcolor, bgcolor; |
48
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
123 |
|
51
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
124 |
// try cache |
52
50a1857557da
Update SDL driver: Enlarge char, attr to 32 bits, 64 bits per terminal cell. Colors and attributes are complete, only blink does not work.
Radek Brich <radek.brich@devl.cz>
parents:
51
diff
changeset
|
125 |
Uint64 id = (Uint64)ch | (Uint64)attr << 32; |
50a1857557da
Update SDL driver: Enlarge char, attr to 32 bits, 64 bits per terminal cell. Colors and attributes are complete, only blink does not work.
Radek Brich <radek.brich@devl.cz>
parents:
51
diff
changeset
|
126 |
cell_surface = _cache.lookup_glyph(id); |
51
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
127 |
if (cell_surface) |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
128 |
{ |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
129 |
return cell_surface; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
130 |
} |
48
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
131 |
|
51
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
132 |
// load attributes |
52
50a1857557da
Update SDL driver: Enlarge char, attr to 32 bits, 64 bits per terminal cell. Colors and attributes are complete, only blink does not work.
Radek Brich <radek.brich@devl.cz>
parents:
51
diff
changeset
|
133 |
_colormap.index_to_rgb((attr & 0x000000FF), fgcolor); |
50a1857557da
Update SDL driver: Enlarge char, attr to 32 bits, 64 bits per terminal cell. Colors and attributes are complete, only blink does not work.
Radek Brich <radek.brich@devl.cz>
parents:
51
diff
changeset
|
134 |
_colormap.index_to_rgb((attr & 0x0000FF00) >> 8, bgcolor); |
50a1857557da
Update SDL driver: Enlarge char, attr to 32 bits, 64 bits per terminal cell. Colors and attributes are complete, only blink does not work.
Radek Brich <radek.brich@devl.cz>
parents:
51
diff
changeset
|
135 |
int style = (attr & 0xFF000000) >> 24; |
50a1857557da
Update SDL driver: Enlarge char, attr to 32 bits, 64 bits per terminal cell. Colors and attributes are complete, only blink does not work.
Radek Brich <radek.brich@devl.cz>
parents:
51
diff
changeset
|
136 |
font = (style & Style::BOLD) ? _font_bold : _font_regular; |
50a1857557da
Update SDL driver: Enlarge char, attr to 32 bits, 64 bits per terminal cell. Colors and attributes are complete, only blink does not work.
Radek Brich <radek.brich@devl.cz>
parents:
51
diff
changeset
|
137 |
if (style & Style::STANDOUT) |
50a1857557da
Update SDL driver: Enlarge char, attr to 32 bits, 64 bits per terminal cell. Colors and attributes are complete, only blink does not work.
Radek Brich <radek.brich@devl.cz>
parents:
51
diff
changeset
|
138 |
{ |
50a1857557da
Update SDL driver: Enlarge char, attr to 32 bits, 64 bits per terminal cell. Colors and attributes are complete, only blink does not work.
Radek Brich <radek.brich@devl.cz>
parents:
51
diff
changeset
|
139 |
std::swap(fgcolor, bgcolor); |
50a1857557da
Update SDL driver: Enlarge char, attr to 32 bits, 64 bits per terminal cell. Colors and attributes are complete, only blink does not work.
Radek Brich <radek.brich@devl.cz>
parents:
51
diff
changeset
|
140 |
} |
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
141 |
|
51
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
142 |
// create surface for whole cell and fill it with bg color |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
143 |
cell_surface = SDL_CreateRGBSurface(SDL_SWSURFACE, |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
144 |
_cell_width, _cell_height, 32, 0, 0, 0, 0); |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
145 |
SDL_Rect dst_rect; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
146 |
dst_rect.x = 0; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
147 |
dst_rect.y = 0; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
148 |
dst_rect.w = _cell_width; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
149 |
dst_rect.h = _cell_height; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
150 |
Uint32 bgcolor_mapped = SDL_MapRGB(cell_surface->format, bgcolor.r, bgcolor.g, bgcolor.b); |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
151 |
SDL_FillRect(cell_surface, &dst_rect, bgcolor_mapped); |
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
152 |
|
51
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
153 |
// render glyph, blit it onto cell surface |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
154 |
if (ch) |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
155 |
{ |
52
50a1857557da
Update SDL driver: Enlarge char, attr to 32 bits, 64 bits per terminal cell. Colors and attributes are complete, only blink does not work.
Radek Brich <radek.brich@devl.cz>
parents:
51
diff
changeset
|
156 |
// when glyph is not provided by BOLD font but is provided by REGULAR font, use that (better than nothing) |
50a1857557da
Update SDL driver: Enlarge char, attr to 32 bits, 64 bits per terminal cell. Colors and attributes are complete, only blink does not work.
Radek Brich <radek.brich@devl.cz>
parents:
51
diff
changeset
|
157 |
if ((style & Style::BOLD) && !TTF_GlyphIsProvided(font, ch) && TTF_GlyphIsProvided(_font_regular, ch)) |
50a1857557da
Update SDL driver: Enlarge char, attr to 32 bits, 64 bits per terminal cell. Colors and attributes are complete, only blink does not work.
Radek Brich <radek.brich@devl.cz>
parents:
51
diff
changeset
|
158 |
{ |
50a1857557da
Update SDL driver: Enlarge char, attr to 32 bits, 64 bits per terminal cell. Colors and attributes are complete, only blink does not work.
Radek Brich <radek.brich@devl.cz>
parents:
51
diff
changeset
|
159 |
// use bold style of regular font instead of bold font |
50a1857557da
Update SDL driver: Enlarge char, attr to 32 bits, 64 bits per terminal cell. Colors and attributes are complete, only blink does not work.
Radek Brich <radek.brich@devl.cz>
parents:
51
diff
changeset
|
160 |
TTF_SetFontStyle(_font_regular, TTF_STYLE_BOLD); |
50a1857557da
Update SDL driver: Enlarge char, attr to 32 bits, 64 bits per terminal cell. Colors and attributes are complete, only blink does not work.
Radek Brich <radek.brich@devl.cz>
parents:
51
diff
changeset
|
161 |
_render_glyph(cell_surface, _font_regular, ch, fgcolor, bgcolor); |
50a1857557da
Update SDL driver: Enlarge char, attr to 32 bits, 64 bits per terminal cell. Colors and attributes are complete, only blink does not work.
Radek Brich <radek.brich@devl.cz>
parents:
51
diff
changeset
|
162 |
TTF_SetFontStyle(_font_regular, TTF_STYLE_NORMAL); |
50a1857557da
Update SDL driver: Enlarge char, attr to 32 bits, 64 bits per terminal cell. Colors and attributes are complete, only blink does not work.
Radek Brich <radek.brich@devl.cz>
parents:
51
diff
changeset
|
163 |
} |
50a1857557da
Update SDL driver: Enlarge char, attr to 32 bits, 64 bits per terminal cell. Colors and attributes are complete, only blink does not work.
Radek Brich <radek.brich@devl.cz>
parents:
51
diff
changeset
|
164 |
else |
50a1857557da
Update SDL driver: Enlarge char, attr to 32 bits, 64 bits per terminal cell. Colors and attributes are complete, only blink does not work.
Radek Brich <radek.brich@devl.cz>
parents:
51
diff
changeset
|
165 |
{ |
50a1857557da
Update SDL driver: Enlarge char, attr to 32 bits, 64 bits per terminal cell. Colors and attributes are complete, only blink does not work.
Radek Brich <radek.brich@devl.cz>
parents:
51
diff
changeset
|
166 |
// normal case |
50a1857557da
Update SDL driver: Enlarge char, attr to 32 bits, 64 bits per terminal cell. Colors and attributes are complete, only blink does not work.
Radek Brich <radek.brich@devl.cz>
parents:
51
diff
changeset
|
167 |
_render_glyph(cell_surface, font, ch, fgcolor, bgcolor); |
50a1857557da
Update SDL driver: Enlarge char, attr to 32 bits, 64 bits per terminal cell. Colors and attributes are complete, only blink does not work.
Radek Brich <radek.brich@devl.cz>
parents:
51
diff
changeset
|
168 |
} |
50a1857557da
Update SDL driver: Enlarge char, attr to 32 bits, 64 bits per terminal cell. Colors and attributes are complete, only blink does not work.
Radek Brich <radek.brich@devl.cz>
parents:
51
diff
changeset
|
169 |
if (style & Style::UNDERLINE) |
50a1857557da
Update SDL driver: Enlarge char, attr to 32 bits, 64 bits per terminal cell. Colors and attributes are complete, only blink does not work.
Radek Brich <radek.brich@devl.cz>
parents:
51
diff
changeset
|
170 |
{ |
50a1857557da
Update SDL driver: Enlarge char, attr to 32 bits, 64 bits per terminal cell. Colors and attributes are complete, only blink does not work.
Radek Brich <radek.brich@devl.cz>
parents:
51
diff
changeset
|
171 |
// draw underline |
50a1857557da
Update SDL driver: Enlarge char, attr to 32 bits, 64 bits per terminal cell. Colors and attributes are complete, only blink does not work.
Radek Brich <radek.brich@devl.cz>
parents:
51
diff
changeset
|
172 |
SDL_LockSurface(cell_surface); |
50a1857557da
Update SDL driver: Enlarge char, attr to 32 bits, 64 bits per terminal cell. Colors and attributes are complete, only blink does not work.
Radek Brich <radek.brich@devl.cz>
parents:
51
diff
changeset
|
173 |
int y = 1 + TTF_FontAscent(font); |
50a1857557da
Update SDL driver: Enlarge char, attr to 32 bits, 64 bits per terminal cell. Colors and attributes are complete, only blink does not work.
Radek Brich <radek.brich@devl.cz>
parents:
51
diff
changeset
|
174 |
Uint32 fgcolor_mapped = SDL_MapRGB(cell_surface->format, fgcolor.r, fgcolor.g, fgcolor.b); |
53
c4263588b716
DriverSDL: Implement cursor, handle window resize.
Radek Brich <radek.brich@devl.cz>
parents:
52
diff
changeset
|
175 |
Uint32 *p = (Uint32 *)((Uint8 *)cell_surface->pixels + y * cell_surface->pitch); |
52
50a1857557da
Update SDL driver: Enlarge char, attr to 32 bits, 64 bits per terminal cell. Colors and attributes are complete, only blink does not work.
Radek Brich <radek.brich@devl.cz>
parents:
51
diff
changeset
|
176 |
for (int x = 0; x < _cell_width; x++) |
50a1857557da
Update SDL driver: Enlarge char, attr to 32 bits, 64 bits per terminal cell. Colors and attributes are complete, only blink does not work.
Radek Brich <radek.brich@devl.cz>
parents:
51
diff
changeset
|
177 |
*p++ = fgcolor_mapped; |
50a1857557da
Update SDL driver: Enlarge char, attr to 32 bits, 64 bits per terminal cell. Colors and attributes are complete, only blink does not work.
Radek Brich <radek.brich@devl.cz>
parents:
51
diff
changeset
|
178 |
SDL_UnlockSurface(cell_surface); |
50a1857557da
Update SDL driver: Enlarge char, attr to 32 bits, 64 bits per terminal cell. Colors and attributes are complete, only blink does not work.
Radek Brich <radek.brich@devl.cz>
parents:
51
diff
changeset
|
179 |
} |
51
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
180 |
} |
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
181 |
|
51
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
182 |
// convert to display format |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
183 |
SDL_Surface *tmp_surface = cell_surface; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
184 |
cell_surface = SDL_DisplayFormat(tmp_surface); |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
185 |
SDL_FreeSurface(tmp_surface); |
49
1611c462c3e3
Update sdlterm: Optimize commit() - use two cell buffers, redraw only dirty cells, not everything. Fix keypress event, filter mousemove.
Radek Brich <radek.brich@devl.cz>
parents:
48
diff
changeset
|
186 |
|
51
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
187 |
// put to cache |
52
50a1857557da
Update SDL driver: Enlarge char, attr to 32 bits, 64 bits per terminal cell. Colors and attributes are complete, only blink does not work.
Radek Brich <radek.brich@devl.cz>
parents:
51
diff
changeset
|
188 |
_cache.put_glyph(id, cell_surface); |
49
1611c462c3e3
Update sdlterm: Optimize commit() - use two cell buffers, redraw only dirty cells, not everything. Fix keypress event, filter mousemove.
Radek Brich <radek.brich@devl.cz>
parents:
48
diff
changeset
|
189 |
|
51
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
190 |
return cell_surface; |
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
191 |
} |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
192 |
|
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
193 |
|
52
50a1857557da
Update SDL driver: Enlarge char, attr to 32 bits, 64 bits per terminal cell. Colors and attributes are complete, only blink does not work.
Radek Brich <radek.brich@devl.cz>
parents:
51
diff
changeset
|
194 |
void GlyphRenderer::_render_glyph(SDL_Surface *cell_surface, TTF_Font *font, Uint32 ch, |
50a1857557da
Update SDL driver: Enlarge char, attr to 32 bits, 64 bits per terminal cell. Colors and attributes are complete, only blink does not work.
Radek Brich <radek.brich@devl.cz>
parents:
51
diff
changeset
|
195 |
SDL_Color fgcolor, SDL_Color bgcolor) |
50a1857557da
Update SDL driver: Enlarge char, attr to 32 bits, 64 bits per terminal cell. Colors and attributes are complete, only blink does not work.
Radek Brich <radek.brich@devl.cz>
parents:
51
diff
changeset
|
196 |
{ |
50a1857557da
Update SDL driver: Enlarge char, attr to 32 bits, 64 bits per terminal cell. Colors and attributes are complete, only blink does not work.
Radek Brich <radek.brich@devl.cz>
parents:
51
diff
changeset
|
197 |
int minx, maxy; |
50a1857557da
Update SDL driver: Enlarge char, attr to 32 bits, 64 bits per terminal cell. Colors and attributes are complete, only blink does not work.
Radek Brich <radek.brich@devl.cz>
parents:
51
diff
changeset
|
198 |
SDL_Rect dst_rect; |
50a1857557da
Update SDL driver: Enlarge char, attr to 32 bits, 64 bits per terminal cell. Colors and attributes are complete, only blink does not work.
Radek Brich <radek.brich@devl.cz>
parents:
51
diff
changeset
|
199 |
SDL_Surface *glyph_surface = TTF_RenderGlyph_Shaded(font, ch, fgcolor, bgcolor); |
50a1857557da
Update SDL driver: Enlarge char, attr to 32 bits, 64 bits per terminal cell. Colors and attributes are complete, only blink does not work.
Radek Brich <radek.brich@devl.cz>
parents:
51
diff
changeset
|
200 |
TTF_GlyphMetrics(font, ch, &minx, NULL, NULL, &maxy, NULL); |
50a1857557da
Update SDL driver: Enlarge char, attr to 32 bits, 64 bits per terminal cell. Colors and attributes are complete, only blink does not work.
Radek Brich <radek.brich@devl.cz>
parents:
51
diff
changeset
|
201 |
dst_rect.x = minx; |
50a1857557da
Update SDL driver: Enlarge char, attr to 32 bits, 64 bits per terminal cell. Colors and attributes are complete, only blink does not work.
Radek Brich <radek.brich@devl.cz>
parents:
51
diff
changeset
|
202 |
dst_rect.y = TTF_FontAscent(font) - maxy; |
50a1857557da
Update SDL driver: Enlarge char, attr to 32 bits, 64 bits per terminal cell. Colors and attributes are complete, only blink does not work.
Radek Brich <radek.brich@devl.cz>
parents:
51
diff
changeset
|
203 |
SDL_BlitSurface(glyph_surface, NULL, cell_surface, &dst_rect); |
50a1857557da
Update SDL driver: Enlarge char, attr to 32 bits, 64 bits per terminal cell. Colors and attributes are complete, only blink does not work.
Radek Brich <radek.brich@devl.cz>
parents:
51
diff
changeset
|
204 |
SDL_FreeSurface(glyph_surface); |
50a1857557da
Update SDL driver: Enlarge char, attr to 32 bits, 64 bits per terminal cell. Colors and attributes are complete, only blink does not work.
Radek Brich <radek.brich@devl.cz>
parents:
51
diff
changeset
|
205 |
} |
50a1857557da
Update SDL driver: Enlarge char, attr to 32 bits, 64 bits per terminal cell. Colors and attributes are complete, only blink does not work.
Radek Brich <radek.brich@devl.cz>
parents:
51
diff
changeset
|
206 |
|
50a1857557da
Update SDL driver: Enlarge char, attr to 32 bits, 64 bits per terminal cell. Colors and attributes are complete, only blink does not work.
Radek Brich <radek.brich@devl.cz>
parents:
51
diff
changeset
|
207 |
|
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
208 |
void TerminalScreen::select_font(const char *fname_regular, const char *fname_bold, int ptsize) |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
209 |
{ |
51
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
210 |
_render.open_font(fname_regular, fname_bold, ptsize); |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
211 |
_reset_cells(); |
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
212 |
} |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
213 |
|
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
214 |
void TerminalScreen::resize(int pxwidth, int pxheight) |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
215 |
{ |
49
1611c462c3e3
Update sdlterm: Optimize commit() - use two cell buffers, redraw only dirty cells, not everything. Fix keypress event, filter mousemove.
Radek Brich <radek.brich@devl.cz>
parents:
48
diff
changeset
|
216 |
_screen_surface = SDL_SetVideoMode(pxwidth, pxheight, 0, SDL_SWSURFACE|SDL_ANYFORMAT|SDL_RESIZABLE); |
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
217 |
|
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
218 |
if (_screen_surface == NULL) |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
219 |
{ |
58
50308ed5e4f9
sdlterm: Cleanup exceptions.
Radek Brich <radek.brich@devl.cz>
parents:
57
diff
changeset
|
220 |
throw SDLTermError(std::string("SDL_SetVideoMode: ") + SDL_GetError()); |
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
221 |
} |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
222 |
|
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
223 |
_pixel_width = pxwidth; |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
224 |
_pixel_height = pxheight; |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
225 |
|
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
226 |
_reset_cells(); |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
227 |
} |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
228 |
|
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
229 |
|
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
230 |
void TerminalScreen::erase() |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
231 |
{ |
51
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
232 |
std::fill(_cells_front.begin(), _cells_front.end(), TerminalCell()); |
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
233 |
} |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
234 |
|
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
235 |
|
52
50a1857557da
Update SDL driver: Enlarge char, attr to 32 bits, 64 bits per terminal cell. Colors and attributes are complete, only blink does not work.
Radek Brich <radek.brich@devl.cz>
parents:
51
diff
changeset
|
236 |
void TerminalScreen::putch(int x, int y, Uint32 ch, Uint32 attr) |
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
237 |
{ |
51
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
238 |
TerminalCell &cell = _cells_front[y * _width + x]; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
239 |
cell.ch = ch; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
240 |
cell.attr = attr; |
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
241 |
} |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
242 |
|
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
243 |
|
53
c4263588b716
DriverSDL: Implement cursor, handle window resize.
Radek Brich <radek.brich@devl.cz>
parents:
52
diff
changeset
|
244 |
void TerminalScreen::toggle_cursor(int x, int y) |
c4263588b716
DriverSDL: Implement cursor, handle window resize.
Radek Brich <radek.brich@devl.cz>
parents:
52
diff
changeset
|
245 |
{ |
c4263588b716
DriverSDL: Implement cursor, handle window resize.
Radek Brich <radek.brich@devl.cz>
parents:
52
diff
changeset
|
246 |
TerminalCell &cell = _cells_front[y * _width + x]; |
c4263588b716
DriverSDL: Implement cursor, handle window resize.
Radek Brich <radek.brich@devl.cz>
parents:
52
diff
changeset
|
247 |
cell.attr ^= (Style::STANDOUT << 24); |
c4263588b716
DriverSDL: Implement cursor, handle window resize.
Radek Brich <radek.brich@devl.cz>
parents:
52
diff
changeset
|
248 |
} |
c4263588b716
DriverSDL: Implement cursor, handle window resize.
Radek Brich <radek.brich@devl.cz>
parents:
52
diff
changeset
|
249 |
|
c4263588b716
DriverSDL: Implement cursor, handle window resize.
Radek Brich <radek.brich@devl.cz>
parents:
52
diff
changeset
|
250 |
|
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
251 |
void TerminalScreen::commit() |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
252 |
{ |
51
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
253 |
auto front_iter = _cells_front.begin(); |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
254 |
auto back_iter = _cells_back.begin(); |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
255 |
SDL_Surface *cell_surface; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
256 |
SDL_Rect dst_rect; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
257 |
for (int y = 0; y < _height; y++) |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
258 |
{ |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
259 |
for (int x = 0; x < _width; x++) |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
260 |
{ |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
261 |
if (*front_iter != *back_iter) |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
262 |
{ |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
263 |
dst_rect.x = x * _cell_width; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
264 |
dst_rect.y = y * _cell_height; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
265 |
cell_surface = _render.render_cell(front_iter->ch, front_iter->attr); |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
266 |
SDL_BlitSurface(cell_surface, NULL, _screen_surface, &dst_rect); |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
267 |
*back_iter = *front_iter; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
268 |
} |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
269 |
front_iter++; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
270 |
back_iter++; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
271 |
} |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
272 |
} |
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
273 |
|
51
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
274 |
SDL_UpdateRect(_screen_surface, 0, 0, 0, 0); |
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
275 |
} |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
276 |
|
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
277 |
|
53
c4263588b716
DriverSDL: Implement cursor, handle window resize.
Radek Brich <radek.brich@devl.cz>
parents:
52
diff
changeset
|
278 |
void TerminalScreen::redraw() |
c4263588b716
DriverSDL: Implement cursor, handle window resize.
Radek Brich <radek.brich@devl.cz>
parents:
52
diff
changeset
|
279 |
{ |
c4263588b716
DriverSDL: Implement cursor, handle window resize.
Radek Brich <radek.brich@devl.cz>
parents:
52
diff
changeset
|
280 |
// clear back buffer, current screen is considered blank |
c4263588b716
DriverSDL: Implement cursor, handle window resize.
Radek Brich <radek.brich@devl.cz>
parents:
52
diff
changeset
|
281 |
std::fill(_cells_back.begin(), _cells_back.end(), TerminalCell()); |
c4263588b716
DriverSDL: Implement cursor, handle window resize.
Radek Brich <radek.brich@devl.cz>
parents:
52
diff
changeset
|
282 |
} |
c4263588b716
DriverSDL: Implement cursor, handle window resize.
Radek Brich <radek.brich@devl.cz>
parents:
52
diff
changeset
|
283 |
|
c4263588b716
DriverSDL: Implement cursor, handle window resize.
Radek Brich <radek.brich@devl.cz>
parents:
52
diff
changeset
|
284 |
|
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
285 |
void TerminalScreen::_reset_cells() |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
286 |
{ |
51
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
287 |
_cell_width = _render.get_cell_width(); |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
288 |
_cell_height = _render.get_cell_height(); |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
289 |
if (!_cell_width || !_cell_height) |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
290 |
return; |
50
c5b8b9d2da95
DriverSDL: Implement colors.
Radek Brich <radek.brich@devl.cz>
parents:
49
diff
changeset
|
291 |
|
51
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
292 |
_width = _pixel_width / _cell_width; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
293 |
_height = _pixel_height / _cell_height; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
294 |
if (!_width || !_height) |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
295 |
return; |
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
296 |
|
51
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
297 |
int num_cells = _width * _height; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
298 |
_cells_front.resize(num_cells, TerminalCell()); |
53
c4263588b716
DriverSDL: Implement cursor, handle window resize.
Radek Brich <radek.brich@devl.cz>
parents:
52
diff
changeset
|
299 |
_cells_back.resize(num_cells); |
c4263588b716
DriverSDL: Implement cursor, handle window resize.
Radek Brich <radek.brich@devl.cz>
parents:
52
diff
changeset
|
300 |
redraw(); |
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
301 |
} |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
302 |
|
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
303 |
|
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
304 |
Terminal::Terminal() |
55
1ab0edd5d784
DriverSDL: mousewheel, key repeation.
Radek Brich <radek.brich@devl.cz>
parents:
54
diff
changeset
|
305 |
: _screen(), _attr(7), _cursor_x(0), _cursor_y(0), _cursor_visible(false), |
1ab0edd5d784
DriverSDL: mousewheel, key repeation.
Radek Brich <radek.brich@devl.cz>
parents:
54
diff
changeset
|
306 |
_mousemove_last_x(-1), _mousemove_last_y(-1) |
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
307 |
{ |
57
911927edbdde
DriverSDL: Add support for timeouts.
Radek Brich <radek.brich@devl.cz>
parents:
55
diff
changeset
|
308 |
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) == -1) |
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
309 |
{ |
58
50308ed5e4f9
sdlterm: Cleanup exceptions.
Radek Brich <radek.brich@devl.cz>
parents:
57
diff
changeset
|
310 |
throw SDLTermError(std::string("SDL_Init: ") + SDL_GetError()); |
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
311 |
} |
48
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
312 |
SDL_EnableUNICODE(1); |
55
1ab0edd5d784
DriverSDL: mousewheel, key repeation.
Radek Brich <radek.brich@devl.cz>
parents:
54
diff
changeset
|
313 |
SDL_EnableKeyRepeat(250, SDL_DEFAULT_REPEAT_INTERVAL); |
53
c4263588b716
DriverSDL: Implement cursor, handle window resize.
Radek Brich <radek.brich@devl.cz>
parents:
52
diff
changeset
|
314 |
SDL_WM_SetCaption("terminal", NULL); |
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
315 |
} |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
316 |
|
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
317 |
|
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
318 |
Terminal::~Terminal() |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
319 |
{ |
51
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
320 |
SDL_Quit(); |
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
321 |
} |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
322 |
|
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
323 |
|
53
c4263588b716
DriverSDL: Implement cursor, handle window resize.
Radek Brich <radek.brich@devl.cz>
parents:
52
diff
changeset
|
324 |
void Terminal::commit() |
c4263588b716
DriverSDL: Implement cursor, handle window resize.
Radek Brich <radek.brich@devl.cz>
parents:
52
diff
changeset
|
325 |
{ |
c4263588b716
DriverSDL: Implement cursor, handle window resize.
Radek Brich <radek.brich@devl.cz>
parents:
52
diff
changeset
|
326 |
if (_cursor_visible) |
c4263588b716
DriverSDL: Implement cursor, handle window resize.
Radek Brich <radek.brich@devl.cz>
parents:
52
diff
changeset
|
327 |
{ |
c4263588b716
DriverSDL: Implement cursor, handle window resize.
Radek Brich <radek.brich@devl.cz>
parents:
52
diff
changeset
|
328 |
_screen.toggle_cursor(_cursor_x, _cursor_y); |
c4263588b716
DriverSDL: Implement cursor, handle window resize.
Radek Brich <radek.brich@devl.cz>
parents:
52
diff
changeset
|
329 |
_screen.commit(); |
c4263588b716
DriverSDL: Implement cursor, handle window resize.
Radek Brich <radek.brich@devl.cz>
parents:
52
diff
changeset
|
330 |
_screen.toggle_cursor(_cursor_x, _cursor_y); |
c4263588b716
DriverSDL: Implement cursor, handle window resize.
Radek Brich <radek.brich@devl.cz>
parents:
52
diff
changeset
|
331 |
} |
c4263588b716
DriverSDL: Implement cursor, handle window resize.
Radek Brich <radek.brich@devl.cz>
parents:
52
diff
changeset
|
332 |
else |
c4263588b716
DriverSDL: Implement cursor, handle window resize.
Radek Brich <radek.brich@devl.cz>
parents:
52
diff
changeset
|
333 |
{ |
c4263588b716
DriverSDL: Implement cursor, handle window resize.
Radek Brich <radek.brich@devl.cz>
parents:
52
diff
changeset
|
334 |
_screen.commit(); |
c4263588b716
DriverSDL: Implement cursor, handle window resize.
Radek Brich <radek.brich@devl.cz>
parents:
52
diff
changeset
|
335 |
} |
c4263588b716
DriverSDL: Implement cursor, handle window resize.
Radek Brich <radek.brich@devl.cz>
parents:
52
diff
changeset
|
336 |
} |
c4263588b716
DriverSDL: Implement cursor, handle window resize.
Radek Brich <radek.brich@devl.cz>
parents:
52
diff
changeset
|
337 |
|
57
911927edbdde
DriverSDL: Add support for timeouts.
Radek Brich <radek.brich@devl.cz>
parents:
55
diff
changeset
|
338 |
|
911927edbdde
DriverSDL: Add support for timeouts.
Radek Brich <radek.brich@devl.cz>
parents:
55
diff
changeset
|
339 |
bool Terminal::wait_event(Event &event, Uint32 timeout) |
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
340 |
{ |
51
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
341 |
static SDL_Event sdl_event; |
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
342 |
|
57
911927edbdde
DriverSDL: Add support for timeouts.
Radek Brich <radek.brich@devl.cz>
parents:
55
diff
changeset
|
343 |
// use timer to simulate SDL_WaitEventTimeout, which is not available in SDL 1.2 |
911927edbdde
DriverSDL: Add support for timeouts.
Radek Brich <radek.brich@devl.cz>
parents:
55
diff
changeset
|
344 |
SDL_TimerID timer_id = NULL; |
911927edbdde
DriverSDL: Add support for timeouts.
Radek Brich <radek.brich@devl.cz>
parents:
55
diff
changeset
|
345 |
if (timeout) |
911927edbdde
DriverSDL: Add support for timeouts.
Radek Brich <radek.brich@devl.cz>
parents:
55
diff
changeset
|
346 |
{ |
911927edbdde
DriverSDL: Add support for timeouts.
Radek Brich <radek.brich@devl.cz>
parents:
55
diff
changeset
|
347 |
timer_id = SDL_AddTimer(timeout, _wait_event_callback, NULL); |
911927edbdde
DriverSDL: Add support for timeouts.
Radek Brich <radek.brich@devl.cz>
parents:
55
diff
changeset
|
348 |
} |
911927edbdde
DriverSDL: Add support for timeouts.
Radek Brich <radek.brich@devl.cz>
parents:
55
diff
changeset
|
349 |
|
51
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
350 |
while (SDL_WaitEvent(&sdl_event)) |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
351 |
{ |
57
911927edbdde
DriverSDL: Add support for timeouts.
Radek Brich <radek.brich@devl.cz>
parents:
55
diff
changeset
|
352 |
if (timer_id) |
911927edbdde
DriverSDL: Add support for timeouts.
Radek Brich <radek.brich@devl.cz>
parents:
55
diff
changeset
|
353 |
{ |
911927edbdde
DriverSDL: Add support for timeouts.
Radek Brich <radek.brich@devl.cz>
parents:
55
diff
changeset
|
354 |
if (sdl_event.type == SDL_USEREVENT && sdl_event.user.code == 1) |
911927edbdde
DriverSDL: Add support for timeouts.
Radek Brich <radek.brich@devl.cz>
parents:
55
diff
changeset
|
355 |
{ |
911927edbdde
DriverSDL: Add support for timeouts.
Radek Brich <radek.brich@devl.cz>
parents:
55
diff
changeset
|
356 |
// timeout |
911927edbdde
DriverSDL: Add support for timeouts.
Radek Brich <radek.brich@devl.cz>
parents:
55
diff
changeset
|
357 |
return false; |
911927edbdde
DriverSDL: Add support for timeouts.
Radek Brich <radek.brich@devl.cz>
parents:
55
diff
changeset
|
358 |
} |
911927edbdde
DriverSDL: Add support for timeouts.
Radek Brich <radek.brich@devl.cz>
parents:
55
diff
changeset
|
359 |
// some event came before timeout... |
911927edbdde
DriverSDL: Add support for timeouts.
Radek Brich <radek.brich@devl.cz>
parents:
55
diff
changeset
|
360 |
SDL_RemoveTimer(timer_id); |
911927edbdde
DriverSDL: Add support for timeouts.
Radek Brich <radek.brich@devl.cz>
parents:
55
diff
changeset
|
361 |
timer_id = NULL; |
911927edbdde
DriverSDL: Add support for timeouts.
Radek Brich <radek.brich@devl.cz>
parents:
55
diff
changeset
|
362 |
} |
51
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
363 |
switch (sdl_event.type) |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
364 |
{ |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
365 |
case SDL_QUIT: |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
366 |
event.type = Event::QUIT; |
57
911927edbdde
DriverSDL: Add support for timeouts.
Radek Brich <radek.brich@devl.cz>
parents:
55
diff
changeset
|
367 |
return true; |
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
368 |
|
53
c4263588b716
DriverSDL: Implement cursor, handle window resize.
Radek Brich <radek.brich@devl.cz>
parents:
52
diff
changeset
|
369 |
case SDL_VIDEORESIZE: |
c4263588b716
DriverSDL: Implement cursor, handle window resize.
Radek Brich <radek.brich@devl.cz>
parents:
52
diff
changeset
|
370 |
event.type = Event::RESIZE; |
c4263588b716
DriverSDL: Implement cursor, handle window resize.
Radek Brich <radek.brich@devl.cz>
parents:
52
diff
changeset
|
371 |
_screen.resize(sdl_event.resize.w, sdl_event.resize.h); |
57
911927edbdde
DriverSDL: Add support for timeouts.
Radek Brich <radek.brich@devl.cz>
parents:
55
diff
changeset
|
372 |
return true; |
53
c4263588b716
DriverSDL: Implement cursor, handle window resize.
Radek Brich <radek.brich@devl.cz>
parents:
52
diff
changeset
|
373 |
|
c4263588b716
DriverSDL: Implement cursor, handle window resize.
Radek Brich <radek.brich@devl.cz>
parents:
52
diff
changeset
|
374 |
case SDL_VIDEOEXPOSE: |
c4263588b716
DriverSDL: Implement cursor, handle window resize.
Radek Brich <radek.brich@devl.cz>
parents:
52
diff
changeset
|
375 |
_screen.redraw(); |
c4263588b716
DriverSDL: Implement cursor, handle window resize.
Radek Brich <radek.brich@devl.cz>
parents:
52
diff
changeset
|
376 |
break; |
c4263588b716
DriverSDL: Implement cursor, handle window resize.
Radek Brich <radek.brich@devl.cz>
parents:
52
diff
changeset
|
377 |
|
51
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
378 |
case SDL_KEYDOWN: |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
379 |
{ |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
380 |
//switch(event.key.keysym.sym) |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
381 |
event.type = Event::KEYPRESS; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
382 |
const char *keyname = _translate_keyname(sdl_event.key.keysym.sym); |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
383 |
// return only keyname or unicode, never both |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
384 |
if (keyname) |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
385 |
{ |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
386 |
strncpy(event.key.keyname, keyname, 10); |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
387 |
event.key.unicode = 0; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
388 |
} |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
389 |
else |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
390 |
{ |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
391 |
event.key.keyname[0] = 0; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
392 |
event.key.unicode = sdl_event.key.keysym.unicode; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
393 |
if (!event.key.unicode) |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
394 |
break; // continue loop (unknown key) |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
395 |
} |
57
911927edbdde
DriverSDL: Add support for timeouts.
Radek Brich <radek.brich@devl.cz>
parents:
55
diff
changeset
|
396 |
return true; |
51
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
397 |
} |
48
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
398 |
|
51
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
399 |
case SDL_MOUSEBUTTONDOWN: |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
400 |
case SDL_MOUSEBUTTONUP: |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
401 |
event.type = (sdl_event.type == SDL_MOUSEBUTTONDOWN) ? Event::MOUSEDOWN : Event::MOUSEUP; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
402 |
event.mouse.x = sdl_event.button.x / _screen.get_cell_width(); |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
403 |
event.mouse.y = sdl_event.button.y / _screen.get_cell_height(); |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
404 |
event.mouse.button = sdl_event.button.button; |
55
1ab0edd5d784
DriverSDL: mousewheel, key repeation.
Radek Brich <radek.brich@devl.cz>
parents:
54
diff
changeset
|
405 |
if (sdl_event.button.button == SDL_BUTTON_WHEELUP || sdl_event.button.button == SDL_BUTTON_WHEELDOWN) |
1ab0edd5d784
DriverSDL: mousewheel, key repeation.
Radek Brich <radek.brich@devl.cz>
parents:
54
diff
changeset
|
406 |
{ |
1ab0edd5d784
DriverSDL: mousewheel, key repeation.
Radek Brich <radek.brich@devl.cz>
parents:
54
diff
changeset
|
407 |
if (sdl_event.type == SDL_MOUSEBUTTONUP) |
1ab0edd5d784
DriverSDL: mousewheel, key repeation.
Radek Brich <radek.brich@devl.cz>
parents:
54
diff
changeset
|
408 |
break; // do not report button-up events for mouse wheel |
1ab0edd5d784
DriverSDL: mousewheel, key repeation.
Radek Brich <radek.brich@devl.cz>
parents:
54
diff
changeset
|
409 |
event.type = Event::MOUSEWHEEL; |
1ab0edd5d784
DriverSDL: mousewheel, key repeation.
Radek Brich <radek.brich@devl.cz>
parents:
54
diff
changeset
|
410 |
} |
51
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
411 |
_mousemove_last_x = -1; |
57
911927edbdde
DriverSDL: Add support for timeouts.
Radek Brich <radek.brich@devl.cz>
parents:
55
diff
changeset
|
412 |
return true; |
48
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
413 |
|
51
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
414 |
case SDL_MOUSEMOTION: |
53
c4263588b716
DriverSDL: Implement cursor, handle window resize.
Radek Brich <radek.brich@devl.cz>
parents:
52
diff
changeset
|
415 |
if (sdl_event.motion.state == 0) |
c4263588b716
DriverSDL: Implement cursor, handle window resize.
Radek Brich <radek.brich@devl.cz>
parents:
52
diff
changeset
|
416 |
break; // continue loop, do not report move events when no button is pressed |
51
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
417 |
event.type = Event::MOUSEMOVE; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
418 |
event.mouse.x = sdl_event.motion.x / _screen.get_cell_width(); |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
419 |
event.mouse.y = sdl_event.motion.y / _screen.get_cell_height(); |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
420 |
if (_mousemove_last_x != event.mouse.x || |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
421 |
_mousemove_last_y != event.mouse.y) |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
422 |
{ |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
423 |
_mousemove_last_x = event.mouse.x; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
424 |
_mousemove_last_y = event.mouse.y; |
57
911927edbdde
DriverSDL: Add support for timeouts.
Radek Brich <radek.brich@devl.cz>
parents:
55
diff
changeset
|
425 |
return true; |
51
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
426 |
} |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
427 |
break; // continue loop when mouse position did not change |
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
428 |
|
51
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
429 |
default: |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
430 |
break; // continue loop |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
431 |
} |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
432 |
} |
58
50308ed5e4f9
sdlterm: Cleanup exceptions.
Radek Brich <radek.brich@devl.cz>
parents:
57
diff
changeset
|
433 |
throw SDLTermError(std::string("SDL_WaitEvent: ") + SDL_GetError()); |
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
434 |
} |
48
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
435 |
|
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
436 |
|
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
437 |
const char *Terminal::_translate_keyname(SDLKey sym) |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
438 |
{ |
51
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
439 |
switch (sym) |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
440 |
{ |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
441 |
case SDLK_BACKSPACE: return "backspace"; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
442 |
case SDLK_TAB: return "tab"; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
443 |
case SDLK_RETURN: return "enter"; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
444 |
case SDLK_KP_ENTER: return "enter"; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
445 |
case SDLK_ESCAPE: return "escape"; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
446 |
case SDLK_DELETE: return "delete"; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
447 |
case SDLK_INSERT: return "insert"; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
448 |
case SDLK_UP: return "up"; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
449 |
case SDLK_DOWN: return "down"; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
450 |
case SDLK_LEFT: return "left"; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
451 |
case SDLK_RIGHT: return "right"; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
452 |
case SDLK_HOME: return "home"; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
453 |
case SDLK_END: return "end"; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
454 |
case SDLK_PAGEUP: return "pageup"; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
455 |
case SDLK_PAGEDOWN: return "pagedown"; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
456 |
case SDLK_F1: return "f1"; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
457 |
case SDLK_F2: return "f2"; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
458 |
case SDLK_F3: return "f3"; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
459 |
case SDLK_F4: return "f4"; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
460 |
case SDLK_F5: return "f5"; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
461 |
case SDLK_F6: return "f6"; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
462 |
case SDLK_F7: return "f7"; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
463 |
case SDLK_F8: return "f8"; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
464 |
case SDLK_F9: return "f9"; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
465 |
case SDLK_F10: return "f10"; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
466 |
case SDLK_F11: return "f11"; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
467 |
case SDLK_F12: return "f12"; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
468 |
case SDLK_PRINT: return "print"; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
469 |
case SDLK_SCROLLOCK: return "scrllock"; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
470 |
case SDLK_PAUSE: return "pause"; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
471 |
default: return NULL; |
dce7325109c1
Clean up: expand unwanted tabs.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
472 |
} |
48
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
473 |
} |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
474 |
|
57
911927edbdde
DriverSDL: Add support for timeouts.
Radek Brich <radek.brich@devl.cz>
parents:
55
diff
changeset
|
475 |
|
911927edbdde
DriverSDL: Add support for timeouts.
Radek Brich <radek.brich@devl.cz>
parents:
55
diff
changeset
|
476 |
Uint32 Terminal::_wait_event_callback(Uint32 interval, void *param) |
911927edbdde
DriverSDL: Add support for timeouts.
Radek Brich <radek.brich@devl.cz>
parents:
55
diff
changeset
|
477 |
{ |
911927edbdde
DriverSDL: Add support for timeouts.
Radek Brich <radek.brich@devl.cz>
parents:
55
diff
changeset
|
478 |
SDL_Event event; |
911927edbdde
DriverSDL: Add support for timeouts.
Radek Brich <radek.brich@devl.cz>
parents:
55
diff
changeset
|
479 |
event.type = SDL_USEREVENT; |
911927edbdde
DriverSDL: Add support for timeouts.
Radek Brich <radek.brich@devl.cz>
parents:
55
diff
changeset
|
480 |
event.user.code = 1; |
911927edbdde
DriverSDL: Add support for timeouts.
Radek Brich <radek.brich@devl.cz>
parents:
55
diff
changeset
|
481 |
SDL_PushEvent(&event); |
911927edbdde
DriverSDL: Add support for timeouts.
Radek Brich <radek.brich@devl.cz>
parents:
55
diff
changeset
|
482 |
return 0; |
911927edbdde
DriverSDL: Add support for timeouts.
Radek Brich <radek.brich@devl.cz>
parents:
55
diff
changeset
|
483 |
} |
911927edbdde
DriverSDL: Add support for timeouts.
Radek Brich <radek.brich@devl.cz>
parents:
55
diff
changeset
|
484 |