diff --git a/README.md b/README.md index 8feb0f0..d38edcf 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,21 @@ # xurses -Xurses... \ No newline at end of file +xurses -- Library for creation of simple programs in terminal. + +- Everything related to my libraries is clean of all warning options on Clang, GCC and Valgrind. +- I don't know what else to write here, program is being done in my free time, so expect more... + +Compile: +```bash +$ sh compile.sh +``` + +Install: +```bash +$ sudo sh install.sh +``` + +Testing: +```bash +$ sh example/testing.sh +``` diff --git a/compile.sh b/compile.sh index c041afa..2c440f9 100644 --- a/compile.sh +++ b/compile.sh @@ -2,6 +2,6 @@ set -xe -gcc -g -ansi -Wall -Wextra -Wpedantic -Werror -c -o xurses.o xurses.c +gcc -g -ansi -Wall -Wextra -Wpedantic -Werror -Ofast -c -o xurses.o xurses.c exit diff --git a/example/compile.sh b/example/compile.sh new file mode 100644 index 0000000..d0ffc31 --- /dev/null +++ b/example/compile.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +set -xe + +#~gcc -g -ansi -Wall -Wextra -Wpedantic -Werror -o ./example/view ./example/view.c /usr/include/xolatile/xurses.o +gcc -g -ansi -Wall -Wextra -Wpedantic -Werror -o ./example/view ./example/view.c +#~gcc -g -ansi -Wall -Wextra -Wpedantic -Werror -c -o ./example/view.o ./example/view.c +#~gcc -o ./example/view ./example/view.o /usr/include/xolatile/xurses.o + +valgrind --show-leak-kinds=all --leak-check=full --log-file=./example/view.log ./example/view + +xighlight -V < ./example/view.log + +exit diff --git a/example/view b/example/view new file mode 100755 index 0000000..ad1b8de Binary files /dev/null and b/example/view differ diff --git a/example/view.c b/example/view.c new file mode 100644 index 0000000..f8a889a --- /dev/null +++ b/example/view.c @@ -0,0 +1,37 @@ +#include +#include + +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); +} diff --git a/example/view.log b/example/view.log new file mode 100644 index 0000000..2ddaf6b --- /dev/null +++ b/example/view.log @@ -0,0 +1,15 @@ +==29652== Memcheck, a memory error detector +==29652== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al. +==29652== Using Valgrind-3.14.0 and LibVEX; rerun with -h for copyright info +==29652== Command: ./example/view +==29652== Parent PID: 29646 +==29652== +==29652== +==29652== HEAP SUMMARY: +==29652== in use at exit: 0 bytes in 0 blocks +==29652== total heap usage: 1 allocs, 1 frees, 88,766 bytes allocated +==29652== +==29652== All heap blocks were freed -- no leaks are possible +==29652== +==29652== For counts of detected and suppressed errors, rerun with: -v +==29652== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) diff --git a/example/view.o b/example/view.o new file mode 100644 index 0000000..22e79a4 Binary files /dev/null and b/example/view.o differ