style: renomenat InputType a InputActions
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
#include <stdlib.h> // Para rand
|
||||
#include <algorithm> // Para clamp, max, min
|
||||
#include "animated_sprite.h" // Para AnimatedSprite
|
||||
#include "input.h" // Para InputType
|
||||
#include "input.h" // Para InputAction
|
||||
#include "param.h" // Para Param, ParamGame, param
|
||||
#include "scoreboard.h" // Para Scoreboard, ScoreboardMode
|
||||
#include "texture.h" // Para Texture
|
||||
@@ -70,7 +70,7 @@ void Player::init()
|
||||
}
|
||||
|
||||
// Actua en consecuencia de la entrada recibida
|
||||
void Player::setInput(InputType input)
|
||||
void Player::setInput(InputAction input)
|
||||
{
|
||||
switch (playing_state_)
|
||||
{
|
||||
@@ -91,33 +91,33 @@ void Player::setInput(InputType input)
|
||||
}
|
||||
|
||||
// Procesa inputs para cuando está jugando
|
||||
void Player::setInputPlaying(InputType input)
|
||||
void Player::setInputPlaying(InputAction input)
|
||||
{
|
||||
switch (input)
|
||||
{
|
||||
case InputType::LEFT:
|
||||
case InputAction::LEFT:
|
||||
{
|
||||
vel_x_ = -BASE_SPEED_;
|
||||
setWalkingState(PlayerState::WALKING_LEFT);
|
||||
break;
|
||||
}
|
||||
case InputType::RIGHT:
|
||||
case InputAction::RIGHT:
|
||||
{
|
||||
vel_x_ = BASE_SPEED_;
|
||||
setWalkingState(PlayerState::WALKING_RIGHT);
|
||||
break;
|
||||
}
|
||||
case InputType::FIRE_CENTER:
|
||||
case InputAction::FIRE_CENTER:
|
||||
{
|
||||
setFiringState(PlayerState::FIRING_UP);
|
||||
break;
|
||||
}
|
||||
case InputType::FIRE_LEFT:
|
||||
case InputAction::FIRE_LEFT:
|
||||
{
|
||||
setFiringState(PlayerState::FIRING_LEFT);
|
||||
break;
|
||||
}
|
||||
case InputType::FIRE_RIGHT:
|
||||
case InputAction::FIRE_RIGHT:
|
||||
{
|
||||
setFiringState(PlayerState::FIRING_RIGHT);
|
||||
break;
|
||||
@@ -132,23 +132,23 @@ void Player::setInputPlaying(InputType input)
|
||||
}
|
||||
|
||||
// Procesa inputs para cuando está introduciendo el nombre
|
||||
void Player::setInputEnteringName(InputType input)
|
||||
void Player::setInputEnteringName(InputAction input)
|
||||
{
|
||||
switch (input)
|
||||
{
|
||||
case InputType::LEFT:
|
||||
case InputAction::LEFT:
|
||||
enter_name_->decPosition();
|
||||
break;
|
||||
case InputType::RIGHT:
|
||||
case InputAction::RIGHT:
|
||||
enter_name_->incPosition();
|
||||
break;
|
||||
case InputType::UP:
|
||||
case InputAction::UP:
|
||||
enter_name_->incIndex();
|
||||
break;
|
||||
case InputType::DOWN:
|
||||
case InputAction::DOWN:
|
||||
enter_name_->decIndex();
|
||||
break;
|
||||
case InputType::START:
|
||||
case InputAction::START:
|
||||
last_enter_name_ = getRecordName();
|
||||
if (last_enter_name_.empty())
|
||||
{
|
||||
@@ -227,10 +227,10 @@ void Player::move()
|
||||
switch (id_)
|
||||
{
|
||||
case 1:
|
||||
setInputPlaying(InputType::LEFT);
|
||||
setInputPlaying(InputAction::LEFT);
|
||||
break;
|
||||
case 2:
|
||||
setInputPlaying(InputType::RIGHT);
|
||||
setInputPlaying(InputAction::RIGHT);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -258,7 +258,7 @@ void Player::move()
|
||||
switch (id_)
|
||||
{
|
||||
case 1:
|
||||
setInputPlaying(InputType::RIGHT);
|
||||
setInputPlaying(InputAction::RIGHT);
|
||||
pos_x_ += vel_x_;
|
||||
if (pos_x_ > default_pos_x_)
|
||||
{
|
||||
@@ -268,7 +268,7 @@ void Player::move()
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
setInputPlaying(InputType::LEFT);
|
||||
setInputPlaying(InputAction::LEFT);
|
||||
pos_x_ += vel_x_;
|
||||
if (pos_x_ < default_pos_x_)
|
||||
{
|
||||
@@ -288,7 +288,7 @@ void Player::move()
|
||||
pos_x_ += vel_x_ / 2.0f;
|
||||
if (vel_x_ > 0)
|
||||
{
|
||||
// setInputPlaying(InputType::RIGHT);
|
||||
// setInputPlaying(InputAction::RIGHT);
|
||||
if (pos_x_ > param.game.game_area.rect.w - WIDTH_)
|
||||
{
|
||||
pos_x_ = param.game.game_area.rect.w - WIDTH_;
|
||||
@@ -297,7 +297,7 @@ void Player::move()
|
||||
}
|
||||
else
|
||||
{
|
||||
// setInputPlaying(InputType::LEFT);
|
||||
// setInputPlaying(InputAction::LEFT);
|
||||
if (pos_x_ < param.game.game_area.rect.x)
|
||||
{
|
||||
pos_x_ = param.game.game_area.rect.x;
|
||||
|
||||
Reference in New Issue
Block a user