Revision 253
commited some stuff
proj/include/graph.h | ||
---|---|---|
3 | 3 |
|
4 | 4 |
#include "graph_macros.h" |
5 | 5 |
|
6 |
// Colors in RBG (8 bit) |
|
7 |
#define GRAPH_BLACK 0x000000 |
|
8 |
#define GRAPH_WHITE 0xFFFFFF |
|
9 |
|
|
10 |
// Alpha |
|
11 |
#define ALPHA_THRESHOLD 0x7F |
|
12 |
|
|
6 | 13 |
/// MACROS |
7 | 14 |
#define GET_ALP(n) (0xFF & ((n) >> 24)) |
8 | 15 |
#define GET_RED(n) (0xFF & ((n) >> 16)) |
proj/include/graph_macros.h | ||
---|---|---|
1 | 1 |
#ifndef GRAPHICS_MACROS_H_INCLUDED |
2 | 2 |
#define GRAPHICS_MACROS_H_INCLUDED |
3 | 3 |
|
4 |
#define VC_BIOS_SERV 0x10 /** @brief Interrupt service of video card */ |
|
5 |
#define VBE_CALL 0x4F /** @brief VBE call function specifier */ |
|
6 | 4 |
|
7 |
#define MBYTE_BASE 0x0 /** @brief Base address (zero address) */ |
|
8 |
#define MBYTE_SIZE 0xFFFFF /** @brief Size of a mebibyte */ |
|
9 | 5 |
|
10 |
// Graphics Functions |
|
11 |
#define VBE_CTRL_INFO 0x00 /** @brief Get VBE Controller Information */ |
|
12 |
#define VBE_MD_INFO 0x01 /** @brief Get VBE Mode Information */ |
|
13 |
#define SET_VBE_MD 0x02 /** @brief Set VBE Mode */ |
|
14 |
|
|
15 |
// Error codes (AH) |
|
16 |
#define AH_SUCCESS 0x00 /** @brief Success code on BIOS call */ |
|
17 |
#define AH_FUNC_CALL_FAIL 0x01 /** @brief Function call failed */ |
|
18 |
#define AH_FUNC_NOT_SUPP 0x02 /** @brief Function call is not supported in current HW configuration */ |
|
19 |
#define AH_FUNC_INVALID 0x03 /** @brief Invalid function in current video mode */ |
|
20 |
|
|
21 |
// Graphics modes |
|
22 |
#define INDEXED_1024_768 0x105 |
|
23 |
#define DIRECT_640_480_888 0x110 |
|
24 |
#define DIRECT_800_600_888 0x115 |
|
25 |
#define DIRECT_1024_768_888 0x118 |
|
26 |
#define DIRECT_1280_1024_565 0x11A |
|
27 |
#define DIRECT_1280_1024_888 0x11B |
|
28 |
#define LINEAR_FRAME_BUFFER_MD BIT(14) |
|
29 |
|
|
30 |
// Colors in RBG (8 bit) |
|
31 |
#define BLACK 0x000000 |
|
32 |
#define WHITE 0xFFFFFF |
|
33 |
|
|
34 |
// Alpha |
|
35 |
#define ALPHA_THRESHOLD 0x7F |
|
36 |
|
|
37 | 6 |
#endif /* end of include guard: GRAPHICS_MACROS_H_INCLUDED */ |
proj/src/font.c | ||
---|---|---|
112 | 112 |
ret->x = 0; |
113 | 113 |
ret->y = 0; |
114 | 114 |
ret->size = 25; |
115 |
ret->color = BLACK; |
|
115 |
ret->color = GRAPH_BLACK;
|
|
116 | 116 |
ret->valign = text_valign_top; |
117 | 117 |
ret->halign = text_halign_left; |
118 | 118 |
return ret; |
proj/src/graph.c | ||
---|---|---|
5 | 5 |
#include "errors.h" |
6 | 6 |
#include <stdio.h> |
7 | 7 |
|
8 |
#define VC_BIOS_SERV 0x10 /** @brief Interrupt service of video card */ |
|
9 |
#define VBE_CALL 0x4F /** @brief VBE call function specifier */ |
|
10 |
|
|
11 |
#define MBYTE_BASE 0x0 /** @brief Base address (zero address) */ |
|
12 |
#define MBYTE_SIZE 0xFFFFF /** @brief Size of a mebibyte */ |
|
13 |
|
|
14 |
// Graphics Functions |
|
15 |
#define VBE_CTRL_INFO 0x00 /** @brief Get VBE Controller Information */ |
|
16 |
#define VBE_MD_INFO 0x01 /** @brief Get VBE Mode Information */ |
|
17 |
#define SET_VBE_MD 0x02 /** @brief Set VBE Mode */ |
|
18 |
|
|
19 |
// Error codes (AH) |
|
20 |
#define AH_SUCCESS 0x00 /** @brief Success code on BIOS call */ |
|
21 |
#define AH_FUNC_CALL_FAIL 0x01 /** @brief Function call failed */ |
|
22 |
#define AH_FUNC_NOT_SUPP 0x02 /** @brief Function call is not supported in current HW configuration */ |
|
23 |
#define AH_FUNC_INVALID 0x03 /** @brief Invalid function in current video mode */ |
|
24 |
|
|
25 |
// Graphics modes |
|
26 |
#define INDEXED_1024_768 0x105 |
|
27 |
#define DIRECT_640_480_888 0x110 |
|
28 |
#define DIRECT_800_600_888 0x115 |
|
29 |
#define DIRECT_1024_768_888 0x118 |
|
30 |
#define DIRECT_1280_1024_565 0x11A |
|
31 |
#define DIRECT_1280_1024_888 0x11B |
|
32 |
#define LINEAR_FRAME_BUFFER_MD BIT(14) |
|
33 |
|
|
34 |
|
|
35 |
|
|
36 |
|
|
37 |
|
|
8 | 38 |
/// MACROS |
9 | 39 |
#define FAR2PHYS(n) ((((n)>>12) & 0xFFFFFFF0) + ((n) & 0x0000FFFF)) |
10 | 40 |
|
proj/src/proj_func.c | ||
---|---|---|
212 | 212 |
ret->t0 == NULL || ret->t1 == NULL || ret->t2 == NULL || |
213 | 213 |
ret->frame == NULL) return NULL; |
214 | 214 |
// VISUAL |
215 |
rectangle_set_fill_color(ret->r0, BLACK); |
|
215 |
rectangle_set_fill_color(ret->r0, GRAPH_BLACK);
|
|
216 | 216 |
rectangle_set_outline_width(ret->r0, 2); |
217 |
rectangle_set_outline_color(ret->r0, WHITE); |
|
218 |
rectangle_set_fill_color(ret->r1, BLACK); |
|
217 |
rectangle_set_outline_color(ret->r0, GRAPH_WHITE);
|
|
218 |
rectangle_set_fill_color(ret->r1, GRAPH_BLACK);
|
|
219 | 219 |
rectangle_set_outline_width(ret->r1, 2); |
220 |
rectangle_set_outline_color(ret->r1, WHITE); |
|
221 |
rectangle_set_fill_color(ret->r2, BLACK); |
|
220 |
rectangle_set_outline_color(ret->r1, GRAPH_WHITE);
|
|
221 |
rectangle_set_fill_color(ret->r2, GRAPH_BLACK);
|
|
222 | 222 |
rectangle_set_outline_width(ret->r2, 2); |
223 |
rectangle_set_outline_color(ret->r2, WHITE); |
|
223 |
rectangle_set_outline_color(ret->r2, GRAPH_WHITE);
|
|
224 | 224 |
text_set_valign(ret->t0, text_valign_center); |
225 | 225 |
text_set_halign(ret->t0, text_halign_center); |
226 | 226 |
text_set_color(ret->t0, TEXT_COLOR); |
... | ... | |
230 | 230 |
text_set_valign(ret->t2, text_valign_center); |
231 | 231 |
text_set_halign(ret->t2, text_halign_center); |
232 | 232 |
text_set_color(ret->t2, TEXT_COLOR); |
233 |
rectangle_set_fill_color(ret->frame, BLACK); |
|
233 |
rectangle_set_fill_color(ret->frame, GRAPH_BLACK);
|
|
234 | 234 |
rectangle_set_outline_width(ret->frame, 6); |
235 |
rectangle_set_outline_color(ret->frame, WHITE); |
|
235 |
rectangle_set_outline_color(ret->frame, GRAPH_WHITE);
|
|
236 | 236 |
// POSITIONS |
237 | 237 |
rectangle_set_pos(ret->r0, |
238 | 238 |
graph_get_XRes()/2 - rectangle_get_w(ret->r0)/2, |
... | ... | |
290 | 290 |
rectangle_draw(menu->r0); |
291 | 291 |
rectangle_draw(menu->r1); |
292 | 292 |
rectangle_draw(menu->r2); |
293 |
rectangle_set_fill_color(menu->r0, BLACK); |
|
293 |
rectangle_set_fill_color(menu->r0, GRAPH_BLACK);
|
|
294 | 294 |
break; |
295 | 295 |
case TEST: |
296 | 296 |
rectangle_set_fill_color(menu->r1, HIGHLIGHT_COLOR); |
297 | 297 |
rectangle_draw(menu->r0); |
298 | 298 |
rectangle_draw(menu->r1); |
299 | 299 |
rectangle_draw(menu->r2); |
300 |
rectangle_set_fill_color(menu->r1, BLACK); |
|
300 |
rectangle_set_fill_color(menu->r1, GRAPH_BLACK);
|
|
301 | 301 |
break; |
302 | 302 |
case EXIT: |
303 | 303 |
rectangle_set_fill_color(menu->r2, HIGHLIGHT_COLOR); |
304 | 304 |
rectangle_draw(menu->r0); |
305 | 305 |
rectangle_draw(menu->r1); |
306 | 306 |
rectangle_draw(menu->r2); |
307 |
rectangle_set_fill_color(menu->r2, BLACK); |
|
307 |
rectangle_set_fill_color(menu->r2, GRAPH_BLACK);
|
|
308 | 308 |
break; |
309 | 309 |
default: |
310 | 310 |
rectangle_draw(menu->r0); |
Also available in: Unified diff