Log In  


Cart #exinput_bc-3 | 2024-10-23 | Code ▽ | Embed ▽ | No License
1

Feature Overview

Buttons input

getbtns() updates the extended button(key) input state.

  • This must be done in the _update() function.
  • Required poke(0x5f2d,1)
  • button values:
    • btrg: returns true only for frames where a key was entered.
    • butrg: returns true only for frames where a key was released.
    • btns: returns true whenever the key is pressed.
    • btnc: returns the count while the key is held.[number]
    • _key: typed characters.[string]
    • _ent: enter key typed.
    • _del: delete/backspace key typed.
  • modifier keys values:
    • _ctr: ctrl/command key pressed.
    • _alt: alt/opt key pressed.
    • _sft: shift(left) key pressed.
  • This function consumes 179 Token.

Example

-- Repeat the loop until Q is entered.
while not btrg.q do
 getbtns()
 flip()
end
-- Fills the screen with white while holding down W.
while 1 do
 getbtns()
 cls(btns.w and 7 or 6)
 flip()
end
-- Update the rotation position by the length you press E.
while 1 do
 getbtns()
 cls()
 ?'e',sin(btnc.e/30)*16+64,cos(btnc.e/30)*16+64,9
 flip()
end

Mouse input

'getmouse()' updates the mouse state.

  • this must be done in the _update() function.
  • Required poke(0x5f2d,1)
  • mouse values:
    • _mo.x: Mouse X coordinate[number]
    • _mo.y: Mouse Y coordinate[number]
    • _mo.lt: returns true only for frames where the left-button was pressed.
    • _mo.lu: returns true only for frames where the left-button was released.
    • _mo.l: returns true whenever the left-button is pressed.
    • _mo.ldb: returns true if the left-button is double-clicked.
    • _mo.rt: returns true only for frames where the right-button was pressed.
    • _mo.ru: returns true only for frames where the right-button was released.
    • _mo.r: returns true whenever the right-button is pressed.
    • _mo.rdb: returns true if the right-button is double-clicked.
    • _mo.mt: returns true only for frames where the middle-button was pressed.
    • _mo.mu: returns true only for frames where the middle-button was released.
    • _mo.m: returns true whenever the middle-button is pressed.
    • _mo.mdb: returns true if the middle-button is double-clicked.
    • _mo.w: returns the mouse wheel input.[number]
    • _mo.sx: returns the x coordinate where the drag started.[number]
    • _mo.sy: returns the y coordinate where the drag started.[number]
  • This function consumes 285 Token.

Example

-- Display the ★ mouse cursor and use the left button to change its shape and the right button to change its color.
while not btrg.q do
 getmouse()
 cls()
 ?_mo.l and '✽' or '★',_mo.x,_mo.y,_mo.r and 14 or 10
 flip()
end
1



[Please log in to post a comment]