本文整理汇总了C++中gdl::Input::isKeyDown方法的典型用法代码示例。如果您正苦于以下问题:C++ Input::isKeyDown方法的具体用法?C++ Input::isKeyDown怎么用?C++ Input::isKeyDown使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gdl::Input
的用法示例。
在下文中一共展示了Input::isKeyDown方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: update
void MenuLabel::update(gdl::GameClock const & gameClock, gdl::Input & input)
{
if (this->MenuDecide == false) {
if (input.isKeyDown(gdl::Keys::Up) == true)
{
this->texture_ = gdl::Image::load("../GDL-library/textures/menu_big_play.png");
this->MenuCurr = 1;
}
if (input.isKeyDown(gdl::Keys::Left) == true)
{
this->texture_ = gdl::Image::load("../GDL-library/textures/menu_big_load.png");
this->MenuCurr = 2;
}
if (input.isKeyDown(gdl::Keys::Right) == true)
{
this->texture_ = gdl::Image::load("../GDL-library/textures/menu_big_save.png");
this->MenuCurr = 3;
}
if (input.isKeyDown(gdl::Keys::Down) == true)
{
this->texture_ = gdl::Image::load("../GDL-library/textures/menu_big_exit.png");
this->MenuCurr = 4;
}
if (input.isKeyDown(gdl::Keys::Space) == true)
{
this->MenuDecide = true;
}
}
}
示例2:
void AdventureGame::update(gdl::Input& input, gdl::GameClock& gClock, StatesManager *sMg, CarrouselHandler * cH)
{
(void)cH;
pressEnter_.update(gClock);
if (input.isKeyDown(gdl::Keys::Return) && !returnHit_)
sMg->pushState(new AdventureState);
returnHit_ = input.isKeyDown(gdl::Keys::Return);
}
示例3: if
int Menu::updateMain(gdl::Input & input_)
{
if (input_.isKeyDown(gdl::Keys::Up))
{
((choice > 0 ? choice-- && usleep(300000) : 0));
this->string[choice].setSize(60);
if (choice == 0)
{
this->string[1].setSize(40);
this->string[2].setSize(40);
}
else if (choice == 1)
{
this->string[2].setSize(40);
this->string[0].setSize(40);
}
else
{
this->string[1].setSize(40);
this->string[0].setSize(40);
}
}
else if (input_.isKeyDown(gdl::Keys::Down))
{
((choice < 2 ? choice++ && usleep(300000) : 0));
this->string[choice].setSize(60);
if (choice == 0)
{
this->string[1].setSize(40);
this->string[2].setSize(40);
}
else if (choice == 1)
{
this->string[2].setSize(40);
this->string[0].setSize(40);
}
else
{
this->string[1].setSize(40);
this->string[0].setSize(40);
}
}
else if (input_.isKeyDown(gdl::Keys::Return))
{
usleep(300000);
this->string[0].setSize(60);
this->string[1].setSize(40);
this->string[2].setSize(40);
this->which = choice + 1;
this->choice = 0;
if (this->which == 3)
exit(0);
}
return (0);
}
示例4:
void Draw::update(gdl::Input& input, gdl::GameClock& gClock, StatesManager *sMg, CarrouselHandler *cH)
{
(void)gClock;
(void)cH;
if (input.isKeyDown(gdl::Keys::Return) && !returnHit_)
{
sMg->popState();
sMg->popState();
}
returnHit_ = input.isKeyDown(gdl::Keys::Return);
}
示例5:
void SoundConfig::update(gdl::Input& input, gdl::GameClock& gClock, StatesManager *sMg, CarrouselHandler *cH)
{
(void)gClock;
(void)sMg;
(void)cH;
for (std::map<gdl::Keys::Key, t_paramFunc>::iterator it = paramMap_.begin(); it != paramMap_.end(); ++it)
if (input.isKeyDown(it->first))
(this->*(it->second))();
upHit_ = input.isKeyDown(gdl::Keys::Up);
downHit_ = input.isKeyDown(gdl::Keys::Down);
returnHit_ = input.isKeyDown(gdl::Keys::Return);
}
示例6: update
void PremadeMap::update(gdl::Input &input, gdl::GameClock &gClock, StatesManager *sMg,
CarrouselHandler * cH)
{
(void)gClock;
(void)cH;
for (std::map<gdl::Keys::Key, void(PremadeMap::*)(StatesManager *)>::iterator it = paramMap_.begin(); it != paramMap_.end(); ++it)
if (input.isKeyDown(it->first))
(this->*(it->second))(sMg);
up_ = input.isKeyDown(gdl::Keys::Up);
down_ = input.isKeyDown(gdl::Keys::Down);
enter_ = input.isKeyDown(gdl::Keys::Return);
}
示例7: PlayState
void QuickGame::update(gdl::Input& input, gdl::GameClock& gClock, StatesManager *sMg, CarrouselHandler *cH)
{
(void)cH;
pressEnter_.update(gClock);
if (input.isKeyDown(gdl::Keys::Return) && !returnHit_)
{
try {
Character::CharacterId = 0;
Map map(13, 13, 2, 0, 0);
sMg->pushState(new PlayState(&map.getTerrain()), false);
} catch (Map::Failure& e) {
std::cerr << e.what() << std::endl;
}
}
returnHit_ = input.isKeyDown(gdl::Keys::Return);
}
示例8: checkBonus
void Character::Action(gdl::Input &input)
{
if ((this->alive && input.isKeyDown(this->Down) == true) &&
((this->map->getPos(this->getPosX(), this->getPosY() + 1) >= 5) && ((this->map->getPos(this->getPosX(), this->getPosY() + 1) <= 9))))
{
this->rotation_->x = 0;
this->map->setPos(9, this->getPosX(), this->getPosY());
this->setPosY(this->getPosY() + 1);
checkBonus(this->map->getPos(this->getPosX(), this->getPosY()));
}
if ((this->alive && input.isKeyDown(this->Up) == true) &&
((this->map->getPos(this->getPosX(), this->getPosY() - 1) >= 5) && ((this->map->getPos(this->getPosX(), this->getPosY() - 1) <= 9))))
{
this->rotation_->x = 180;
this->map->setPos(9, this->getPosX(), this->getPosY());
this->setPosY(this->getPosY() - 1);
checkBonus(this->map->getPos(this->getPosX(), this->getPosY()));
}
if ((this->alive && input.isKeyDown(this->Right) == true) &&
((this->map->getPos(this->getPosX() + 1, this->getPosY()) >= 5) && ((this->map->getPos(this->getPosX() + 1, this->getPosY()) <= 9))))
{
this->rotation_->x = 90;
this->map->setPos(9, this->getPosX(), this->getPosY());
this->setPosX(this->getPosX() + 1);
checkBonus(this->map->getPos(this->getPosX(), this->getPosY()));
}
if ((this->alive && input.isKeyDown(this->Left) == true) &&
((this->map->getPos(this->getPosX() - 1, this->getPosY()) >= 5) && ((this->map->getPos(this->getPosX() - 1, this->getPosY()) <= 9))))
{
this->rotation_->x = 270;
this->map->setPos(9, this->getPosX(), this->getPosY());
this->setPosX(this->getPosX() - 1);
checkBonus(this->map->getPos(this->getPosX(), this->getPosY()));
}
if (this->alive && input.isKeyDown(this->Space) == true)
{
this->map->setPos(4, this->getPosX(), this->getPosY());
this->dropBomb();
// this->map->affMap();
//this->bomb->add_positions(new Vector3f(this->position_->x, 0.0f, this->position_->z), this->_power);
}
}
示例9: ShaderException
void newin::Light::update(gdl::GameClock const & c, gdl::Input & i) {
(void) c;
if (_sindex == "1") {
if (i.isKeyDown(gdl::Keys::I)) {
_pos.setZ(_pos.getZ() - 0.1);
_changed = true;
}
if (i.isKeyDown(gdl::Keys::K)) {
_pos.setZ(_pos.getZ() + 0.1);
_changed = true;
}
if (i.isKeyDown(gdl::Keys::J)) {
_pos.setX(_pos.getX() - 0.1);
_changed = true;
}
if (i.isKeyDown(gdl::Keys::L)) {
_pos.setX(_pos.getX() + 0.1);
_changed = true;
}
if (i.isKeyDown(gdl::Keys::U)) {
_pos.setY(_pos.getY() - 0.1);
_changed = true;
}
if (i.isKeyDown(gdl::Keys::O)) {
_pos.setY(_pos.getY() + 0.1);
_changed = true;
}
}
if (!_prgm) {
throw newin::ShaderException("cannot use light without shader");
}
if (_changed){
_changed = false;
_prgm->setVariable("L[" + _sindex + "].Pos", _pos.getX(), _pos.getY(), _pos.getZ());
}
}
示例10: update
void GDLModel::update(/*gdl::GameClock const & gameClock, */gdl::Input & input) {
//_model.update(gameClock);
if (input.isKeyDown(gdl::Keys::P) == true)
_model.play("Take 001");
}
示例11: if
void Bomberman::update(gdl::GameClock const & gameClock, gdl::Input & input)
{
float dist;
if (_map->isOnFirePos(_position.x, _position.y))
{
_inLife = false;
_rotation.x = 0;
_rotation.y = 0;
_rotation.z = 90;
}
if (_inLife)
{
_model.update(gameClock);
if (_nextpos != _position)
{
if (_moveend < gameClock.getTotalGameTime())
{
_position.x = _nextpos.x;
_position.y = _nextpos.y;
_moving = NO;
_model.stop_animation("Run");
_model.play("Take 001");
_model.stop_animation("Take 001");
}
else
{
dist = gameClock.getTotalGameTime() - _movetmp;
_movetmp += dist;
dist *= 250.0f;
if ((int)_nextpos.x > (int)_position.x)
_position.x += dist;
else if ((int)_nextpos.x < (int)_position.x)
_position.x -= dist;
else if ((int)_nextpos.y > (int)_position.y)
_position.y += dist;
else if ((int)_nextpos.y < (int)_position.y)
_position.y -= dist;
}
}
else
{
if (input.isKeyDown(_putbomb))
_mygame->addBombe(_position.x, _position.y);
if (input.isKeyDown(_right) && _map->isEmptyPos(_position.x + 300, _position.y))
{
_nextpos.x = _position.x + 300;
_rotation.y = 90.0f;
}
else if (input.isKeyDown(_left) && _map->isEmptyPos(_position.x - 300, _position.y))
{
_nextpos.x = _position.x - 300;
_rotation.y = 270.0f;
}
else if (input.isKeyDown(_up) && _map->isEmptyPos(_position.x, _position.y + 300))
{
_nextpos.y = _position.y + 300;
_rotation.y = 180.0f;
}
else if (input.isKeyDown(_down) && _map->isEmptyPos(_position.x, _position.y - 300))
{
_nextpos.y = _position.y - 300;
_rotation.y = 0.0f;
}
if (_nextpos != _position)
{
_model.play("Run");
_movetmp = gameClock.getTotalGameTime();
_moveend = _movetmp + 1.2f;
}
}
}
}