|
1 | | -"""SDL2 specific functionality. |
| 1 | +"""SDL2 Window and Display handling. |
2 | 2 |
|
3 | | -Add the line ``import tcod.sdl`` to include this module, as importing this |
4 | | -module is not implied by ``import tcod``. |
| 3 | +.. versionadded:: 13.4 |
5 | 4 | """ |
6 | 5 | from __future__ import annotations |
7 | 6 |
|
@@ -33,33 +32,60 @@ class WindowFlags(enum.IntFlag): |
33 | 32 | """ |
34 | 33 |
|
35 | 34 | FULLSCREEN = lib.SDL_WINDOW_FULLSCREEN or 0 |
| 35 | + """""" |
36 | 36 | FULLSCREEN_DESKTOP = lib.SDL_WINDOW_FULLSCREEN_DESKTOP or 0 |
| 37 | + """""" |
37 | 38 | OPENGL = lib.SDL_WINDOW_OPENGL or 0 |
| 39 | + """""" |
38 | 40 | SHOWN = lib.SDL_WINDOW_SHOWN or 0 |
| 41 | + """""" |
39 | 42 | HIDDEN = lib.SDL_WINDOW_HIDDEN or 0 |
| 43 | + """""" |
40 | 44 | BORDERLESS = lib.SDL_WINDOW_BORDERLESS or 0 |
| 45 | + """""" |
41 | 46 | RESIZABLE = lib.SDL_WINDOW_RESIZABLE or 0 |
| 47 | + """""" |
42 | 48 | MINIMIZED = lib.SDL_WINDOW_MINIMIZED or 0 |
| 49 | + """""" |
43 | 50 | MAXIMIZED = lib.SDL_WINDOW_MAXIMIZED or 0 |
| 51 | + """""" |
44 | 52 | MOUSE_GRABBED = lib.SDL_WINDOW_INPUT_GRABBED or 0 |
| 53 | + """""" |
45 | 54 | INPUT_FOCUS = lib.SDL_WINDOW_INPUT_FOCUS or 0 |
| 55 | + """""" |
46 | 56 | MOUSE_FOCUS = lib.SDL_WINDOW_MOUSE_FOCUS or 0 |
| 57 | + """""" |
47 | 58 | FOREIGN = lib.SDL_WINDOW_FOREIGN or 0 |
| 59 | + """""" |
48 | 60 | ALLOW_HIGHDPI = lib.SDL_WINDOW_ALLOW_HIGHDPI or 0 |
| 61 | + """""" |
49 | 62 | MOUSE_CAPTURE = lib.SDL_WINDOW_MOUSE_CAPTURE or 0 |
| 63 | + """""" |
50 | 64 | ALWAYS_ON_TOP = lib.SDL_WINDOW_ALWAYS_ON_TOP or 0 |
| 65 | + """""" |
51 | 66 | SKIP_TASKBAR = lib.SDL_WINDOW_SKIP_TASKBAR or 0 |
| 67 | + """""" |
52 | 68 | UTILITY = lib.SDL_WINDOW_UTILITY or 0 |
| 69 | + """""" |
53 | 70 | TOOLTIP = lib.SDL_WINDOW_TOOLTIP or 0 |
| 71 | + """""" |
54 | 72 | POPUP_MENU = lib.SDL_WINDOW_POPUP_MENU or 0 |
| 73 | + """""" |
55 | 74 | VULKAN = lib.SDL_WINDOW_VULKAN or 0 |
| 75 | + """""" |
56 | 76 | METAL = getattr(lib, "SDL_WINDOW_METAL", None) or 0x20000000 # SDL >= 2.0.14 |
| 77 | + """""" |
57 | 78 |
|
58 | 79 |
|
59 | 80 | class FlashOperation(enum.IntEnum): |
| 81 | + """Values for :any:`Window.flash`.""" |
| 82 | + |
60 | 83 | CANCEL = 0 |
| 84 | + """Stop flashing.""" |
61 | 85 | BRIEFLY = 1 |
| 86 | + """Flash breifly.""" |
62 | 87 | UNTIL_FOCUSED = 2 |
| 88 | + """Flash until focus is gained.""" |
63 | 89 |
|
64 | 90 |
|
65 | 91 | class _TempSurface: |
@@ -185,7 +211,7 @@ def flags(self) -> WindowFlags: |
185 | 211 | def fullscreen(self) -> int: |
186 | 212 | """Get or set the fullscreen status of this window. |
187 | 213 |
|
188 | | - Can be set to :any:`WindowFlags.FULLSCREEN` or :any:`WindowFlags.FULLSCREEN_DESKTOP` flags |
| 214 | + Can be set to the :any:`WindowFlags.FULLSCREEN` or :any:`WindowFlags.FULLSCREEN_DESKTOP` flags. |
189 | 215 |
|
190 | 216 | Example:: |
191 | 217 |
|
@@ -304,8 +330,9 @@ def new_window( |
304 | 330 |
|
305 | 331 | Example:: |
306 | 332 |
|
| 333 | + import tcod.sdl.video |
307 | 334 | # Create a new resizable window with a custom title. |
308 | | - window = tcod.sdl.video.new_window(640, 480, title="Title bar text", flags=tcod.lib.SDL_WINDOW_RESIZABLE) |
| 335 | + window = tcod.sdl.video.new_window(640, 480, title="Title bar text", flags=tcod.sdl.video.WindowFlags.RESIZABLE) |
309 | 336 |
|
310 | 337 | .. seealso:: |
311 | 338 | :func:`tcod.sdl.render.new_renderer` |
|
0 commit comments