Skip to content
Snippets Groups Projects
Select Git revision
  • d423b378ea399aa0813a52ff33cabbdd416c1821
  • main default protected
2 results

main.cpp

Blame
  • main.cpp 3.06 KiB
    #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");