本文整理汇总了C++中HGE::Input_KeyDown方法的典型用法代码示例。如果您正苦于以下问题:C++ HGE::Input_KeyDown方法的具体用法?C++ HGE::Input_KeyDown怎么用?C++ HGE::Input_KeyDown使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HGE
的用法示例。
在下文中一共展示了HGE::Input_KeyDown方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: execute
int CTextAction::execute( CGameState * )
{
HGE *hge = hgeCreate(HGE_VERSION);
float dt = hge->Timer_GetDelta();
int ret = m_textbox->Update(dt);
//DebugMsg("textbox ret: %d\n", ret);
bool lbtndown = hge->Input_KeyDown(HGEK_LBUTTON);
bool spacedown = hge->Input_KeyDown(HGEK_SPACE);
if (ret > 0)
{
if (m_showText && lbtndown)
{
return m_textbox->GetID();
}
if (spacedown)
{
m_showText = !m_showText;
m_textbox->Show(m_showText);
}
}
else
{
if (lbtndown)
{
//m_textbox->SpeedUpLine();
m_textbox->SpeedUpAll();
}
}
hge->Release();
return 0;
}
示例2: action
void Button::action()
{
if (countdelay != 50)
countdelay++;
else
SetDelayrender(false);
if (!IsDelayrender())
{
HGE *hge = hgeCreate(HGE_VERSION);
float mousex, mousey;
hge->Input_GetMousePos(&mousex, &mousey);
if (countalpha<255)
{
countalpha += 5;
SetChangeColor(countalpha, 0, 0, 0);
}
else
SetChangeColor(255, 0, 0, 0);
if (state != MouseDown)
if (mousex > GetX() && mousex<GetX() + width && mousey>GetY() && mousey < GetY() + height)
{
state = MouseOver;
if (!playsound)
{
playsound = true;
SFXManager::GetSFXManager().PlaySFX(BUTTONSFX);
}
if (state == MouseOver && hge->Input_KeyDown(HGEK_LBUTTON))
{
state = MouseDown;
SFXManager::GetSFXManager().PlaySFX(BUTTONSFX2);
}
}
else
{
state = MouseOff;
playsound = false;
}
if (state == MouseDown)
{
if (!finishchangecolor)
{
if (!colorreverse)
count += 50;
else
count -= 50;
if (count == 250)
colorreverse = true;
SetChangeColor(count + 5, 255, 255, 255);
if (count == 0 && colorreverse)
{
finishchangecolor = true;
SetChangeColor(255, 0, 0, 0);
finishmove = false;
}
}
else
{
switch (buttonnum)
{
case BUTTON_1_OFF:
if (!flag)
{
SceneManager::GetSceneManager().SetMenuStage(1);
flag = true;
}
if (!finishmove && ObjectPool::GetObjPool().ChangeAllPos(Left, 853))
{
finishmove = true;
flag = false;
state = MouseOff;
finishchangecolor = false;
buttondown = false;
colorreverse = false;
}
break;
case BUTTON_2_OFF:
state = MouseOff;
finishchangecolor = false;
buttondown = false;
colorreverse = false;
break;
case BUTTON_3_OFF:
state = MouseOff;
finishchangecolor = false;
buttondown = false;
colorreverse = false;
break;
case BUTTON_4_OFF:
SceneManager::GetSceneManager().ExitGame();
state = MouseOff;
finishchangecolor = false;
buttondown = false;
colorreverse = false;
break;
case BUTTON_5_OFF:
if (!flag && SceneManager::GetSceneManager().ReturnMenuStage() == 2)
{
SceneManager::GetSceneManager().SetMenuStage(0);
flag = true;
//.........这里部分代码省略.........
示例3: Action
void Robot::Action()
{
switch (GetType())
{
case Left:
if (!startattack)
{
if (!trigger)
{
if (coretype != Eternity)
{
HGE *hge = hgeCreate(HGE_VERSION);
float x, y;
hge->Input_GetMousePos(&x, &y);
int dis = GetDistance(x, y);
if (dis < 20)
{
if (hge->Input_KeyDown(HGEK_LBUTTON))
{
trigger = true;
backx = GetX();
backy = GetY();
}
else
{
if (hge->Input_KeyDown(HGEK_RBUTTON))
Suicide(true);
}
}
}
}
else
{
ObjectPool::GetObjPool().LockOnGameObject(this);
if (runback)
{
if (GoToAnotherPos(backx,backy))
{
trigger = false;
runback = false;
SetSpeed(0);
}
}
else
{
HGE *hge = hgeCreate(HGE_VERSION);
float x, y;
hge->Input_GetMousePos(&x, &y);
SetPos(x, y);
if (hge->Input_KeyUp(HGEK_LBUTTON))
{
if (x<ACT_START_X || x>ACT_END_X || y<ACT_START_Y || y>ACT_END_Y)
{
runback = true;
SetSpeed(1200);
}
else
{
switch (coretype)
{
//攻击型
//开始攻击
case Attack:
SetCollisionRange(40);
SetSolid(true);
SetBlock(true);
break;
//触发技能型
//跟hero做intercation将自身赋给hero然后自杀
case Magic:
dynamic_cast<Hero*>(ObjectPool::GetObjPool().GetOurHero(GetType()))->SetSkill(GetInnerCode() + 300);
Suicide();
break;
//BUFF型
//施放技能
case Buff:
{
int count = 0;
Hero *a = dynamic_cast<Hero*>(ObjectPool::GetObjPool().GetOurHero(GetType()));
for (int i = 0; i < STD_CORES; i++)
{
Robot *b = dynamic_cast<Robot*>(a->GetCOREs(i));
if (b && b->IsActive())
{
if (b->GetInnerCode() == GetInnerCode())
{
b->Suicide();
a->Interaction(b);
}
else
if (b->GetCoreType() == Buff)
count++;
}
}
SetSpeed(1500);
SetAim(25+count * 50, 175);
}
break;
}
//.........这里部分代码省略.........