New stuff, compilation script and examples...
This commit is contained in:
parent
9f7c946c2f
commit
fc78431d48
20
README.md
20
README.md
@ -1,3 +1,21 @@
|
||||
# xurses
|
||||
|
||||
Xurses...
|
||||
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
|
||||
```
|
||||
|
@ -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
|
||||
|
14
example/compile.sh
Normal file
14
example/compile.sh
Normal file
@ -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
|
BIN
example/view
Executable file
BIN
example/view
Executable file
Binary file not shown.
37
example/view.c
Normal file
37
example/view.c
Normal file
@ -0,0 +1,37 @@
|
||||
#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);
|
||||
}
|
15
example/view.log
Normal file
15
example/view.log
Normal file
@ -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)
|
BIN
example/view.o
Normal file
BIN
example/view.o
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user