README: mention SDL2 backend
[rofl0r-concol.git] / nopconsole.c
blob4c510d863bcc37fec28b9b504b75764ae2e62868
1 #include "console.h"
2 #include "console_keys.h"
3 #include "colors.h"
4 #include <stdarg.h>
5 #include <stdio.h>
6 #include <stddef.h>
7 #include <unistd.h>
8 #include <string.h>
11 /* initialize a Console struct */
12 void console_init(struct Console* self) {
15 /* cleanup restores the original term behaviour and releases acquired resources. */
16 void console_cleanup(struct Console* self) {
19 int console_setcolor(struct Console* self, int is_fg, rgb_t mycolor) {
20 return 1;
23 int console_getcolorcount(Console *self) { (void) self; return 8; }
25 void console_initoutput(struct Console* self) { (void) self; }
27 /* get width and height of the console display (in characters) */
28 void console_getbounds(struct Console* self, int* width, int* height) {
29 self->dim.x = *width = 80;
30 self->dim.y = *height = 25;
33 void console_goto(struct Console* self, int x, int y) {
34 self->cursor.x = x;
35 self->cursor.y = y;
38 /* prints a char and NOT advances cursor */
39 void console_addchar(struct Console* self, int c, unsigned int attributes) {
41 /* prints a char and advances cursor */
42 void console_printchar(struct Console* self, int c, unsigned int attributes) {
45 void console_putchar(Console* self, int ch, int doupdate) {
50 void console_printf (struct Console* con, const char* fmt, ...) {
53 void console_printfxy (struct Console* con, int x, int y, const char* fmt, ...) {
57 int console_getkey(struct Console* self) {
58 return '\n';
61 /* non blocking getkey. returns -1 if no data is available */
62 int console_getkey_nb(struct Console* self) {
63 return -1;
65 #undef _POSIX_C_SOURCE
66 #define _POSIX_C_SOURCE 200809L
67 #include <time.h>
68 #include <errno.h>
70 int msleep(long millisecs) {
71 struct timespec req, rem;
72 req.tv_sec = millisecs / 1000;
73 req.tv_nsec = (millisecs % 1000) * 1000 * 1000;
74 int ret;
75 while((ret = nanosleep(&req, &rem)) == -1 && errno == EINTR) req = rem;
76 return ret;
79 void console_sleep(struct Console* self, int ms) {
80 (void) self;
81 msleep(ms);
84 void console_refresh(struct Console* self) {
87 void console_clear(struct Console* self) {
90 void console_blink_cursor(struct Console* self) { (void) self; }
91 void console_lock(void) {}
92 void console_unlock(void) {}
93 void console_toggle_fullscreen(struct Console* self) { (void) self; }
95 void console_init_graphics(Console* self, point resolution, font* fnt) {
98 void console_settitle(Console *self, const char *title) {