APIInputOverview

Input

Input helpers expose keyboard, mouse, and touch state for the current frame. Pressed and released helpers return true for one frame; down and up helpers describe continuous state.

Keyboard

  • is_key_pressed(key: int) -> bool
  • is_key_down(key: int) -> bool
  • is_key_released(key: int) -> bool
  • is_key_up(key: int) -> bool
  • get_key_pressed() -> int
  • KEY_A through KEY_Z, KEY_SPACE, arrows, numbers, and Raylib-compatible control keys.

Mouse And Touch

  • get_mouse_x() -> int
  • get_mouse_y() -> int
  • get_mouse_position() -> tuple[int, int]
  • is_mouse_button_pressed(button: int) -> bool
  • is_mouse_button_down(button: int) -> bool
  • is_mouse_button_released(button: int) -> bool
  • is_mouse_button_up(button: int) -> bool
  • MOUSE_BUTTON_LEFT, MOUSE_BUTTON_RIGHT, MOUSE_BUTTON_MIDDLE
  • get_touch_x() -> int
  • get_touch_y() -> int
  • get_touch_position() -> tuple[int, int]
from conjure import *
 
init_window(360, 640, "Input")
x = 180
 
while not window_should_close():
    if is_key_down(KEY_LEFT):
        x -= 4
    if is_key_down(KEY_RIGHT):
        x += 4
 
    begin_drawing()
    clear_background(WHITE)
    draw_circle(x, 320, 30, BLUE)
    end_drawing()

For score-driven games, combine input with leaderboards.