About Input

SwinGame's input operations allow you to respond to the user's actions. You can respond to mouse and keyboard actions, read text from the user, and find out if they have closed the window.

Level

Beginner

Details

SwinGame input uses an event input model, this means that the user performs actions on the program and these are recorded as events.

An event in SwinGame is anything the user does, this includes pressing a key on the keyboard as well as moving the mouse. These events can be detected in your code using various functions and procedures, a full list of functions SwinGame can perform with input can be found by browsing the API.

  • AnyKeyPressed
  • KeyDown
  • MouseClicked
  • MousePosition
  • WindowCloseRequested


However none of these events will be registered with SwinGame until the ProcessEvents procedure is called. Once ProcessEvents is called the events are handled by SwinGame and can then be accessed in your code.


It is a good idea to call ProcessEvents before you want to handle user input