当前位置: 首页>>代码示例>>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;未经允许,请勿转载。