当前位置: 首页>>代码示例>>C++>>正文


C++ Display::getTileRefAt方法代码示例

本文整理汇总了C++中Display::getTileRefAt方法的典型用法代码示例。如果您正苦于以下问题:C++ Display::getTileRefAt方法的具体用法?C++ Display::getTileRefAt怎么用?C++ Display::getTileRefAt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Display的用法示例。


在下文中一共展示了Display::getTileRefAt方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: LOGIC

void LOGIC(Timer& InputCoolDown, Display& game)
{
	Player& player = game::pHandler.getLocalPlayer();
	HANDLE h = GetActiveWindow();
	HANDLE focus = GetFocus();
	//if (h != focus) { return; }
    if(InputCoolDown.Update()==true)
    {
		/* Movement */
		////////////////////////////////////////////////
        /*if(GetAsyncKeyState('W'))
        {
			game::player.moveHandUp(game);
            InputCoolDown.StartNewTimer(0.075);
        }else if(GetAsyncKeyState('S'))
        {
			game::player.moveHandDown(game);
            InputCoolDown.StartNewTimer(0.075);
        }else if(GetAsyncKeyState('A'))
        {
			game::player.moveHandLeft(game);
            InputCoolDown.StartNewTimer(0.075);
        }else if(GetAsyncKeyState('D'))
        {
			game::player.moveHandRight(game);
            InputCoolDown.StartNewTimer(0.075);
        }*/
		for (int x = 0; x < 3; x++)
		{
			if (kbhit())
			{
				int key = getch();
				if (key == 224)
					key = getch();
				switch (key)
				{
				case 'w':player.moveHandUp(game); InputCoolDown.StartNewTimer(0.075); break;
				case 's':player.moveHandDown(game); InputCoolDown.StartNewTimer(0.075); break;
				case 'a':player.moveHandLeft(game); InputCoolDown.StartNewTimer(0.075); break;
				case 'd':player.moveHandRight(game); InputCoolDown.StartNewTimer(0.075); break;
				case 'j':game::SlideUI.addSlide("Testing"); InputCoolDown.StartNewTimer(0.075); break;
				case 'y':player.spawnTurret(Position(10, 10)); InputCoolDown.StartNewTimer(0.075); break;
				case 't':InputCoolDown.StartNewTimer(0.075); break;
				case 'm':game::server.SendLiteral("12\n9\nTesting"); InputCoolDown.StartNewTimer(0.075); break;
				case 'c':player.purchaseTurret(); InputCoolDown.StartNewTimer(0.075); break;
				case 72:player.mineUp(game); InputCoolDown.StartNewTimer(0.075); break;
				case 80:player.mineDown(game); InputCoolDown.StartNewTimer(0.075); break;
				case 75:player.mineLeft(game); InputCoolDown.StartNewTimer(0.075); break;
				case 77:player.mineRight(game); InputCoolDown.StartNewTimer(0.075); break;
				default: break;
				}
			}
			else
				x = 3;
		}
		////////////////////////////////////////////////
		/* Mining */
		////////////////////////////////////////////////
		/*if (GetAsyncKeyState(VK_UP))
		{
			game::player.mineUp(game);
			InputCoolDown.StartNewTimer(0.075);
		}else if (GetAsyncKeyState(VK_DOWN))
		{
			game::player.mineDown(game);
			InputCoolDown.StartNewTimer(0.075);
		}else if (GetAsyncKeyState(VK_LEFT))
		{
			game::player.mineLeft(game);
			InputCoolDown.StartNewTimer(0.075);
		}else if (GetAsyncKeyState(VK_RIGHT))
		{
			game::player.mineRight(game);
			InputCoolDown.StartNewTimer(0.075);
		}*/
		////////////////////////////////////////////////
		Position pos = player.getHandPosition();
        if(GetAsyncKeyState('F'))
        {
			game.getTileRefAt(pos).isFortified(true);
            InputCoolDown.StartNewTimer(0.075);
        }
        if(GetAsyncKeyState(VK_SPACE))
        {
			if (game.isWalkableTileNear(pos))
			{
				game.getTileRefAt(pos).mine(10, player);
				InputCoolDown.StartNewTimer(0.075);
			}
        }
        if(GetAsyncKeyState('V'))
        {
			player.claimOnHand();
			InputCoolDown.StartNewTimer(0.075);
        }
    }
}
开发者ID:ZestyTheWalrus,项目名称:Mine-Mania,代码行数:97,代码来源:main.cpp


注:本文中的Display::getTileRefAt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。