當前位置: 首頁>>代碼示例>>C++>>正文


C++ CEvents類代碼示例

本文整理匯總了C++中CEvents的典型用法代碼示例。如果您正苦於以下問題:C++ CEvents類的具體用法?C++ CEvents怎麽用?C++ CEvents使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了CEvents類的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: Unload

bool CScriptingManager::Unload(CScript * pScript)
{
	if(pScript)
	{
		CEvents * pEvents = CEvents::GetInstance();
		pEvents->Call("scriptExit", pScript);

		CScriptArguments pArguments;
		pArguments.push(pScript->GetMetaFile().ToMetaAndFileString());
		pEvents->Call("scriptUnload", &pArguments);
		pEvents->RemoveScript(pScript->GetVM());

#ifdef _SERVER
		if(g_pModuleManager)
			g_pModuleManager->ScriptUnload(pScript->GetVM());
#endif

		pScript->Unload();
		m_scripts.remove(pScript);
		delete pScript;
		return true;
	}

	return false;
}
開發者ID:Dmitriy782,項目名稱:iv-online,代碼行數:25,代碼來源:CScriptingManager.cpp

示例2: lua_checkstack

// The_GTA: use childCall sparringly, because in Eir it's use does not make sense.
bool CClientEntity::CallEvent( const char *name, lua_State *callee, unsigned int argCount, bool childCall )
{
    lua_checkstack( m_lua, 1 );

    // Reference ourselves so we cannot be deleted during eventcalls
    lua_class_reference ref;
    Reference( ref );

    CEvents *pEvents = g_pClientGame->GetEvents();

    // Make sure our event-manager knows we're about to call an event
    pEvents->PrePulse();

    // Call the event on our parents/us
    CallParentEvent( callee, argCount, name, this );

    if ( childCall )
        CallEventNoParent( callee, argCount, name, this );

    // Remove the arguments from the stack
    lua_pop( callee, (int)argCount );

    // Tell the event manager that we're done calling the event
    pEvents->PostPulse();

    // Return whether it got cancelled or not
    return !pEvents->WasCancelled();
}
開發者ID:qaisjp,項目名稱:green-candy,代碼行數:29,代碼來源:CClientEntity.cpp

示例3: GetTimeUs

bool CClientEntity::CallEvent ( const char* szName, const CLuaArguments& Arguments, bool bCallOnChildren )
{
    g_pClientGame->GetDebugHookManager()->OnPreEvent( szName, Arguments, this, NULL );

    TIMEUS startTime = GetTimeUs ();

    CEvents* pEvents = g_pClientGame->GetEvents();

    // Make sure our event-manager knows we're about to call an event
    pEvents->PreEventPulse ();

    // Call the event on our parents/us first
    CallParentEvent ( szName, Arguments, this );

    if ( bCallOnChildren )
    {
        // Call it on all our children
        CallEventNoParent ( szName, Arguments, this );
    }

    // Tell the event manager that we're done calling the event
    pEvents->PostEventPulse ();

    if ( IS_TIMING_CHECKPOINTS() )
    {
        TIMEUS deltaTimeUs = GetTimeUs () - startTime;
        if ( deltaTimeUs > 10000 )
            TIMING_DETAIL( SString ( "Event: %s [%d ms]", szName, deltaTimeUs / 1000 ) );
    }

    g_pClientGame->GetDebugHookManager()->OnPostEvent( szName, Arguments, this, NULL );

    // Return whether it got cancelled or not
    return ( !pEvents->WasEventCancelled () );
}
開發者ID:Jusonex,項目名稱:mtasa-awesomium,代碼行數:35,代碼來源:CClientEntity.cpp

示例4: CScript

CScript * CScriptingManager::Load(CMetaFile & mf)
{
	CScript * pScript = new CScript();

	if(!pScript->Load(mf))
	{
		delete pScript;
		return NULL;
	}

	for(auto i = m_funcs.begin(); i != m_funcs.end(); i++)
		pScript->RegisterFunction((*i)->strName, (*i)->pfnFunction, (*i)->iParameterCount, (*i)->strTemplate);

	for(auto i = m_classes.begin(); i != m_classes.end(); i++)
		pScript->RegisterClass(*i);

	for(auto i = m_constants.begin(); i != m_constants.end(); i++)
		pScript->RegisterConstant((*i)->strName, (*i)->value);

#ifdef _SERVER
	if(g_pModuleManager)
		g_pModuleManager->ScriptLoad(pScript->GetVM());
#endif

	// not a very good way , but leave it as is for now
	for(auto i = m_scripts.begin(); i != m_scripts.end(); i++)
	{
		if((*i)->GetMetaFile().m_Meta == "common" && (*i)->GetMetaFile().m_Type == mf.m_Type)
		{
			pScript->AddExternal((*i)->GetMetaFile());
		}
	}

	if(!pScript->Execute())
	{
		delete pScript;
		CLogFile::Printf("Failed to execute script %s", mf.ToMetaAndFileString().Get());
		return NULL;
	}

	m_scripts.push_back(pScript);

	CEvents * pEvents = CEvents::GetInstance();
	pEvents->Call("scriptInit", pScript);

	CScriptArguments arguments;
	arguments.push(mf.ToMetaAndFileString());
	pEvents->Call("scriptLoad", &arguments);
	return pScript;
}
開發者ID:Dmitriy782,項目名稱:iv-online,代碼行數:50,代碼來源:CScriptingManager.cpp

示例5: OnCheckboxCheckStateChanged

// event checkBoxCheckedChanged(checkBoxName)
bool OnCheckboxCheckStateChanged(const CEGUI::EventArgs &eventArgs)
{
	CEvents * pEvents = g_pClient->GetEvents();
	String eventName("checkBoxCheckedChanged");

	if(!pEvents->IsEventRegistered(eventName))
		return false;

	CEGUI::Window * pWindow = static_cast<const CEGUI::WindowEventArgs&>(eventArgs).window;
	CSquirrel * pScript = g_pClient->GetClientScriptManager()->GetGUIManager()->GetScript(pWindow);

	CSquirrelArguments pArguments;
	pArguments.push(pWindow->getName().c_str());
	pEvents->Call(eventName, &pArguments, pScript);
	return true;
}
開發者ID:guilhermelhr,項目名稱:ivmultiplayer,代碼行數:17,代碼來源:GUINatives.cpp

示例6: OnButtonClick

// event buttonClick(buttonName, bState)
// TODO: remove it. We have better alternative guiClick (OnClick) for any gui element
bool OnButtonClick(const CEGUI::EventArgs &eventArgs)
{
	CEvents * pEvents = g_pClient->GetEvents();
	String eventName("buttonClick");

	if(!pEvents->IsEventRegistered(eventName))
		return false;

	CEGUI::Window * pWindow = static_cast<const CEGUI::WindowEventArgs&>(eventArgs).window;
	CSquirrel * pScript = g_pClient->GetClientScriptManager()->GetGUIManager()->GetScript(pWindow);

	CSquirrelArguments pArguments;
	pArguments.push(pWindow->getName().c_str());
	pArguments.push(0);	// FIXME or what?
	pEvents->Call(eventName, &pArguments, pScript);
	return true;
}
開發者ID:guilhermelhr,項目名稱:ivmultiplayer,代碼行數:19,代碼來源:GUINatives.cpp

示例7: OnMouseLeaves

// event guiMouseLeave(guiName)
bool OnMouseLeaves(const CEGUI::EventArgs &eventArgs)
{
	CEvents * pEvents = g_pClient->GetEvents();
	String eventName("guiMouseLeave");

	if(!pEvents->IsEventRegistered(eventName))
		return false;

	const CEGUI::MouseEventArgs eArgs = static_cast<const CEGUI::MouseEventArgs&>(eventArgs);
	CEGUI::Window * pWindow = eArgs.window;
	CSquirrel * pScript = g_pClient->GetClientScriptManager()->GetGUIManager()->GetScript(pWindow);
	
	CSquirrelArguments pArguments;
	pArguments.push(pWindow->getName().c_str());
	pEvents->Call(eventName, &pArguments, pScript);
	return true;
}
開發者ID:guilhermelhr,項目名稱:ivmultiplayer,代碼行數:18,代碼來源:GUINatives.cpp

示例8: CallEvent

bool CElement::CallEvent ( const char* szName, const CLuaArguments& Arguments, CPlayer* pCaller )
{
    CEvents* pEvents = g_pGame->GetEvents();

    // Make sure our event-manager knows we're about to call an event
    pEvents->PreEventPulse ();

    // Call the event on our parents/us first
    CallParentEvent ( szName, Arguments, this, pCaller );

    // Call it on all our children
    CallEventNoParent ( szName, Arguments, this, pCaller );

    // Tell the event manager that we're done calling the event
    pEvents->PostEventPulse ();

    // Return whether our event was cancelled or not
    return ( !pEvents->WasEventCancelled () );
}
開發者ID:50p,項目名稱:multitheftauto,代碼行數:19,代碼來源:CElement.cpp

示例9: OnKeyPress

// event guiKeyPress(string guiName, string key, string keyState)
bool OnKeyPress(const CEGUI::KeyEventArgs &eArgs, String keyState)
{	
	CEvents * pEvents = g_pClient->GetEvents();
	String eventName("guiKeyPress");

	if(!pEvents->IsEventRegistered(eventName))
		return false;

	CEGUI::Window * pWindow = eArgs.window;
	CSquirrel * pScript = g_pClient->GetClientScriptManager()->GetGUIManager()->GetScript(pWindow);
	CEGUI::Key::Scan keyCode = eArgs.scancode;

	CSquirrelArguments pArguments;
	pArguments.push(eArgs.window->getName().c_str());
	pArguments.push(GetKeyNameByScan(eArgs.scancode));
	pArguments.push(keyState);

	CSquirrelArgument pReturn = pEvents->Call(eventName, &pArguments, pScript);
	return pReturn.GetBool();
}
開發者ID:guilhermelhr,項目名稱:ivmultiplayer,代碼行數:21,代碼來源:GUINatives.cpp

示例10: main

extern "C" int main(int argc, char** argv)  { 
    
    SDL_Init( SDL_INIT_EVERYTHING );                                            //Inicjacja SDL
    ekran = SDL_SetVideoMode( 800, 600, 32, SDL_SWSURFACE);                     //Ustawienie sterownika okna SDL
    CMap *world = new CMap("data/mapa.japierdole");                             //Konstruktor œwiata
    CPlayer *player = new CPlayer( "data/grog.japierdole",150,150,1);           //Konstruktor gracza
    CEvents *events = new CEvents;                                              //Konstruktor pêtli
    
    player->draw();                                                             //rysowanie gracza
    world->draw();                                                              //rysowanie œwiata
    SDL_Flip( ekran );                                                          //"przerzucenie" ekranu - podwójny bufor
    events->loop();                                                             //pêtla
	
	delete world;                                                               //Destruktor œwiata
	delete player;                                                              //destruktor gracza
	delete events;                                                              //destruktor pêtli
    SDL_Quit();                                                                 //wy³¹cza SDL
    
    return 0;
}
開發者ID:KebabuTurka,項目名稱:Coma-Engine,代碼行數:20,代碼來源:main.cpp

示例11: OnWindowClose

// event windowClose(windowName)
bool OnWindowClose(const CEGUI::EventArgs &eventArgs)
{
	CEvents * pEvents = g_pClient->GetEvents();
	String eventName("windowClose");

	if(!pEvents->IsEventRegistered(eventName))
		return false;

	CEGUI::Window * pWindow = static_cast<const CEGUI::WindowEventArgs&>(eventArgs).window;
	CSquirrel * pScript = g_pClient->GetClientScriptManager()->GetGUIManager()->GetScript(pWindow);

	CSquirrelArguments pArguments;
	pArguments.push(pWindow->getName().c_str());

	// Event handler must return 1 to close window, otherwise, 0.
	CSquirrelArgument pReturn = pEvents->Call(eventName, &pArguments, pScript);

	if(pReturn.GetInteger())
		pWindow->hide();

	return true;
}
開發者ID:guilhermelhr,項目名稱:ivmultiplayer,代碼行數:23,代碼來源:GUINatives.cpp

示例12: CallEvent

bool CClientEntity::CallEvent ( const char* szName, const CLuaArguments& Arguments, bool bCallOnChildren )
{
    CEvents* pEvents = g_pClientGame->GetEvents();

    // Make sure our event-manager knows we're about to call an event
    pEvents->PreEventPulse ();

    // Call the event on our parents/us first
    CallParentEvent ( szName, Arguments, this );

    if ( bCallOnChildren )
    {
        // Call it on all our children
        CallEventNoParent ( szName, Arguments, this );
    }

    // Tell the event manager that we're done calling the event
    pEvents->PostEventPulse ();

    // Return whether it got cancelled or not
    return ( !pEvents->WasEventCancelled () );
}
開發者ID:AdiBoy,項目名稱:multitheftauto,代碼行數:22,代碼來源:CClientEntity.cpp

示例13: main

int main(int argc, char *argv[])
{
		
		std::string jobBatchFileLocation;
		
   	CEvents events;
		
    CSimulation sim;
		
		// initialise from jobHeader file
		
		if(2==argc) 
		{
			jobBatchFileLocation=argv[1];
			sim.initialise(jobBatchFileLocation); 
		}
		
		CSDLGLscreen window;
		
		window.initialiseSDLandGL(&sim);
		
		do 
		{
			events.doEvents(&sim);
			
			sim.next_step();
			
			if (true==sim.get_draw()) window.drawSystem();
			
		} while(sim.is_running());
    
    sim.clean_up();


    return 0;
    
}
開發者ID:JonathanWatkins,項目名稱:GravitySim,代碼行數:37,代碼來源:sim.cpp

示例14: OnRowClick

// event rowClick(string guiName)
bool OnRowClick(const CEGUI::EventArgs &eventArgs)
{
	CEvents * pEvents = g_pClient->GetEvents();
	String eventName ("rowClick");

	if(!pEvents->IsEventRegistered(eventName))
		return false;

	const CEGUI::WindowEventArgs eArgs = static_cast<const CEGUI::WindowEventArgs&>(eventArgs);
	CEGUI::Window * pWindow = eArgs.window;
	CSquirrel * pScript = g_pClient->GetClientScriptManager()->GetGUIManager()->GetScript(pWindow);

	CEGUI::MultiColumnList * pMultiColumnList = static_cast<CEGUI::MultiColumnList*>(eArgs.window);
	int iItemID = pMultiColumnList->getItemRowIndex(pMultiColumnList->getFirstSelectedItem());

	CSquirrelArguments pArguments;
	pArguments.push(eArgs.window->getName().c_str()); // Window Name
	pArguments.push(iItemID); // Row

	CLogFile::Printf("Value: %i",iItemID);

	pEvents->Call(eventName, &pArguments, pScript);
	return true;
}
開發者ID:guilhermelhr,項目名稱:ivmultiplayer,代碼行數:25,代碼來源:GUINatives.cpp


注:本文中的CEvents類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。