summaryrefslogtreecommitdiffstatshomepage
path: root/src/frontend/mame/luaengine.cpp
diff options
context:
space:
mode:
author mooglyguy <therealmogminer@gmail.com>2018-11-04 16:19:29 +0100
committer mooglyguy <therealmogminer@gmail.com>2018-11-04 16:19:49 +0100
commit6c2328e286ce1280987c3fee792c158289a8b62b (patch)
tree626cddcc334bdba02d23134fae30407144d5f7e7 /src/frontend/mame/luaengine.cpp
parent8c875845a79e20b12dfee6d1dea5bf0e0dc0834f (diff)
luaengine: Added pixel(x,y) function. [Ryan Holtz]
Diffstat (limited to 'src/frontend/mame/luaengine.cpp')
-rw-r--r--src/frontend/mame/luaengine.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/frontend/mame/luaengine.cpp b/src/frontend/mame/luaengine.cpp
index 697726f19a4..e540ba35360 100644
--- a/src/frontend/mame/luaengine.cpp
+++ b/src/frontend/mame/luaengine.cpp
@@ -989,7 +989,7 @@ void lua_engine::initialize()
* item:read_block(offset, count) - read a block of entry values as a string (byte addressing)
* item:write(offset, value) - write entry value by index
*/
-
+
emu.new_usertype<save_item>("item", sol::call_constructor, sol::initializers([this](save_item &item, int index) {
if(!machine().save().indexed_item(index, item.base, item.size, item.count))
{
@@ -1742,6 +1742,7 @@ void lua_engine::initialize()
* screen:tag() - screen device tag
* screen:xscale() - screen x scale factor
* screen:yscale() - screen y scale factor
+ * screen:pixel(x, y) - get pixel at (x, y)
*/
sol().registry().new_usertype<screen_device>("screen_dev", "new", sol::no_constructor,
@@ -1854,7 +1855,11 @@ void lua_engine::initialize()
"shortname", &screen_device::shortname,
"tag", &screen_device::tag,
"xscale", &screen_device::xscale,
- "yscale", &screen_device::yscale);
+ "yscale", &screen_device::yscale,
+ "pixel", [](screen_device &sdev, float x, float y) {
+ return sdev.pixel((s32)x, (s32)y);
+ }
+ );
/* mame_manager:ui()
* ui:is_menu_active() - ui menu state