Пример #1
0
int main()
{
	// Create the window
	sf::RenderWindow window(sf::VideoMode(400, 300), "TestXPF");
	tgui::Gui gui(window);

	try
	{
		// Load the font
		gui.setFont("../../fonts/DejaVuSans.ttf");

		// Load the widgets
		loadWidgets(gui);
	}
	catch (const tgui::Exception& e)
	{
		std::cerr << "Failed to load TGUI widgets: " << e.what() << std::endl;
		return 1;
	}

	// Main loop
	while (window.isOpen())
	{
		sf::Event event;
		while (window.pollEvent(event))
		{
			// When the window is closed, the application ends
			if (event.type == sf::Event::Closed)
				window.close();

			// When the window is resized, the view is changed
			else if (event.type == sf::Event::Resized)
			{
				window.setView(sf::View(sf::FloatRect(0, 0, event.size.width, event.size.height)));
				gui.setView(window.getView());
			}

			// Pass the event to all the widgets
			gui.handleEvent(event);
		}

		window.clear();

		// Draw all created widgets
		gui.draw();

		window.display();
	}

	return EXIT_SUCCESS;
}
Пример #2
0
void PreMenu::run()
{
	sf::RenderWindow& window(config.window);

	//the background when loading.
	sf::RectangleShape backgrd;
	backgrd.setSize(sf::Vector2f(1024, 768));
	backgrd.setTexture(&config.texMan.get("Tower1.png"));

	//the gui in loading
	tgui::Gui gui(window);
	tgui::Label::Ptr label = std::make_shared<tgui::Label>();
	
	//the "loading" label in loading
	label->setFont(tgui::Font(config.fontMan.get("arial.ttf")));
	label->setText("Loading...");
	label->setTextColor(tgui::Color(0, 0, 0, 255));
	label->setPosition(900, 700);
	gui.add(label);

	//initialize the cursor
	config.cursor.setLogo(config.texMan.get("cursor_test.png"),
		sf::IntRect(0, 0, 31, 31));

	//start the initialze thread
	// ??? why thread ???
	std::thread init(&PreMenu::initialize, this);
	
	//when not finished, poll event
	while (window.isOpen() && !finished)
	{
		sf::Event event;
		while (window.pollEvent(event))
		{
			if (event.type == sf::Event::Closed)
			{
				window.close();	//to be changed, the init thread still running
			}

			config.cursor.update();
		}

		window.clear();
		window.draw(backgrd);
		gui.draw();
		window.draw(config.cursor);
		window.display();
	}
	init.join();
}
Пример #3
0
int main(int argc, char* argv[])
{
	SDLGui gui(800, 600);

	bool running = true;

	while(running)
	{

		running = gui.update();
	}

	return 0;
}
Пример #4
0
void
gui_main::init_thread(void)
{
	if (!self) {
		// We are holding the Python GIL through this process, including the wait!
		// We can't let go because a different Python thread could come along and mess us up (e.g.
		//   think that we are initialized and go on to call PostThreadMessage without a valid idThread)
		self = new gui_main;
		thread gui( boost::bind( &gui_main::run, self ) );
		lock L( self->init_lock );
		while (self->gui_thread == -1)
			self->initialized.wait( L );
	}
}
Пример #5
0
int runGui(int argc, char *argv[])
{
    QApplication a(argc, argv);

    QTranslator translator;
    translator.load(":/translations/pengo_" + QLocale::system().name());
    a.installTranslator(&translator);

    Loader loader(":levels/pengo");
    Game* game = loader.loadGame(1);
    GameGui gui(game);

    return a.exec();
}
Пример #6
0
void mouse_handler_base::mouse_wheel(int scrollx, int scrolly, bool browse)
{
    int x, y;
    SDL_GetMouseState(&x, &y);

    int movex = scrollx * preferences::scroll_speed();
    int movey = scrolly * preferences::scroll_speed();

    // Don't scroll map and map zoom slider at same time
    gui::slider* s = gui().find_slider("map-zoom-slider");
    if (s && point_in_rect(x, y, s->location())) {
        movex = 0;
        movey = 0;
    }

    if (movex != 0 || movey != 0) {
        CKey pressed;
        // Alt + mousewheel do an 90° rotation on the scroll direction
        if (pressed[SDLK_LALT] || pressed[SDLK_RALT]) {
            gui().scroll(movey,movex);
        } else {
            gui().scroll(movex,-movey);
        }
    }

    if (scrollx < 0) {
        mouse_wheel_left(x, y, browse);
    } else if (scrollx > 0) {
        mouse_wheel_right(x, y, browse);
    }

    if (scrolly < 0) {
        mouse_wheel_down(x, y, browse);
    } else if (scrolly > 0) {
        mouse_wheel_up(x, y, browse);
    }
}
Пример #7
0
int main()
{
    sf::RenderWindow window({800,600}, "Table widget example");
    window.setFramerateLimit(60);

    tgui::Gui gui(window);

    auto table = std::make_shared<tgui::Table>();
    table->setSize({780, 580});
    table->setPosition({10,10});
    table->setHeaderColumns({"First Name", "Last Name", ""});
    table->setBackgroundColor({203,201,207});
    table->setFixedColumnWidth(0, 400);
    table->setStripesRowsColor({246,246,246}, {233,233,233});
    gui.add(table);

    auto button = std::make_shared<tgui::Button>();
    button->setText("Connect");
    button->setSize({100,30});
    button->connect("pressed", [](){ std::cout << "Button pressed" << std::endl; });

    auto tableRow = std::make_shared<tgui::TableRow>();
    tableRow->addItem("Eve");
    tableRow->addItem("Jackson");
    tableRow->add(button, true);

    table->add(tableRow);
    table->addRow({"John", "Doe", "80"});
    table->addRow({"Adam", "Johnson", "67"});
    table->addRow({"Jill", "Smith", "50"});

    while (window.isOpen())
    {
        sf::Event event;
        while(window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();

            gui.handleEvent(event);
        }

        window.clear();
        gui.draw();
        window.display();
    }

    return 0;
}
Пример #8
0
int main(int argc, char *argv[]){
  GtkWidget *window;
  GtkWidget *slate;
  GtkWidget *vbox;
  gtk_init(&argc, &argv);

  window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
  gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
  gtk_window_set_default_size(GTK_WINDOW(window), 200, 180);

  slate = gtk_slate_new();

  vbox = gtk_vbox_new(FALSE, 0);
  gtk_container_add(GTK_CONTAINER(window), vbox);

  GtkWidget *menubar = gtk_menu_bar_new();
  GtkWidget *filemenu = gtk_menu_new();
  GtkWidget *file = gtk_menu_item_new_with_mnemonic("_File");
  GtkWidget *quit = gtk_menu_item_new_with_mnemonic("_Quit");
  g_signal_connect(G_OBJECT(quit), "activate",
    G_CALLBACK(menu_file_quit), NULL);
  gtk_menu_item_set_submenu(GTK_MENU_ITEM(file), filemenu);
  gtk_menu_shell_append(GTK_MENU_SHELL(filemenu), quit);
  gtk_menu_shell_append(GTK_MENU_SHELL(menubar), file);

  gtk_box_pack_start(GTK_BOX(vbox), menubar, FALSE, FALSE, 0);

  gtk_box_pack_start(GTK_BOX(vbox), slate, TRUE, TRUE, 0);

  g_signal_connect(G_OBJECT(window), "destroy",
    G_CALLBACK(gtk_main_quit), NULL);
  g_signal_connect(G_OBJECT(window), "destroy",
    G_CALLBACK(gtk_widget_destroyed), &window);

  g_signal_connect(G_OBJECT(slate), "button-release-event",
    G_CALLBACK(cadview_mouse_release), 0);

  cad_core::cad_document<double> document;
  cad_gtk::cad_gtk_adaptor<double> gui(slate);
  cad_core::cad_gui_view<double,
    cad_gtk::cad_gtk_adaptor<double> > view(document, gui);
  gtk_slate_set_view(slate, &view);

  gtk_widget_show_all(window);

  gtk_main();

  return 0;
}
Пример #9
0
// The start of the Application
int App::start(const std::vector<CL_String> &args)
{
	CL_DisplayWindowDescription win_desc;
	win_desc.set_allow_resize(true);
	win_desc.set_title("ColorWheel Example");
	win_desc.set_size(CL_Size( 800, 600 ), false);

	CL_DisplayWindow window(win_desc);
	CL_Slot slot_quit = window.sig_window_close().connect(this, &App::on_window_close);
	CL_Slot slot_input_up = (window.get_ic().get_keyboard()).sig_key_up().connect(this, &App::on_input_up);

	CL_String theme;
	if (CL_FileHelp::file_exists("../../../Resources/GUIThemeAero/theme.css"))
		theme = "../../../Resources/GUIThemeAero";
	else if (CL_FileHelp::file_exists("../../../Resources/GUIThemeBasic/theme.css"))
		theme = "../../../Resources/GUIThemeBasic";
	else
		throw CL_Exception("No themes found");

	CL_GUIWindowManagerTexture wm(window);
	CL_GUIManager gui(wm, theme);

	CL_GraphicContext gc = window.get_gc();

	// Deleted automatically by the GUI
	new ColorWheel(gc, gui, CL_Rect(32, 32, CL_Size(512, 512)));


	unsigned int time_last = CL_System::get_time();

	while (!quit)
	{
		unsigned int time_now = CL_System::get_time();
		float time_diff = (float) (time_now - time_last);
		time_last = time_now;

		gc.clear(CL_Colorf(0.0f,0.0f,0.0f));

		wm.process();
		wm.draw_windows(gc);

		window.flip(1);

		CL_KeepAlive::process();
	}

	return 0;
}
Пример #10
0
// The start of the Application
int App::start(const std::vector<std::string> &args)
{
	create_window();

	GUI gui(this);

	clan::GameTime game_time;
	while(!quit)
	{
		game_time.update();
		if (!gui.run(game_time))
			break;
	}

	return 0;
}
Пример #11
0
int main(int argc, char **argv)
{
    if (argc < 4)
    {
        printUsage();
        return 1;
    }

    std::string database_filename = argv[1];
    std::string image_dir = argv[2];
    std::string command = argv[3];

    std::vector<std::string> args;
    for(int i = 4; i < argc; ++i)
        args.push_back(argv[i]);

    PhotoDatabase db;
    loadDatabase(database_filename, db);
    db.setPhotoPrefixPath(image_dir);

    if (command == "gui")
    {
        unsigned int photo_idx_start = 0;
        if (args.size() > 0)
            photo_idx_start = atoi(args[0].c_str());

        GUI gui(&db, photo_idx_start);
        gui.run();
    }
    else if (command == "search")
    {
        search(db, args);
    }
    else if (command == "scan")
    {
        scan(db, image_dir);
    }
    else
    {
        std::cout << "Unknown command: " << command << std::endl;
        return 0;
    }

    writeDatabase(db, database_filename);

    return 0;
}
Пример #12
0
int main( int argc, char ** argv )
{
   walberla::Environment env( argc, argv );

   // create blocks
   shared_ptr< StructuredBlockForest > blocks = blockforest::createUniformBlockGrid(
            uint_c( 3), uint_c(2), uint_c( 4), // number of blocks in x,y,z direction
            uint_c(10), uint_c(8), uint_c(12), // how many cells per block (x,y,z)
            real_c(0.5),                       // dx: length of one cell in physical coordinates
            false,                             // one block per process? - "false" means all blocks to one process
            false, false, false );             // no periodicity

   // add a field to all blocks - and store the returned block data ID which is needed to access the field
   BlockDataID fieldID = blocks->addStructuredBlockData< Field<real_t,1> >( &createFields, "My Field" );

   // iterate all blocks and initialize with random values
   for( auto blockIterator = blocks->begin(); blockIterator != blocks->end(); ++blockIterator )
   {
      IBlock & currentBlock = *blockIterator;

      // get the field stored on the current block
      Field<real_t,1> * field = currentBlock.getData< Field<real_t,1> >( fieldID );

      // iterate the field and set random values
      for( auto iter = field->begin(); iter != field->end(); ++iter )
         *iter = real_c( rand() % ARBITRARY_VALUE );
   }

   // create time loop
   const uint_t numberOfTimesteps = uint_c(10); // number of time steps for non-gui runs
   SweepTimeloop timeloop( blocks, numberOfTimesteps );

   // registering the function sweep
   auto pointerToTwoArgFunction = & simpleSweep;
   auto pointerToOneArgFunction = std::bind( pointerToTwoArgFunction, std::placeholders::_1, fieldID );
   timeloop.add() << Sweep( pointerToOneArgFunction, "BogusAlgorithm" );

   // registering the class sweep
   timeloop.add() << Sweep( SimpleSweep(fieldID), "BogusAlgorithmButNowAsFunctor" );

   // two sweeps were registered, so both are executed in each time step

   GUI gui( timeloop, blocks, argc, argv );
   gui.run();

   return EXIT_SUCCESS;
}
Пример #13
0
void ResourceConverterDialog::on_open_file_button()
{
    // List all files in the working directory.
    ReadFiles rf(workingdirectory, "", "");
    // Select a file.
    ListviewDialog dialog(_("Select file"), rf.files, filename, true, NULL);
    if (dialog.run() == GTK_RESPONSE_OK) {
        // Store filename, read it.
        filename = dialog.focus;
        ReadText rt(gw_build_filename(workingdirectory, filename), true, false);
        lines = rt.lines;
        anchors_written = false;
    }
    if (open_file_gui()) {
        gui();
    }
}
Пример #14
0
TextRegion::TextRegion() 
{
  line1_ = 0;
  column1_ = 0;
  line2_ = 0;
  column2_ = 0;

  WidgetKit* kit = WidgetKit::instance();
  Style* style = kit->style();
  String gui("monochrome");
  if (gui == kit->gui()) {
    color_ = new Color(*kit->foreground(), 0.25);
  } else {
    color_ = new Color(.7, .8, 1, 1);
  }
  Resource::ref(color_);
}
Пример #15
0
int main(int argc, char* argv[]){
	char filename[] = "output.txt";

	City city; // Our City

	Output output(&city, filename); // Our output

	CityParser parser(&city, &output); // Our Parser

	Simulator simulator(&city, &output); // Our simulator

	GUI gui(&city, &simulator, &parser, &output); // Our GUI

	gui.readArguments(argc, argv); // give the arguments to the GUI

	gui.start();	// start the GUI
}
Пример #16
0
int App::start(const std::vector<std::string> &args)
{
	std::string theme;
	if (clan::FileHelp::file_exists("../../../Resources/GUIThemeAero/theme.css"))
		theme = "../../../Resources/GUIThemeAero";
	else if (clan::FileHelp::file_exists("../../../Resources/GUIThemeBasic/theme.css"))
		theme = "../../../Resources/GUIThemeBasic";
	else
		throw clan::Exception("Not themes found");

	clan::GUIManager gui(theme);

	// Window 1
	clan::DisplayWindowDescription win_desc;
	win_desc.set_allow_resize(true);
	win_desc.set_title("PushButton #1");
	win_desc.set_position(clan::Rect(200, 200, clan::Size(340, 240)), false);
	clan::GUIComponent *window = new clan::GUIComponent(&gui, win_desc, "Window");
	window->func_close().set(this, &App::on_close, window);

	clan::PushButton *button = new clan::PushButton(window);
	button->set_geometry(clan::Rect(10, 10, clan::Size(160, 40)));
	button->func_clicked().set(this, &App::on_button_clicked, button);
	button->set_text("Button #1");

	label = new clan::Label(window);
	label->set_geometry(clan::Rect(10, 160, clan::Size(330, 20)));
	label->set_text("Click a button on either window");


	// Window 2
	win_desc.set_title("PushButton #2");
	win_desc.set_position(clan::Rect(600, 200, clan::Size(340, 240)), false);
	clan::GUIComponent *window2 = new clan::GUIComponent(&gui, win_desc, "Window");
	window2->func_close().set(this, &App::on_close, window2);

	clan::PushButton *button2 = new clan::PushButton(window2);
	button2->set_geometry(clan::Rect(10, 10, clan::Size(160, 40)));
	button2->func_clicked().set(this, &App::on_button_clicked, button2);
	button2->set_text("Button #2");

	gui.exec();

	return 0;
}
Пример #17
0
int main( ) {
#ifdef TARGET_OSX
    //this allows to embed all the data folder inside the app bundle.
    string newRoot = "../Resources/data/";
    ofEnableDataPath();
    ofSetDataPathRoot(newRoot);
#endif

    ofSetupOpenGL(1024,768,OF_WINDOW);

    shared_ptr<mainAppController> mainApp (new mainAppController);
    shared_ptr<BYBGui> gui (new BYBGui);
    mainApp->gui = gui;
    gui->controllerPtr = mainApp;

    ofDirectory dir;
    dir.allowExt("ttf");
    dir.allowExt("otf");
    dir.listDir("fonts");
    for (int i = 0; i < dir.size(); i++ ) {
        ofTrueTypeFont f;
        if(f.load(dir.getPath(i),12, true, true)) {
            gui->fonts[ofFilePath::removeExt(dir.getName(i))] = f;
            cout << "added Font: " << ofFilePath::removeExt(dir.getName(i)) << endl;
        }
        if(f.load(dir.getPath(i),25, true, true)) {
            gui->fonts[ofFilePath::removeExt(dir.getName(i)) + "_25"] = f;
        }
    }

    try {
        ofRunApp(mainApp);
    } catch(exception& e) {
        cout << e.what() << '\n';
    }
    catch (int param) {
        cout << "int exception";
    }
    catch (char param) {
        cout << "char exception";
    }
    catch (...) {
        cout << "default exception";
    }
}
Пример #18
0
Text::Text(unsigned initialLines, unsigned initialColumns, TextBuffer* t)
{
	handler_ = new TextHandler(this);
	Resource::ref(handler_);
	dirty_ = false;
	text_ = t;
	insertion_.line_ = 0;
	insertion_.column_ = 0;
	WidgetKit* kit = WidgetKit::instance();
	Style* s = kit->style();
	String gui("monochrome");

	if (gui == kit->gui()) 
		insertion_.color_ = new Color(*kit->foreground());
	else 
		insertion_.color_ = new Color(1, .5, .5, 1);
	Resource::ref(insertion_.color_);
	insertion_.width_ = 2;

	initialLines_ = Math::max(initialLines, 1u);
	initialColumns_ = Math::max(initialColumns, 1u);

	font_ = kit->font();
	Resource::ref(font_);
	textColor_ = new Color(*kit->foreground());
	Resource::ref(textColor_);

	readOnly_ = false;

	canvas_ = 0;
	allocation_ = 0;

	curLowerX_ = 0;
	curUpperX_ = 0;
	curLowerY_ = 0;
	curUpperY_ = 0;

	textBuffer_ = 0;

	needWidth_ = false;
	width_ = 0;

	ctl_pn_col_ = -1;
	escape_ = 10;
}
Пример #19
0
void TextReplacementDialog::on_cell_edited(GtkCellRendererText * cell, const gchar * path_string, const gchar * new_text, int column)
{
  // Set / initialize some variables.
  GtkTreeModel *tmodel = (GtkTreeModel *) model;
  GtkTreePath *path = gtk_tree_path_new_from_string(path_string);
  GtkTreeIter iter;
  gtk_tree_model_get_iter(tmodel, &iter, path);
  // Free memory for the old text.
  gchar *old_text;
  gtk_tree_model_get(tmodel, &iter, column, &old_text, -1);
  g_free(old_text);
  // Make copy of new text and put it in the store. 
  gtk_list_store_set(GTK_LIST_STORE(model), &iter, column, g_strdup(new_text), -1);
  // Free path.
  gtk_tree_path_free(path);
  // Update gui.
  gui();
}
Пример #20
0
int main(int argc, char *argv[])
{
    ros::init(argc, argv, "RoboticanGuiNode");
    ros::AsyncSpinner spinner(1);
    spinner.start();

    QApplication app(argc, argv);
    QMainWindow widget;
    Ui::MainWindow win;
    win.setupUi(&widget);

    GUImanager gui(widget, win, app);
    gui.startGUI();

    widget.show();
    app.exec();
    return 0;
}
Пример #21
0
TEST(ComboBox, Render)
{
    // The position is offset so the window doesn't go into the title bar.
    win::qt::Window window("test_qt_combo_box",
                           math::Vector2U(256, 128),
                           math::Vector2I(256, 128));

    Gui gui(window);

    const math::Vector2F size(200, 50);
    const math::Vector2F position(32, 7);
    std::vector<std::string> values =
    {
        "Hello",
        "World",
        "How",
        "Are",
        "You",
        "Doing",
        "Today"
    };

    ComboBox* widget = new ComboBox(size, position, values);
    gui["widget"] = widget;

    // We need to make sure the Window is fully updated and has time to
    // animate if need be.
    for (size_t ii = 0; ii < 10; ++ii)
    {
        window.update();
        core::sleep(100);
    }

    EXPECT_TRUE(test::compareImage(window.getPixels(),
                                   "test_qt_combo_box.png"));
    EXPECT_EQ(widget->getText(), values[0]);
    EXPECT_EQ(widget->getPosition(), position);
    EXPECT_EQ(widget->getSize(), size);

    widget->setText("Are");
    EXPECT_EQ(widget->getText(), "Are");

    EXPECT_ANY_THROW(widget->setText("foo"));
}
Пример #22
0
QWidget * QCamTrans::buildGUI(QWidget * parent) {
   QWidget * remoteCTRL=QCam::buildGUI(parent);
   int modeTable[]={Off,Copy,On};
   const char * modeLabel[]={"Off","Copy","On"};
   QCamRadioBox * modeWidget=new QCamRadioBox("Mode",remoteCTRL,
                        3,modeTable,modeLabel,3);
   connect(this,SIGNAL(modeChanged(int)),modeWidget,SLOT(update(int)));
   connect(modeWidget,SIGNAL(change(int)),this,SLOT(mode(int)));
   emit(modeChanged(mode_));
   if (algo_) {
      algoWidget_=algo_->allocGui(gui());
      algoWidget_->show();
   }

   if(hideMode_)
      modeWidget->hide();

   return remoteCTRL;
}
Пример #23
0
void Config::configEnc()
{
    if(ui.treeDevices->selectedItems().size() == 0)
        return;

    QString devname = ui.treeDevices->selectedItems().at(0)->data(0, Qt::UserRole).toString();
    QString encoder = SystemInfo::platformValue(devname,
                    SystemInfo::CurEncoder).toString();
    ui.encoderName->setText(EncoderBase::getEncoderName(SystemInfo::platformValue(devname,
                    SystemInfo::CurEncoder).toString()));


    EncoderBase* enc = EncoderBase::getEncoder(this,encoder);

    EncTtsCfgGui gui(this,enc,EncoderBase::getEncoderName(encoder));
    gui.exec();

    updateEncState();
}
Пример #24
0
// The start of the Application
int App::start(const std::vector<CL_String> &args)
{
	sfx_pacman_start = CL_SoundBuffer("../../Game/Pacman/resources/start.wav");
	sfx_beast_title = CL_SoundBuffer("Resources/boss.mod");
	sfx_cheer = CL_SoundBuffer("Resources/cheer1.ogg");


	CL_String theme;
	if (CL_FileHelp::file_exists("../../../Resources/GUIThemeAero/theme.css"))
		theme = "../../../Resources/GUIThemeAero";
	else if (CL_FileHelp::file_exists("../../../Resources/GUIThemeBasic/theme.css"))
		theme = "../../../Resources/GUIThemeBasic";
	else
		throw CL_Exception("No themes found");

	CL_GUIManager gui(theme);

	CL_DisplayWindowDescription win_desc;
	win_desc.set_allow_resize(true);
	win_desc.set_title("Sound Example");
	win_desc.set_position(CL_Rect(200, 100, 540, 440), false);
	win_desc.set_visible(false);
	CL_Window window(&gui, win_desc);
	window.func_close().set(this, &App::on_close, &window);

	CL_GUILayoutCorners layout;
	window.set_layout(layout);

	window.create_components("Resources/layout.xml");

	prepare_gui(window);

	window.set_visible(true);

	set_sound_output();

	initial_time = CL_System::get_time();

	gui.exec();

	return 0;
}
Пример #25
0
/**
 * @brief Switch to play mode.
 */
void uiPlay(void)
{
    if (guiInfo.Playing == GUI_PLAY)
        return;

    if (guiInfo.StreamType != STREAMTYPE_CDDA &&
        guiInfo.StreamType != STREAMTYPE_VCD &&
        guiInfo.StreamType != STREAMTYPE_DVD &&
        guiInfo.StreamType != STREAMTYPE_TV &&
        guiInfo.StreamType != STREAMTYPE_DVB &&
        (!guiInfo.Filename || (guiInfo.Filename[0] == 0)))
        return;

    if (guiInfo.Playing == GUI_PAUSE) {
        uiPause();
        return;
    }

    gui(GUI_SET_STATE, (void *)GUI_PLAY);
}
int main(int argc, char **argv)
{
#ifdef GRASPITDBG
#ifdef Q_WS_WIN
  AllocConsole(); 
  freopen("conin$", "r", stdin); 
  freopen("conout$", "w", stdout); 
  freopen("conout$", "w", stderr); 
  //ios::sync_with_stdio();
#endif
#endif

  GraspItApp app(argc, argv);
 
  if (app.splashEnabled()) {
    app.showSplash();
    QApplication::setOverrideCursor( Qt::waitCursor );
  }

  GraspItGUI gui(argc,argv);
  
  //This is the GraspIt TCP server. It can be used to connect to GraspIt from
  //external programs, such as Matlab.
  //On some machines, the Q3Socket segfaults at exit, so this is commented out by
  //default
  //GraspItServer server(4765);
 
  app.setMainWidget(gui.getMainWindow()->mWindow);
  QObject::connect(qApp, SIGNAL(lastWindowClosed()), qApp, SLOT(quit()));

  if (app.splashEnabled()) {
    app.closeSplash();
    QApplication::restoreOverrideCursor();
  }

  if (!gui.terminalFailure()) {
	  gui.startMainLoop();
  }
  return gui.getExitCode();
}
Пример #27
0
int main(int argc, char* argv[])
{

	SimpleOpenGL3App* app = new SimpleOpenGL3App("Bullet Standalone Example",1024,768,true);
	
	prevMouseButtonCallback = app->m_window->getMouseButtonCallback();
	prevMouseMoveCallback = app->m_window->getMouseMoveCallback();

	app->m_window->setMouseButtonCallback((b3MouseButtonCallback)OnMouseDown);
	app->m_window->setMouseMoveCallback((b3MouseMoveCallback)OnMouseMove);
	
	OpenGLGuiHelper gui(app,false);
    
	CommonExampleOptions options(&gui);

	example = StandaloneExampleCreateFunc(options);
  example->initPhysics();
	example->resetCamera();
	
	do
	{
		app->m_instancingRenderer->init();
        app->m_instancingRenderer->updateCamera(app->getUpAxis());

		example->stepSimulation(1./60.);
	  	
		example->renderScene();
 	
		DrawGridData dg;
        dg.upAxis = app->getUpAxis();
		app->drawGrid(dg);
		
		app->swapBuffer();
	} while (!app->m_window->requestedExit());

	example->exitPhysics();
	delete example;
	delete app;
	return 0;
}
Пример #28
0
int main(int argc, char *argv[])
{


  if(contains(argv,argc,"--help")!=0 || contains(argv,argc,"-h")!=0){
    printf("Usage: yourprog | %s [-noCtrlC] [-novideo]\n",argv[0]);
    printf("\t-noCtrlC will catch ctrlC and the program only terminates via the pipe\n");
    printf("\t-novideo will not record frames on #V lines (because it slows down significantly)\n");
    return 0;
  }

  if(contains(argv,argc,"-noCtrlC"))
    signal_handler_init();
  bool novideo = contains(argv,argc,"-novideo")!=0;

  QApplication app(argc, argv);
  MatrixVisualizer gui(0, novideo);
  int rv = app.exec();

  signal_handler_exit();
  return rv;
}
Пример #29
0
/**
  * Arguments : [--lang <language>]
  *  --lang <language> : set the language and save it to the settings file. (ISO-63, two letters). Do not start the gui in this case.
  */
int main(int argc, char *argv[])
{
#if defined(DEBUG) && defined(ENABLE_NVWA)
   new_progname = argv[0];
#endif

   QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));

   QLocale locale;
   for (int i = 1; i < argc; i++)
   {
      const QString arg = QString::fromLatin1(argv[i]);
      if (arg == "--lang" && i < argc - 1)
         locale = QLocale(QString::fromLatin1(argv[++i]));
   }

   SETTINGS.setFilename(Common::Constants::GUI_SETTINGS_FILENAME);
   SETTINGS.setSettingsMessage(new Protos::GUI::Settings());
   SETTINGS.load();
   if (locale != QLocale::system())
      SETTINGS.set("language", locale);
   SETTINGS.save(); // To automatically create the file if it doesn't exist.

   // 'locale' has been set with "--lang".
   if (locale != QLocale::system())
      return 0;

   LM::Builder::setLogDirName("log_gui");

   try
   {
      GUI::D_LAN_GUI gui(argc, argv);
      return GUI::D_LAN_GUI::exec();
   }
   catch (GUI::D_LAN_GUI::AbortException&)
   {
      return 1;
   }
}
Пример #30
0
hotkey::ACTION_STATE play_controller::hotkey_handler::get_action_state(hotkey::HOTKEY_COMMAND command, int /*index*/) const
{
	switch(command) {

	case hotkey::HOTKEY_MINIMAP_DRAW_VILLAGES:
		return (preferences::minimap_draw_villages()) ? hotkey::ACTION_ON : hotkey::ACTION_OFF;
	case hotkey::HOTKEY_MINIMAP_CODING_UNIT:
		return (preferences::minimap_movement_coding()) ? hotkey::ACTION_ON : hotkey::ACTION_OFF;
	case hotkey::HOTKEY_MINIMAP_CODING_TERRAIN:
		return (preferences::minimap_terrain_coding()) ? hotkey::ACTION_ON : hotkey::ACTION_OFF;
	case hotkey::HOTKEY_MINIMAP_DRAW_UNITS:
		return (preferences::minimap_draw_units()) ? hotkey::ACTION_ON : hotkey::ACTION_OFF;
	case hotkey::HOTKEY_MINIMAP_DRAW_TERRAIN:
		return (preferences::minimap_draw_terrain()) ? hotkey::ACTION_ON : hotkey::ACTION_OFF;
	case hotkey::HOTKEY_ZOOM_DEFAULT:
		return (gui()->get_zoom_factor() == 1.0) ? hotkey::ACTION_ON : hotkey::ACTION_OFF;
	case hotkey::HOTKEY_DELAY_SHROUD:
		return viewing_team().auto_shroud_updates() ? hotkey::ACTION_OFF : hotkey::ACTION_ON;
	default:
		return hotkey::ACTION_STATELESS;
	}
}