mame/src/emu/divideo.h
Vas Crabb ec80428647 Fairly significant overhaul of Lua engine and some cleanup.
The things that were previously called device iterators are not
iterators in the C++ sense of the word.  This is confusing for
newcomers.  These have been renamed to be device enumerators.

Several Lua methods and properties that previously returned tables now
return lightweight wrappers for the underlying objects.  This means
creating them is a lot faster, but you can't modify them, and the
performance characteristics of different operations varies.

The render manager's target list uses 1-based indexing to be more like
idiomatic Lua.

It's now possible to create a device enumerator on any device, and then
get subdevices (or sibling devices) using a relative tag.

Much more render/layout functionality has been exposed to Lua.  Layout
scripts now have access to the layout file and can directly set the
state of an item with no bindings, or register callbacks to obtain
state.  Some things that were previously methods are now read-only
properties.

Layout files are no longer required to supply a "name".  This was
problematic because the same layout file could be loaded for multiple
instances of the same device, and each instance of the layout file
should use the correct inputs (and in the future outputs) for the device
instance it's associated with.

This should also fix video output with MSVC builds by avoiding delegates
that return things that don't fit in a register.
2020-11-25 19:18:26 +11:00

75 lines
2.1 KiB
C++

// license:BSD-3-Clause
// copyright-holders:Aaron Giles
/***************************************************************************
divideo.h
Device video interfaces.
***************************************************************************/
#pragma once
#ifndef __EMU_H__
#error Dont include this file directly; include emu.h instead.
#endif
#ifndef MAME_EMU_DIVIDEO_H
#define MAME_EMU_DIVIDEO_H
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
// ======================> device_video_interface
class device_video_interface : public device_interface
{
static const char s_unconfigured_screen_tag[];
public:
// construction/destruction
device_video_interface(const machine_config &mconfig, device_t &device, bool screen_required = true);
virtual ~device_video_interface();
// configuration
void set_screen(const char *tag);
void set_screen(device_t &base, const char *tag)
{
m_screen_base = &base;
m_screen_tag = tag;
}
template <class ObjectClass, bool Required>
void set_screen(device_finder<ObjectClass, Required> &finder)
{
m_screen_base = &finder.finder_target().first;
m_screen_tag = finder.finder_target().second;
}
// getters
screen_device &screen() const { return *m_screen; }
bool has_screen() const { return m_screen != nullptr; }
protected:
// optional operation overrides
virtual void interface_config_complete() override;
virtual void interface_validity_check(validity_checker &valid) const override;
virtual void interface_pre_start() override;
private:
// configuration state
bool m_screen_required; // is a screen required?
device_t * m_screen_base; // base device for resolving target screen
const char * m_screen_tag; // configured tag for the target screen
// internal state
screen_device * m_screen; // pointer to the screen device
};
// iterator
typedef device_interface_enumerator<device_video_interface> video_interface_enumerator;
#endif /* MAME_EMU_DIVIDEO_H */