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

C++ Instance函数代码示例

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

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



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

示例1: switch

void QueuedWork::Run(Type what, int maxcount) {
	switch (what) {
		case Polling:
			Instance().poll.get();
			for (std::vector<Queued *>::iterator it = Instance().Polls.begin(); it != Instance().Polls.end(); ++it) {
				(*it)->run();
			}
			Instance().poll.put();
			break;
		case Blocking:
			for (;;) {
				Instance().semaphore.get();
				Instance().lock.get();
				Queued *q = Instance().MayBlock.front();
				Instance().MayBlock.pop_front();
				Instance().lock.put();
				q->run();
			}
			break;
		case OpenGL:
			Instance().lock.get();
			for (int i = 0; i < maxcount && Instance().OpenGLContext.size(); i++) {
				Queued *q = Instance().OpenGLContext.front();
				Instance().OpenGLContext.pop_front();
				Instance().lock.put();
				q->run();
				Instance().lock.get();
			}
			Instance().lock.put();
			break;
	}
}
开发者ID:dascandy,项目名称:rtsgame,代码行数:32,代码来源:QueuedWork.cpp


示例2: Instance

void HUD::SetHighscore(int score)
{
	Instance().strScore = Tools::ToString(score);
	Instance().DisplayHighscore();
}
开发者ID:tmoss343,项目名称:Profile,代码行数:5,代码来源:HUD.cpp


示例3: assert

HRESULT AnimaApplication::CreateInstance( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
	assert( AnimaApplication::mInstance == 0 );

	HWND	   hWnd;
	WNDCLASSEX winClass;
	memset( &winClass, 0x0, sizeof(WNDCLASSEX) );
	
	winClass.lpszClassName = "MY_WINDOWS_CLASS";
	winClass.cbSize        = sizeof(WNDCLASSEX);
	winClass.style         = CS_HREDRAW | CS_VREDRAW;
	winClass.lpfnWndProc   = WindowProc;
	winClass.hInstance     = hInstance;
	winClass.hIcon	       = LoadIcon(hInstance, (LPCTSTR)IDI_DIRECTX_ICON);
    winClass.hIconSm	   = LoadIcon(hInstance, (LPCTSTR)IDI_DIRECTX_ICON);
	winClass.hCursor       = LoadCursor(NULL, IDC_ARROW);
	winClass.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
	winClass.lpszMenuName  = NULL;
	winClass.cbClsExtra    = 0;
	winClass.cbWndExtra    = 0;

	if( !RegisterClassEx(&winClass) )
		return E_FAIL;

	hWnd = CreateWindowEx( NULL, "MY_WINDOWS_CLASS", 
                             "DX9 Skinning Sample",
						     WS_OVERLAPPEDWINDOW | WS_VISIBLE,
					         0, 0, DISPLAY_WIDTH, DISPLAY_HEIGHT, NULL, NULL, hInstance, NULL );

	if( hWnd == NULL )
		return E_FAIL;

	// register raw input device
	RAWINPUTDEVICE Rid[2];
    Rid[0].usUsagePage = HID_USAGE_PAGE_GENERIC; 
    Rid[0].usUsage = HID_USAGE_GENERIC_MOUSE; 
    Rid[0].dwFlags = RIDEV_INPUTSINK;   
    Rid[0].hwndTarget = hWnd;
 
	// Keyboard
	Rid[1].usUsagePage = HID_USAGE_PAGE_GENERIC;
	Rid[1].usUsage = 6;
	Rid[1].dwFlags = 0;
	Rid[1].hwndTarget=hWnd;

	RegisterRawInputDevices( Rid, 2, sizeof(Rid[0]) );


	ShowWindow( hWnd, nCmdShow );
    UpdateWindow( hWnd );

	LPWSTR *szArglist;
	int nArgs;
	
	szArglist = CommandLineToArgvW(GetCommandLineW(), &nArgs);
	TestEnvironment* testEnvironment = new TestEnvironment( nArgs, szArglist );
	Math::Random::Init( testEnvironment->GetRandomSeed() );

	AnimaApplication::mInstance = new AnimaApplication( winClass, hWnd );

	char szCurrentDir[2048];
	GetCurrentDirectory( sizeof(szCurrentDir), szCurrentDir );
	strcat_s(szCurrentDir, "/../Shaders");
	Instance()->mShadersWatcher = FindFirstChangeNotification( szCurrentDir, FALSE, FILE_NOTIFY_CHANGE_LAST_WRITE);
	if (Instance()->mShadersWatcher  == INVALID_HANDLE_VALUE) 
		DXTRACE_ERR("Unable to monitor shaders directory. Live shaders editing will not work", E_FAIL );

	Instance()->mTestEnvironment = testEnvironment;
	Instance()->mRenderContext = new RenderContext( hWnd, DISPLAY_WIDTH, DISPLAY_HEIGHT );
	Instance()->mFramerateCounter = new FramerateCounter;

	Instance()->mUserInterface = new UserInterface( mInstance->mRenderContext, mInstance->mFramerateCounter );
	Instance()->mUserInterface->AcquireResources( Instance()->mRenderContext );

	Instance()->mInput = new Input();
	Instance()->mCamera = new Camera( *Instance()->mInput, *Instance()->mRenderContext );
	// set up renderer 

	Instance()->mModel = new SkeletalModel( "..\\Models\\frank.dae" );
	Instance()->mModel->Load( Instance()->mRenderContext );
	Instance()->mModel->SetNext( Instance()->mUserInterface );
	Instance()->mModel->PlayAnimation( 0, 0.25f );

	Instance()->mModelRotationAngle = 0.f;
	Instance()->mRotateModel = true;
	Instance()->mFrameCounter = 0;

	return S_OK;
}
开发者ID:devdetails,项目名称:anima-animation-sample,代码行数:89,代码来源:Cubes.cpp


示例4: while

void HUD::SetLives(int amount, bool who)
{
	if(who)
	{
		//Removes previous list from the higscore score. As to not diplay the score along with the previous score. 
		while(!Instance().playerLivesSymbols.empty())
		{
			Instance().playerLivesSymbols.pop_front();
		}
		Instance().nextPos = sf::Vector2f(16*4, 0);
		for (int i=0; i < amount; i++)
		{
			Instance().playerLivesSymbols.push_back(  Instance().BlasterFont.GetGlyph((char)Instance().strScore.at(0), Instance().nextPos) );
			Instance().nextPos.x += 16;
		}
	}
	else
	{
		//Removes previous list from the higscore score. As to not diplay the score along with the previous score. 
		while(!Instance().playerLivesSymbols.empty())
		{
			Instance().playerLivesSymbols.pop_front();
		}
		Instance().nextPos = sf::Vector2f(16*24, 0);
		for (int i=0; i < amount; i++)
		{
			Instance().playerLivesSymbols.push_back(  Instance().BlasterFont.GetGlyph((char)Instance().strScore.at(0), Instance().nextPos) );
			Instance().nextPos.x -= 16;
		}
	}
}
开发者ID:tmoss343,项目名称:Profile,代码行数:31,代码来源:HUD.cpp


示例5: Disable

 static void Disable() {
   Instance().enable_ = false;
 }
开发者ID:h-godai,项目名称:ssa,代码行数:3,代码来源:memory.hpp


示例6: DelCnt

template <typename T> static T* DelCnt(T* p) { return Instance().dl(p); }
开发者ID:h-godai,项目名称:ssa,代码行数:1,代码来源:memory.hpp


示例7: GetArguments

 const CNcbiArguments& GetArguments(void)
 { return *(CNcbiArguments*)Instance(); }
开发者ID:jackgopack4,项目名称:pico-blast,代码行数:2,代码来源:srv_lib.hpp


示例8: Instance

// Set the position of the next character (and the x-coordinate of the first
// character of all following new lines )
void Typewriter::SetStartPosition( const Point3D& ac_roPosition )
{
    Instance().m_oStartPosition = ac_roPosition;
    Instance().SetPosition( ac_roPosition );
}
开发者ID:emlowry,项目名称:AiE,代码行数:7,代码来源:Typewriter.cpp


示例9: Instance

// static command target
void PatchInspector::toggle(const cmd::ArgumentList& args)
{
	Instance().ToggleVisibility();
}
开发者ID:nbohr1more,项目名称:DarkRadiant,代码行数:5,代码来源:PatchInspector.cpp


示例10: SetEnvironment

 CNcbiEnvironment& SetEnvironment(void)
 { return *(CNcbiEnvironment*)Instance(); }
开发者ID:jackgopack4,项目名称:pico-blast,代码行数:2,代码来源:srv_lib.hpp


示例11: handleRunInstances

bool handleRunInstances( AttributeValueMap & avm, std::string & reply, unsigned requestNumber ) {
    // fprintf( stdout, "handleRunInstances()\n" );

    bool found = false;
    std::string userID;
    User & user = validateAndAcquireUser( avm, userID, reply, found );
    if( ! found ) { return false; }

    // Validate the ImageId, MinCount, and MaxCount parameters, as well
    // as the optional parameters KeyName, InstanceType, SecurityGroup*,
    // and UserData.

    // We presently assume all imageIDs are valid.
    std::string imageID = getObject< std::string >( avm, "ImageId", found );
    if( (! found) || imageID.empty() ) {
        fprintf( stderr, "Failed to find imageID in query.\n" );
        reply = "Required parameter ImageId missing or empty.\n";
        return false;
    }

    std::string minCount = getObject< std::string >( avm, "MinCount", found );
    if( (! found) || minCount.empty() ) {
        fprintf( stderr, "Failed to find minCount in query.\n" );
        reply = "Required parameter MinCount missing or empty.\n";
        return false;
    }

    std::string maxCount = getObject< std::string >( avm, "MaxCount", found );
    if( (! found) || maxCount.empty() ) {
        fprintf( stderr, "Failed to find maxCount in query.\n" );
        reply = "Required parameter MaxCount missing or empty.\n";
        return false;
    }

    if( minCount != "1" || maxCount != "1" ) {
        fprintf( stderr, "The simulator presently only supports starting one instance at a time.\n" );
        reply = "Counts must be '1' at present.\n";
        return false;
    }

    std::string keyName = getObject< std::string >( avm, "KeyName", found );
    if( ! keyName.empty() ) {
        Keypair kp = getObject< Keypair >( user.keypairs, keyName, found );
        if( ! found ) {
            std::ostringstream error;
            error << "The requested keypair, '" << keyName << "', does not exist." << std::endl;
            reply = error.str();
            fprintf( stderr, "%s", reply.c_str() );
            return false;
        }
    }

    // We presently assume all instanceTypes are valid.
    std::string instanceType = getObject< std::string >( avm, "InstanceType", found );
    if( instanceType.empty() ) {
        instanceType = "m1.small";
    }

    std::string userData = getObject< std::string >( avm, "UserData", found );
    if( ! userData.empty() ) {
        // We should validate that the user data is properly Base64-encoded.
    }

    std::vector< std::string > groupNames;
    for( int i = 1; ; ++i ) {
        std::ostringstream sgParameterName;
        sgParameterName << "SecurityGroup." << i;
        std::string sgName = getObject< std::string >( avm, sgParameterName.str(), found );
        if( ! found ) { break; }
        if( sgName.empty() ) {
            std::ostringstream error;
            error << "Optional parameter " << sgName << " must not be empty." << std::endl;
            reply = error.str();
            fprintf( stderr, "%s", reply.c_str() );
            return false;
        }

        NameToGroupMap::const_iterator ci = user.groups.find( sgName );
        if( ci != user.groups.end() ) {
            groupNames.push_back( sgName );
        } else {
            std::ostringstream error;
            error << "Group '" << sgName << "' does not exist.\n";
            reply = error.str();
            fprintf( stderr, "%s", reply.c_str() );
            return false;
        }
    }

    if( groupNames.empty() ) {
        groupNames.push_back( "default" );
    }

    // Create the (unique) corresponding Instance.
    char edh[] = "12345678";
    snprintf( edh, sizeof( edh ), "%.8x", (unsigned)user.instances.size() );

    std::string instanceID = "i-"; instanceID += edh;
    std::string privateDNSName = "private.dns."; privateDNSName += edh;
    std::string publicDNSName = "public.dns."; publicDNSName += edh;
//.........这里部分代码省略.........
开发者ID:dcbradley,项目名称:htcondor,代码行数:101,代码来源:queryAPI-sim.cpp


示例12: Instance

void CALLBACK SceneSync::ITimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
{
    Instance().Update();
}
开发者ID:cwalther,项目名称:Plasma-nobink-test,代码行数:4,代码来源:SceneSync.cpp


示例13: main

int main( int args, char *argv[])
{
	
	//Platform init code
	GLFWwindow* window;
    if (!glfwInit())
        return 0;
    
	glfwWindowHint(GLFW_SAMPLES, 4);
	glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
	glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
	glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); 
	
	
	window = glfwCreateWindow(640, 480, "Simple example", NULL, NULL);
    
	if (!window)
    {
        glfwTerminate();
        return 0;
    }
    
	glfwMakeContextCurrent(window);
	
	glewExperimental = GL_TRUE;
	if(glewInit() != GLEW_OK)
	{
		glfwTerminate();
        return 0;
	}
	
	//End of platform init code

	const GLchar FragmentSource[] = {
		"#version 330 core							  \n"
		"out vec4 fcolor;							  \n"
		"void main(){  							      \n"
		"	fcolor = vec4( 1,0,0,0);				  \n"
		"}											  \n" 
	};
	
	const GLchar VertexSource[] = {
		"#version 330 core							  \n"
		"layout(location = 0) in vec2 in_position;    \n"
		"layout(location = 1) in vec2 in_size; 	      \n"
		"											  \n"
		"uniform sce_camera{						  \n"
		"	vec2 camera;							  \n"
		"   float zoom;								  \n"
		"};		  									  \n"
		"											  \n"
		"void main(){							      \n"
		"	gl_Position = vec4( in_position + camera, 0, 1 );  \n"
		"}											  \n" 
	};
	
	
	
	Engine::CShader VertexShader( Engine::VertexShader );
	if( !VertexShader.Compile( VertexSource ) ){
		std::cout << VertexShader.Log() << std::endl;
	}
	
	Engine::CShader FragmentShader( Engine::FragmentShader );
	if( !FragmentShader.Compile( FragmentSource ) ){
		std::cout << FragmentShader.Log() << std::endl;
	}
	
	Engine::CProgram SpriteProgram;
	SpriteProgram.Attach( &VertexShader );
	SpriteProgram.Attach( &FragmentShader );
	if( !SpriteProgram.Link())
	{
		std::cout << SpriteProgram.Log() << std::endl;
	}
	
	Engine::CSCECamera Camera;
	Engine::CSCEInstance Instance( &Camera );
	
	
	const size_t sprite_count = 128;
	SSprite *SpritesOfGods = new SSprite[sprite_count];
	for( size_t i = 0; i < sprite_count; i++ )
		SpritesOfGods[i].position = glm::vec2( 0,0 );
	
	GPUSpriteStorage*  SpriteStorage  = new GPUSpriteStorage();
	GPUSpriteInstance* SpriteInstance = new GPUSpriteInstance();
	GPUSpriteRenderer* SpriteRenderer = new GPUSpriteRenderer();
	
	SpriteRenderer->Program().Attach( &VertexShader   );
	SpriteRenderer->Program().Attach( &FragmentShader );
	if( !SpriteRenderer->Program().Link())
	{
		std::cout << SpriteRenderer->Program().Log() << std::endl;
	}
	
	Instance.Initialize( SpriteRenderer );
	Instance.Camera()->Position() = glm::vec2( 0.25, 0.25 );
	Instance.Camera()->UpdateGpuBuffer();
	
//.........这里部分代码省略.........
开发者ID:knaaas,项目名称:2D-Engine,代码行数:101,代码来源:test.cpp


示例14: Clear

 static void Clear() {
   Instance().count_.clear();
 }
开发者ID:h-godai,项目名称:ssa,代码行数:3,代码来源:memory.hpp


示例15: Instance

void
Logger::setPriority(Logger::Priority priority)
{
    Logger* logger = Instance();
    logger->mPriority = priority;
}
开发者ID:BackupTheBerlios,项目名称:openfdm-svn,代码行数:6,代码来源:Logger.cpp


示例16: Enable

 static void Enable() {
   Instance().enable_ = true;
 }
开发者ID:h-godai,项目名称:ssa,代码行数:3,代码来源:memory.hpp


示例17: Instance

void DESC_MANAGER::NotifyClientPackageFileChanged( const std::string& dirName, eFileUpdatedOptions eUpdateOption )
{
    Instance().LoadClientPackageCryptInfo(dirName.c_str());
}
开发者ID:qq670028,项目名称:Server,代码行数:4,代码来源:desc_manager.cpp


示例18: NewCnt

template <typename T> static T* NewCnt(T* p) { return Instance().nw(p); }
开发者ID:h-godai,项目名称:ssa,代码行数:1,代码来源:memory.hpp


示例19: Instance

void DrawerCommandQueue::Begin()
{
	auto queue = Instance();
	queue->Finish();
	queue->threaded_render++;
}
开发者ID:Xane123,项目名称:world-of-kirbycraft,代码行数:6,代码来源:r_thread.cpp


示例20: Instance

void RecyclingPlayerExplosionFactory::RecyclePlayerExplosion(GameObject* explosion)
{
	//adds EnemyExplosion to recycle stack
	Instance().recycledItems.push( (PlayerExplosion*) explosion);
	
}
开发者ID:HHMedina,项目名称:DePaul-UNI-Projects,代码行数:6,代码来源:RecyclingPlayerExplosion.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ Int函数代码示例发布时间:2022-05-30
下一篇:
C++ InstallWindowEventHandler函数代码示例发布时间: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