Rename class CustomKey to CustomButton

This commit is contained in:
Henrik Rydgård 2023-05-08 10:13:16 +02:00
parent 90ea4243e0
commit e078f61bad
3 changed files with 9 additions and 9 deletions

View File

@ -28,7 +28,7 @@ class CustomButtonMappingScreen : public UIDialogScreenWithGameBackground {
public:
CustomButtonMappingScreen(const Path &gamePath, int id) : UIDialogScreenWithGameBackground(gamePath), id_(id) {}
const char *tag() const override { return "CustomKey"; }
const char *tag() const override { return "CustomButton"; }
void CreateViews() override;
void onFinish(DialogResult result) override;

View File

@ -189,11 +189,11 @@ bool PSPButton::Touch(const TouchInput &input) {
return retval;
}
bool CustomKey::IsDown() {
bool CustomButton::IsDown() {
return (toggle_ && on_) || (!toggle_ && pointerDownMask_ != 0);
}
void CustomKey::GetContentDimensions(const UIContext &dc, float &w, float &h) const {
void CustomButton::GetContentDimensions(const UIContext &dc, float &w, float &h) const {
MultiTouchButton::GetContentDimensions(dc, w, h);
if (invertedContextDimension_) {
float tmp = w;
@ -202,7 +202,7 @@ void CustomKey::GetContentDimensions(const UIContext &dc, float &w, float &h) co
}
}
bool CustomKey::Touch(const TouchInput &input) {
bool CustomButton::Touch(const TouchInput &input) {
using namespace CustomKeyData;
bool lastDown = pointerDownMask_ != 0;
bool retval = MultiTouchButton::Touch(input);
@ -233,7 +233,7 @@ bool CustomKey::Touch(const TouchInput &input) {
return retval;
}
void CustomKey::Update() {
void CustomButton::Update() {
MultiTouchButton::Update();
using namespace CustomKeyData;
@ -825,10 +825,10 @@ UI::ViewGroup *CreatePadLayout(float xres, float yres, bool *pause, bool showPau
}
return nullptr;
};
auto addCustomButton = [=](const ConfigCustomButton& cfg, const char *key, const ConfigTouchPos &touch) -> CustomKey * {
auto addCustomButton = [=](const ConfigCustomButton& cfg, const char *key, const ConfigTouchPos &touch) -> CustomButton * {
using namespace CustomKeyData;
if (touch.show) {
auto aux = root->Add(new CustomKey(cfg.key, key, cfg.toggle, cfg.repeat, controllMapper,
auto aux = root->Add(new CustomButton(cfg.key, key, cfg.toggle, cfg.repeat, controllMapper,
g_Config.iTouchButtonStyle == 0 ? customKeyShapes[cfg.shape].i : customKeyShapes[cfg.shape].l, customKeyShapes[cfg.shape].i,
customKeyImages[cfg.image].i, touch.scale, customKeyShapes[cfg.shape].d, buttonLayoutParams(touch)));
aux->SetAngle(customKeyImages[cfg.image].r, customKeyShapes[cfg.shape].r);

View File

@ -173,9 +173,9 @@ UI::ViewGroup *CreatePadLayout(float xres, float yres, bool *pause, bool showPau
const int D_pad_Radius = 50;
const int baseActionButtonSpacing = 60;
class CustomKey : public MultiTouchButton {
class CustomButton : public MultiTouchButton {
public:
CustomKey(uint64_t pspButtonBit, const char *key, bool toggle, bool repeat, ControlMapper* controllMapper, ImageID bgImg, ImageID bgDownImg, ImageID img, float scale, bool invertedContextDimension, UI::LayoutParams *layoutParams)
CustomButton(uint64_t pspButtonBit, const char *key, bool toggle, bool repeat, ControlMapper* controllMapper, ImageID bgImg, ImageID bgDownImg, ImageID img, float scale, bool invertedContextDimension, UI::LayoutParams *layoutParams)
: MultiTouchButton(key, bgImg, bgDownImg, img, scale, layoutParams), pspButtonBit_(pspButtonBit), toggle_(toggle), repeat_(repeat), controlMapper_(controllMapper), on_(false), invertedContextDimension_(invertedContextDimension) {
}
bool Touch(const TouchInput &input) override;