Пример #1
0
 View* View::create(cocos2d::Scene* scene)
 {
     View* view = new View();
     view->setScene(scene);
     view->init();
     return view;
 }
Пример #2
0
int main(int argc, char** argv) {

    if (argc < 3) {
        printf("format : ./assign4 <ply file1 path> <ply file2 path>\n");
        return 0;
    }

    Model::pl.readFile(argv[1]);

    Model::pl1.readFile(argv[2]);

    glutInit(&argc, argv);
    v.init(SCREEN_WIDTH,SCREEN_HEIGHT);

    //Mouse event controller
    glutMouseFunc(Controller::mouseEventHandler);
    glutMotionFunc (Controller::mouseMotion);

    //Keyboard Event Controller
    glutKeyboardFunc(Controller::keyboardEventHandler);
    glutSpecialFunc(Controller::specialKeyEventHandler);

    //Display function
    // glutIdleFunc(Model::idle);
    glutReshapeFunc(View::reshape);
    glutDisplayFunc(View::render);
    glEnable(GL_DEPTH_TEST);
    glDepthFunc(GL_LESS);
    glutMainLoop();

    return 0;
}
Пример #3
0
int main(int argc, char* argv[])
{
    try 
    {
        View v;
        v.init();
        v.execute();
    } 
    catch (const std::runtime_error &e) 
    {
        std::cout << e.what() << std::endl;
        return -1;
    }
    return 0;
}
Пример #4
0
int main()
{
	const int FRAMES_PER_SECOND = 25;
    const int SKIP_TICKS = 1000 / FRAMES_PER_SECOND;
	const int MAX_FRAMESKIP = 10;

    unsigned long next_game_tick = GetTickCount();
	int loops = 0;

	Tetris game;
	printf("Game initializing\n");
	game.init();
	
	printf("Game initialized\n");
	View view;
	view.init(game);

    //int sleep_time = 0;
	int quit = 0;

    bool game_is_running = true;
    while( game_is_running ) 
	{
		while( GetTickCount() > next_game_tick && loops < MAX_FRAMESKIP) 
		{
			quit = view.getInput();
			next_game_tick += SKIP_TICKS;
			loops++;
		}
		if(quit == 1)
		{
			game.pause();
			quit = 0;
		}
		else if(quit == 2)
		{
			game_is_running = false;
			quit = 0;
		}
		game.update();
        view.update();
    }
	return 0;
}
Пример #5
0
bool View::stopRecording()
{
// TODO
#if 0
    QString errmsg;
    bool error = ViewControl::stopRecording(errmsg);
    QStringList archiveList = ViewControl::archiveList();

    for (int i = 0; i < archiveList.size(); i++) {
	QString archive = archiveList.at(i);
	int sts;

	console->post("View::stopRecording opening archive %s",
			(const char *)archive.toAscii());
	if ((sts = archiveGroup->use(PM_CONTEXT_ARCHIVE, archive)) < 0) {
	    errmsg.append(QApplication::tr("Cannot open PCP archive: "));
	    errmsg.append(archive);
	    errmsg.append("\n");
	    errmsg.append(pmErrStr(sts));
	    errmsg.append("\n");
	    error = true;
	}
	else {
	    archiveGroup->updateBounds();
	    QmcSource source = archiveGroup->context()->source();
	    pmtime->addArchive(source.start(), source.end(),
				source.timezone(), source.host(), true);
	}
    }

    // If all is well, we can now create the new "Record" View.
    // Order of cleanup and changing Record mode state is different
    // in the error case to non-error case, this is important for
    // getting the window state correct (i.e. pmview->enableUi()).

    if (error) {
	cleanupRecording();
	pmview->setRecordState(false);
	QMessageBox::warning(NULL, pmProgname, errmsg,
		QMessageBox::Ok|QMessageBox::Default|QMessageBox::Escape,
		QMessageBox::NoButton, QMessageBox::NoButton);
    }
    else {
	// Make the current View stop recording before changing Views
	pmview->setRecordState(false);

	View *view = new View;
	console->post("View::stopRecording creating view: delta=%.2f pos=%.2f",
			App::timevalToSeconds(*pmtime->archiveInterval()),
			App::timevalToSeconds(*pmtime->archivePosition()));
	// TODO: may need to update archive samples/visible?
	view->init(archiveGroup, pmview->viewMenu(), "Record");
	pmview->addActiveView(view);
	OpenViewDialog::openView((const char *)ViewControl::view().toAscii());
	cleanupRecording();
    }
    return error;
#else
    return false;
#endif
}