summaryrefslogtreecommitdiff
path: root/src/screen.c
diff options
context:
space:
mode:
author@syxhe <https://t.me/syxhe>2024-08-28 16:58:12 -0500
committer@syxhe <https://t.me/syxhe>2024-08-28 16:58:12 -0500
commite02eea72455ffbd3647898b2c65dc5b6626d33b8 (patch)
tree39e3505abbfd7993bcc796222f360fa08d99fe62 /src/screen.c
parent0aa539f551560df43660943f653374b5dda35f76 (diff)
Random slots achieved
Diffstat (limited to 'src/screen.c')
-rw-r--r--src/screen.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/screen.c b/src/screen.c
index d6806ad..85bc031 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -231,7 +231,8 @@ static int init_slotholder(struct slotholder *slots) {
231 const int height = my - 2, width = mx - 2; 231 const int height = my - 2, width = mx - 2;
232 mvwcreate_box(slots->subslot[i], 1, 1, height, width, NULL); 232 mvwcreate_box(slots->subslot[i], 1, 1, height, width, NULL);
233 for(int j = 0; j < 3; j++) { 233 for(int j = 0; j < 3; j++) {
234 mvwcreate_box(slots->subslot[i], 2 + (j * (height / 3)), width / 4, height / 3, width / 2, NULL); 234 slots->slotchar[i][j] = randombytes_uniform('~' - '!' + 1) + '!';
235 mvwcreate_box(slots->subslot[i], 2 + (j * (height / 3)), (width / 4) - 1, height / 3, (width / 2) + 5 /*???????????*/, NULL);
235 } 236 }
236 237
237 wnoutrefresh(slots->subslot[i]); 238 wnoutrefresh(slots->subslot[i]);
@@ -276,7 +277,7 @@ int main() {
276 struct funcholder *p = NULL; // Function pointer used for callbacks in the menu driver 277 struct funcholder *p = NULL; // Function pointer used for callbacks in the menu driver
277 WINDOW *menuholder = NULL; // The window for displaying the menu 278 WINDOW *menuholder = NULL; // The window for displaying the menu
278 int row = -1, col = -1; // The rows and columns of the main screen 279 int row = -1, col = -1; // The rows and columns of the main screen
279 int randomnum; // A random number for getting the banner phrase 280 uint32_t randomnum; // A random number for getting the banner phrase
280 MENU *menu; // The actual menu object 281 MENU *menu; // The actual menu object
281 int c; // Integer for storing keys from user input 282 int c; // Integer for storing keys from user input
282 283
@@ -289,10 +290,6 @@ int main() {
289 } 290 }
290 291
291 randomnum = randombytes_uniform(STATIC_ARRSIZE(phrases)); 292 randomnum = randombytes_uniform(STATIC_ARRSIZE(phrases));
292 if(randomnum < 0) {
293 endwin();
294 error(1, errno, "[VX-GAMBLEGROUND] Call to randombytes_uniform failed, can't get random phrase");
295 }
296 293
297 WINDOW *banner = create_banner(col, randomnum); 294 WINDOW *banner = create_banner(col, randomnum);
298 init_items(items, menu_choices, STATIC_ARRSIZE(menu_choices), userfuncs); 295 init_items(items, menu_choices, STATIC_ARRSIZE(menu_choices), userfuncs);
@@ -405,6 +402,18 @@ int spin(void *spinp) {
405 /* Previous solution fucked it by changing the actual color when it's supposed to be the default color to revert back to 402 /* Previous solution fucked it by changing the actual color when it's supposed to be the default color to revert back to
406 // This works better, but is also more ugly. So be it */ 403 // This works better, but is also more ugly. So be it */
407 wbkgd(p->slots->subslot[subs], COLOR_PAIR(rangemod(CCP_CURSES_DEFAULT, i + CCP_RED, CCP_RED, CCP_WHITE))); 404 wbkgd(p->slots->subslot[subs], COLOR_PAIR(rangemod(CCP_CURSES_DEFAULT, i + CCP_RED, CCP_RED, CCP_WHITE)));
405
406 p->slots->slotchar[subs][2] = p->slots->slotchar[subs][1];
407 p->slots->slotchar[subs][1] = p->slots->slotchar[subs][0];
408 p->slots->slotchar[subs][0] = randombytes_uniform('~' - '!' + 1) + '!';
409
410 // Update characters & draw them
411 int my, mx;
412 getmaxyx(p->slots->subslot[subs], my, mx);
413 for(int j = 0; j < 3; j++) {
414 mvwaddch(p->slots->subslot[subs], 2 + ((my - 2) / 6) + (((my - 2) / 3) * j), (mx - 1) / 2, p->slots->slotchar[subs][j]);
415 }
416
408 wnoutrefresh(p->slots->subslot[subs]); 417 wnoutrefresh(p->slots->subslot[subs]);
409 } 418 }
410 419