Advertisement
gopro2027

Help Text UI

Oct 21st, 2020
2,400
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.18 KB | None | 0 0
  1. char MenuArray[500];
  2. int MenuArrayPlace = 0;
  3. char MenuArrayBreak[] = "~n~~s~";
  4.  
  5. //reset menu
  6. void beginMenu() {
  7.     MenuArrayPlace = 0;
  8.     for (int i = 0; i < 500; i++)
  9.         MenuArray[i] = 0;
  10. }
  11.  
  12. //remove from screen
  13. void closeMiniMenu() {
  14.     *(volatile int*)(0x020672EC + 0x03) = 0x02;
  15. }
  16.  
  17. //show on screen
  18. void openMiniMenu() {
  19.     *(volatile int*)(0x020672EC + 0x03) = 0x03;
  20. }
  21.  
  22. //add line to menu
  23. void pushMenu(char *text) {
  24.     int j = 0;
  25.     while (text[j] != 0) {
  26.         if (MenuArrayPlace < 500) {
  27.             MenuArray[MenuArrayPlace] = text[j];
  28.             MenuArrayPlace++;
  29.         }
  30.         j++;
  31.     }
  32.     j = 0;
  33.     while (MenuArrayBreak[j] != 0) {
  34.         if (MenuArrayPlace < 500) {
  35.             MenuArray[MenuArrayPlace] = MenuArrayBreak[j];
  36.             MenuArrayPlace++;
  37.         }
  38.         j++;
  39.     }
  40. }
  41.  
  42. //add title
  43. void addTitle(char *text) {
  44.     beginMenu();
  45.     char *red = "~r~";
  46.     int j = 0;
  47.     while (red[j] != 0) {
  48.         if (MenuArrayPlace < 500) {
  49.             MenuArray[MenuArrayPlace] = red[j];
  50.             MenuArrayPlace++;
  51.         }
  52.         j++;
  53.     }
  54.     pushMenu(text);
  55. }
  56.  
  57.  
  58. //add option line
  59. void addOption(char *text) {
  60.     pushMenu(text);
  61. }
  62.  
  63. //draw the menu on the screen
  64. void popMenu() {
  65.     for (int i = 0; i < 500; i++)
  66.         *(char*)(0x02066BDC+i) = MenuArray[i];
  67. }
  68.  
  69.  
  70.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement