本文整理汇总了C++中CCommandQueue::Enqueue方法的典型用法代码示例。如果您正苦于以下问题:C++ CCommandQueue::Enqueue方法的具体用法?C++ CCommandQueue::Enqueue怎么用?C++ CCommandQueue::Enqueue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCommandQueue
的用法示例。
在下文中一共展示了CCommandQueue::Enqueue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Initialize
//------------------------------------------
bool CEngine::Initialize(const wchar* settings/*="game.ini"*/, bool customWindow/*=false*/, sDisplayProperties *dp/*=NULL*/){
assertd(s_bInit==false, "DOUBLE ENGINE INITIALIZATION!");
s_bInit = true; //predict :-P
// initialize random generator
srand( (unsigned int)milisec() );
cInternalWindow()->BeginSplash();
// memory leaks detection
#if defined(_DEBUG) && defined(_MSC_VER) && _MSC_VER >= 800
_CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
//_CrtSetBreakAlloc(23296);
#endif
// ---------------------------------------------------
// QUEUE TESTS
CON(MSG_INFO, _W("------- Command Queue Test -------"));
CCommandQueue q;
DWORD tim;
for (int t=0; t<10; t++)
{
tim = GetTickCount();
// FILL IN QUEUE
for (int i=0; i<20000; i++)
{
sE2RCanvasDesc *cd;
q.Enqueue(NULL, CQI_ENGINE2RENDERER_CANVAS_CREATE, (void*&)cd, sizeof(sE2RCanvasDesc));
cd->handle = 0;
}
CON(MSG_INFO, _W("Iteration #%d: Enqueue %d ms"), t, GetTickCount()-tim );
// DEQUEUE
unsigned int cqi; const void* optr; IQueueCommandReceiver *recv;
tim = GetTickCount();
while (q.Dequeue(cqi, optr, recv))
{
switch(cqi)
{
case CQI_ENGINE2RENDERER_CANVAS_CREATE:
{
sE2RCanvasDesc *cd = (sE2RCanvasDesc *)optr;
}
break;
}
}
CON(MSG_INFO, _W("Iteration #%d: Dequeue %d ms"), t, GetTickCount()-tim );
}
CON(MSG_INFO, _W("----------------------------------"));
// ---------------------------------------------------
// --- WRITE INFO ABOUT LIBRARIES AND MODULES
I_DebugPrint( ConsoleMsg );
CON(MSG_INFO, _W("= %s %s build %d initialization ="), _W(P3DNAME), sizeof(void*)==8?_W("x64"):_W("x86"), GetBuildNum());
if (sizeof(wchar)>1)
CON(MSG_INFO, _W("Unicode support \x263A"));
else
CON(MSG_INFO, _W("Multibyte character set"));
// --- LOAD SETTINGS
m_szSettings = new wchar[wstrlen(settings)+1];
wstrcpy(m_szSettings, settings);
cConfig()->Load(m_szSettings);
//cConfig()->Save(m_szSettings);
// --- INITIALIZE SCRIPT SYSTEM
CON(MSG_INFO, _W("Script system initialization"));
cScriptEngine()->Initialize();
// --- LOAD KEY BINDINGS
cInputManager()->Assign(_W("GUI_CURSOR"), WE_MOUSE_MOTION, 0);
cInputManager()->Assign(_W("GUI_SELECT"), WE_MOUSE_DOWN, 0);
cInputManager()->Save(_W("keys.ini")); // TODO: FIXME: What about load? :D
// --- CREATE MAIN WINDOW
Vec2i mainWindowSize(800,600);
bool initFullscreen = false;
if (customWindow)
{
// use primary screen resolution for frame buffer
// TODO: multiplatform
#ifdef _WIN32
mainWindowSize.x = GetSystemMetrics(SM_CXSCREEN);
mainWindowSize.y = GetSystemMetrics(SM_CYSCREEN);
#endif
}
else
{
if (dp)
{
// use user-defined resolution
initFullscreen = dp->Fullscreen;
mainWindowSize.x = dp->HorRes;
mainWindowSize.y = dp->VertRes;
//.........这里部分代码省略.........