本文整理汇总了C++中Play::Game方法的典型用法代码示例。如果您正苦于以下问题:C++ Play::Game方法的具体用法?C++ Play::Game怎么用?C++ Play::Game使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Play
的用法示例。
在下文中一共展示了Play::Game方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawMenu
int MainMenu::DrawMenu(SDL_Surface *screen)
{
Play igra;
SDL_FillRect(screen , NULL , 0x000000);
txtRect3.x = HEIGHT/2 - 100;
txtRect3.y = WIDTH/2 - 295;
font3 = TTF_OpenFont("./font/42852.ttf",20);
imgTxt3 = TTF_RenderText_Solid( font3 , "Текущий игрок: " , Color3 );
SDL_BlitSurface( imgTxt3 , NULL , screen , &txtRect3 );
txtRect3.x = HEIGHT/2 + 50;
imgTxt3 = TTF_RenderText_Solid( font3 , name , Color3 );
SDL_BlitSurface( imgTxt3 , NULL , screen , &txtRect3 );
txtRect3.x = HEIGHT/2 - 100;
txtRect3.y = WIDTH/2 - 200;
font3 = TTF_OpenFont("./font/42852.ttf",25);
imgTxt3 = TTF_RenderText_Solid( font3 , "Начало игры" , menucolor3 );
SDL_BlitSurface( imgTxt3 , NULL , screen , &txtRect3 );
Draw_Rect(screen, txtRect3.x - 10, txtRect3.y , 285, 25, 0xFFFFFF);
txtRect3.y = WIDTH/2 - 175;
imgTxt3 = TTF_RenderText_Solid( font3 , "Смена игрока" , Color3 );
SDL_BlitSurface( imgTxt3 , NULL , screen , &txtRect3 );
txtRect3.y = WIDTH/2 - 150;
imgTxt3 = TTF_RenderText_Solid( font3 , "Просмотр результатов" , Color3 );
SDL_BlitSurface( imgTxt3 , NULL , screen , &txtRect3 );
txtRect3.y = WIDTH/2 - 125;
imgTxt3 = TTF_RenderText_Solid( font3 , "Правила игры" , Color3 );
SDL_BlitSurface( imgTxt3 , NULL , screen , &txtRect3 );
txtRect3.y = WIDTH/2 - 100;
imgTxt3 = TTF_RenderText_Solid( font3 , "Выход" , Color3 );
SDL_BlitSurface( imgTxt3 , NULL , screen , &txtRect3 );
SDL_Flip(screen);
j3=0;
txtRect3.y = WIDTH/2 - 200;
while(end3 == 0)
{
while(SDL_PollEvent(&event3))
{
switch(event3.type)
{
case SDL_MOUSEBUTTONDOWN:
{
if(event3.button.x >= HEIGHT/2 - 100 && event3.button.x <= HEIGHT/2 + 185)
{
if(event3.button.y >= WIDTH/2 - 200 && event3.button.y < WIDTH/2 - 175) /*играть*/
{
igra.Game(screen);
return 0;
}
if(event3.button.y >= WIDTH/2 - 175 && event3.button.y < WIDTH/2 - 150) /*смена имени*/
{
while(name[i3]!='\0')
name[i3++] = '\0';
Zastavka2(screen);
return 0;
}
if(event3.button.y >= WIDTH/2 - 150 && event3.button.y < WIDTH/2 - 125)
{
Tablitca(screen);
return 0;
}
if(event3.button.y >= WIDTH/2 - 125 && event3.button.y < WIDTH/2 - 100)/*правила игры*/
{
PravilaGame(screen);
return 0;
}
if(event3.button.y >= WIDTH/2 - 100 && event3.button.y < WIDTH/2 - 75)
end3 = 1;
}
break;
}
case SDL_KEYDOWN:
{
if(event3.key.keysym.sym == SDLK_DOWN && j3 != 4)
{
if(j3<4)
j3++;
Draw_Rect(screen, txtRect3.x - 10, txtRect3.y , 285, 25, 0x000000);
if(j3==0)
txtRect3.y = WIDTH/2 - 200;
//.........这里部分代码省略.........