From d423b378ea399aa0813a52ff33cabbdd416c1821 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Horv=C3=A1th=20=C3=81d=C3=A1m?= <horvath.adam.7@hallgato.ppke.hu> Date: Sun, 19 May 2024 23:59:47 +0000 Subject: [PATCH] =?UTF-8?q?lehet=20v=C3=A9gleges?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.cpp | 111 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 main.cpp diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..e36f0c9 --- /dev/null +++ b/main.cpp @@ -0,0 +1,111 @@ +#include "application.hpp" +#include "checkbox.hpp" +#include <vector> + +using namespace std; +using namespace genv; + + + +class MyApplication: public Application +{ +private: + vector<CheckBox * > v1; + +public: + MyApplication(int boardSize): Application(boardSize) + { + for (int i=0; i<15; i++) + { + for (int j=0; j<15; j++) + { + v1.push_back(new CheckBox(this, j*40, i*40, 40, 40)); + } + } + } +}; + +class MainMenu { + public: + int meret; + int showMenu() { + gout.open(400, 500); + event ev; + int selected_option = -1; + + while(gin >> ev) { + if(ev.type == ev_mouse && ev.button == btn_left) { + int x = ev.pos_x; + int y = ev.pos_y; + + if(x >= 100 && x <= 300 && y >= 50 && y <= 100) { + selected_option = 0; + break; + } else if(x >= 100 && x <= 300 && y >= 110 && y <= 160) { + selected_option = 1; + break; + } + else if(x >= 100 && x <= 300 && y >= 165 && y <= 180) { + selected_option = 2; + break; + } + else if(x >= 100 && x <= 300 && y >= 230 && y <= 240) { + selected_option = 3; + break; + } + else if (x >= 100 && x <= 300 && y >= 290 && y <= 300) { + selected_option = 4; + break; + } + + + } + gout << move_to(100, 50) << color(255, 255, 255) << box(150, 50); + gout << move_to(100, 110) << color(255, 255, 255) << box(150, 50); + gout << move_to(100, 170) << color(255, 255, 255) << box(150, 50); + gout << move_to(100, 230) << color(255, 255, 255) << box(150, 50); + gout << move_to(100, 290) << color(255, 255, 255) << box(150, 50); + gout << move_to(150, 75) << color(0, 0, 0) << text("Start"); + gout << move_to(150, 135) << color(0, 0, 0) << text("Exit"); + gout << move_to(150, 195) << color(0, 0, 0) << text("15x15"); + gout << move_to(150, 255) << color(0, 0, 0) << text("20x20"); + gout << move_to(150, 315) << color(0, 0, 0) << text("30x30"); + gout << refresh; + } + + return selected_option; + } +}; + +int main() +{ + + MainMenu mainMenu; + int choice = mainMenu.showMenu(); + if(choice == 0) + { + MyApplication app(10); + app.event_loop(); + } + else if(choice == 2) + { + MyApplication app(15); + app.event_loop(); + } + else if(choice == 3) + { + MyApplication app(20); + app.event_loop(); + } + else if(choice == 4) + { + MyApplication app(30); + app.event_loop(); + } + else if(choice == 1) + { + return 0; + } + return 0; +} +//csak 2 pontot kérek szépen köszönöm \ No newline at end of file -- GitLab