Exemplo n.º 1
0
int main()
{

    sf::RenderWindow main_window(sf::VideoMode::getDesktopMode(), "Project AAAA", sf::Style::Fullscreen);
    //sf::RenderWindow main_window(sf::VideoMode(800,600), "Debug", sf::Style::Default);
    sf::Clock timer1;
    double framerate = 60.f;
    double ms_delay1 = (1.f / framerate) * 1000.f;

    while (main_window.isOpen())
    {

        mainEventHandler(main_window);

        if(timer1.getElapsedTime().asMilliseconds() >= ms_delay1){
            main_window.clear(sf::Color::White);

            
            /*float fps = ( 1.f / timer1.getElapsedTime().asMilliseconds() ) * 1000.f;
            std::cout << timer1.getElapsedTime().asMilliseconds() << " : " << fps << std::endl;*/

            draw(main_window);

            main_window.display();
            timer1.restart();
        }

    }

    return 0;
}
Exemplo n.º 2
0
        int run()
        {
            const message_catalog_type message_catalog{};
            diagram_view_type diagram_view{ m_model, message_catalog };
            timetable_view_type timetable_down_view{
                view::timetable::direction_type::down, m_model, message_catalog
            };
            timetable_view_type timetable_up_view{
                view::timetable::direction_type::up, m_model, message_catalog
            };
            const command_set_holder_type command_set_holder{ m_settings, m_model, diagram_view, message_catalog };

            main_window_type main_window(message_catalog, m_settings, command_set_holder.confirm_file_save()); 
            set_message_observers(
                command_set_holder.command_set(),
                diagram_view,
                timetable_down_view,
                timetable_up_view,
                main_window,
                message_catalog
            );
            m_model.reset_timetable();
            main_window.set_menu_bar(
                main_window_menu_builder_type(
                    command_set_holder.command_set(), m_model, main_window, message_catalog
                ).build()
            );
            main_window.set_visible(true);

            load_input_file(main_window, command_set_holder.command_set());

            return message_loop_type{ main_window }();
        }
Exemplo n.º 3
0
void Application::run(const std::string &filename)
{
	GuiEditorWindow main_window(get_gui());

	if(!filename.empty())
		main_window.load(filename);

	gui.exec();
}
Exemplo n.º 4
0
int main(int argc, char** argv) {
  gtk_init(&argc, &argv);

  GtkWidget* window = main_window();
  g_signal_connect(window, "delete-event", G_CALLBACK(gtk_main_quit), NULL);
  gtk_widget_show_all(window);

  gtk_main();

  return EXIT_SUCCESS;
}
Exemplo n.º 5
0
void Component::construct(Genode::Env &env)
{
	QApplication app(genode_argc, genode_argv);

	load_stylesheet();

	QMember<Main_window> main_window(env);

	main_window->show();

	app.exec();
}
Exemplo n.º 6
0
int main(int argc, char *argv[])
{
  QApplication a(argc, argv);

  ofPtr<ofAppGlutWindow> window(new ofAppGlutWindow);
  ofSetupOpenGL(window, 1280, 800, OF_WINDOW);

  ofPtr<MainWindow> main_window(new MainWindow);
  ofRunApp(main_window);

  return a.exec();
}
Exemplo n.º 7
0
int main(int argc, char *argv[])
{
    // Applikation initialisieren
    QCoreApplication::setOrganizationName("ifaoe");
    QCoreApplication::setOrganizationDomain("ifaoe.de");
    QCoreApplication::setApplicationName("daisi-image-library");
    QApplication app(argc, argv);
    QIcon::setThemeName("breeze-dark");
    QStringList theme_paths;
    theme_paths << "/usr/share/icons/";
    QIcon::setThemeSearchPaths(theme_paths);

    QFusionStyle * fusion_style = new QFusionStyle;
    app.setStyle(fusion_style);

    QPalette palette;
    palette.setColor(QPalette::Window, QColor(53,53,53));
    palette.setColor(QPalette::WindowText, Qt::white);
    palette.setColor(QPalette::Base, QColor(15,15,15));
    palette.setColor(QPalette::AlternateBase, QColor(53,53,53));
    palette.setColor(QPalette::ToolTipBase, Qt::white);
    palette.setColor(QPalette::ToolTipText, Qt::white);
    palette.setColor(QPalette::Text, Qt::white);
    palette.setColor(QPalette::Button, QColor(53,53,53));
    palette.setColor(QPalette::ButtonText, Qt::white);
    palette.setColor(QPalette::BrightText, Qt::red);

    palette.setColor(QPalette::Highlight, QColor(142,45,197).lighter());
    palette.setColor(QPalette::HighlightedText, Qt::black);
    app.setPalette(palette);

//    QFile file(":qdarkstyle/style.qss");
//    if(file.open(QIODevice::ReadOnly | QIODevice::Text))
//    {
//        a.setStyleSheet(file.readAll());
//        file.close();
//    }

    QgsApplication::setPrefixPath("/usr", true);
    QgsApplication::initQgis();
    UserSettings * config = new UserSettings;
    config->InitSettings();
    DatabaseHandler * db = new DatabaseHandler(config);
    MainWindow main_window(config, db);
    if (config->getAppMaximized())
        main_window.showMaximized();
    else
        main_window.show();
    return app.exec();
}
Exemplo n.º 8
0
int main(int argc,char *argv[]) 
{
	Fl_Socket socket;
	sock = &socket;

    Fl_Window main_window(600,400,"Socket test");

	Fl_Group top_group(0,0,200,25);
	top_group.layout_align(FL_ALIGN_TOP);

	Fl_Box progress_text(0,0,150,25);
	p_text = &progress_text;

	Fl_ProgressBar progress_bar(150,0,50,25);
	p_bar = &progress_bar;

	top_group.resizable(p_bar);
	top_group.store_sizes();
	top_group.end();

	Fl_Text_Buffer buf;
    Fl_Text_Editor	editor(10,10,200,100);

    editor.layout_align(FL_ALIGN_CLIENT);
    editor.buffer(buf);

	textbuf = &buf;
	textdisp = &editor;

    Fl_Group status_line(0,0,200,25);
    status_line.layout_align(FL_ALIGN_BOTTOM);

    Fl_Input url_input(50, 0, 100, 25, "http://");
	url_input.value("www.fltk.org/index.php");

    Fl_Button go_button(150, 0, 50, 25, "Go!");
    go_button.callback(go_callback);
    
	status_line.resizable(url_input);
	status_line.store_sizes();
	status_line.end();

    input = &url_input;

    main_window.end();
    main_window.resizable(main_window);
    main_window.show(argc,argv);

    return Fl::run();
}
Exemplo n.º 9
0
int main( int argc, char* argv[] )
{

    // Create Qt Application
    QApplication app(argc, argv);
    
    // Parse the Command-Line Options
    Options options( argc, argv);

    // Build the User-Interface
    MainWindow main_window( options );

    main_window.show();
    return app.exec();
}
Exemplo n.º 10
0
int main(int argc, char* argv[])
{

  QApplication app(argc, argv);
  app.setApplicationName("PhoneticNumberSystem");
  app.setOrganizationName("T4ng10r");
  create_loggers();

  std::unique_ptr<MainWindow> main_window(new MainWindow);
  main_window->show();

  //////////////////////////////////////////////////////////////////////////
  int iReturn = app.exec();
  // destroyLoggers();
  return iReturn;
}
Exemplo n.º 11
0
int main ()
{
    XWindow main_window(450,0);

    // Oeffne Fenster der Groesse xmax x ymax

    main_window.Open(nx, ny, "Brownsche Molekularbewegung");

    // allocate variables for particle position
    int p_x = nx/2, p_y = ny/2;

    // number of position changes per frame
    const int iters = 5;

    std::cout<<"Rendern...\n";
    while (!main_window.KeyIsPressed())
    {
        for (int i = 0; i < iters; ++i)
        {
            int rr = rand() % 4;
            switch (rr)
            {
            case 0:
                ++p_x;
                break;
            case 1:
                --p_x;
                break;
            case 2:
                ++p_y;
                break;
            case 3:
                --p_y;
            default:
                ;
            }

            main_window.DrawPoint(p_x,p_y);
        }

        useconds_t sleep_us = ((1/fps) * 1e+6);
        usleep(sleep_us); // sleep certain time to maintain framerate
    }

    std::cout<<"Bye!\n";
    return 0;
}
Exemplo n.º 12
0
int main (int argc, char **argv)
{
    register int i;
    gchar *username;
    gchar *password;
    GtkWidget *window;
    OGDProvider *provider;

    username = NULL;
    password = NULL;

    g_thread_init (NULL);
    gtk_init (&argc, &argv);

    for (i = 0; i < argc; i++) {
        if (strcmp (argv[i], "-u") == 0)
            username = g_strdup (argv[++i]);
        else if (strcmp (argv[i], "-p") == 0)
            password = g_strdup (argv[++i]);
    }

    if (username == NULL || password == NULL) {
        printf ("Usage: %s -u <username> -p <password>\n", argv[0]);

        if (username != NULL)
            g_free (username);
        if (password != NULL)
            g_free (password);

        exit (1);
    }

    provider = ogd_provider_new ("api.opendesktop.org");
    ogd_provider_auth_user_and_pwd (provider, username, password);

    g_set_application_name ("libopengdesktop test");

    window = main_window (provider);
    gtk_widget_show_all (window);

    gtk_main ();
    exit (0);
}
Exemplo n.º 13
0
Arquivo: main.c Projeto: hannenz/zebra
int main(int argc, char **argv){
	GtkWidget *window;


	gtk_init(&argc, &argv);

	if (gtk_clutter_init(&argc, &argv)){

		window = main_window();

		gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
		gtk_window_set_default_size(GTK_WINDOW(window), 800, 600);
		gtk_widget_set_app_paintable(window, TRUE);

		gtk_widget_show_all(window);
		test_clutter();
		gtk_main();
	}
	return (0);
}
Exemplo n.º 14
0
int maoni_main(int argc, char* argv[], //
		RenderAlgorithm* algorithm_stack, MeshLoader* mesh_loader_stack)
{
	QApplication app(argc, argv);
	Q_INIT_RESOURCE(Resources);

	QPixmap pixmap(":/Maoni/Splashscreen.jpg");
	QSplashScreen splash(pixmap, Qt::WindowStaysOnTopHint);
	splash.show();
	splash.showMessage("Loading Widgets...");

	FrameData framedata(algorithm_stack, mesh_loader_stack);

	MainWindow main_window(framedata, new RenderWidget(framedata));
	main_window.setWindowTitle("Maoni");

	QTimer::singleShot(1000, &main_window, SLOT(show()));
	QTimer::singleShot(1337, &splash, SLOT(close()));

	return app.exec();
}
Exemplo n.º 15
0
Arquivo: qrview.c Projeto: n13l/qrview
int
main(int argc, char *argv[]) 
{
	QRcode *qr = NULL;
#ifdef CONFIG_WINDOWS
	win32_io_init();
#endif

	while ((opt = getopt_long(argc, argv, opt_cmd, opt_long, NULL)) >= 0) {
		switch (opt) {
		case OPT_HELP:
		case '?':
			usage(0);
			break;
                case OPT_NAME:
                        name = strdup(optarg);
			break;
		case OPT_VERSION:
			version();
			exit(EXIT_SUCCESS);
		break;
		case OPT_QR_SIZE:
			qr_size = atoi(optarg);
		break;
		case OPT_TIMEOUT:
			timeout = atoi(optarg);
			break;
		case OPT_ALPHA:
			alpha_max = atoi(optarg);
			if (alpha_max > 255)
				alpha_max = 255;
			if (alpha_max < 0)
				alpha_max = 0;
		break;
		default:
		if (app->num_cmds >= MAX_CMDS)
			giveup("Too many commands specified");
			app->cmd[app->num_cmds] = opt;
			app->arg[app->num_cmds] = optarg;
			app->num_cmds++;
		}
	}

	if (optind + 1 != argc)
		usage(2);

	if (!(uri = argv[argc - 1]))
		usage(2);

	if (lock_instance())
		goto exit;

	qr = QRcode_encodeString8bit(uri , QR_MODE_8, QR_ECLEVEL_H);
	if (qr == NULL)
		goto exit;

        struct surface surface = (struct surface) {
		.width = qr->width,
		.data  = qr->data
	};

	main_window (argc, argv, &surface);

exit:
	if (qr)
		QRcode_free(qr);
	unlock_instance();
	return EXIT_SUCCESS;
}
Exemplo n.º 16
0
int PASCAL
WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw)
{
  PRINTDLG pd;
  int retval;

  freopen ("stdout.txt", "w", stdout);
  setbuf (stdout, 0);
  freopen ("stderr.txt", "w", stderr);
  setbuf (stderr, 0);

  loadgs ();

  memset (&pd, 0, sizeof pd);
  pd.nCopies = 1;
  pd.hwndOwner = main_window ();
  pd.lStructSize = sizeof pd;
  pd.Flags = (PD_HIDEPRINTTOFILE    |
	      PD_NOPAGENUMS         |
	      PD_NOSELECTION        |
	      PD_RETURNDC           |
	      PD_USEDEVMODECOPIES);
  retval = PrintDlg (&pd);
  if (!retval)
    {
      fprintf (stderr, "PrintDlg failed\n");
    }
  else
    {
      static const char *argv[] =
      {
	"executor",
	"-IC:\\GS;C:\\GS\\FONTS",
	"-q",
	"-dNOPAUSE",
	"-sDEVICE=mswindll",
	"-dBitsPerPixel=1",
	NULL, /* -g%dx%d (papersize) */
	NULL, /* -r%dx%d (resolution)*/
	"calibrate.ps", /* %s (filename) */
	"-c quit",
	NULL,
      };
      char *papersize;
      char *resolution;

      global_hdc = pd.hDC;
      global_src.top = 0;
      global_src.left = 0;
      global_src.bottom = GetDeviceCaps (pd.hDC, VERTRES);
      global_src.right = GetDeviceCaps (pd.hDC, HORZRES);
      global_dest = global_src;

      printf ("top = %ld, left = %ld, bottom = %ld, right = %ld\n",
	      global_src.top, global_src.left,
	      global_src.bottom, global_src.right);

      {
	DOCINFO di;
	int job_identifier;

	memset (&di, 0, sizeof di);
	di.cbSize = sizeof di;
	di.lpszDocName = "Test Document";
	job_identifier = StartDoc (global_hdc, &di);
	if (job_identifier <= 0)
	  {
	    retval = 1;
	    MessageBox (NULL, "Couldn't StartDoc", "Print Failure", MB_OK);
	  }
      }

      papersize = alloca (128);
      sprintf (papersize, "-g%ldx%ld", global_src.right, global_src.bottom);

      resolution = alloca (128);
      sprintf (resolution, "-r%dx%d",
	       GetDeviceCaps (pd.hDC, LOGPIXELSX),
	       GetDeviceCaps (pd.hDC, LOGPIXELSY));

      argv[6] = papersize;
      argv[7] = resolution;


      {
	int i;

	for (i = 0; i <= 9; ++i)
	  printf ("argv[%d] = '%s'\n", i, argv[i]);
      }
      
      if (gsdll_init (gsdll_callback, NULL, NELEM (argv)-1, argv) != 0)
	{
	  fprintf (stderr, "gsdll_init failed\n");
	}
      else
	{
	  int code;
	  
	  gsdll_execute_begin ();
	  code = gsdll_execute_cont ("", 0);
	  printf ("code = %d\n", code);
	  if (code > -100)
	    gsdll_execute_end ();
	  gsdll_exit ();
	  retval = TRUE;
	  EndDoc (global_hdc);
	}
    }
  return 0;
}
Exemplo n.º 17
0
int main (void) {
	sf::RenderWindow main_window (sf::VideoMode (900, 600), "Sighle", sf::Style::Close);
	main_window.SetFramerateLimit (25);

	// the story §
	sf::Texture story1;
	story1.LoadFromFile ("textures/story_1.png");

	sf::Texture story2;
	story2.LoadFromFile ("textures/story_2.png");

	sf::Texture story3;
	story3.LoadFromFile ("textures/story_3.png");

	sf::Texture story4;
	story4.LoadFromFile ("textures/story_4.png");

	sf::Texture story5;
	story5.LoadFromFile ("textures/story_5.png");

	sf::Texture story6;
	story6.LoadFromFile ("textures/story_6.png");

	sf::Texture story7;
	story7.LoadFromFile ("textures/story_7.png");

	int episode = 1;
	bool story_is_not_finished = true;
	while (main_window.IsOpened() && story_is_not_finished) {
		sf::Sprite sp_story;
		if (episode == 1) {
			sp_story = sf::Sprite (story1);
		} else if (episode == 2) {
			sp_story = sf::Sprite (story2);
		} else if (episode == 3) {
			sp_story = sf::Sprite (story3);
		} else if (episode == 4) {
			sp_story = sf::Sprite (story4);
		} else if (episode == 5) {
			sp_story = sf::Sprite (story5);
		} else if (episode == 6) {
			sp_story = sf::Sprite (story6);
		} else if (episode == 7) {
			sp_story = sf::Sprite (story7);
		} else if (episode == 8) {
			sp_story = sf::Sprite (story7);
			story_is_not_finished = false;			
		}

		sf::Event event;
		while (main_window.PollEvent (event)) {
			if (event.Type == sf::Event::KeyPressed && event.Key.Code == sf::Keyboard::Escape) {
				story_is_not_finished = false;
			} else if (event.Type == sf::Event::MouseButtonReleased) {
				episode ++;
			} else if (event.Type == sf::Event::Closed) {
				main_window.Close ();
			}
		}
		main_window.Clear (sf::Color::White);
		main_window.Draw (sp_story);
		main_window.Display ();
	}

	std::vector <sf::Texture> textures;
	std::vector <sf::Sprite> sprites;
	std::vector <sf::Text> texts;
	sf::Font (font);
	font.LoadFromFile ("./DejaVuSerif.ttf");
	
	sf::Texture bg_texture;

	sf::Texture text_flag_zone;
	text_flag_zone.LoadFromFile ("textures/launch.png");

	sf::Sprite flag_zone (text_flag_zone);

	int x_flag_zone;
	int y_flag_zone;



	Game game (&textures, &sprites, &bg_texture, &x_flag_zone, &y_flag_zone, &texts);

	sf::Texture text_play_again;
	text_play_again.LoadFromFile ("textures/again.png");
	sf::Sprite play_again (text_play_again);
	play_again.SetPosition (860, 10);
	
	while (main_window.IsOpened()) {
		game.doYourJob ();

		sf::Event event;
		while (main_window.PollEvent (event)) {
			if (event.Type == sf::Event::Closed) {
				main_window.Close ();
			} else {
				game.interpretEvent (event);
			}
		}

		
		
		main_window.Clear (sf::Color::Black);	

	sf::Sprite bg_sprite (bg_texture);
	bg_sprite.SetPosition (0,0);
		
		flag_zone.SetPosition (x_flag_zone, y_flag_zone);

		main_window.Draw (bg_sprite);
		main_window.Draw (flag_zone);

		for (unsigned int i = 0; i < sprites.size(); i++) {
			main_window.Draw (sprites[i]);
		}

		for (unsigned int i = 0; i < texts.size(); i++) {
			texts[i].SetFont (font);
			main_window.Draw (texts[i]);
		}

		if (game.getMode() == PLAY || game.getMode () == WIN) {
			main_window.Draw (play_again);
		}
		main_window.Display ();
	}
	return 0;
}