Advertisement
GenesisFan64

A52_SketchMouse

Jan 7th, 2020
400
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.89 KB | None | 0 0
  1. -- ACTION 52 SKETCH MOUSE
  2.  
  3. xset = 0x80
  4. yset = 0x80
  5.  
  6. gui.register( function ()
  7.  xset = 0x80 + input.get(0)["xmouse"]
  8.  yset = 0x74 + input.get(0)["ymouse"]
  9.  if xset < 0x80 then
  10.             xset = 0x80
  11.  elseif xset > 0x80+320 then
  12.             xset = 320+0x80
  13.  elseif yset < 0x70 then
  14.             yset = 0x70
  15.  elseif yset > 0x80+224 then
  16.             yset = 224+0x80
  17.  end
  18.  
  19.  if input.get(0)["leftclick"] == true then
  20.   joypad.set({C=true})
  21.  elseif input.get(0)["middleclick"] == true then
  22.   joypad.set({B=true}) 
  23.  end
  24.  
  25.  memory.writeword(0xFF028A,xset)
  26.  memory.writeword(0xFF028C,yset)
  27.  
  28.  -- OSC
  29.  xpos = memory.readword(0xFF028A)
  30.  ypos = memory.readword(0xFF028C)
  31.  color = memory.readword(0xFF00BC)
  32.  size = memory.readword(0xFF00C4)
  33.  msg2 = string.format("Pencil: %x %x %x %x", xpos, ypos, color, size)          
  34.  gui.text(240,224-10,msg2,"white","black")
  35.            
  36.  end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement