dofile("textrender.lua");
while true do
mtype, message = jpcrr.wait_event();
if mtype == "lock" then
mouseinfo = jpcrr.status();
jpcrr.hud.bottom_gap(3, 16);
if mouseinfo.mouse_button_1 then
mouse1 = 255
else
mouse1 = 50
end
if mouseinfo.mouse_button_2 then
mouse2 = 255
else
mouse2 = 50
end
if mouseinfo.mouse_button_3 then
mouse3 = 255
else
mouse3 = 50
end
render_text(3, 100, 400, "LEFT", false, 0, mouse1, 0);
render_text(3, 200, 400, "MIDDLE", false, 0, mouse2, 0);
render_text(3, 300, 400, "RIGHT", false, 0, mouse3, 0);
jpcrr.release_vga();
elseif mtype == "message" then
c,d,e = string.match(message, "(.*) (.*) (.*)");
C,D = string.match(message, "(.*) (.*)");
if message == "hi" then
print("hi");
elseif e and c == "moveb" then
if string.match(d, "-?[0-9]+") and string.match(e, "-?[0-9]+") then
print("Moved X "..tonumber(d).." and Y "..tonumber(e));
jpcrr.sendevent("org.jpc.emulator.peripheral.Keyboard", "XMOUSEMOTION", tonumber(d));
jpcrr.sendevent("org.jpc.emulator.peripheral.Keyboard", "YMOUSEMOTION", tonumber(e));
end
elseif D and C == "movex" then
if string.match(D, "-?[0-9]+") then
print("Moved X "..tonumber(D));
jpcrr.sendevent("org.jpc.emulator.peripheral.Keyboard", "XMOUSEMOTION", tonumber(D));
end
elseif D and C == "movey" then
if string.match(D, "-?[0-9]+") then
print("Moved Y "..tonumber(D));
jpcrr.sendevent("org.jpc.emulator.peripheral.Keyboard", "YMOUSEMOTION", tonumber(D));
end
end
end
end