Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ClusterM/fceux.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/output
diff options
context:
space:
mode:
authoransstuff <ansstuff@users.sf.net>2011-09-23 22:09:40 +0400
committeransstuff <ansstuff@users.sf.net>2011-09-23 22:09:40 +0400
commit84ae16d8c22b3837aaad4f6646eab5db0519ad53 (patch)
tree84c04d4dd17eddfcec257f8fda6f365a96e7aa73 /output
parentae1bb879ef01081ccab9684dd1363399f3a72270 (diff)
* HideMenu (Esc) only works when FCEU window has focus
* moved "Display movie status icon" from Config->Movie options to Config->Display * File->AVI/Wav->Enable HUD recording
Diffstat (limited to 'output')
-rw-r--r--output/luaScripts/AVI-HeadsUpDisplay.lua352
1 files changed, 120 insertions, 232 deletions
diff --git a/output/luaScripts/AVI-HeadsUpDisplay.lua b/output/luaScripts/AVI-HeadsUpDisplay.lua
index cde16658..94585bdd 100644
--- a/output/luaScripts/AVI-HeadsUpDisplay.lua
+++ b/output/luaScripts/AVI-HeadsUpDisplay.lua
@@ -1,233 +1,121 @@
---Input and frame counter display by andymac (by feos' request)
---Useful for recording input onto avi, or if you just don't want the
---display getting in the way of your movie!
---Simply drag and drop the input display or frame counter
---Middle click to disable a display
---Numpad 1-5 to enable displays.
-
-print("Input, frame & lag counter display by andymac (by feos' request).",
- "\r\nUseful for recording input & these counters onto avi.",
- "\r\nSimply drag and drop the input display or frame counter.",
- "\r\nMiddle click to disable a display.",
- "\r\nNumpad 1-4 to enable input displays.",
- "\r\nNumpad 5 to enable conters display.")
-
-function drawpad(padnum,cx,cy) -- draws a gamepad on the screen
-
- gui.transparency (0) --draws backround box
- gui.drawbox (cx - 3,cy - 3,cx + 28,cy + 6,"blue")
- gui.transparency (0)
-
- gui.drawbox (cx,cy,cx + 3,cy + 3,"black") --centre square
-
- controller = joypad.read(padnum)
-
- if (padnum == 1) then
- colour = "red" --changes colour of gamepads
- elseif (padnum == 2) then
- colour = "yellow"
- elseif (padnum == 3) then
- colour = "green"
- elseif (padnum == 4) then
- colour = "orange"
- end
-
- if (controller.A) then
- gui.drawbox (cx + 25,cy,cx + 28,cy + 3,colour) --other buttons
- else
- gui.drawbox (cx + 25,cy,cx + 28,cy + 3,"black")
- end
-
- if (controller.B) then
- gui.drawbox (cx + 20,cy,cx + 23,cy + 3,colour)
- else
- gui.drawbox (cx + 20,cy,cx + 23,cy + 3,"black")
- end
-
- if (controller.start) then
- gui.drawbox (cx + 14,cy + 1,cx + 18,cy + 2,colour)
- else
- gui.drawbox (cx + 14,cy + 1,cx + 18,cy + 2,"black")
- end
-
- if (controller.select) then
- gui.drawbox (cx + 8,cy + 1,cx + 12,cy + 2,colour)
- else
- gui.drawbox (cx + 8,cy + 1,cx + 12,cy + 2,"black")
- end
-
- if (controller.up) then
- gui.drawbox (cx,cy - 3,cx + 3,cy,colour)
- else
- gui.drawbox (cx,cy - 3,cx + 3,cy,"black")
- end
-
- if (controller.down) then
- gui.drawbox (cx,cy + 3,cx + 3,cy + 6,colour)
- else
- gui.drawbox (cx,cy + 3,cx + 3,cy + 6,"black")
- end
-
- if (controller.left) then
- gui.drawbox (cx - 3,cy,cx,cy + 3,colour)
- else
- gui.drawbox (cx - 3,cy,cx,cy + 3,"black")
- end
-
- if (controller.right) then
- gui.drawbox (cx + 3,cy,cx + 6,cy + 3,colour)
- else
- gui.drawbox (cx + 3,cy,cx + 6,cy + 3,"black")
- end
-
-
-end
-
-function mouseover(boxx, boxy) --checks if mouseover
-
- if keys.xmouse >= ( boxx - 5 ) and keys.xmouse <= ( boxx + 30 ) then
-
- if keys.ymouse >= ( boxy -3 ) and keys.ymouse <= ( boxy + 21 ) then
-
- return true
- end
- end
-end
-
-function inrange(upper, lower, testval)
-
- if testval >= upper then return upper
-
- elseif testval <= lower then return lower
-
- else return testval
-
- end
-
-end
-
-function everything()
-
- keys = input.get()
-
- if (text == 1) then
-
- if (FCEU.lagged()) then --flash lagcounter red if lagged, otherwise green.
- gui.text (ex,ey + 9,FCEU.lagcount(), "red")
- else
- gui.text (ex,ey + 9,FCEU.lagcount(), "green")
- end
-
- if (movie.mode() == "finished" or movie.mode() == nil) then
- gui.text (ex,ey,movie.framecount(), "red")
- else
- gui.text (ex,ey,movie.framecount())
- end
-
- end
-
-
- if keys["numpad5"] then text = 1 end --enable 1-4 and text using and numpad 1-5
- if keys["numpad1"] then pad1 = 1 end
- if keys["numpad2"] then pad2 = 1 end
- if keys["numpad3"] then pad3 = 1 end
- if keys["numpad4"] then pad4 = 1 end
-
-
- xmouse = inrange(240, 16, keys.xmouse) --limits x and y mouse position to be on screen
-
- ymouse = inrange(225, 11, keys.ymouse) --so we can't drag items off the screen.
-
- xmouse2 = inrange(241, 10, keys.xmouse)
-
- ymouse2 = inrange(223, 16, keys.ymouse)
-
- if keys.xmouse >= ( ex - 10 ) and keys.xmouse <= ( ex + 40 ) then -- test if mouse is over text
-
- if keys.ymouse >= ( ey ) and keys.ymouse <= ( ey + 40 ) then
-
- motext = true
- else
- motext = false
- end
- else motext = false
- end
-
-
- if mouseover(pad1x, pad1y) then -- checks if clicked, or middle clicked
-
- if keys["leftclick"] then
- pad1x = xmouse - 13
- pad1y = ymouse - 8
- elseif keys["middleclick"] then
- pad1 = 0
- end
-
- elseif mouseover(pad2x, pad2y) then
-
- if keys["leftclick"] then
- pad2x = xmouse - 13
- pad2y = ymouse - 8
- elseif keys["middleclick"] then
- pad2 = 0
- end
-
- elseif mouseover(pad3x, pad3y) then
-
- if keys["leftclick"] then
- pad3x = xmouse - 13
- pad3y = ymouse - 8
- elseif keys["middleclick"] then
- pad3 = 0
- end
-
- elseif mouseover(pad4x, pad4y) then
-
- if keys["leftclick"] then
- pad4x = xmouse - 13
- pad4y = ymouse - 8
- elseif keys["middleclick"] then
- pad4 = 0
- end
-
- elseif motext then
- if keys["leftclick"] then
- ex = xmouse2 - 10
- ey = ymouse2 - 16
- elseif keys["middleclick"] then
- text = 0
- end
- end
-
- if (pad1 == 1) then drawpad(1,pad1x, pad1y) end --draw pads
- if (pad2 == 1) then drawpad(2,pad2x, pad2y) end
- if (pad3 == 1) then drawpad(3,pad3x, pad3y) end
- if (pad4 == 1) then drawpad(4,pad4x, pad4y) end
-
-end
-
-while (true) do
-
-pad1x = 10
-pad1y = 200
-pad2x = 60
-pad2y = 200
-pad3x = 110
-pad3y = 200
-pad4x = 160
-pad4y = 200
-ex = 200
-ey = 200
-pad1 = 1
-pad2 = 0
-pad3 = 0
-pad4 = 0
-text = 1
-
- while (true) do
-
- gui.register(everything)
- FCEU.frameadvance()
-
- end
+-- Script by amaurea, andymac and feos for FCEUX 2.1.6 and earlier versions.
+-- Allows customizable recording of Frame, Lag, Timer and Input display to AVI dump.
+-- Drag and drop HUD items with mouse, use Numpad 1-6 to switch them on/off.
+
+print("Drag and drop HUD items with mouse, use Numpad 1-6 to switch them on/off.")
+
+screen = {w=256,h=231}
+move = {object=nil,offx=0,offy=0}
+
+pads = {
+ {num=1,on=true, color="red", x=9, y=220,w=34,h=10,toggle="numpad1"},
+ {num=2,on=true, color="yellow",x=54, y=220,w=34,h=10,toggle="numpad2"},
+ {num=3,on=false,color="green", x=99, y=220,w=34,h=10,toggle="numpad3"},
+ {num=4,on=false,color="orange",x=144,y=220,w=34,h=10,toggle="numpad4"}
+}
+
+buttons = {
+ A = {x=30,y=5,w=3,h=3},
+ B = {x=24,y=5,w=3,h=3},
+ start = {x=12,y=7,w=3,h=1},
+ select = {x=18,y=7,w=3,h=1},
+ up = {x=4, y=1,w=2,h=2},
+ down = {x=4, y=7,w=2,h=2},
+ left = {x=1, y=4,w=2,h=2},
+ right = {x=7, y=4,w=2,h=2}
+}
+
+text = {on=true,x=1, y=9,w=30,h=16,toggle="numpad5"}
+timer = {on=true,x=197,y=9,w=58,h= 7,toggle="numpad6"}
+
+function drawpad(pad)
+ gui.drawbox( pad.x, pad.y, pad.x+pad.w, pad.y+pad.h, "#3070ffb0" )
+ gui.drawbox( pad.x+4, pad.y+4, pad.x+6, pad.y+6, "black" )
+ controller = joypad.read(pad.num)
+ for name, b in pairs(buttons) do
+ gui.drawbox( pad.x + b.x, pad.y + b.y, pad.x + b.x + b.w, pad.y + b.y + b.h,
+ controller[name] and pad.color or "black" )
+ end
+end
+
+function mouseover(pad, margin)
+ return keys.xmouse >= pad.x-margin and keys.xmouse <= pad.x+pad.w+margin and
+ keys.ymouse >= pad.y-margin and keys.ymouse <= pad.y+pad.h+margin
+end
+
+function inrange(upper, lower, testval)
+ if testval >= upper then return upper
+ elseif testval <= lower then return lower
+ else return testval
+ end
+end
+
+function concat(tables)
+ local res = {}
+ for _, tab in ipairs(tables) do
+ for _, val in ipairs(tab) do
+ table.insert(res, val)
+ end
+ end
+ return res
+end
+
+prev_keys = input.get()
+objects = concat({pads, {text, timer}})
+
+function everything()
+ keys = input.get()
+
+ -- Are we moving anything around?
+ if move.object then
+ if keys["leftclick"] then
+ -- Do not go outside screen
+ local safex = inrange(screen.w - move.object.w, 0, keys.xmouse - move.offx)
+ local safey = inrange(screen.h - move.object.h, 8, keys.ymouse - move.offy)
+ move.object.x = safex
+ move.object.y = safey
+ else move.object = nil end
+
+ -- Try to pick something up
+ elseif keys["leftclick"] then
+ for _,object in ipairs(objects) do
+ if mouseover(object,0) then
+ move.object = object
+ move.offx = keys.xmouse - object.x
+ move.offy = keys.ymouse - object.y
+ end
+ end
+ end
+
+ -- Toggle displays
+ for _, object in ipairs(objects) do
+ if keys[object.toggle] and not prev_keys[object.toggle] then
+ object.on = not object.on
+ end
+ end
+
+ -- Actually draw the stuff
+ if timer.on then
+ mins = math.floor(movie.framecount()/3600)
+ secs = movie.framecount()/60-mins*60
+ gui.text( timer.x, timer.y, string.format("%s:%05.2f",os.date("!%H:%M",mins*60),secs), "white" )
+ end
+
+ if text.on then
+ local done = movie.mode() == "finished" or movie.mode() == nil
+ gui.text( text.x, text.y, movie.framecount(), done and "red" or "white" )
+ gui.text( text.x, text.y + 9, FCEU.lagcount(), FCEU.lagged() and "red" or "green" )
+ end
+
+ for _, pad in ipairs(pads) do
+ if pad.on then drawpad(pad) end
+ end
+
+ prev_keys = keys
+end
+
+gui.register(everything)
+
+while (true) do
+ FCEU.frameadvance()
end \ No newline at end of file