From 567d14881df3e405bd9f955c18978cf14ee4c12b Mon Sep 17 00:00:00 2001 From: "@syxhe" Date: Fri, 30 Aug 2024 18:11:32 -0500 Subject: lol, lmao --- src/screen.c | 142 ++++++++++++++++++++++++++++++----------------------------- 1 file changed, 72 insertions(+), 70 deletions(-) (limited to 'src/screen.c') diff --git a/src/screen.c b/src/screen.c index 7018c2a..e70bf21 100644 --- a/src/screen.c +++ b/src/screen.c @@ -396,7 +396,7 @@ int rangemod(int x, int offset, int min, int max) { return ((x - min + offset) % (max - min + 1)) + min; } -static int init_rgb_color(int colornum, int red, int green, int blue) { +int init_rgb_color(int colornum, int red, int green, int blue) { int nred = normalize(red, RGB_MIN, RGB_MAX, CURSESCOLOR_MIN, CURSESCOLOR_MAX); int ngreen = normalize(green, RGB_MIN, RGB_MAX, CURSESCOLOR_MIN, CURSESCOLOR_MAX); int nblue = normalize(blue, RGB_MIN, RGB_MAX, CURSESCOLOR_MIN, CURSESCOLOR_MAX); @@ -429,72 +429,74 @@ int mvwcreate_box(WINDOW *win, int y, int x, int height, int width, const chtype //////////////////////////////////// MAIN //////////////////////////////////// -int main() { - // I have no fucking clue why gcc complains that this isn't properly bracketed. Maybe im rarted - const struct sigaction handler = { - .sa_flags = SA_SIGINFO, - .sa_mask = SIGINT | SIGWINCH, - .sa_sigaction = catcher, - }; - doinit(&handler); - - docolors(); - - // Variable definitions - ITEM *items[STATIC_ARRSIZE(menu_choices) + 1]; // An array of ITEM pointers large enough to store all the menu items - struct params params; // Function pointer used for callbacks in the menu driver - WINDOW *menuholder = NULL; // The window for displaying the menu - int row = -1, col = -1; // The rows and columns of the main screen - uint32_t randomnum; // A random number for getting the banner phrase - MENU *menu; // The actual menu object - - struct slotholder slots; - - getmaxyx(stdscr, row, col); - randomnum = randombytes_uniform(STATIC_ARRSIZE(phrases) + 1); - - WINDOW *banner = create_banner(col, randomnum); - init_items(items, menu_choices, STATIC_ARRSIZE(menu_choices), userfuncs); - - // No point in moving this into a function - menu = new_menu(items); - if(menu == NULL) { - endwin(); - error(1, errno, "Could not create menu"); - } - - // Set up the menuholder & init everything - menuholder = newwin(1, col, row - 1, 0); - keypad(menuholder, TRUE); - init_custom_menu_format(menuholder, menu, (int []){1, col}, O_ONEVALUE | O_IGNORECASE, O_SHOWDESC | O_NONCYCLIC); - - - slots.slotwin = newwin(row - 2, col, 1, 0); - if(slots.slotwin == NULL) { - endwin(); - error(1, errno, "[VX-GAMBLEGROUND] Could not create slots window"); - } - - init_slotholder(&slots); - - doupdate(); - - params.bannerwin = banner; - params.menu = menu; - params.menuholder = menuholder; - params.numspins = 3; - params.price = 1; - params.slots = &slots; - - handle_input(menuholder, menu, ¶ms); - - // Clean up the menu - unpost_menu(menu); - free_menu(menu); - for(long unsigned int i = 0; i < STATIC_ARRSIZE(menu_choices); i++) - free_item(items[i]); - //*/ - - endwin(); // Clean up curses - return 0; -} \ No newline at end of file +// Use this as an example for implementing screen's functions in another file + +// int main() { +// // I have no fucking clue why gcc complains that this isn't properly bracketed. Maybe im rarted +// const struct sigaction handler = { +// .sa_flags = SA_SIGINFO, +// .sa_mask = SIGINT | SIGWINCH, +// .sa_sigaction = catcher, +// }; +// doinit(&handler); + +// docolors(); + +// // Variable definitions +// ITEM *items[STATIC_ARRSIZE(menu_choices) + 1]; // An array of ITEM pointers large enough to store all the menu items +// struct params params; // Function pointer used for callbacks in the menu driver +// WINDOW *menuholder = NULL; // The window for displaying the menu +// int row = -1, col = -1; // The rows and columns of the main screen +// uint32_t randomnum; // A random number for getting the banner phrase +// MENU *menu; // The actual menu object + +// struct slotholder slots; + +// getmaxyx(stdscr, row, col); +// randomnum = randombytes_uniform(STATIC_ARRSIZE(phrases) + 1); + +// WINDOW *banner = create_banner(col, randomnum); +// init_items(items, menu_choices, STATIC_ARRSIZE(menu_choices), userfuncs); + +// // No point in moving this into a function +// menu = new_menu(items); +// if(menu == NULL) { +// endwin(); +// error(1, errno, "Could not create menu"); +// } + +// // Set up the menuholder & init everything +// menuholder = newwin(1, col, row - 1, 0); +// keypad(menuholder, TRUE); +// init_custom_menu_format(menuholder, menu, (int []){1, col}, O_ONEVALUE | O_IGNORECASE, O_SHOWDESC | O_NONCYCLIC); + + +// slots.slotwin = newwin(row - 2, col, 1, 0); +// if(slots.slotwin == NULL) { +// endwin(); +// error(1, errno, "[VX-GAMBLEGROUND] Could not create slots window"); +// } + +// init_slotholder(&slots); + +// doupdate(); + +// params.bannerwin = banner; +// params.menu = menu; +// params.menuholder = menuholder; +// params.numspins = 3; +// params.price = 1; +// params.slots = &slots; + +// handle_input(menuholder, menu, ¶ms); + +// // Clean up the menu +// unpost_menu(menu); +// free_menu(menu); +// for(long unsigned int i = 0; i < STATIC_ARRSIZE(menu_choices); i++) +// free_item(items[i]); +// //*/ + +// endwin(); // Clean up curses +// return 0; +// } \ No newline at end of file -- cgit v1.2.3