diff options
Diffstat (limited to 'src/emu/screen.h')
-rw-r--r-- | src/emu/screen.h | 79 |
1 files changed, 40 insertions, 39 deletions
diff --git a/src/emu/screen.h b/src/emu/screen.h index 8c9fb448138..f1126b4cb69 100644 --- a/src/emu/screen.h +++ b/src/emu/screen.h @@ -91,19 +91,22 @@ private: public: // construction/destruction screen_bitmap() - : m_format(BITMAP_FORMAT_RGB32), - m_texformat(TEXFORMAT_RGB32), - m_live(&m_rgb32) { } + : m_format(BITMAP_FORMAT_RGB32) + , m_texformat(TEXFORMAT_RGB32) + , m_live(&m_rgb32) + { } screen_bitmap(bitmap_ind16 &orig) - : m_format(BITMAP_FORMAT_IND16), - m_texformat(TEXFORMAT_PALETTE16), - m_live(&m_ind16), - m_ind16(orig, orig.cliprect()) { } + : m_format(BITMAP_FORMAT_IND16) + , m_texformat(TEXFORMAT_PALETTE16) + , m_live(&m_ind16) + , m_ind16(orig, orig.cliprect()) + { } screen_bitmap(bitmap_rgb32 &orig) - : m_format(BITMAP_FORMAT_RGB32), - m_texformat(TEXFORMAT_RGB32), - m_live(&m_rgb32), - m_rgb32(orig, orig.cliprect()) { } + : m_format(BITMAP_FORMAT_RGB32) + , m_texformat(TEXFORMAT_RGB32) + , m_live(&m_rgb32) + , m_rgb32(orig, orig.cliprect()) + { } // resizing void resize(int width, int height) { live().resize(width, height); } @@ -215,6 +218,28 @@ public: m_yscale = yscale; m_yoffset = yoffs; } + + // FIXME: these should be aware of current device for resolving the tag + template <class FunctionClass> + void set_screen_update(u32 (FunctionClass::*callback)(screen_device &, bitmap_ind16 &, const rectangle &), const char *name) + { + set_screen_update(screen_update_ind16_delegate(callback, name, nullptr, static_cast<FunctionClass *>(nullptr))); + } + template <class FunctionClass> + void set_screen_update(u32 (FunctionClass::*callback)(screen_device &, bitmap_rgb32 &, const rectangle &), const char *name) + { + set_screen_update(screen_update_rgb32_delegate(callback, name, nullptr, static_cast<FunctionClass *>(nullptr))); + } + template <class FunctionClass> + void set_screen_update(const char *devname, u32 (FunctionClass::*callback)(screen_device &, bitmap_ind16 &, const rectangle &), const char *name) + { + set_screen_update(screen_update_ind16_delegate(callback, name, devname, static_cast<FunctionClass *>(nullptr))); + } + template <class FunctionClass> + void set_screen_update(const char *devname, u32 (FunctionClass::*callback)(screen_device &, bitmap_rgb32 &, const rectangle &), const char *name) + { + set_screen_update(screen_update_rgb32_delegate(callback, name, devname, static_cast<FunctionClass *>(nullptr))); + } void set_screen_update(screen_update_ind16_delegate callback) { m_screen_update_ind16 = callback; @@ -225,6 +250,7 @@ public: m_screen_update_ind16 = screen_update_ind16_delegate(); m_screen_update_rgb32 = callback; } + template<class Object> devcb_base &set_screen_vblank(Object &&object) { return m_screen_vblank.set_callback(std::forward<Object>(object)); } template<typename T> void set_palette(T &&tag) { m_palette.set_tag(std::forward<T>(tag)); } void set_video_attributes(u32 flags) { m_video_attributes = flags; } @@ -512,9 +538,9 @@ typedef device_type_iterator<screen_device> screen_device_iterator; #define MCFG_SCREEN_DEFAULT_POSITION(_xscale, _xoffs, _yscale, _yoffs) \ downcast<screen_device &>(*device).set_default_position(_xscale, _xoffs, _yscale, _yoffs); #define MCFG_SCREEN_UPDATE_DRIVER(_class, _method) \ - downcast<screen_device &>(*device).set_screen_update(screen_update_delegate_smart(&_class::_method, #_class "::" #_method, nullptr)); + downcast<screen_device &>(*device).set_screen_update(&_class::_method, #_class "::" #_method); #define MCFG_SCREEN_UPDATE_DEVICE(_device, _class, _method) \ - downcast<screen_device &>(*device).set_screen_update(screen_update_delegate_smart(&_class::_method, #_class "::" #_method, _device)); + downcast<screen_device &>(*device).set_screen_update(_device, &_class::_method, #_class "::" #_method); #define MCFG_SCREEN_VBLANK_CALLBACK(_devcb) \ devcb = &downcast<screen_device &>(*device).set_screen_vblank(DEVCB_##_devcb); #define MCFG_SCREEN_PALETTE(_palette_tag) \ @@ -526,29 +552,4 @@ typedef device_type_iterator<screen_device> screen_device_iterator; #define MCFG_SCREEN_COLOR(_color) \ downcast<screen_device &>(*device).set_color(_color); - -//************************************************************************** -// INLINE HELPERS -//************************************************************************** - -//------------------------------------------------- -// screen_update_delegate_smart - collection of -// inline helpers which create the appropriate -// screen_update_delegate based on the input -// function type -//------------------------------------------------- - -template<class _FunctionClass> -inline screen_update_ind16_delegate screen_update_delegate_smart(u32 (_FunctionClass::*callback)(screen_device &, bitmap_ind16 &, const rectangle &), const char *name, const char *devname) -{ - return screen_update_ind16_delegate(callback, name, devname, (_FunctionClass *)nullptr); -} - -template<class _FunctionClass> -inline screen_update_rgb32_delegate screen_update_delegate_smart(u32 (_FunctionClass::*callback)(screen_device &, bitmap_rgb32 &, const rectangle &), const char *name, const char *devname) -{ - return screen_update_rgb32_delegate(callback, name, devname, (_FunctionClass *)nullptr); -} - - -#endif /* MAME_EMU_SCREEN_H */ +#endif // MAME_EMU_SCREEN_H |