README: mention SDL2 backend
[rofl0r-concol.git] / sdlconsole.h
blob4aedcc952c15b30d7d7547d086ff850d27802a87
1 #ifndef SDLCONSOLE_H
2 #define SDLCONSOLE_H
5 #include <stdint.h>
6 #include "endianness.h"
8 #include "point.h"
9 #include "rect.h"
10 #include "fonts/font.h"
11 #include "console_sel.h"
12 #include "console_events.h"
15 typedef union {
16 struct colors {
17 #ifdef IS_LITTLE_ENDIAN
18 unsigned char b;
19 unsigned char g;
20 unsigned char r;
21 unsigned char a;
22 #else
23 unsigned char a;
24 unsigned char r;
25 unsigned char g;
26 unsigned char b;
27 #endif
28 } colors;
29 uint32_t val;
30 } sdl_rgb_t;
32 #define SRGB(R,G,B) ((sdl_rgb_t) {.colors.r = R, .colors.g = G, .colors.b = B, .colors.a = 0})
33 #define SRGB_INIT(x,y,z) ({.colors.r = R, .colors.g = G, .colors.b = B, .colors.a = 0})
34 #define SRGB3(X) SRGB(X)
36 #include "colors.h"
38 #define SRGB_BLACK SRGB3(BLACK)
39 #define SRGB_WHITE SRGB3(WHITE)
40 #define SRGB_RED SRGB3(RED)
41 #define SRGB_GREEN SRGB3(GREEN)
42 #define SRGB_GREEN2 SRGB3(GREEN2)
43 #define SRGB_BLUE SRGB3(BLUE)
44 #define SRGB_YELLOW SRGB3(YELLOW)
46 #define SRGB_BLUE_NICE SRGB3(BLUE_NICE)
47 #define SRGB_GRAY_LIGHT SRGB3(GRAY_LIGHT)
48 #define SRGB_GRAY_DARK SRGB3(GRAY_DARK)
50 #define SRGB_NORTON_UTILITIES_VIOLET SRGB3(NORTON_UTILITIES_VIOLET)
51 #define SRGB_ORANGE SRGB3(ORANGE)
54 typedef struct {
55 sdl_rgb_t bgcolor;
56 sdl_rgb_t fgcolor;
57 } sdl_rgb_tuple;
59 typedef struct SDLConsole {
60 void *surface;
61 void *window;
62 void *renderer;
63 void *texture;
64 sdl_rgb_tuple color;
65 sdl_rgb_tuple* cache;
66 point res;
67 font* fnt;
68 int paintmode:1;
69 int cursorblink:1;
70 int fullscreen:1;
71 } SDLConsole;
73 #if CONSOLE_BACKEND == SDL_CONSOLE
74 #if USE_SDL2 +0 == 0
75 #pragma RcB2 LINK "-lSDL"
76 #else
77 #pragma RcB2 LINK "-lSDL2"
78 #endif
79 #pragma RcB2 DEP "sdlconsole.c"
80 #endif
82 #endif