Some bugfixes for BGFX on SDL, nw

This commit is contained in:
therealmogminer@gmail.com 2016-03-18 04:49:37 +01:00
parent ea9e591a0c
commit e37b96b68d
7 changed files with 76 additions and 9 deletions

View File

@ -554,7 +554,6 @@ bool osd_common_t::font_get_bitmap(osd_font *font, unicode_char chnum, bitmap_ar
slider_state* osd_common_t::get_slider_list() slider_state* osd_common_t::get_slider_list()
{ {
printf("Core get_slider_list\n");
return nullptr; return nullptr;
} }

View File

@ -244,6 +244,9 @@ protected:
virtual bool input_init(); virtual bool input_init();
virtual void input_pause(); virtual void input_pause();
virtual void build_slider_list() { }
virtual void update_slider_list() { }
private: private:
// internal state // internal state
running_machine * m_machine; running_machine * m_machine;

View File

@ -732,7 +732,7 @@ int renderer_bgfx::draw(int update)
#ifdef OSD_WINDOWS #ifdef OSD_WINDOWS
m_framebuffer = m_targets->create_backbuffer(window().m_hwnd, m_width[window_index], m_height[window_index]); m_framebuffer = m_targets->create_backbuffer(window().m_hwnd, m_width[window_index], m_height[window_index]);
#else #else
m_framebuffer = m_targets->create_backbuffer(sdlNativeWindowHandle(window().sdl_window()), m_width[index], m_height[index]); m_framebuffer = m_targets->create_backbuffer(sdlNativeWindowHandle(window().sdl_window()), m_width[window_index], m_height[window_index]);
#endif #endif
bgfx::setViewFrameBuffer(view_index, m_framebuffer->target()); bgfx::setViewFrameBuffer(view_index, m_framebuffer->target());
m_dimensions = osd_dim(m_width[window_index], m_height[window_index]); m_dimensions = osd_dim(m_width[window_index], m_height[window_index]);

View File

@ -142,6 +142,9 @@ public:
virtual void init(running_machine &machine) override; virtual void init(running_machine &machine) override;
virtual void update(bool skip_redraw) override; virtual void update(bool skip_redraw) override;
// video overridables
virtual slider_state *get_slider_list() override;
// input overridables // input overridables
virtual void customize_input_type_list(simple_list<input_type_entry> &typelist) override; virtual void customize_input_type_list(simple_list<input_type_entry> &typelist) override;
@ -173,6 +176,10 @@ public:
sdl_options &options() { return m_options; } sdl_options &options() { return m_options; }
protected:
virtual void build_slider_list() override;
virtual void update_slider_list() override;
private: private:
virtual void osd_exit() override; virtual void osd_exit() override;
@ -181,7 +188,7 @@ private:
sdl_options &m_options; sdl_options &m_options;
watchdog *m_watchdog; watchdog *m_watchdog;
slider_state * m_sliders;
}; };
//============================================================ //============================================================

View File

@ -140,6 +140,60 @@ float osd_monitor_info::aspect()
//============================================================
// update_slider_list
//============================================================
void sdl_osd_interface::update_slider_list()
{
for (sdl_window_info *window = sdl_window_list; window != nullptr; window = window->m_next)
{
if (window->renderer().sliders_dirty())
{
build_slider_list();
return;
}
}
}
//============================================================
// get_slider_list
//============================================================
slider_state *sdl_osd_interface::get_slider_list()
{
return m_sliders;
}
//============================================================
// build_slider_list
//============================================================
void sdl_osd_interface::build_slider_list()
{
m_sliders = nullptr;
slider_state *curr = m_sliders;
for (sdl_window_info *info = sdl_window_list; info != nullptr; info = info->m_next)
{
slider_state *window_sliders = info->renderer().get_slider_list();
if (window_sliders != nullptr)
{
if (m_sliders == nullptr)
{
m_sliders = window_sliders;
curr = m_sliders;
}
else
{
while (curr->next != nullptr)
{
curr = curr->next;
}
curr->next = window_sliders;
}
}
}
}
//============================================================ //============================================================
// update // update
@ -152,6 +206,8 @@ void sdl_osd_interface::update(bool skip_redraw)
if (m_watchdog != NULL) if (m_watchdog != NULL)
m_watchdog->reset(); m_watchdog->reset();
update_slider_list();
// if we're not skipping this redraw, update all windows // if we're not skipping this redraw, update all windows
if (!skip_redraw) if (!skip_redraw)
{ {

View File

@ -87,6 +87,7 @@ public:
osd_dim blit_surface_size() override; osd_dim blit_surface_size() override;
int prescale() const { return m_prescale; } int prescale() const { return m_prescale; }
osd_renderer &renderer() const { return *m_renderer; }
// Pointer to next window // Pointer to next window
sdl_window_info * m_next; sdl_window_info * m_next;
@ -122,8 +123,7 @@ private:
} }
static OSDWORK_CALLBACK( complete_create_wt ); static OSDWORK_CALLBACK( complete_create_wt );
protected:
osd_renderer &renderer() { return *m_renderer; }
private: private:
int wnd_extra_width(); int wnd_extra_width();
int wnd_extra_height(); int wnd_extra_height();

View File

@ -298,10 +298,12 @@ public:
int window_count(); int window_count();
protected:
virtual void build_slider_list() override;
virtual void update_slider_list() override;
private: private:
virtual void osd_exit() override; virtual void osd_exit() override;
void build_slider_list();
void update_slider_list();
windows_options & m_options; windows_options & m_options;
slider_state * m_sliders; slider_state * m_sliders;