Skip to content

Commit

Permalink
大雅久不作,吾衰竟谁陈
Browse files Browse the repository at this point in the history
调大摇杆范围
  • Loading branch information
scarsty committed Jul 14, 2024
1 parent e99c0c4 commit a5db5d4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 17 deletions.
3 changes: 2 additions & 1 deletion src/TitleScene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ void TitleScene::draw()
{
Engine::getInstance()->fillColor({ 0, 0, 0, 255 }, 0, 0, Engine::getInstance()->getWindowWidth(), Engine::getInstance()->getWindowHeight());
int pic[] = { 154, 154, 153, 154 };
TextureManager::getInstance()->renderTexture("title", pic[battle_mode_], 0, 90);
int y[] = { 90, 90, 0, 90 };
TextureManager::getInstance()->renderTexture("title", pic[battle_mode_], 0, y[battle_mode_]);
Font::getInstance()->draw(GameUtil::VERSION(), 28, 0, 0);
return;
//屏蔽随机头像
Expand Down
29 changes: 13 additions & 16 deletions src/VirtualStick.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,25 +128,22 @@ void VirtualStick::dealEvent(BP_Event& e)
}
else
{
if (b->inSideInStartWindow(x, y))
axis_x_ = x;
axis_y_ = y;
double r = sqrt((x - axis_center_x_) * (x - axis_center_x_) + (y - axis_center_y_) * (y - axis_center_y_));
//fmt1::print("{}", r);
auto& intval = button_interval_[b];
if (r < axis_radius_ * 1.5)
{
axis_x_ = x;
axis_y_ = y;
double r = sqrt((x - axis_center_x_) * (x - axis_center_x_) + (y - axis_center_y_) * (y - axis_center_y_));
//fmt1::print("{}", r);
auto& intval = button_interval_[b];
if (r < axis_radius_)
engine->setGameControllerAxis(SDL_CONTROLLER_AXIS_LEFTX, (x - axis_center_x_) * 30000 / axis_radius_);
engine->setGameControllerAxis(SDL_CONTROLLER_AXIS_LEFTY, (y - axis_center_y_) * 30000 / axis_radius_);
button_interval_[b].prev_press = engine->getTicks();
is_press = true;
b->state_ = NodePress;
intval.interval = 0;
if (is_real)
{
engine->setGameControllerAxis(SDL_CONTROLLER_AXIS_LEFTX, (x - axis_center_x_) * 30000 / axis_radius_);
engine->setGameControllerAxis(SDL_CONTROLLER_AXIS_LEFTY, (y - axis_center_y_) * 30000 / axis_radius_);
button_interval_[b].prev_press = engine->getTicks();
is_press = true;
b->state_ = NodePress;
intval.interval = 0;
if (is_real)
{
intval.interval = 0;
}
}
}
}
Expand Down

0 comments on commit a5db5d4

Please sign in to comment.