mirror of
https://github.com/libretro/ppsspp.git
synced 2025-02-19 00:19:26 +00:00
Fix bug with float sliders. minor stuff.
This commit is contained in:
parent
4a1c3c4f83
commit
5422dead6a
@ -8,6 +8,7 @@ const char *GetDeviceName(int deviceId) {
|
||||
case DEVICE_ID_PAD_0: return "pad";
|
||||
case DEVICE_ID_X360_0: return "x360";
|
||||
case DEVICE_ID_ACCELEROMETER: return "accelerometer";
|
||||
case DEVICE_ID_MOUSE: return "mouse";
|
||||
default:
|
||||
return "unknown";
|
||||
}
|
||||
|
@ -63,16 +63,16 @@ private:
|
||||
|
||||
class ListPopupScreen : public PopupScreen {
|
||||
public:
|
||||
ListPopupScreen(std::string title) : PopupScreen(title) {}
|
||||
ListPopupScreen(std::string title, const std::vector<std::string> &items, int selected, std::function<void(int)> callback)
|
||||
: PopupScreen(title), adaptor_(items, selected), callback_(callback) {
|
||||
ListPopupScreen(std::string title) : PopupScreen(title), showButtons_(false) {}
|
||||
ListPopupScreen(std::string title, const std::vector<std::string> &items, int selected, std::function<void(int)> callback, bool showButtons = false)
|
||||
: PopupScreen(title), adaptor_(items, selected), callback_(callback), showButtons_(showButtons) {
|
||||
}
|
||||
|
||||
UI::Event OnChoice;
|
||||
|
||||
protected:
|
||||
virtual bool FillVertical() { return true; }
|
||||
virtual bool ShowButtons() { return false; }
|
||||
virtual bool ShowButtons() { return showButtons_; }
|
||||
void CreatePopupContents(UI::ViewGroup *parent);
|
||||
UI::StringVectorListAdaptor adaptor_;
|
||||
UI::ListView *listView_;
|
||||
@ -81,6 +81,7 @@ private:
|
||||
UI::EventReturn OnListChoice(UI::EventParams &e);
|
||||
|
||||
std::function<void(int)> callback_;
|
||||
bool showButtons_;
|
||||
};
|
||||
|
||||
class MessagePopupScreen : public PopupScreen {
|
||||
|
@ -507,7 +507,7 @@ void SliderFloat::Key(const KeyInput &input) {
|
||||
void SliderFloat::Touch(const TouchInput &input) {
|
||||
if (dragging_ || bounds_.Contains(input.x, input.y)) {
|
||||
float relativeX = (input.x - bounds_.x) / bounds_.w;
|
||||
*value_ = floorf(relativeX * (maxValue_ - minValue_) + minValue_ + 0.5f);
|
||||
*value_ = relativeX * (maxValue_ - minValue_) + minValue_;
|
||||
Clamp();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user