summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd/modules/render/bgfx/slider.cpp
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2021-01-27 19:13:27 -0500
committer AJR <ajrhacker@users.noreply.github.com>2021-01-27 19:25:18 -0500
commit1ef9d6991b39bc03565278f35b4af97e44c7bcbf (patch)
treea2915371d4f4ad8534ee989e8aa8b53f5d4c5e82 /src/osd/modules/render/bgfx/slider.cpp
parentcdde43b7a70f8aa434a028840d661c532525b1f2 (diff)
ui: Clean up slider callbacks
Diffstat (limited to 'src/osd/modules/render/bgfx/slider.cpp')
-rw-r--r--src/osd/modules/render/bgfx/slider.cpp29
1 files changed, 6 insertions, 23 deletions
diff --git a/src/osd/modules/render/bgfx/slider.cpp b/src/osd/modules/render/bgfx/slider.cpp
index 927898be5a5..bfd472f7a8a 100644
--- a/src/osd/modules/render/bgfx/slider.cpp
+++ b/src/osd/modules/render/bgfx/slider.cpp
@@ -37,38 +37,21 @@ bgfx_slider::~bgfx_slider()
{
}
-int32_t bgfx_slider::slider_changed(running_machine& /*machine*/, void *arg, int /*id*/, std::string *str, int32_t newval)
-{
- if (arg != nullptr)
- {
- return reinterpret_cast<bgfx_slider*>(arg)->update(str, newval);
- }
- return 0;
-}
-
void bgfx_slider::import(float val)
{
m_value = val;
- slider_changed(m_machine, this, m_slider_state->id, nullptr, int32_t(floor(m_value / m_step + 0.5f)));
+ update(nullptr, int32_t(floor(m_value / m_step + 0.5f)));
}
std::unique_ptr<slider_state> bgfx_slider::create_core_slider()
{
- auto state = std::make_unique<slider_state>();
-
- state->minval = int32_t(floor(m_min / m_step + 0.5f));
- state->defval = int32_t(floor(m_default / m_step + 0.5f));
- state->maxval = int32_t(floor(m_max / m_step + 0.5f));
- state->incval = int32_t(floor(m_step / m_step + 0.5f));
+ int32_t minval = int32_t(floor(m_min / m_step + 0.5f));
+ int32_t defval = int32_t(floor(m_default / m_step + 0.5f));
+ int32_t maxval = int32_t(floor(m_max / m_step + 0.5f));
+ int32_t incval = int32_t(floor(m_step / m_step + 0.5f));
using namespace std::placeholders;
- state->update = std::bind(&bgfx_slider::slider_changed, this, _1, _2, _3, _4, _5);
-
- state->arg = this;
- state->id = 0;
- state->description = m_description;
-
- return state;
+ return std::make_unique<slider_state>(m_description, minval, defval, maxval, incval, std::bind(&bgfx_slider::update, this, _1, _2));
}
int32_t bgfx_slider::update(std::string *str, int32_t newval)