Skip to content
Snippets Groups Projects
Commit d423b378 authored by Horváth Ádám's avatar Horváth Ádám
Browse files

lehet végleges

parent 21b41b66
Branches
No related tags found
No related merge requests found
main.cpp 0 → 100644
#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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment