Thread: lua gfx help
View Single Post
Old 09-01-2019, 08:45 AM   #1
Anton9
Human being with feelings
 
Anton9's Avatar
 
Join Date: Jun 2009
Location: Earth
Posts: 1,335
Default lua gfx help

Hey Guys,

I have the following code which opens a graphic of a vertical MIDI keyboard.
What I'd like to do now is when the mouse is over specific keys other graphics should open/close automatically.

Each key is aprox. 30 x 120, black keys are a little shorter. Detection zone does'nt have to be exact, just a few pix in each direction should work.

So when mouse is over key 1, "mygraphic001.png" should auto-open aprox. 100 pix to the right of the cursor, when mouse is over key 2, "mygraphic001.png" should close and "mygraphic002.png" should open.., etc.

Any help whould be greatly appreciated.

Code:
function Init()
  --- Init window ---
  gfx.clear = 0xF0F0F0
  gui = {w = 364, h = 975 , dock = 0, x = 1920, y = 3}
  gfx.loadimg(0,"C:\\Pictures\\kybd.png")         
  gfx.init("Keyboard", gui.w, gui.h, gui.dock, gui.x, gui.y)
  gfx.blit(0,1.0,0.0)
end

function  loop()
  char = gfx.getchar()
  if char~=-1 then reaper.defer(loop) end 
  gfx.update()
end

Init()
loop()
Anton9 is offline   Reply With Quote