Skip to content

Commit 37ec7c0

Browse files
committed
Fixed many typos in the tcod.sdl package.
1 parent 7d994ee commit 37ec7c0

File tree

5 files changed

+44
-18
lines changed

5 files changed

+44
-18
lines changed

.vscode/settings.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@
5757
"bfade",
5858
"bgcolor",
5959
"bitmask",
60+
"bitorder",
61+
"BITSIZE",
6062
"BKGND",
6163
"Blit",
6264
"blits",
@@ -123,6 +125,7 @@
123125
"DISPLAYSWITCH",
124126
"dlopen",
125127
"Doryen",
128+
"DPAD",
126129
"DTEEE",
127130
"DTEEN",
128131
"DTEES",
@@ -149,6 +152,8 @@
149152
"frombuffer",
150153
"fullscreen",
151154
"fwidth",
155+
"GAMECONTROLLER",
156+
"gamepad",
152157
"genindex",
153158
"GFORCE",
154159
"GLES",
@@ -220,12 +225,18 @@
220225
"LDFLAGS",
221226
"LEFTBRACE",
222227
"LEFTBRACKET",
228+
"LEFTDOWN",
223229
"LEFTPAREN",
230+
"LEFTSHOULDER",
231+
"LEFTSTICK",
232+
"LEFTUP",
233+
"LEFTX",
224234
"lerp",
225235
"LGUI",
226236
"libsdl",
227237
"libtcod",
228238
"libtcodpy",
239+
"linspace",
229240
"liskin",
230241
"LMASK",
231242
"lmeta",
@@ -289,8 +300,10 @@
289300
"onefile",
290301
"OPENGL",
291302
"OPER",
303+
"packbits",
292304
"PAGEDOWN",
293305
"PAGEUP",
306+
"PATCHLEVEL",
294307
"pathfinding",
295308
"pathlib",
296309
"pcpp",
@@ -329,7 +342,12 @@
329342
"RGUI",
330343
"RIGHTBRACE",
331344
"RIGHTBRACKET",
345+
"RIGHTDOWN",
332346
"RIGHTPAREN",
347+
"RIGHTSHOULDER",
348+
"RIGHTSTICK",
349+
"RIGHTUP",
350+
"RIGHTX",
333351
"RMASK",
334352
"rmeta",
335353
"roguelike",
@@ -354,18 +372,21 @@
354372
"servernum",
355373
"setuptools",
356374
"SHADOWCAST",
375+
"SIZEALL",
357376
"SIZENESW",
358377
"SIZENS",
359378
"SIZENWSE",
360379
"SIZEWE",
361380
"SMILIE",
362381
"snprintf",
382+
"soundfile",
363383
"stdeb",
364384
"struct",
365385
"structs",
366386
"SUBP",
367387
"SYSREQ",
368388
"tablefmt",
389+
"TARGETTEXTURE",
369390
"tcod",
370391
"tcoddoc",
371392
"TCODK",
@@ -383,6 +404,9 @@
383404
"toctree",
384405
"todos",
385406
"tolist",
407+
"touchpad",
408+
"TRIGGERLEFT",
409+
"TRIGGERRIGHT",
386410
"tris",
387411
"truetype",
388412
"typestr",
@@ -405,6 +429,8 @@
405429
"voronoi",
406430
"VRAM",
407431
"vsync",
432+
"VULKAN",
433+
"WAITARROW",
408434
"WASD",
409435
"waterlevel",
410436
"windowclose",

tcod/sdl/audio.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
"""SDL2 audio playback and recording tools.
22
3-
This module includes SDL's low-level audio API and a naive implentation of an SDL mixer.
3+
This module includes SDL's low-level audio API and a naive implementation of an SDL mixer.
44
If you have experience with audio mixing then you might be better off writing your own mixer or
55
modifying the existing one which was written using Python/Numpy.
66
77
This module is designed to integrate with the wider Python ecosystem.
8-
It leaves the loading to sound samples to other libaries like
8+
It leaves the loading to sound samples to other libraries like
99
`SoundFile <https://pysoundfile.readthedocs.io/en/latest/>`_.
1010
1111
Example::
@@ -17,9 +17,9 @@
1717
import tcod.sdl.audio
1818
1919
device = tcod.sdl.audio.open() # Open the default output device.
20-
sound, samplerate = soundfile.read("example_sound.wav", dtype="float32") # Load an audio sample using SoundFile.
21-
converted = device.convert(sound, samplerate) # Convert this sample to the format expected by the device.
22-
device.queue_audio(converted) # Play audio syncroniously by appending it to the device buffer.
20+
sound, sample_rate = soundfile.read("example_sound.wav", dtype="float32") # Load an audio sample using SoundFile.
21+
converted = device.convert(sound, sample_rate) # Convert this sample to the format expected by the device.
22+
device.queue_audio(converted) # Play audio synchronously by appending it to the device buffer.
2323
2424
while device.queued_samples: # Wait until device is done playing.
2525
time.sleep(0.001)
@@ -33,8 +33,8 @@
3333
import tcod.sdl.audio
3434
3535
mixer = tcod.sdl.audio.BasicMixer(tcod.sdl.audio.open()) # Setup BasicMixer with the default audio output.
36-
sound, samplerate = soundfile.read("example_sound.wav") # Load an audio sample using SoundFile.
37-
sound = mixer.device.convert(sound, samplerate) # Convert this sample to the format expected by the device.
36+
sound, sample_rate = soundfile.read("example_sound.wav") # Load an audio sample using SoundFile.
37+
sound = mixer.device.convert(sound, sample_rate) # Convert this sample to the format expected by the device.
3838
channel = mixer.play(sound) # Start asynchronous playback, audio is mixed on a separate Python thread.
3939
while channel.busy: # Wait until the sample is done playing.
4040
time.sleep(0.001)
@@ -59,7 +59,7 @@
5959

6060

6161
def _get_format(format: DTypeLike) -> int:
62-
"""Return a SDL_AudioFormat bitfield from a NumPy dtype."""
62+
"""Return a SDL_AudioFormat bit-field from a NumPy dtype."""
6363
dt: Any = np.dtype(format)
6464
assert dt.fields is None
6565
bitsize = dt.itemsize * 8
@@ -83,15 +83,15 @@ def _dtype_from_format(format: int) -> np.dtype[Any]:
8383
"""Return a dtype from a SDL_AudioFormat."""
8484
bitsize = format & lib.SDL_AUDIO_MASK_BITSIZE
8585
assert bitsize % 8 == 0
86-
bytesize = bitsize // 8
86+
byte_size = bitsize // 8
8787
byteorder = ">" if format & lib.SDL_AUDIO_MASK_ENDIAN else "<"
8888
if format & lib.SDL_AUDIO_MASK_DATATYPE:
8989
kind = "f"
9090
elif format & lib.SDL_AUDIO_MASK_SIGNED:
9191
kind = "i"
9292
else:
9393
kind = "u"
94-
return np.dtype(f"{byteorder}{kind}{bytesize}")
94+
return np.dtype(f"{byteorder}{kind}{byte_size}")
9595

9696

9797
def convert_audio(
@@ -103,8 +103,8 @@ def convert_audio(
103103
104104
Args:
105105
in_sound: The input ArrayLike sound sample. Input format and channels are derived from the array.
106-
in_rate: The samplerate of the input array.
107-
out_rate: The samplerate of the output array.
106+
in_rate: The sample-rate of the input array.
107+
out_rate: The sample-rate of the output array.
108108
out_format: The output format of the converted array.
109109
out_channels: The number of audio channels of the output array.
110110
@@ -142,7 +142,7 @@ class AudioDevice:
142142
143143
Open new audio devices using :any:`tcod.sdl.audio.open`.
144144
145-
When you use this object directly the audio passed to :any:`queue_audio` is always played syncroniously.
145+
When you use this object directly the audio passed to :any:`queue_audio` is always played synchronously.
146146
For more typical asynchronous audio you should pass an AudioDevice to :any:`BasicMixer`.
147147
"""
148148

@@ -231,7 +231,7 @@ def convert(self, sound: ArrayLike, rate: int | None = None) -> NDArray[Any]:
231231
232232
Args:
233233
sound: An ArrayLike sound sample.
234-
rate: The samplerate of the input array.
234+
rate: The sample-rate of the input array.
235235
If None is given then it's assumed to be the same as the device.
236236
237237
.. versionadded:: 13.6

tcod/sdl/mouse.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ def get_cursor() -> Cursor | None:
148148
def capture(enable: bool) -> None:
149149
"""Enable or disable mouse capture to track the mouse outside of a window.
150150
151-
It is highly reccomended to read the related remarks section in the SDL docs before using this.
151+
It is highly recommended to read the related remarks section in the SDL docs before using this.
152152
153153
Example::
154154

tcod/sdl/sys.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ def _get_power_info() -> tuple[_PowerState, int, int]:
6060
buffer = ffi.new("int[2]")
6161
power_state = _PowerState(lib.SDL_GetPowerInfo(buffer, buffer + 1))
6262
seconds_of_power = buffer[0]
63-
percenage = buffer[1]
64-
return power_state, seconds_of_power, percenage
63+
percentage = buffer[1]
64+
return power_state, seconds_of_power, percentage
6565

6666

6767
def _get_clipboard() -> str:

tcod/sdl/video.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ def border_size(self) -> tuple[int, int, int, int]:
262262

263263
@property
264264
def opacity(self) -> float:
265-
"""Get or set this windows opacity. 0.0 is fully transarpent and 1.0 is fully opaque.
265+
"""Get or set this windows opacity. 0.0 is fully transparent and 1.0 is fully opaque.
266266
267267
Will error if you try to set this and opacity isn't supported.
268268
"""

0 commit comments

Comments
 (0)