Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <conio.h>
- #include <Windows.h>
- class champion {
- public:
- std::string name; // Nazwa bohatera
- float hp;
- float hp_g;
- float hp_r;
- float hp_r_g;
- float mana;
- float mana_g;
- float mana_r;
- float mana_r_g;
- float range;
- float ad;
- float ad_g;
- float as;
- float as_g;
- float armor;
- float armor_g;
- float mr;
- float mr_g;
- float ms;
- void assign(std::string pick)
- {
- if (pick == "ezreal")
- {
- name = "Ezreal";
- hp = 484.4; hp_g = 80;
- hp_r = 6.4; hp_r_g = 0.55;
- mana = 360.6; mana_g = 42;
- mana_r = 8.09; mana_r_g = 0.65;
- ad = 55.66; ad_g = 2.41;
- as = 0.625; as_g = 2.8;
- armor = 21.88; armor_g = 3.5;
- mr = 30; mr_g = 0;
- ms = 325; range = 550;
- }
- else if (pick == "leblanc")
- {
- name = "LeBlanc";
- hp = 516; hp_g = 80;
- hp_r = 7.42; hp_r_g = 0.55;
- mana = 334; mana_g = 50;
- mana_r = 6; mana_r_g = 0.8;
- ad = 54.88; ad_g = 3.5;
- as = 0.625; as_g = 1.4;
- armor = 21.88; armor_g = 3.5;
- mr = 30; mr_g = 0;
- ms = 340; range = 550;
- }
- return;
- }
- };
- class menu {
- private:
- void cursor(int x, int y)
- {
- COORD pozycja = { x,y };
- SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pozycja);
- return;
- }
- short key()
- {
- int k = _getch();
- k = static_cast<int>(k);
- if (k == 224) //jeśli strzałki
- {
- k = _getch(); //która strzałka? 80-w dol, 72-w górę, 75-w lewo, 77-w prawo
- k = static_cast<int>(k); // zamiana na typ int
- return k;
- }
- return k;
- }
- void clear(short x_min, short x_max, short y_min, short y_max)
- {
- for (short y = y_min; y <= y_max; y++)
- {
- for (short x = x_min; x <= x_max; x++)
- {
- cursor(x, y);
- std::cout << " ";
- }
- }
- }
- void clear(std::string opcja)
- {
- int x_min, x_max, y_min, y_max;
- if (opcja == "Blackboard")
- {
- x_min = 1;
- x_max = 17;
- y_min = 1;
- y_max = 18;
- }
- else if (opcja == "Console")
- {
- x_min = 19;
- x_max = 74;
- y_min = 1;
- y_max = 23;
- }
- else if (opcja == "Extra Menu")
- {
- x_min = 1;
- x_max = 17;
- y_min = 20;
- y_max = 23;
- }
- else
- {
- return;
- }
- for (short y = y_min; y <= y_max; y++)
- {
- for (short x = x_min; x <= x_max; x++)
- {
- cursor(x, y);
- std::cout << " ";
- }
- }
- }
- void frame()
- {
- using namespace std;
- for (short w = 1; w <= y_size; w++)
- {
- for (short z = 1; z <= x_size; z++)
- {
- if (w == 1 && z == 1)
- cout << char(201);
- else if (w == y_size && z == 1)
- cout << char(200);
- else if (w == 1 && z == x_size)
- cout << char(187);
- else if (w == y_size && z == x_size)
- cout << char(188);
- else if (w == 1 && z == x_size * 0.25)
- cout << char(203);
- else if (w == y_size && z == x_size * 0.25)
- cout << char(202);
- else if (w == y_size * 0.8 && z == 1)
- cout << char(204);
- else if (w == y_size * 0.8 && z == x_size * 0.25)
- cout << char(185);
- else if (w == 1 || w == y_size || (w == y_size * 0.8 && z < x_size * 0.25))
- cout << char(205);
- else if (z == 1 || z == x_size || z == 0.25 * x_size)
- cout << char(186);
- else
- cout << " ";
- }
- cout << endl;
- }
- }
- void line()
- {
- for (short i = 19; i < 75; i++)
- {
- cursor(i, 2);
- std::cout << "=";
- }
- return;
- }
- int x_size = 76, y_size = 25;
- public:
- std::string mainOptions[3] = { "Bohater ", "Przedmiot","Wyjscie " };
- std::string dispOptions[4] = {"Przedmiot","Runy ","Specjalizacje","Wyjscie "};
- std::string data[9] = {"HP","HP Regen","Mana","Mana Regen","AD","AS","Armor","MResist","MSpeed"};
- std::string champions[5] = { "Ezreal","Katarina","LeBlanc","Lulu","End" };
- void mainMenu()
- {
- using namespace std;
- frame();
- short pointer = 0;
- while (1)
- {
- for (short i = 0; i < 3; i++)
- {
- cursor(2, y_size*0.8 + i);
- if (i == pointer)
- {
- cout << "> ";
- }
- else
- {
- cout << " ";
- }
- cout << mainOptions[i];
- }
- short click = key();
- if (click == 72 && pointer != 0)
- {
- pointer--;
- }
- else if (click == 80 && pointer != 2)
- {
- pointer++;
- }
- else if (click == 13)
- {
- if (pointer == 0)
- {
- clear("Extra Menu");
- championMenu();
- }
- else if (pointer == 1)
- {
- continue;
- }
- else if (pointer == 2)
- {
- return;
- }
- }
- else
- {
- continue;
- }
- }
- return;
- }
- void displayMenu(std::string opcja)
- {
- using namespace std;
- clear("Console");
- champion pick;
- pick.assign(opcja);
- cursor(20, 1);
- cout << pick.name;
- line();
- cursor(20, 4); cout << "HP: " << pick.hp << " (+" << pick.hp_g << ")";
- cursor(42, 4); cout << "HP Regen: " << pick.hp_r << " (+" << pick.hp_r_g << ")";
- cursor(20, 5); cout << "Mana: " << pick.mana << " (+" << pick.mana_g << ")";
- cursor(42, 5); cout << "Mana Regen: " << pick.mana_r<< " (+" << pick.mana_r_g << ")";
- cursor(20, 6); cout << "AD: " << pick.ad << " (+" << pick.ad_g << ")";
- cursor(42, 6); cout << "AS: " << pick.as << " (+" << pick.as_g << "%)";
- cursor(20, 7); cout << "Armor: " << pick.armor << " (+" << pick.armor_g << ")";
- cursor(42, 7); cout << "MR " << pick.mr << " (+" << pick.mr_g << ")";
- cursor(20, 8); cout << "Range: " << pick.range;
- cursor(42, 8); cout << "MS: " << pick.ms;
- short pointer = 0;
- while (1)
- {
- for (short i = 0; i < 4; i++)
- {
- cursor(2, y_size*0.8 + i);
- if (i == pointer)
- {
- cout << "> ";
- }
- else
- {
- cout << " ";
- }
- cout << dispOptions[i];
- }
- short click = key();
- if (click == 72 && pointer != 0)
- {
- pointer--;
- }
- else if (click == 80 && pointer != 3)
- {
- pointer++;
- }
- else if (click == 13)
- {
- if (pointer == 0)
- {
- continue;
- }
- else if (pointer == 1)
- {
- continue;
- }
- else if (pointer == 2)
- {
- continue;
- }
- else if (pointer == 3)
- {
- clear("Console");
- clear("Extra Menu");
- return;
- }
- }
- else
- {
- continue;
- }
- }
- }
- void championMenu()
- {
- using namespace std;
- short p_x = 0, p_y = 0;
- while (1)
- {
- int lb = 0;
- for (int i = 0; ; i++)
- {
- if (champions[i] == "End")
- {
- break;
- }
- else
- {
- lb++;
- }
- }
- cursor(20, 1);
- cout << "Lista bohaterow: " << lb << endl;
- line();
- for (short i = 0; i < lb; i++)
- {
- cursor(19, 3 + i);
- if (p_y == i)
- {
- cout << "> ";
- }
- else
- {
- cout << " ";
- }
- cout << champions[i] << endl;
- }
- short click = key();
- if (click == 72 && p_y != 0)
- {
- p_y--;
- }
- else if (click == 80 && p_y != lb-1)
- {
- p_y++;
- }
- else if (click == 13)
- {
- if (p_y == 0)
- {
- displayMenu("ezreal");
- continue;
- }
- else if (p_y == 1)
- {
- return;
- }
- else if (p_y == 2)
- {
- displayMenu("leblanc");
- continue;
- }
- else if (p_y == 3)
- {
- return;
- }
- }
- else
- {
- continue;
- }
- }
- return;
- }
- };
- int main()
- {
- using namespace std;
- menu start;
- start.mainMenu();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement