diff options
| author | 2026-02-19 17:45:26 +0100 | |
|---|---|---|
| committer | 2026-02-20 03:45:26 +1100 | |
| commit | 57cf10f09f79fab5fef3544bca98aeca6eadcfe3 (patch) | |
| tree | 0478fd0e05bb52363b4247161b17a6cdfe1e05a2 /plugins | |
| parent | 644147eb50a94c33ee1307c5fe903b4b8cf90d11 (diff) | |
video/vector.cpp, frontend/mame/luaengine.cpp: Refactored recently-added Lua hooks for vector devices. (#14991)
Diffstat (limited to 'plugins')
| -rw-r--r-- | plugins/vector/init.lua | 45 | ||||
| -rw-r--r-- | plugins/vector/plugin.json | 10 |
2 files changed, 55 insertions, 0 deletions
diff --git a/plugins/vector/init.lua b/plugins/vector/init.lua new file mode 100644 index 00000000000..1f8b13def50 --- /dev/null +++ b/plugins/vector/init.lua @@ -0,0 +1,45 @@ +-- license:BSD-3-Clause +-- copyright-holders:Ryan Holtz +local exports = { + name = 'vector', + version = '0.0.1', + description = 'Vector-hook demonstration plugin', + license = 'BSD-3-Clause', + author = { name = 'Ryan Holtz' } } + + +local vector = exports + +local reset_subscription, frame_begin_subscription, frame_end_subscription, move_subscription, line_subscription + +function vector.startplugin() + local function frame_begin(index) + print("frame begin"); + end + + local function frame_end(index) + print("frame end"); + end + + local function vector_move(x, y, color, width, height) + print(string.format("beam move, x:%.1f y:%.1f color:%08x width:%d height:%d", x, y, color, width, height)); + end + + local function vector_line(lastx, lasty, x, y, color, intensity, width, height) + print(string.format("line, from x:%.1f y:%.1f, to x:%.1f y:%.1f, color:%08x intensity:%d width:%d height:%d", lastx, lasty, x, y, color, intensity, width, height)); + end + + local function start() + local vector_device = manager.machine.vector_devices:at(1) + if vector_device then + frame_begin_subscription = vector_device:add_frame_begin_notifier(frame_begin) + frame_end_subscription = vector_device:add_frame_end_notifier(frame_end) + move_subscription = vector_device:add_move_notifier(vector_move) + line_subscription = vector_device:add_line_notifier(vector_line) + end + end + + reset_subscription = emu.add_machine_reset_notifier(start) +end + +return exports diff --git a/plugins/vector/plugin.json b/plugins/vector/plugin.json new file mode 100644 index 00000000000..a8dbdc58b72 --- /dev/null +++ b/plugins/vector/plugin.json @@ -0,0 +1,10 @@ +{ + "plugin": { + "name": "vector", + "description": "Vector-hook demonstration plugin", + "version": "0.0.1", + "author": "Ryan Holtz", + "type": "plugin", + "start": "false" + } +} |
