• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ App函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: testFullRender

void testFullRender(bool generateGoldStandard) {
    initGLG3D();

    GApp::Settings settings;

    settings.window.caption			= "Test Renders";
    settings.window.width        = 1280; settings.window.height       = 720;
    settings.film.preferredColorFormats.clear();
    settings.film.preferredColorFormats.append(ImageFormat::RGB32F());

	// Enable vsync.  Disable 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(16, 16);
    settings.dataDir				= FileSystem::currentDirectory();
    if(generateGoldStandard) { // Warning! Do not change these directories without changing the App... it relies on these directories to tell what mode we are in
        settings.screenshotDirectory	= "../data-files/RenderTest/GoldStandard";
    } else {
        settings.screenshotDirectory	= "../data-files/RenderTest/Results";
    }  
    int result = App(settings).run();
    testAssertM(result == 0 ,"App failed to run");
}
开发者ID:jackpoz,项目名称:G3D-backup,代码行数:24,代码来源:tFullRender.cpp


示例17: config_get_string

void OBSBasic::RefreshSceneCollections()
{
	QList<QAction*> menuActions = ui->sceneCollectionMenu->actions();
	int count = 0;

	for (int i = 0; i < menuActions.count(); i++) {
		QVariant v = menuActions[i]->property("fileName");
		if (v.typeName() != nullptr)
			delete menuActions[i];
	}

	const char *cur_name = config_get_string(App()->GlobalConfig(),
			"Basic", "SceneCollection");

	auto addCollection = [&](const char *name, const char *path)
	{
		std::string file = strrchr(path, '/') + 1;
		file.erase(file.size() - 5, 5);

		QAction *action = new QAction(QT_UTF8(name), this);
		action->setProperty("fileName", QT_UTF8(path));
		connect(action, &QAction::triggered,
				this, &OBSBasic::ChangeSceneCollection);
		action->setCheckable(true);

		action->setChecked(strcmp(name, cur_name) == 0);

		ui->sceneCollectionMenu->addAction(action);
		count++;
		return true;
	};

	EnumSceneCollections(addCollection);

	ui->actionRemoveSceneCollection->setEnabled(count > 1);
}
开发者ID:chewcode,项目名称:obs-studio,代码行数:36,代码来源:window-basic-main-scene-collections.cpp


示例18: App

void SplineGenerator::drawSpline(Path p,int x, int y)
{
    sf::RenderWindow App(sf::VideoMode(x, y, 32), "SFML Graphics");

    // Start game loop
    while (App.IsOpened())
    {
        // Process events
        sf::Event Event;
        while (App.GetEvent(Event))
        {
            // Close window : exit
            if (Event.Type == sf::Event::Closed)
                App.Close();
        }

        // Clear the screen (fill it with black color)
        App.Clear();

        //Draw path
        Path::iterator iPath = p.begin();
        Vector2d prevPoint = *iPath;
        ++iPath;
        while(iPath!=p.end())
        {
            Vector2d currPoint = *iPath;
            sf::Shape line   = sf::Shape::Line(prevPoint.x * x, prevPoint.y * y,currPoint.x * x , currPoint.y * y, 1, sf::Color::Red);
            App.Draw(line);
            ++iPath;
            prevPoint = currPoint;
        }

        // Display window contents on screen
        App.Display();
    }
}
开发者ID:samhaldenby,项目名称:NewComponentEngine,代码行数:36,代码来源:SplineGenerator.cpp


示例19: main

int main()
{
    srand(static_cast<unsigned int> (time(NULL)));

    // Create the main window
    sf::RenderWindow App(sf::VideoMode(WINDOW_W, WINDOW_H), "Game of Life");
	App.setFramerateLimit(60);
    sf::Clock clock;
    float elapsedTime=0;

    //Game of life;
    CellularAutomaton gameOfLife(WINDOW_W, WINDOW_H);
	int gen=0;
    bool pausedGame = true;

    //View (pour zoom)
	sf::View mainView = App.getDefaultView();
    sf::View zoomView;
    zoomView.setSize(WINDOW_W / ZOOM_FRACTION, WINDOW_H / ZOOM_FRACTION);
    bool zoom = false;

        // Start the game loop
    while (App.isOpen())
    {
        // Process events
        sf::Event event;
        while (App.pollEvent(event))
        {
            // Close window : exit
            if (event.type == sf::Event::Closed)
                App.close();
            // Simulation controls
            if (event.type == sf::Event::KeyPressed)
            {
				switch(event.key.code)
				{
				case sf::Keyboard::Space : // Pause simulation
					if(event.key.code == sf::Keyboard::Space)
					{
						if(pausedGame)
							pausedGame = false;
						else
							pausedGame = true;
					}
					break;
				case sf::Keyboard::Z : // Toggle zoom
					if(event.key.code == sf::Keyboard::Z)
					{
						if(zoom)
						{
							zoom = false;
							App.setView(App.getDefaultView());
						}
						else
						{
							zoom = true;
							App.setView(zoomView);
						}
					}
					break;
				case sf::Keyboard::R : // reset grid with random cell states
                    gameOfLife.reset();
					break;
				case sf::Keyboard::C: // clear all living cells
                    gameOfLife.clear(false);
					break;
				case sf::Keyboard::Right :
					if(pausedGame)
					{
						if(event.key.control)
							for(unsigned int i=0; i<10; i++)
								gameOfLife.nextStep();
						else
							gameOfLife.nextStep();
					}
					break;
				default :
					break;
				}
            }
            if(event.type == sf::Event::MouseMoved)
            {
                if(!zoom)
                {
					sf::Vector2f mousePos =  App.mapPixelToCoords(sf::Mouse::getPosition(App));

					mousePos.x = floor(mousePos.x);
					mousePos.y = floor(mousePos.y);
                    zoomView.setCenter(mousePos);
                }
            }

            // Change cell state according to mouse button
            if(event.type == sf::Event::MouseButtonReleased && zoom)
            {
                sf::Vector2f mousePos =  App.mapPixelToCoords(sf::Mouse::getPosition(App));

                mousePos.x = floor(mousePos.x);
                mousePos.y = floor(mousePos.y);

//.........这里部分代码省略.........
开发者ID:Minaithnir,项目名称:CUDA_CellularAutomaton,代码行数:101,代码来源:main.cpp


示例20: config_get_string

void OBSBasic::on_actionRemoveProfile_triggered()
{
	std::string newName;
	std::string newPath;
	ConfigFile config;

	std::string oldDir = config_get_string(App()->GlobalConfig(),
			"Basic", "ProfileDir");
	std::string oldName = config_get_string(App()->GlobalConfig(),
			"Basic", "Profile");

	auto cb = [&](const char *name, const char *filePath)
	{
		if (strcmp(oldName.c_str(), name) != 0) {
			newName = name;
			newPath = filePath;
			return false;
		}

		return true;
	};

	EnumProfiles(cb);

	/* this should never be true due to menu item being grayed out */
	if (newPath.empty())
		return;

	QString text = QTStr("ConfirmRemove.Text");
	text.replace("$1", QT_UTF8(oldName.c_str()));

	QMessageBox::StandardButton button = QMessageBox::question(this,
			QTStr("ConfirmRemove.Title"), text);
	if (button == QMessageBox::No)
		return;

	size_t newPath_len = newPath.size();
	newPath += "/basic.ini";

	if (config.Open(newPath.c_str(), CONFIG_OPEN_ALWAYS) != 0) {
		blog(LOG_ERROR, "ChangeProfile: Failed to load file '%s'",
				newPath.c_str());
		return;
	}

	newPath.resize(newPath_len);

	const char *newDir = strrchr(newPath.c_str(), '/') + 1;

	config_set_string(App()->GlobalConfig(), "Basic", "Profile",
			newName.c_str());
	config_set_string(App()->GlobalConfig(), "Basic", "ProfileDir",
			newDir);

	config.Swap(basicConfig);
	InitBasicConfigDefaults();
	ResetProfileData();
	DeleteProfile(oldName.c_str(), oldDir.c_str());
	RefreshProfiles();
	config_save_safe(App()->GlobalConfig(), "tmp", nullptr);

	blog(LOG_INFO, "Switched to profile '%s' (%s)",
			newName.c_str(), newDir);
	blog(LOG_INFO, "------------------------------------------------");

	UpdateTitleBar();
}
开发者ID:AhmedAbdulSalam5,项目名称:obs-studio,代码行数:67,代码来源:window-basic-main-profiles.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ AppInit函数代码示例发布时间:2022-05-30
下一篇:
C++ Any函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap