int main() { Price myPrice; myPrice.bid = 45; myPrice.ask = 46; int a = 50; Fl_Window win(1200, 900, "Michael Window"); /////////////////////////////////////////////////////// //Window Construction win.begin(); Fl_Button upBtn(200,10,100,20,"Up"); Fl_Button startBtn(10,30,100,20,"Start"); Fl_Button stopBtn(400,30,100,20,"Stop"); Fl_Button downBtn(200,50,100,20,"Down"); Fl_Output output(200, 100, 100, 20, "Output"); win.end(); ///////////////////////////////////////////////// startBtn.callback(OnStartClick, &myPrice); upBtn.callback(OnUpClick, &output); stopBtn.callback(OnStartClick, &myPrice); downBtn.callback(OnStartClick, &myPrice); win.show(); Fl::run(); ++a; }
void Menu::create(std::shared_ptr<EngineHelper> engine) { engine->actualScene.reset(new mgf::Node("menuScene")); engine->overlay.reset(new mgf::Overlay()); /* * Create buttons */ float x = 0.0; float y = 0.0; float dividend = 0.5; if (engine->isCurrentDisplayMode()) dividend = 0.5; std::cout << dividend << std::endl; std::shared_ptr<mgf::Label> titleLbl(new mgf::Label("titleLbl")); titleLbl->setBackground("res/images/elemente/transparent.png"); titleLbl->setFont("res/fonts/main.ttf"); titleLbl->setText("Clash of Mages"); titleLbl->setColor(glm::vec3(255,165,0)); // some green x = (dividend - titleLbl->getScale()[0] / 2); titleLbl->scale(glm::vec2(4,2)); titleLbl->translate(glm::vec2(x, 0.0f)); engine->overlay->add(titleLbl); std::shared_ptr<mgf::Button> startBtn(new mgf::Button("startBtn")); startBtn->setBackground("res/images/elemente/play.png"); x = (dividend - startBtn->getScale()[0] / 2); y = (0.3f/engine->w->getAspectRatio() + startBtn->getScale()[1]); std::cout << x <<"x"<< y << " (Start Button)" << std::endl; startBtn->translate(glm::vec2(x, y)); engine->overlay->add(startBtn); std::shared_ptr<mgf::Button> creditsBtn(new mgf::Button("creditsBtn")); creditsBtn->setBackground("res/images/elemente/credits.png"); x = (dividend - creditsBtn->getScale()[0] / 2); y += 0.1; std::cout << x <<"x"<< y << " (Settings Button)" << std::endl; creditsBtn->translate(glm::vec2(x, y)); engine->overlay->add(creditsBtn); // std::shared_ptr<mgf::Button> settingsBtn(new mgf::Button("settingsBtn")); // settingsBtn->setBackground("res/images/elemente/settings.png"); // x = (dividend/engine->w->getAspectRatio() + settingsBtn->getScale()[0]); // y += 0.1; // std::cout << x <<"x"<< y << " (Settings Button)" << std::endl; // settingsBtn->translate(glm::vec2(x, y)); // engine->overlay->add(settingsBtn); std::shared_ptr<mgf::Button> quitBtn(new mgf::Button("quitBtn")); quitBtn->setBackground("res/images/elemente/quit.png"); x = (dividend - quitBtn->getScale()[0] / 2); y += 0.1; std::cout << x <<"x"<< y << " (Quit Button)" << std::endl; quitBtn->translate(glm::vec2(x, y)); engine->overlay->add(quitBtn); /* * Set mouse pointer */ engine->pointer.reset(new mgf::Label("mouse")); engine->pointer->setBackground("res/images/Mouse.png"); engine->pointer->translate(glm::vec2(-10.f, -10.f)); std::cout << x <<"x"<< y << " (Quit Button)" << std::endl; /* * Add elements to Overlay */ engine->overlay->add(engine->pointer); }