本文整理汇总了C++中EventHandler::init方法的典型用法代码示例。如果您正苦于以下问题:C++ EventHandler::init方法的具体用法?C++ EventHandler::init怎么用?C++ EventHandler::init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EventHandler
的用法示例。
在下文中一共展示了EventHandler::init方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
void main()
{
LOG("Burger Bash running on the Sifteo SDK\n");
EventHandler eventHandler;
eventHandler.init();
// Plate cube initialize
pCube.init(gNumCubes - 1);
// Init all other cubes
for (int i = 0; i < gNumCubes - 1; i++)
{
cubes[i].init(i);
}
// Game loop
TimeStep ts;
while (1) {
for (int i = 0; i < gNumCubes; i++)
{
cubes[i].update();
}
System::paint();
ts.next();
}
//AudioTracker::play(Music);
}
示例2: main
void main()
{
GameState state = StateResults;
Random randomGen;
randomGen.seed();
for (unsigned i = 0; i < arraysize(cubeVideo); i++)
{
InitCube(i, i);
}
EventHandler handler;
handler.init();
TimeStep ts;
float Delay;
bool isDone;
while (1)
{
switch (state)
{
case StateInit:
CurrentGame->init();
Delay = 3;
playSfx (CountSound);
LOG ("Init\n");
state = StateStart;
break;
case StateStart:
Delay -= float(ts.delta());
if (Delay <= 0)
{
CurrentGame->start();
for (unsigned i = 0; i < gNumCubes; i++)
{
CurrentGameCube[i]->start();
}
LOG ("Start Done\n");
state = StatePlay;
}
break;
case StatePlay:
isDone = CurrentGame->update(ts.delta());
if (isDone)
{
LOG ("Game Done\n");
state = StateResults;
Delay = 3;
playSfx (CheersSound);
}
else
{
for (unsigned i = 0; i < gNumCubes; i++)
{
CurrentGameCube[i]->update(ts.delta());
}
}
break;
case StateResults:
Delay -= float(ts.delta());
if (Delay <= 0)
{
state = StateInit;
LOG ("Results Done\n");
int rand = randomGen.randint(0, 3);
switch (rand)
{
case 0:
case 2:
case 3:
LOG ("Playing Flip It\n");
CurrentGame = &flipItGame;
break;
case 1:
LOG ("Playing Shake\n");
CurrentGame = &shakeGame;
break;
}
}
break;
}
System::paint();
ts.next();
}
}