summaryrefslogtreecommitdiff
path: root/src/screen.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/screen.c')
-rw-r--r--src/screen.c137
1 files changed, 137 insertions, 0 deletions
diff --git a/src/screen.c b/src/screen.c
new file mode 100644
index 0000000..d79ec3c
--- /dev/null
+++ b/src/screen.c
@@ -0,0 +1,137 @@
1/***
2 * Screen - The actual point of this godforsaken project
3 *
4 * This file's goal is to "render" a slot machine that the soon-to-be unlucky victim must play to get their
5 * files back. To do this, I am using curses and probably the menu library to create the TUI. Once I figure
6 * out how to actually do this, everything should work hopefully maybe
7 *
8Example window layout
9
10Random Phrases list:
11 > WE CLOWN IN THIS MF, TAKE YO SENSITIVE ASS BACK TO @GENTOOMEMES
12 > R.I.P VxHeaven
13 > tmp(2) nuked by Smelly
14 > 99% of Randomware Operators quit before compromising a bank
15 > Equation Group wuz here
16 > Lazarus wuz here
17 > LockBit wuz here
18 > Sponsored by Equation Group
19 > Sponsored by Lazarus
20 > Sponsored by LockBit
21 > Free my boy Ross Ulbricht he did nothing wrong
22 > Stay off the dark web, kids
23 > FREE BITCOIN JUST 3 SPINS AWAY
24 > We all glow in the dark
25 > Shoutouts to Simpleflips
26 > Shoutouts to BugHunter
27 > Shoutouts to EyeDeeKay
28 > :beecat:
29 > :3
30
31======================================================== (Window 1) (One line long, top of screen)
32VX-GAMBLEGROUND: <Random phrase from list of phrases>
33======================================================== (End Window 1) (Takes up space between top & bottom windows)
34======================================================== (Window 2)
35
36SLOTS HERE
37
38======================================================== (End Window 2)
39======================================================== (Window 3) (One line long, bottom of screen)
40> Spin > Buy Spins > Quit
41======================================================== (End Window 3)
42 */
43
44#define _GNU_SOURCE
45
46#include "screen.h"
47#include <curses.h>
48#include <menu.h>
49#include <locale.h>
50
51#include <errno.h>
52#include <error.h>
53
54#include <stdio.h>
55#include <stdlib.h>
56
57#define STATIC_ARRSIZE(arr) (sizeof((arr)) / sizeof((arr)[0]))
58
59static const char *menu_choices[] = {
60 "Spin",
61 "Buy spins",
62 "Quit",
63 NULL
64};
65
66int main() {
67 if(setlocale(LC_ALL, "") == NULL) // Clear out the locale so it doesn't default to ncurses' ISO-8859-1 setting
68 error(1, errno, "Could not set proper locale");
69
70 if(initscr() == NULL) // Initialize curses
71 error(1, errno, "Could not init standard screen");
72
73 if(has_colors()) { // Init colors if available & create color pairings
74 start_color();
75
76 // Init colors here
77
78 //init_color();
79 }
80
81 cbreak(); // Disables character buffering
82 noecho(); // Disable echoing characters
83 keypad(stdscr, TRUE); // Enable keypad on the standard screen
84
85 int row = -1, col = -1;
86 getmaxyx(stdscr, row, col);
87
88
89 /* Ignore
90 for(int c = getch();; c = getch())
91 mvaddch(c % row, c % col, c | A_BOLD);
92 //*/
93
94 /* Menu example
95 ITEM **items;
96 MENU *menu;
97
98 items = calloc(STATIC_ARRSIZE(menu_choices) + 1, sizeof(ITEM*));
99 if(items == NULL)
100 error(-1, errno, "Could not allocate space for menu items");
101
102 for(long unsigned int i = 0; i < STATIC_ARRSIZE(menu_choices); i++)
103 items[i] = new_item(menu_choices[i], menu_choices[i]);
104 items[STATIC_ARRSIZE(menu_choices)] = NULL;
105
106 menu = new_menu(items);
107 mvprintw(LINES - 2, 0, "F1 to Exit");
108 post_menu(menu);
109 refresh();
110
111 int c;
112 while((c = getch()) != KEY_F(1)) {
113 switch(c) {
114 case KEY_DOWN:
115 menu_driver(menu, REQ_DOWN_ITEM);
116 break;
117
118 case KEY_UP:
119 menu_driver(menu, REQ_UP_ITEM);
120 break;
121
122 case KEY_ENTER:
123 break;
124 }
125 }
126
127
128 for(long unsigned int i = 0; i < STATIC_ARRSIZE(menu_choices); i++)
129 free_item(items[i]);
130 free_menu(menu);
131 //*/
132
133
134
135 endwin(); // Clean up curses
136 return 0;
137} \ No newline at end of file