Module OcsfmlWindow.Keyboard

module Keyboard: sig .. end
Give access to the real-time state of the keyboard.

Keyboard provides an interface to the state of the keyboard.

This class allows users to query the keyboard state at any time and directly, without having to deal with a window and its events. Compared to the KeyPressed and KeyReleased events, Keyboard can retrieve the state of a key at any time (you don't need to store and update a boolean on your side in order to know if a key is pressed or released), and you always get the real state of the keyboard, even if keys are pressed or released when your window is out of focus and no event is triggered.

Usage example:

    if OcsfmlWindow.Keyboard.is_key_pressed OcsfmlWindow.KeyCode.Left
    then begin
    (* move left... *)
    else if OcsfmlWindow.Keyboard.is_key_pressed OcsfmlWindow.KeyCode.Right
    then begin
    (* move right... *)
    else if OcsfmlWindow.Keyboard.is_key_pressed OcsfmlWindow.KeyCode.Escape
    then begin
    (* quit... *)

val is_key_pressed : OcsfmlWindow.KeyCode.t -> bool
Check if a key is pressed.
Returns True if the key is pressed, false otherwise