mirror of
https://github.com/Maschell/hid_to_vpad.git
synced 2024-11-23 23:09:16 +01:00
Fixed the "hitbox" of the settings elements.
- Now the on/off toggles "hitbox" corresponde to the icon.
This commit is contained in:
parent
f3d3a5835c
commit
3f1872437c
@ -21,8 +21,8 @@
|
||||
* Constructor for the GuiSwitch class.
|
||||
*/
|
||||
|
||||
GuiSwitch::GuiSwitch(bool checked,f32 switchscale)
|
||||
: GuiToggle(checked,90*switchscale,38*switchscale)
|
||||
GuiSwitch::GuiSwitch(bool checked,f32 w, f32 h)
|
||||
: GuiToggle(checked,w,h)
|
||||
,switchbase_imgdata(Resources::GetImageData("switchIconBase.png"))
|
||||
,switchbase_img(switchbase_imgdata)
|
||||
,switchbase_highlighted_imgdata(Resources::GetImageData("switchIconBaseHighlighted.png"))
|
||||
@ -32,9 +32,9 @@ GuiSwitch::GuiSwitch(bool checked,f32 switchscale)
|
||||
,switchOff_imgdata(Resources::GetImageData("switchIconOff.png"))
|
||||
,switchOff_img(switchOff_imgdata)
|
||||
{
|
||||
f32 scale = 0.0;
|
||||
f32 scale = 1.0;
|
||||
if(switchbase_img.getHeight() > switchbase_img.getWidth()){
|
||||
scale = height*switchscale/switchbase_img.getHeight();
|
||||
scale = height/switchbase_img.getHeight();
|
||||
}else{
|
||||
scale = width/switchbase_img.getWidth();
|
||||
}
|
||||
@ -45,9 +45,11 @@ GuiSwitch::GuiSwitch(bool checked,f32 switchscale)
|
||||
switchOff_img.setScale(scale);
|
||||
|
||||
switchOn_img.setParent(this);
|
||||
switchOn_img.setPosition((width/4.0),0);
|
||||
switchOn_img.setAlignment(ALIGN_RIGHT);
|
||||
//switchOn_img.setPosition((width/4.0),0);
|
||||
switchOff_img.setParent(this);
|
||||
switchOff_img.setPosition(-((width/4.0)),0);
|
||||
switchOff_img.setAlignment(ALIGN_LEFT);
|
||||
//switchOff_img.setPosition(-((width/4.0)),0);
|
||||
setImage(&switchbase_img);
|
||||
setIconOver(&switchbase_highlighted_img);
|
||||
}
|
||||
@ -70,11 +72,3 @@ void GuiSwitch::draw(CVideo *v){
|
||||
switchOff_img.draw(v);
|
||||
}
|
||||
}
|
||||
|
||||
f32 GuiSwitch::getHeight(){
|
||||
return switchOn_img.getHeight();
|
||||
}
|
||||
|
||||
f32 GuiSwitch::getWidth(){
|
||||
return switchbase_img.getWidth();
|
||||
}
|
||||
|
@ -27,13 +27,10 @@ class GuiSwitch : public GuiToggle
|
||||
public:
|
||||
//!Constructor
|
||||
//!\param checked Checked
|
||||
GuiSwitch(bool checked,f32 switchscale = 1.0f);
|
||||
GuiSwitch(bool checked,f32 w, f32 h);
|
||||
//!Destructor
|
||||
virtual ~GuiSwitch();
|
||||
|
||||
f32 getHeight();
|
||||
f32 getWidth();
|
||||
|
||||
protected:
|
||||
|
||||
GuiImageData * switchbase_imgdata;
|
||||
|
@ -25,9 +25,9 @@ ContentSettings::ContentSettings():ContentTemplate()
|
||||
, touchTrigger(GuiTrigger::CHANNEL_1, GuiTrigger::VPAD_TOUCH)
|
||||
, wpadTouchTrigger(GuiTrigger::CHANNEL_2 | GuiTrigger::CHANNEL_3 | GuiTrigger::CHANNEL_4 | GuiTrigger::CHANNEL_5, GuiTrigger::BUTTON_A)
|
||||
, languageSelectBox("",NULL)
|
||||
, rumbleSwitch(CSettings::instance()->getValueAsBool(CSettings::RumbleActivated))
|
||||
, musicSwitch(CSettings::instance()->getValueAsBool(CSettings::MusicActivated))
|
||||
, networkControllerSwitch(CSettings::instance()->getValueAsBool(CSettings::NetworkControllerActivated))
|
||||
, rumbleSwitch(CSettings::instance()->getValueAsBool(CSettings::RumbleActivated),90.0f,38.0f)
|
||||
, musicSwitch(CSettings::instance()->getValueAsBool(CSettings::MusicActivated),90.0f,38.0f)
|
||||
, networkControllerSwitch(CSettings::instance()->getValueAsBool(CSettings::NetworkControllerActivated),90.0f,38.0f)
|
||||
, buttonClickSound(Resources::GetSound("settings_click_2.mp3"))
|
||||
{
|
||||
headLine.setText(gettext("Settings"));
|
||||
|
Loading…
Reference in New Issue
Block a user