xurses/example/view.c

38 lines
1.2 KiB
C
Raw Normal View History

#include <xolatile/xtandard.c>
#include <xolatile/xurses.c>
static int i_x = 0;
static int i_y = 0;
static void i_up (void) { --i_y; limit (& i_y, 0, curses_screen_height - 1); }
static void i_down (void) { ++i_y; limit (& i_y, 0, curses_screen_height - 1); }
static void i_left (void) { --i_x; limit (& i_x, 0, curses_screen_width - 1); }
static void i_right (void) { ++i_x; limit (& i_x, 0, curses_screen_width - 1); }
int main (void) {
curses_configure ();
curses_bind (SIGNAL_W, i_up);
curses_bind (SIGNAL_S, i_down);
curses_bind (SIGNAL_A, i_left);
curses_bind (SIGNAL_D, i_right);
while (curses_active != 0) {
curses_render_background ('.', COLOUR_GREY, EFFECT_BOLD);
curses_render_character ('A', COLOUR_GREEN, EFFECT_NORMAL, 0, 1);
curses_render_character ('B', COLOUR_YELLOW, EFFECT_REVERSE, 0, 2);
curses_render_character ('C', COLOUR_WHITE, EFFECT_BLINK, 1, 0);
curses_render_character ('D', COLOUR_BLUE, EFFECT_ITALIC, 2, 0);
curses_render_string ("Heyo world!", COLOUR_RED, EFFECT_BOLD, 3, 0);
curses_render_string ("Heyo world!", COLOUR_PINK, EFFECT_BOLD, 168, 0);
curses_render_character ('@', COLOUR_CYAN, EFFECT_ITALIC, i_x, i_y);
curses_synchronize ();
}
return (EXIT_SUCCESS);
}