本文整理汇总了C++中Platform::prepare_level方法的典型用法代码示例。如果您正苦于以下问题:C++ Platform::prepare_level方法的具体用法?C++ Platform::prepare_level怎么用?C++ Platform::prepare_level使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Platform
的用法示例。
在下文中一共展示了Platform::prepare_level方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleKeypress
void handleKeypress(unsigned char key, int x, int y) {
switch (key) {
case 100:
if(c.mmovement == c.NONE)
{
c.mmovement = c.RIGHT;
}
break;
case 97:
if(c.mmovement == c.NONE)
{
c.mmovement = c.LEFT;
}
break;
case 119:
if(c.mmovement == c.NONE)
{
c.mmovement = c.UP;
}
break;
case 115:
if(c.mmovement == c.NONE)
{
c.mmovement = c.DOWN;
}
break;
case 109:
mute = !mute;
c.set_sound();
p.set_sound();
break;
case 'r':
p.prepare_level();
break;
case 27: //Escape key
glutDisplayFunc(screen_title);
glutKeyboardFunc(handle_titlescreen_key);
}
}
示例2: handle_titlescreen_key
// Handle the keys pressed on the title screen
void handle_titlescreen_key(unsigned char key, int x, int y)
{
switch(key)
{
case 119:
case 38:
if(titleposition != 0.25)
{
if(!mute)
{
PlaySound(L"select.wav", NULL, SND_ASYNC|SND_FILENAME);
}
titleposition += 2;
}
break;
case 's':
if(titleposition != (0.25 - 3*2))
{
if(!mute){
PlaySound(L"select.wav", NULL, SND_ASYNC|SND_FILENAME);
}
titleposition -= 2;
}
break;
case 13:
// Make the selection automatically the above one
if(titleposition == 0.25 || titleposition == -1.75)
{
if(titleposition == 0.25)
{
// Do the level finder
ifstream myfile ("pwd.txt");
if(myfile == NULL){
// Nothing to do
}
else
{
string a;
const char* l;
int lvl;
getline(myfile, a);
lvl = a[0];
p.change_mlevelno(lvl);
}
}
else{
p.change_mlevelno(1);
}
titleposition = 0.25;
p.prepare_level();
glutDisplayFunc(drawScene);
glutKeyboardFunc(handleKeypress);
}
else if (titleposition == -3.75)
{
titleposition = 0.25;
glutDisplayFunc(instruction_screen);
glutKeyboardFunc(instruction_keys);
}
else if(titleposition == -5.75)
{
exit(0);
}
break;
case 109:
mute = !mute;
c.set_sound();
p.set_sound();
break;
case 27: //Escape key
exit(0);
break;
}
}