Post subject: Lua question
YaLTeR
He/Him
Joined: 12/2/2011
Posts: 129
Location: Moscow, Russia
How do I make my gui.drawRectangle function paint a rectangle that will stay while emulation is paused (like in FCEUX or like gui.text)?
Post subject: Re: Lua question
Former player
Joined: 2/19/2007
Posts: 424
Location: UK
YaLTeR wrote:
How do I make my gui.drawRectangle function paint a rectangle that will stay while emulation is paused (like in FCEUX or like gui.text)?
I am not familiar with Bizhawk, but if it works like other lua-enabled emualtors, then a function passed to gui.register() will be called every time the screen needs to be redrawn, whether paused or not. If so, you can get a rectangle to stay by doing:
Language: lua

gui.register(function() gui.drawbox(10,10,20,20,0xff0000) end)
once, before entering the main loop of the script.
Post subject: Re: Lua question
Masterjun
He/Him
Site Developer, Skilled player (1988)
Joined: 10/12/2010
Posts: 1185
Location: Germany
amaurea wrote:
I am not familiar with Bizhawk, but if it works like other lua-enabled emualtors, then a function passed to gui.register() will be called every time the screen needs to be redrawn, whether paused or not.
unfortunately, there is no gui.register() or something similar to that in Bizhawk, so i think we'll have to wait for a newer version...
Warning: Might glitch to credits I will finish this ACE soon as possible (or will I?)
Former player
Joined: 5/4/2005
Posts: 502
Location: Onett, Eagleland
This has been fixed in the latest revision on the SVN.
I think.....therefore I am not Barry Burton
Skilled player (1828)
Joined: 4/20/2005
Posts: 2161
Location: Norrköping, Sweden
I have a lua question for BizHawk: What is the correct syntax when using gui.drawImage? I've tried
imfile="C:\pics\map.png"
gui.drawImage(imstr,30,30,10,10) 
but it doesn't work - the lua window does not return an error, so the code passes, but nothing appears on the screen. Can someone help?
Warepire
He/Him
Editor
Joined: 3/2/2010
Posts: 2178
Location: A little to the left of nowhere (Sweden)
Randil wrote:
I have a lua question for BizHawk: What is the correct syntax when using gui.drawImage? I've tried
imfile="C:\pics\map.png"
gui.drawImage(imstr,30,30,10,10) 
but it doesn't work - the lua window does not return an error, so the code passes, but nothing appears on the screen. Can someone help?
I am not a lua programmer per say so I might be way off... But shouldn't the code be the following?
imfile="C:\pics\map.png"
gui.drawImage(imfile,30,30,10,10) 
Skilled player (1828)
Joined: 4/20/2005
Posts: 2161
Location: Norrköping, Sweden
Ah yes, sorry, that was a typo in the post. The actual code reads as you posted.