int main() { Flexlay flexlay; flexlay.init(); Editor editor; GUIManager* gui = editor.get_gui_manager(); new CL_Button(CL_Rect(CL_Point(50, 50), CL_Size(100, 25)), "Hello World", gui->get_component()); EditorMap m; Tileset tileset(32); TilemapLayer tilemap(tileset, 20, 10); m.add_layer(tilemap.to_layer()); TilemapLayer::set_current(tilemap); EditorMapComponent editor_map(CL_Rect(0, 0, 799, 599), gui->get_component()); Workspace workspace(799, 599); editor_map.set_workspace(workspace); workspace.set_map(m); new CL_Button(CL_Rect(CL_Point(50, 150), CL_Size(100, 25)), "Quit", gui->get_component()); gui->run(); flexlay.deinit(); }
int main(const std::vector<std::string> &args) { GUIManager gui; GUIWindowManagerSystem wm; gui.set_window_manager(wm); gui.add_resources(clan::XMLResourceDocument("../../../Resources/GUIThemeAero/resources.xml")); gui.add_theme("../../../Resources/GUIThemeAero/theme.css"); DisplayWindowDescription win_desc; win_desc.set_allow_resize(true); win_desc.set_title("Button WM System Test Application"); win_desc.set_position(Rect(200, 200, 540, 440), false); Window window(&gui, win_desc); window.func_close().set(this, &App::on_close, &window); PushButton button(&window); button.set_geometry(Rect(10, 10, 160, 50)); button.func_clicked().set(this, &App::on_button_clicked, &button); button.set_text("Button Normal"); PushButton button_disabled(&window); button_disabled.set_geometry(Rect(10, 60, 160, 100)); button_disabled.func_clicked().set(this, &App::on_button_clicked, &button_disabled); button_disabled.set_text("Button Disabled"); button_disabled.set_enabled(false); label = new Label(&window); label->set_geometry(Rect(10, 160, 330, 180)); label->set_text("Click the buttons"); gui.exec(); return 0; }
void AnimationTestScene::ExitScene() { GUIManager* guiMgr = Engine::GetInstance()->GetModuleByType<OpenGLRenderModule>(EngineModuleType::RENDERER)->GetGUIManager(); if (guiMgr) { guiMgr->RemoveLayer("pause_menu_gui"); } Scene::ExitScene(); }
int main(int argc, char* argv[]) { // Create all the necessary objects (calls the default constructor for each) TargetDetector detector; TargetProcessor processor; NetworkController networkController; VideoDevice camera; CmdLineInterface interface(argc, argv); AppConfig config = interface.getConfig(); GUIManager gui; if(config.getIsDevice()) { camera.startCapture(config.getDeviceID()); if(config.getIsDebug()) std::cout << "Camera ready!\n"; } //init networking if(config.getIsNetworking()) networkController.startServer(); if(!config.getIsHeadless()) gui.init(); if(config.getIsDebug()) std::cout << "Im debugging! :D\n"; while(true) { networkController.waitForPing(); cv::Mat image = camera.getImage(); Target* target = detector.processImage(image); bool foundTarget = (target == NULL ? false : true); if(foundTarget) { processor.loadTarget(target); double distance = processor.calculateDistance(); networkController.sendMessage("true;" + boost::lexical_cast<std::string> (distance)); std::cout << "Target Found! Distance: " << distance; } else { networkController.sendMessage("false;"); } } return 0; }
bool SinglePlayerGameScene::Init() { if (Scene::Init()) { /*FreeLookCamera* freelookCam = FreeLookCamera::Create(); AddChild(freelookCam); SetCurrentCamera( freelookCam );*/ // create a level from the level resource std::shared_ptr<LevelResource> levelRes = Engine::GetInstance()->GetModuleByType<CachedResourceLoader>( EngineModuleType::RESOURCELOADER )->LoadResource<LevelResource>( "Casino/Casino.vgsLevel", ( char )0xA6 ); LevelNode* level = LevelNode::CreateFromResource( levelRes ); #ifdef TONEARM_DEBUG level->ShowCollisions( false ); #endif SetLevel(level); //create local character(s) TankCharacter* player = TankCharacter::Create("Models/RobynTank.vgsmodel", "Data/Characters.ini", "Tank", false); player->SetPosition(glm::vec3(1000.0f, 8.5f, 1000.0f)); AddPlayer(player); /*SniperCharacter* player = SniperCharacter::Create("Models/DonTank.vgsmodel", "Data/Characters.ini", "Sniper", false); player->SetPosition(glm::vec3(1000.0f, 8.5f, 1000.0f)); AddPlayer(player);*/ /*SniperCharacter* player2 = SniperCharacter::Create("Models/DonTank.vgsmodel", "Data/Characters.ini", "Sniper", false); player2->SetPosition(glm::vec3(1000.0f, 8.5f, 1200.0f)); AddPlayer(player2);*/ // create camera FixedCamera* fixedCam = FixedCamera::Create(); fixedCam->InitWithTarget(player, 1000.0f, 1900.0f); fixedCam->Init(); SetCurrentCamera(fixedCam); //create fog of war FogOfWarNode* fog = FogOfWarNode::Create(); AddChild( fog ); // will be called when ingame starts GameScene::InitGUI(); GUIManager* guiMgr = Engine::GetInstance()->GetModuleByType<OpenGLRenderModule>(EngineModuleType::RENDERER)->GetGUIManager(); guiMgr->CreateLayer(new PauseGUI(PauseGUI::Type::SINGLE), "pause_menu_gui"); CreateReticle(); return true; } return false; }
void draw() { Begin(); gui.draw(); End(); }
int main(const std::vector<std::string> &args) { ConsoleWindow console("Console"); try { DisplayCache resources; resources.load("../../../Resources/GUIThemeLuna/resources.xml"); GUIManager gui; GUIWindowManagerSystem wm; gui.set_window_manager(wm); GUIThemeDefault theme; theme.set_resources(resources); gui.set_theme(theme); gui.set_css_document("../../../Resources/GUIThemeLuna/theme.css"); DisplayWindowDescription win_desc; win_desc.set_allow_resize(true); win_desc.set_title("CheckBox test app."); win_desc.set_position(Rect(200,200,600,600), false); Window root(&gui, win_desc); root.func_close().set(this, &App::on_close, &root); CheckBox checkbox1(&root); checkbox1.set_geometry(Rect(20, 20, 200, 40)); checkbox1.set_text("CheckBox 1"); gui.exec(); } catch (Exception e) { Console::write_line(e.message); console.display_close_message(); } return 0; }
int main(const std::vector<std::string> &args) { try { DisplayWindowDescription desc; desc.set_title("Custom Component"); desc.set_size(Size(1024, 768), true); DisplayWindow displaywindow(desc); Slot slotWindowClose = displaywindow.sig_window_close().connect(this, &App::on_close); DisplayCache resources("../../../Resources/GUIThemeAero/resources.xml"); GUIWindowManagerTexture wm(displaywindow); GUIThemeDefault theme; theme.set_resources(resources); GUIManager gui; gui.set_window_manager(wm); gui.set_theme(theme); gui.set_css_document("../../../Resources/GUIThemeAero/theme.css"); CustomComponent comp1(Rect(10, 10, 400, 200), &gui, Colorf::beige); // CustomComponent comp2(Rect(20, 210, 500, 400), &gui, Colorf::green); // CustomComponent comp3(Rect(50, 20, 600, 300), &gui, Colorf::blue); CustomComponent comp3(Rect(87, 200, 600, 300), &gui, Colorf::blue); // CustomComponent comp3(Rect(88, 200, 600, 300), &gui, Colorf::blue); gui.exec(); } catch (Exception e) { ConsoleWindow console("Console"); Console::write_line(e.message); console.display_close_message(); } return 0; }
int main(const std::vector<std::string> &args) { try { GUIManager gui; DisplayCache gui_resources("../../../Resources/GUIThemeAero/resources.xml"); DisplayCache app_resources("resources.xml"); GUIWindowManagerSystem wm; gui.set_window_manager(wm); GUIThemeDefault theme; theme.set_resources(gui_resources); gui.set_theme(theme); gui.set_css_document("theme.css"); DisplayWindowDescription win_desc; win_desc.set_allow_resize(true); win_desc.set_title("Button WM System Test Application"); win_desc.set_position(Rect(200, 200, 940, 640), false); Window window(&gui, win_desc); window.func_close().set(this, &App::on_close, &window); GraphicContext gc = window.get_gc(); Font_Sprite font_sprite(gc, "ClanFont", &app_resources); // Set the gui named font FontDescription clanlib_font_desc; clanlib_font_desc.set_typeface_name("ClanLib Font"); gui.register_font(font_sprite, clanlib_font_desc); Label label(&window); label.set_geometry(Rect(10, 160, 330, 180)); label.set_text("Click the button"); main_label = &label; PushButton button(&window); button.set_geometry(Rect(10, 10, 400, 100)); button.func_clicked().set(this, &App::on_button_clicked, &button); button.set_class_name("redtext"); button.set_text("Button Normal"); LineEdit lineedit1(&window); lineedit1.set_geometry(Rect(20, 300, 700, 380)); lineedit1.set_class_name("greentext"); lineedit1.set_text("Select, Click and Edit me :)"); gui.exec(); } catch (Exception e) { ConsoleWindow console("Console"); Console::write_line(e.message); console.display_close_message(); } return 0; }
void WindowManager::PollEvents(GUIManager& a_GUIMgr) { //poll for events sf::Event curEvent; while(m_pSFMLRenderWindow->pollEvent(curEvent)) { switch(curEvent.type) { /*case(Event::MouseButtonPressed): { Callback::MouseClick(curEvent.mouseButton); break; }*/ case(Event::Closed): { m_IsQuittingNextUpdate = true; break; } case(Event::MouseEntered): { m_pSFMLRenderWindow->setMouseCursorVisible(false); break; } case(Event::MouseLeft): { m_pSFMLRenderWindow->setMouseCursorVisible(true); break; } case(Event::KeyPressed): { if(curEvent.key.code == sf::Keyboard::Escape) { m_IsQuittingNextUpdate = true; break; } //fall through } default: { //let our current input_handler deal with it if(m_pInputHandler) m_pInputHandler->HandleInputEvent(curEvent); //let the gui know about it too a_GUIMgr.HandleEvent(curEvent); break; } } } }
int main() { memset(&controller, 0, sizeof (struct controller_data_s)); // Initialize the Xbox 360 hardware HardwareManager::InitializeXbox(); // Initialiaze the GUI gui.initialize(); // Run the main loop while(!shouldQuit) { update(); draw(); } return 0; }
int main(const std::vector<std::string> &args) { GUIWindowManagerSystem wm; GUIManager gui; gui.set_window_manager(wm); gui.add_theme("../../../Resources/GUIThemeAero/theme.css"); //gui.add_theme("theme.css"); gui.add_resources(clan::XMLResourceDocument("../../../Resources/GUIThemeAero/resources.xml")); //gui.add_resources(clan::XMLResourceDocument("resources.xml")); GUITopLevelDescription window_desc; window_desc.set_allow_resize(true); window_desc.set_size(Size(600, 600), false); Window window(&gui, window_desc); // window.set_id_name("mainmenu"); window.func_close().set(this, &App::on_close, &window); GUILayoutCorners layout; window.set_layout(layout); window.create_components("dialog.xml"); FPSLabel fps_label(&window); fps_label.set_geometry(Rect(10, 10, 100, 40)); while (!gui.get_exit_flag()) { gui.process_messages(0); window.request_repaint(); } return gui.get_exit_code(); }
int main(const std::vector<std::string> &args) { ConsoleWindow console("Console"); try { DisplayCache resources; resources.load("../../../Resources/GUIThemeLuna/resources.xml"); GUIManager gui; GUIWindowManagerSystem wm; gui.set_window_manager(wm); GUIThemeDefault theme; theme.set_resources(resources); gui.set_theme(theme); gui.set_css_document("../../../Resources/GUIThemeLuna/theme.css"); DisplayWindowDescription win_desc; win_desc.set_allow_resize(true); win_desc.set_title("Label test app."); win_desc.set_position(Rect(200,200,600,700), false); Window root(&gui, win_desc); root.func_close().set(this, &App::on_close, &root); Tab tab(&root); tab.set_geometry(Rect(Point(50,20),Size(280,360))); // tab 1 TabPage *tab_page_1 = tab.add_page("foo"); //tab_page_1->set_geometry(Rect(Point(0,0),Size(230,300))); //tab.add_page("foo", "foo", &tab_page_1); Label label_p1(tab_page_1); label_p1.set_geometry(Rect(Point(10,10),Size(130,20))); label_p1.set_text("tab page 1"); PushButton btn_p1(tab_page_1); btn_p1.set_geometry(Rect(Point(10,30),Size(130,20))); btn_p1.set_text("Button Foo"); // tab 2 TabPage *tab_page_2 = tab.add_page("bar"); //tab_page_2->set_geometry(Rect(Point(0,0),Size(230,300))); //tab.add_page("bar", "tab with really long name", &tab_page_2); Label label_p2(tab_page_2); label_p2.set_geometry(Rect(Point(10,10),Size(130,20))); label_p2.set_text("tab page 2"); PushButton btn_p2(tab_page_2); btn_p2.set_geometry(Rect(Point(10,30),Size(80,26))); btn_p2.set_text("Button Bar"); // tab 3 TabPage *tab_page_3 = tab.add_page("p3"); //tab_page_3->set_geometry(Rect(Point(0,0),Size(230,300))); //tab.add_page("p3", "p3", &tab_page_3); gui.exec(); } catch (Exception e) { Console::write_line(e.message); console.display_close_message(); } return 0; }
int main(const std::vector<std::string> &args) { GUIManager gui; GUIWindowManagerSystem wm; gui.set_window_manager(wm); gui.add_theme("../../../Resources/GUIThemeAero/theme.css"); gui.add_resources(clan::XMLResourceDocument("../../../Resources/GUIThemeAero/resources.xml")); DisplayWindowDescription win_desc; win_desc.set_allow_resize(true); win_desc.set_title("Popup Menu test app."); win_desc.set_drop_shadow(false); win_desc.set_size(Size(600,600), false); Window root(&gui, win_desc); root.func_close().set(this, &App::on_close, &root); MenuBar menubar(&root); menubar.set_geometry(Rect(0,0,400,24)); PopupMenu menu_file; menu_file.insert_item("New"); menu_file.insert_item("Open"); menu_file.insert_item("Save"); menu_file.insert_item("Exit"); menubar.add_menu("File", menu_file); PopupMenu menu_edit; menu_edit.insert_item("Undo"); menu_edit.insert_item("Redo"); menu_edit.insert_separator(); menu_edit.insert_item("Cut"); menu_edit.insert_item("Copy"); menu_edit.insert_separator(); PopupMenuItem item_submenu = menu_edit.insert_item("Submenu"); menu_edit.insert_separator(); menu_edit.insert_item("Paste"); menu_edit.insert_item("Delete"); menu_edit.insert_separator(); menu_edit.insert_item("Select All"); PopupMenu menu_submenu; menu_submenu.insert_item("foo"); menu_submenu.insert_item("bar"); menu_submenu.insert_item("foobar"); item_submenu.set_submenu(menu_submenu); menubar.add_menu("Edit", menu_edit); PushButton button1(&root); button1.set_geometry(Rect(20, 100, 200, 125)); button1.set_text("Click for pop-up menu"); button1.func_clicked().set(this, &App::on_button1_clicked, &button1); ComboBox combobox1(&root); combobox1.set_geometry(Rect(20, 140, 200, 162)); combobox1.set_popup_menu(menu_edit); combobox1.set_editable(false); gui.exec(); return 0; }
int main(int argc, char* argv[]) { // get command line interface config options CmdLineInterface interface(argc, argv); AppConfig config = interface.getConfig(); GUIManager gui; VideoDevice camera; LProcessor processor; NetworkController networkController; ArduinoController arduino; //init camera if(config.getIsDevice()) { camera.startCapture(config.getDeviceID()); if(config.getIsDebug()) std::cout << "Camera ready!\n"; } //init networking if(config.getIsNetworking()) networkController.startServer(); if(!config.getIsHeadless()) gui.init(); if (config.getHasArduino()) { //16 is /dev/ttyUSB0, 24 is /dev/ttyACM0 arduino.init(9600, 24); //baud rate, serial port } //continuous server loop do { if(config.getIsNetworking()) networkController.waitForPing(); LDetector detector; cv::Mat image; if(config.getIsFile()); //image = cv::imread(config.getFileName()); //else // image = camera.getImage(config.getIsDebug()); //detector.elLoad(image); //detector.elSplit(); //detector.elThresh(); //detector.elContours(); detector.elFilter(); bool foundL = true; if (detector.getLs().size() > 0) detector.largest2(); else foundL = false; if (detector.getLs().size() == 0) foundL = false; if (foundL) { processor.determineL(detector.getLs()); processor.determineAzimuth(); processor.determineDistance(); double azimuth = processor.getAzimuth(); double distance = processor.getDistance(); if(config.getIsDebug()) { processor.outputData(); std::cout << "Final distance (m): " << processor.getDistance() << std::endl; } if(!config.getIsHeadless()) { int i_dist = (int) (distance * 1000.0); int dist_left = i_dist / 1000; int dist_right = i_dist % 1000; std::string dist_str = boost::lexical_cast<std::string>(dist_left) + "." + boost::lexical_cast<std::string>(dist_right); gui.setImage(detector.show()); gui.setImageText("Distance: " + dist_str + " m"); gui.show(config.getIsFile()); } if(config.getIsNetworking()) { networkController.sendMessage(boost::lexical_cast<std::string> ("true") + std::string(";") + boost::lexical_cast<std::string> (distance) + std::string(";") + boost::lexical_cast<std::string> (azimuth)); } } else { if(config.getIsNetworking()) networkController.sendMessage(boost::lexical_cast<std::string> ("false") + std::string(";")); if(!config.getIsHeadless()) { gui.setImage(detector.show()); gui.setImageText("No L's Found"); gui.show(config.getIsFile()); } } if(config.getHasArduino()) { char c = std::rand() % 26 + 'A'; arduino.sendMessage(c, cv::Point(5, 5)); cv::waitKey(300); } } while(config.getIsDevice()); return 0; }
int main(const std::vector<std::string> &args) { ConsoleWindow console("Console"); try { DisplayWindowDescription displaywindow_desc; displaywindow_desc.set_allow_resize(true); displaywindow_desc.set_title("Button WM Texture Test Application"); displaywindow_desc.set_size(Size(640, 480), true); DisplayWindow displaywindow(displaywindow_desc); // GUIWindowManagerTexture wm(displaywindow); GUIWindowManagerSystem wm; GUIManager gui; gui.set_window_manager(wm); // DisplayCache resources("../../../Resources/GUIThemeLuna/resources.xml"); DisplayCache resources("resources.xml"); GUIThemeDefault theme; theme.set_resources(resources); gui.set_theme(theme); // gui.set_css_document("../../../Resources/GUIThemeLuna/theme.css"); gui.set_css_document("theme.css"); Window window(&gui, GUITopLevelDescription(Rect(200, 200, 540, 440), false)); window.func_close().set(this, &App::on_close, &window); PushButton button(&window); button.set_geometry(Rect(10, 10, 160, 50)); button.func_clicked().set(this, &App::on_button_clicked, &button); button.set_text("Button Normal"); PushButton button_disabled(&window); button_disabled.set_geometry(Rect(10, 60, 160, 100)); button_disabled.func_clicked().set(this, &App::on_button_clicked, &button_disabled); button_disabled.set_text("Button Disabled"); button_disabled.set_enabled(false); PushButton button_ugly_flat(&window); button_ugly_flat.set_geometry(Rect(170, 110, 330, 150)); button_ugly_flat.func_clicked().set(this, &App::on_button_clicked, &button_ugly_flat); button_ugly_flat.set_flat(true); button_ugly_flat.set_class_name("ugly"); button_ugly_flat.set_text("Button Ugly Flat"); PushButton button_ugly(&window); button_ugly.set_geometry(Rect(170, 10, 330, 50)); button_ugly.func_clicked().set(this, &App::on_button_clicked, &button_ugly); button_ugly.set_flat(false); button_ugly.set_class_name("ugly"); button_ugly.set_text("Button Ugly"); PushButton button_ugly_disabled(&window); button_ugly_disabled.set_geometry(Rect(170, 60, 330, 100)); button_ugly_disabled.func_clicked().set(this, &App::on_button_clicked, &button_ugly_disabled); button_ugly_disabled.set_class_name("ugly"); button_ugly_disabled.set_text("Button Ugly Disabled"); button_ugly_disabled.set_enabled(false); label = new Label(&window); label->set_geometry(Rect(10, 160, 330, 180)); label->set_text("Click the buttons"); gui.exec(); } catch (Exception e) { Console::write_line(e.message); console.display_close_message(); } return 0; }
void update() { updateInput(); gui.update(&controller); }
int main(const std::vector<std::string> &args) { try { GUIManager gui; DisplayCache resources("../../../Resources/GUIThemeLuna/resources.xml"); GUIWindowManagerSystem wm; gui.set_window_manager(wm); GUIThemeDefault theme; theme.set_resources(resources); gui.set_theme(theme); //gui.set_css_document("theme.css"); gui.set_css_document("../../../Resources/GUIThemeLuna/theme.css"); DisplayWindowDescription win_desc; win_desc.set_allow_resize(true); win_desc.set_title("Button WM System Test Application"); win_desc.set_position(RectPS(200, 200, 320, 240), false); Window window(&gui, win_desc); window.func_close().set(this, &App::on_close, &window); PushButton button(&window); button.set_geometry(RectPS(10, 10, 160, 40)); button.set_text("Button 1"); PushButton button2(&window); button2.set_geometry(RectPS(10, 50, 160, 40)); button2.set_text("Button 2"); button2.set_enabled(false); PushButton button3(&window); button3.set_geometry(RectPS(10, 90, 160, 40)); button3.set_text("Button 3"); CheckBox check1(&window); check1.set_geometry(RectPS(10, 130, 160, 21)); check1.set_text("Check Box 1"); CheckBox check2(&window); check2.set_geometry(RectPS(10, 160, 160, 21)); check2.set_text("Check Box 2"); check2.set_enabled(false); CheckBox check3(&window); check3.set_geometry(RectPS(10, 190, 160, 21)); check3.set_text("Check Box 3"); gui.exec(); } catch (Exception e) { ConsoleWindow console("Console"); Console::write_line(e.message); console.display_close_message(); } return 0; }