-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new sdl2.ext module for handling SDL input events (#261)
* Initial commit of new input module * Update TTF example to use ext.input * Break loops on matching input in ext.input * Added a function for checking quit requests * Add quit_requested to some examples * Add test for quit_requested * Update news.rst * Improve displays.rst title * Additional docs tweaks * Fix tests with Python 2.7
- Loading branch information
Showing
11 changed files
with
703 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
`sdl2.ext.input` - Handling SDL2 Input Events | ||
============================================= | ||
|
||
This module provides a range of Pythonic functions for handling and processing | ||
SDL input events (e.g. key presses, mouse clicks, unicode text input) as | ||
retrieved from :func:`~sdl2.ext.get_events`. | ||
|
||
The :func:`key_pressed` function allows for easily checking whether a given key | ||
has been pressed (or released). Likewise, :func:`mouse_clicked` lets you handle | ||
mouse button press and release events. If you want to check the `locations` of | ||
mouse clicks, :func:`get_clicks` returns the pixel coordinates for all clicks | ||
(if any) in a given list of events. | ||
|
||
For handling text entry in PySDL2 (including unicode characters), | ||
:func:`get_text_input` returns all text input in a given list of events as a | ||
unicode string. Note that text input events are disabled by default in SDL, but | ||
can easily be enabled/disabled using :func:`start_text_input` and | ||
:func:`stop_text_input`. | ||
|
||
.. automodule:: sdl2.ext.input | ||
:members: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,3 +27,4 @@ | |
from .window import * | ||
from .mouse import * | ||
from .displays import * | ||
from .input import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.