diff options
| author | @syxhe <https://t.me/syxhe> | 2024-07-26 13:17:31 -0500 |
|---|---|---|
| committer | @syxhe <https://t.me/syxhe> | 2024-07-26 13:17:31 -0500 |
| commit | fc247603ecf22eb10192a0fcde9c140e3b35872c (patch) | |
| tree | 40c87b5108c5fc9012af518e308d9e1e0ce3fff8 /src/screen.h | |
| parent | 50f435fbc734faf6a870f0777cf3e8d3a9bd5c21 (diff) | |
Slightly refactor ncurses code & make errors not explode the terminal
Diffstat (limited to 'src/screen.h')
| -rw-r--r-- | src/screen.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/screen.h b/src/screen.h index 78e2077..5d0837e 100644 --- a/src/screen.h +++ b/src/screen.h | |||
| @@ -10,6 +10,8 @@ | |||
| 10 | #define CURSESCOLOR_MIN 0 | 10 | #define CURSESCOLOR_MIN 0 |
| 11 | #define CURSESCOLOR_MAX 1000 | 11 | #define CURSESCOLOR_MAX 1000 |
| 12 | 12 | ||
| 13 | #define FUCKED_UP_ENTER 10 | ||
| 14 | |||
| 13 | enum custom_colors { | 15 | enum custom_colors { |
| 14 | // Unspecified color | 16 | // Unspecified color |
| 15 | CC_UNSPEC = -1, | 17 | CC_UNSPEC = -1, |
| @@ -50,10 +52,20 @@ enum customcolor_pairs { | |||
| 50 | CCP_TOOBIG | 52 | CCP_TOOBIG |
| 51 | }; | 53 | }; |
| 52 | 54 | ||
| 55 | struct funcholder { | ||
| 56 | int (*callback)(void); | ||
| 57 | |||
| 58 | }; | ||
| 59 | |||
| 53 | // Converts value from within the range of [oldmin, oldmax] to a value within the range [newmin, newmax] | 60 | // Converts value from within the range of [oldmin, oldmax] to a value within the range [newmin, newmax] |
| 54 | static float normalize(float value, float oldmin, float oldmax, float newmin, float newmax); | 61 | static float normalize(float value, float oldmin, float oldmax, float newmin, float newmax); |
| 55 | 62 | ||
| 56 | // Initialize a new curses color using standard rgb values (0-255) instead of curses' 0-1000 range | 63 | // Initialize a new curses color using standard rgb values (0-255) instead of curses' 0-1000 range |
| 57 | static int init_rgb_color(int colornum, int red, int green, int blue); | 64 | static int init_rgb_color(int colornum, int red, int green, int blue); |
| 58 | 65 | ||
| 66 | int spin(void); | ||
| 67 | int buy(void); | ||
| 68 | int quit(void); | ||
| 69 | #define USERFUNCS (int (* [])(void)){spin, buy, quit} | ||
| 70 | |||
| 59 | #endif \ No newline at end of file | 71 | #endif \ No newline at end of file |
