File: init.lua

package info (click to toggle)
mame 0.286%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 930,472 kB
  • sloc: cpp: 5,499,413; xml: 2,250,892; ansic: 752,116; sh: 34,431; lisp: 19,643; python: 17,598; makefile: 13,246; java: 8,492; yacc: 8,152; javascript: 7,147; cs: 6,013; asm: 4,786; ada: 1,681; pascal: 1,191; lex: 1,174; perl: 585; ruby: 373
file content (45 lines) | stat: -rw-r--r-- 1,443 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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