当前位置: 首页>>代码示例>>C++>>正文


C++ App函数代码示例

本文整理汇总了C++中App函数的典型用法代码示例。如果您正苦于以下问题:C++ App函数的具体用法?C++ App怎么用?C++ App使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了App函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main(int argc, char** argv)
{
	int gameState = 0;
	
	srand(time(NULL));
	// ================ Initialising ! ================
	// Create main window
	// Black screen
	sf::RenderWindow App(sf::VideoMode(WINDOW_WIDTH, WINDOW_HEIGHT), "SIMPLE RUMBLE !!!");
	
	sf::CircleShape circle;
	circle.setRadius(150);
	circle.setOutlineColor(sf::Color::Red);
	circle.setOutlineThickness(5);
	circle.setPosition(10, 20);
//	App.draw(circle);

	sf::Clock clock;
	while (App.isOpen())
	{
		// Process events
		sf::Event event;
		sf::Time elapsedTime = clock.getElapsedTime();
		clock.restart();

		while (App.pollEvent(event))
		{
			// Event processing
			if(event.type == sf::Event::Closed){ App.close(); }
			if(event.type == sf::Event::KeyPressed)
			{
				if (event.key.code == sf::Keyboard::Escape){ App.close(); }
			}
		}
		App.draw(circle);
		App.display();
	}

	return EXIT_SUCCESS;
}
开发者ID:r1d1,项目名称:simplerumble2,代码行数:40,代码来源:testShape.cpp

示例2: main

int
main(int argc, char** argv) 
{
  int rc = 0;
  Miro::Client client(argc, argv);

  try {
    QApplication App(argc, argv);
    PolicyEditorClass PolicyEditor(argc, argv, client);
    

    // TODO warning dialog
    if (argc>2) { 
      std::cout << argv[0] << " [policyfile]" << std::endl; 
      return 1;
    }

    // TODO load comman line argument policy here

    App.setMainWidget(&PolicyEditor);
    PolicyEditor.show();
    App.exec();
    
  }

  catch (const std::string& s) {
    std::cerr << "Uncought exception: " << s << std::endl;
    rc = 1;
  }
  catch (const Miro::Exception& e) {
    std::cerr << "Uncought Miro exception: " << e << endl;
    rc = 1;
  }
  catch (const CORBA::Exception& e) {
    std::cerr << "Uncought CORBA exception: " << e << endl;
    rc = 1;
  }

  return rc;
}
开发者ID:BackupTheBerlios,项目名称:miro-middleware-svn,代码行数:40,代码来源:PolicyEditor.cpp

示例3: main

int main(int argc, char *argv[]) {
	QApplication App(argc, argv);
	QImage MemoryImage("D:/Vyzkumak/Workspace/Qt/Qt/Debug/Picture.png");
	QImage ShowImage("D:/Vyzkumak/Workspace/Qt/Qt/Debug/Picture.png");
	QLabel label;
	label.setPixmap(QPixmap::fromImage(ShowImage));
	label.show();

    int w = MemoryImage.width();
    int h = MemoryImage.height();
	start = time (NULL);
	for (int j=0; j<1; j++){
		qreal H, S, V;
		QColor Color;
		qreal cont=0;
		for (int i=0; i<100; i++){
			cont=cont+0.01;

			for ( int x = 0; x < w; x++ ){
				for ( int y = 0; y < h; y++ ){
					QRgb Rgb = MemoryImage.pixel( x, y);
					Color.setRgb(Rgb);
					Color.getHsvF(&H, &S, &V);
					qreal v=V*cont;
					Color.setHsvF(H, S, v);
					Rgb = Color.rgb();
					ShowImage.setPixel(x, y, Rgb);
				}
			}
			label.setPixmap(QPixmap::fromImage(ShowImage));
			label.repaint();
		}
	}
	end = time (NULL);
	int length = (int) (end - start);
	std::cout << "Length of rendering 100 frames was: " << length << " seconds.\n";
	std::cout << "Average fps is: " << 100. / (float)length << " frames per seconds.\n";
	App.exec();
}
开发者ID:flaska,项目名称:VUworkspace,代码行数:39,代码来源:main.cpp

示例4: main

int main(int argc, char** argv) {
    GApp::Settings settings;
    
    settings.useDeveloperTools = false;

    settings.window.fullScreen = false;
    settings.window.framed = ! settings.window.fullScreen;
    settings.window.msaaSamples = 1;
    settings.dataDir = "./";
    settings.window.defaultIconFilename = "g3d.ico";

#   ifdef G3D_WIN32
	if (!FileSystem::exists(settings.window.defaultIconFilename)) {
        // We are probably running in the debugger and launched from the wrong directory
        chdir("../build/win-i386-vc9.0/bin/gfxmeter");
		debugAssert(FileSystem::exists(settings.window.defaultIconFilename));
    }
#   endif

    App(settings).run();
    return 0;
}
开发者ID:luaman,项目名称:g3d-cvs,代码行数:22,代码来源:main.cpp

示例5: GetStretchHandleData

void OBSBasicPreview::GetStretchHandleData(const vec2 &pos)
{
	OBSBasic *main = reinterpret_cast<OBSBasic*>(App()->GetMainWindow());

	OBSScene scene = main->GetCurrentScene();
	if (!scene)
		return;

	HandleFindData data(pos, main->previewScale);
	obs_scene_enum_items(scene, FindHandleAtPos, &data);

	stretchItem     = std::move(data.item);
	stretchHandle   = data.handle;

	if (stretchHandle != ItemHandle::None) {
		matrix4 boxTransform;
		vec3    itemUL;
		float   itemRot;

		stretchItemSize = GetItemSize(stretchItem);

		obs_sceneitem_get_box_transform(stretchItem, &boxTransform);
		itemRot = obs_sceneitem_getrot(stretchItem);
		vec3_from_vec4(&itemUL, &boxTransform.t);

		/* build the item space conversion matrices */
		matrix4_identity(&itemToScreen);
		matrix4_rotate_aa4f(&itemToScreen, &itemToScreen,
				0.0f, 0.0f, 1.0f, RAD(itemRot));
		matrix4_translate3f(&itemToScreen, &itemToScreen,
				itemUL.x, itemUL.y, 0.0f);

		matrix4_identity(&screenToItem);
		matrix4_translate3f(&screenToItem, &screenToItem,
				-itemUL.x, -itemUL.y, 0.0f);
		matrix4_rotate_aa4f(&screenToItem, &screenToItem,
				0.0f, 0.0f, 1.0f, RAD(-itemRot));
	}
}
开发者ID:antihax,项目名称:obs-studio,代码行数:39,代码来源:window-basic-preview.cpp

示例6: main

int main(int argc, char** argv)
{
    (void) argc;
    (void) argv;

    sf::Font MyFont;
    //MyFont.LoadFromFile("data/Polsku.ttf");
    MyFont.LoadFromFile("data/Junicode-Bold.ttf");

    // Create main window
    sf::RenderWindow App(sf::VideoMode(SCREEN_W, SCREEN_H), "DDcar", sf::Style::Fullscreen);
    App.UseVerticalSync(true);

    App.SetFramerateLimit(60);
    //const sf::Input& Input = App.GetInput();

    //main menu ?
    Menu menu(&App,&MyFont);
    menu.create();

    bool quit_game=false;
    while (!quit_game)
    {
      if (menu.show())
	{
	  quit_game=true;continue;
	}

      //Race race(&App,"data/track2.xml",15);
      Race race(&App,&MyFont,menu.get_track(),menu.get_rule(),menu.get_nbr_cars());
      if (race.run())
        {
	  quit_game=true;
        }
    }
    App.Close();

	return 0;
}
开发者ID:jmimu,项目名称:DDcar,代码行数:39,代码来源:main.cpp

示例7: setWindowFlags

OBSProjector::OBSProjector(QWidget *widget, obs_source_t *source_, bool window)
	: OBSQTDisplay                 (widget,
	                                Qt::Window),
	  source                       (source_),
	  removedSignal                (obs_source_get_signal_handler(source),
	                                "remove", OBSSourceRemoved, this)
{
	if (!window) {
		setWindowFlags(Qt::FramelessWindowHint |
				Qt::X11BypassWindowManagerHint);
	}

	setAttribute(Qt::WA_DeleteOnClose, true);

	//disable application quit when last window closed
	setAttribute(Qt::WA_QuitOnClose, false);

	installEventFilter(CreateShortcutFilter());

	auto addDrawCallback = [this] ()
	{
		obs_display_add_draw_callback(GetDisplay(), OBSRender, this);
		obs_display_set_background_color(GetDisplay(), 0x000000);
	};

	connect(this, &OBSQTDisplay::DisplayCreated, addDrawCallback);

	bool hideCursor = config_get_bool(GetGlobalConfig(),
			"BasicWindow", "HideProjectorCursor");
	if (hideCursor && !window) {
		QPixmap empty(16, 16);
		empty.fill(Qt::transparent);
		setCursor(QCursor(empty));
	}

	App()->IncrementSleepInhibition();
	resize(480, 270);
}
开发者ID:LiminWang,项目名称:obs-studio,代码行数:38,代码来源:window-projector.cpp

示例8: DrawSelectedItem

bool OBSBasicPreview::DrawSelectedItem(obs_scene_t scene, obs_sceneitem_t item,
		void *param)
{
	if (!obs_sceneitem_selected(item))
		return true;

	OBSBasic *main = reinterpret_cast<OBSBasic*>(App()->GetMainWindow());

	gs_load_vertexbuffer(main->circle);

	matrix4 boxTransform;
	obs_sceneitem_get_box_transform(item, &boxTransform);

	gs_matrix_push();
	gs_matrix_scale3f(HANDLE_RADIUS, HANDLE_RADIUS, 1.0f);
	DrawCircleAtPos(0.0f, 0.0f, boxTransform, main->previewScale);
	DrawCircleAtPos(0.0f, 1.0f, boxTransform, main->previewScale);
	DrawCircleAtPos(1.0f, 0.0f, boxTransform, main->previewScale);
	DrawCircleAtPos(1.0f, 1.0f, boxTransform, main->previewScale);
	DrawCircleAtPos(0.5f, 0.0f, boxTransform, main->previewScale);
	DrawCircleAtPos(0.0f, 0.5f, boxTransform, main->previewScale);
	DrawCircleAtPos(0.5f, 1.0f, boxTransform, main->previewScale);
	DrawCircleAtPos(1.0f, 0.5f, boxTransform, main->previewScale);
	gs_matrix_pop();

	gs_load_vertexbuffer(main->box);

	gs_matrix_push();
	gs_matrix_set(&boxTransform);
	gs_matrix_scale3f(main->previewScale, main->previewScale, 1.0f);
	gs_draw(GS_LINESTRIP, 0, 0);

	gs_matrix_pop();

	UNUSED_PARAMETER(scene);
	UNUSED_PARAMETER(param);
	return true;
}
开发者ID:antihax,项目名称:obs-studio,代码行数:38,代码来源:window-basic-preview.cpp

示例9: main

int main(int argc, const char* argv[]) {
    {
        G3DSpecification g3dSpec;
        g3dSpec.audio = false;
        initGLG3D(g3dSpec);
    }

    GApp::Settings settings(argc, argv);

    // Change the window and other startup parameters by modifying the
    // settings class.  For example:
    settings.window.caption             = argv[0];
    // settings.window.debugContext     = true;

    // settings.window.width              =  854; settings.window.height       = 480;
    // settings.window.width            = 1024; settings.window.height       = 768;
     settings.window.width            = 1280; settings.window.height       = 720;
//    settings.window.width               = 1920; settings.window.height       = 1080;
    // settings.window.width            = OSWindow::primaryDisplayWindowSize().x; settings.window.height = OSWindow::primaryDisplayWindowSize().y;
    settings.window.fullScreen          = false;
    settings.window.resizable           = ! settings.window.fullScreen;
    settings.window.framed              = ! settings.window.fullScreen;

    // Set to true for a significant performance boost if your app can't render at 60fps,
    // or if you *want* to render faster than the display.
    settings.window.asynchronous        = false;

    settings.depthGuardBandThickness    = Vector2int16(64, 64);
    settings.colorGuardBandThickness    = Vector2int16(0, 0);
    settings.dataDir                    = FileSystem::currentDirectory();
    settings.screenshotDirectory        = "../journal/";

    settings.renderer.deferredShading = false;
    settings.renderer.orderIndependentTransparency = false;


    return App(settings).run();
}
开发者ID:lieff,项目名称:g3d,代码行数:38,代码来源:App.cpp

示例10: DrawSceneEditing

void OBSBasicPreview::DrawSceneEditing()
{
	OBSBasic *main = reinterpret_cast<OBSBasic*>(App()->GetMainWindow());

	effect_t    solid = obs_get_solid_effect();
	technique_t tech  = effect_gettechnique(solid, "Solid");

	vec4 color;
	vec4_set(&color, 1.0f, 0.0f, 0.0f, 1.0f);
	effect_setvec4(solid, effect_getparambyname(solid, "color"), &color);

	technique_begin(tech);
	technique_beginpass(tech, 0);

	OBSScene scene = main->GetCurrentScene();
	if (scene)
		obs_scene_enum_items(scene, DrawSelectedItem, this);

	gs_load_vertexbuffer(nullptr);

	technique_endpass(tech);
	technique_end(tech);
}
开发者ID:antihax,项目名称:obs-studio,代码行数:23,代码来源:window-basic-preview.cpp

示例11: on_actionExportProfile_triggered

void OBSBasic::on_actionExportProfile_triggered()
{
	char path[512];

	QString home = QDir::homePath();

	QString currentProfile =
		QString::fromUtf8(config_get_string(App()->GlobalConfig(),
		"Basic", "ProfileDir"));

	int ret = GetConfigPath(path, 512, "obs-studio/basic/profiles/");
	if (ret <= 0) {
		blog(LOG_WARNING, "Failed to get profile config path");
		return;
	}

	QString dir = QFileDialog::getExistingDirectory(
			this,
			QTStr("Basic.MainMenu.Profile.Export"),
			home,
			QFileDialog::ShowDirsOnly |
			QFileDialog::DontResolveSymlinks);

	if (!dir.isEmpty() && !dir.isNull()) {
		QString outputDir = dir + "/" + currentProfile;
		QString inputPath = QString::fromUtf8(path);
		QDir folder(outputDir);

		if (!folder.exists()) {
			folder.mkpath(outputDir);
			QFile::copy(inputPath + currentProfile + "/basic.ini",
					outputDir + "/basic.ini");
			QFile::copy(inputPath + currentProfile + "/service.json",
					outputDir + "/service.json");
		}
	}
}
开发者ID:AnthonySuper,项目名称:obs-studio,代码行数:37,代码来源:window-basic-main-profiles.cpp

示例12: main

int main()
{
    // Create the main window
    sf::RenderWindow App(sf::VideoMode(800, 600, 32), "Hello World - SFML");
 
    // Start the main loop
    while (App.isOpen())
    {
        // Process events
        sf::Event Event;
        while (App.pollEvent(Event))
        {
            // Close window : exit
            if (Event.type == sf::Event::Closed)
                App.close();
        }
        // Clear screen, and fill it with blue
        App.clear(sf::Color::Blue);
 
        // Display the content of the window on screen
        App.display();
    }
    return 0;
}
开发者ID:Manu343726,项目名称:sfml-biicode,代码行数:24,代码来源:main.cpp

示例13: AddNew

bool AddNew(QWidget *parent, const char *id, const char *name,
		const bool visible, OBSSource &newSource)
{
	OBSBasic     *main = reinterpret_cast<OBSBasic*>(App()->GetMainWindow());
	OBSScene     scene = main->GetCurrentScene();
	bool         success = false;
	if (!scene)
		return false;

	obs_source_t *source = obs_get_source_by_name(name);
	if (source) {
		OBSMessageBox::information(parent,
				QTStr("NameExists.Title"),
				QTStr("NameExists.Text"));

	} else {
		source = obs_source_create(id, name, NULL, nullptr);

		if (source) {
			AddSourceData data;
			data.source = source;
			data.visible = visible;

			obs_enter_graphics();
			obs_scene_atomic_update(scene, AddSource, &data);
			obs_leave_graphics();

			newSource = source;

			success = true;
		}
	}

	obs_source_release(source);
	return success;
}
开发者ID:ElectronicWar,项目名称:obs-studio,代码行数:36,代码来源:window-basic-source-select.cpp

示例14: GetScreenSnapOffset

vec3 OBSBasicPreview::GetScreenSnapOffset(const vec3 &tl, const vec3 &br)
{
	OBSBasic *main = reinterpret_cast<OBSBasic*>(App()->GetMainWindow());
	vec2 screenSize = GetOBSScreenSize();
	vec3 clampOffset;

	vec3_zero(&clampOffset);

	const float clampDist = CLAMP_DISTANCE / main->previewScale;

	if (fabsf(tl.x) < clampDist)
		clampOffset.x = -tl.x;
	if (fabsf(clampOffset.x) < EPSILON &&
	    fabsf(screenSize.x - br.x) < clampDist)
		clampOffset.x = screenSize.x - br.x;

	if (fabsf(tl.y) < clampDist)
		clampOffset.y = -tl.y;
	if (fabsf(clampOffset.y) < EPSILON &&
	    fabsf(screenSize.y - br.y) < clampDist)
		clampOffset.y = screenSize.y - br.y;

	return clampOffset;
}
开发者ID:antihax,项目名称:obs-studio,代码行数:24,代码来源:window-basic-preview.cpp

示例15: main

int main()
{
	bool x = true;

	sf::Clock clock;
	float lastTime = clock.GetElapsedTime();
    sf::RenderWindow App(sf::VideoMode(800, 600), "Rogalik");
	ImageRes::getInstance().loadImages("tiles.png", 8, 0);
	Game game;


    while (App.IsOpened())
    {
        sf::Event Event;
        while (App.GetEvent(Event))
        {
            if (Event.Type == sf::Event::Closed)
                App.Close();
            else if (Event.Type == sf::Event::KeyPressed)
			{
				game.getInput(Event.Key);
			}
			
        }

		float dt = clock.GetElapsedTime() - lastTime;
		lastTime += dt;

        App.Clear();
		game.draw(App);
		
        App.Display();
    }

    return EXIT_SUCCESS;
}
开发者ID:mszkolka,项目名称:rogalik,代码行数:36,代码来源:main.cpp


注:本文中的App函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。