Skip to content

Commit

Permalink
故人昔新今尚故,还见新人有故时
Browse files Browse the repository at this point in the history
在即时战斗时不将b和a转为功能键
  • Loading branch information
scarsty committed Jul 14, 2024
1 parent 2f66e09 commit 2cb8c6b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
5 changes: 3 additions & 2 deletions src/MainScene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,8 @@ void MainScene::dealEvent(BP_Event& e)
}

// Tab激活控制台
if (e.type == BP_KEYUP && e.key.keysym.sym == BPK_TAB)
if (e.type == BP_KEYUP && e.key.keysym.sym == BPK_TAB
|| (e.type == BP_CONTROLLERBUTTONUP && e.cbutton.button == BP_CONTROLLER_BUTTON_BACK))
{
Console c;
}
Expand Down Expand Up @@ -292,7 +293,7 @@ void MainScene::dealEvent(BP_Event& e)
}
else
{
if (rest_time_ > 2) { total_step_ = 0; } //虚拟按键中间可能出现空白帧,此处减少清空的情况,为了第一步可以不连续
if (rest_time_ > 2) { total_step_ = 0; } //虚拟按键中间可能出现空白帧,此处减少清空的情况,为了第一步可以不连续
}

if (pressed && checkEntrance(x, y))
Expand Down
3 changes: 2 additions & 1 deletion src/SubScene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,8 @@ void SubScene::dealEvent(BP_Event& e)
total_step_ = 0;
}
// Tab激活控制台
if (e.type == BP_KEYUP && e.key.keysym.sym == BPK_TAB)
if (e.type == BP_KEYUP && e.key.keysym.sym == BPK_TAB
|| (e.type == BP_CONTROLLERBUTTONUP && e.cbutton.button == BP_CONTROLLER_BUTTON_BACK))
{
Console c;
}
Expand Down
19 changes: 8 additions & 11 deletions src/VirtualStick.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,22 +152,19 @@ void VirtualStick::dealEvent(BP_Event& e)
}
}
}
if (is_press && button_a_->state_ == NodePress)
if (!is_real)
{
//fmt1::print("{}", "press a");
e.type = BP_KEYUP;
e.key.keysym.sym = BPK_RETURN;
if (!is_real)
if (is_press && button_a_->state_ == NodePress)
{
//fmt1::print("{}", "press a");
e.type = BP_KEYUP;
e.key.keysym.sym = BPK_RETURN;
button_interval_[button_a_].interval = 100;
}
}
if (is_press && button_b_->state_ == NodePress)
{
e.type = BP_KEYUP;
e.key.keysym.sym = BPK_ESCAPE;
if (!is_real)
if (is_press && button_b_->state_ == NodePress)
{
e.type = BP_KEYUP;
e.key.keysym.sym = BPK_ESCAPE;
button_interval_[button_b_].interval = 100;
}
}
Expand Down

0 comments on commit 2cb8c6b

Please sign in to comment.