window.jamo (built in)

window: opens a window, and reads the keyboard, mouse and frame timing. use "window.jamo"

Each window keeps what Windows tells it in a block of memory, whose address Windows stores with the window. The block: closed at 0, width at 8, height at 16, mouse x at 24, mouse y at 32, wheel at 40, mouse buttons at 48 to 50, focus at 56, minimized at 64, resized at 72, then a byte for each key being held at 128, pressed at 384, and let go at 640. Those three, from wheel to let go, collect what happens between frames. Each frame they move to the copies the program reads: wheel at 44, resized at 76, pressed at 896 and let go at 1152. After those: keys pressed or repeating while held at 1408, copied to 1664; typed letters, a count at 1920 then up to 64 bytes from 1928, copied to 2000 and 2008; and mouse buttons pressed at 2080, copied to 2088.

structWindow

struct Window
    handle: int
    state: int
    timing: int
    open: bool
    closed_by_program: bool
    shown: bool
    quiet_start: bool
    frame_seconds: float
end

funcopen_window

func open_window(title: string, width: int, height: int): Window

funcWindow.quiet

func Window.quiet()

Keeps the window from taking the keyboard when it first appears

funcWindow.is_open

func Window.is_open(): bool

Handles what Windows sent, and answers false once the window is closed. Call it once a frame

funcWindow.shut

func Window.shut()

funcWindow.close

func Window.close()

funcWindow.must_be_open

func Window.must_be_open()

funcWindow.key_down

func Window.key_down(name: string): bool

funcWindow.key_pressed

func Window.key_pressed(name: string): bool

funcWindow.key_released

func Window.key_released(name: string): bool

funcWindow.mouse_x

func Window.mouse_x(): int

funcWindow.mouse_y

func Window.mouse_y(): int

funcWindow.mouse_down

func Window.mouse_down(button: string): bool

funcWindow.mouse_pressed

func Window.mouse_pressed(button: string): bool

True in the frame a mouse button went down, even if it came back up in the same frame

funcWindow.key_repeated

func Window.key_repeated(name: string): bool

True in the frame a key went down, and again each time it repeats while held, like in a text box

funcWindow.typed

func Window.typed(): string

The letters typed this frame. Only English letters, digits, spaces and symbols come through

funcWindow.wheel

func Window.wheel(): int

How far the mouse wheel turned this frame. Away from you is more than 0

funcWindow.width

func Window.width(): int

funcWindow.height

func Window.height(): int

funcWindow.resized

func Window.resized(): bool

funcWindow.has_focus

func Window.has_focus(): bool

funcWindow.minimized

func Window.minimized(): bool

funcWindow.set_title

func Window.set_title(title: string)

funcWindow.move

func Window.move(x: int, y: int)

funcWindow.resize

func Window.resize(width: int, height: int)

funcWindow.wait_frame

func Window.wait_frame(frames_a_second: int)

Waits until it's time for the next frame. A game that falls behind starts counting again from now

funcWindow.frame_time

func Window.frame_time(): float

How long the last frame took, in seconds

funcwindow_button

func window_button(button: string): int

--- Inside the library ---

funcwindow_key_code

func window_key_code(name: string): int

funcwindow_low_part

func window_low_part(value: int): int

Windows packs two 16-bit numbers into one. These unpack them, with their signs

funcwindow_high_part

func window_high_part(value: int): int

funcwindow_key

func window_key(state: int, code: int, down: bool)

funcwindow_mouse

func window_mouse(state: int, place: int)

funcwindow_message

func window_message(handle: int, message: int, first: int, second: int): int