Commit Graph

125 Commits

Author SHA1 Message Date
Petar Popovic c70f54e28b Remove redundant casts 2025-02-21 10:09:10 -08:00
captain0xff b03332b68d updated bytepusher demo to be C++ compatible 2025-02-11 13:38:29 -08:00
captain0xff 5dd2492645 updated the snake demo to be C++ compatible 2025-02-11 13:38:29 -08:00
Christian Walter e29ebb9f18 Update geometry renderer example
This PR updates the geometry renderer example such that the `color` values of `vertices[3]` are set correctly in `SDL_AppIterate`.
2025-02-09 10:53:14 -08:00
Sam Lantinga 235022fe2f Fixed error C2059: syntax error: '}'
Fixes https://github.com/libsdl-org/SDL/issues/12155
2025-02-01 15:32:58 -08:00
Aki 943579a545 Fix inverted pen Y tilt on macOS and add tilt display to example
- Negate tilt.y in Cocoa pen handling to correct inverted Y tilt axis
- Update drawing example to display X/Y tilt values for visualization
- see 0f128fd7c5/src/plugins/platforms/cocoa/qnsview_tablet.mm (L63)
- see https://source.chromium.org/chromium/chromium/src/+/main:components/input/web_input_event_builders_mac.mm;drc=0af5ffa1e4cc4cc4f818725f8fee93ec57855e4b;l=421
2025-01-29 22:09:02 -08:00
Klayism bb3c5b4f3a Fix multiple occurences of typo "an simple" to "a simple" 2025-01-21 14:00:54 -08:00
Nicolas Firmo 842f6dc402
Fixed wrong type of `phase` (#12014)
`phase` should be a `float` value that ranges between `0` and `1`.
2025-01-17 18:12:47 -08:00
Nicolas Firmo do Patrocinio Barra b95989d14a Fixed sine wave distortion over time.
Audio distortion after a while caused by loss of precision in dividing a large floating point number resolved by keeping `current_sine_sample` (formelly named `total_samples_generated`) between 0 and freq - 1.
2025-01-17 17:41:56 -08:00
expikr 569de84907 better numerical precision for playback example 2025-01-13 10:29:51 -08:00
mausimus 03a3c19c27 examples: use doubles to generate sine waves and avoid distortion 2025-01-13 09:50:45 -05:00
Sam Lantinga c4f2f7b352 Removed redundant information in example pages
This is large text and is already covered by the header and breadcrumb
2025-01-12 15:57:48 -08:00
Semphris dcc645e413 Fix HTML examples template tabs
Tab labels now follow their drawer again. Also, to avoid tabs covering
up code or debugging logs, the tab label that's on top (and therefore
not automatically hidden behind the other drawer when that drawer
opens) will now automatically hide itself when the other drawer is
opened.
2025-01-05 11:39:20 -08:00
Ryan C. Gordon c030e6f782 examples/pen/01-drawing-lines: Match render target size to renderer output.
Otherwise, on HiDPI displays (like a retina iPad), the lines you draw don't
match where the pen is touching.
2024-12-28 15:36:02 -05:00
Carl Åstholm a0e537b9c0 examples: Fix dead links in app metadata 2024-12-27 17:10:52 -08:00
Ryan C. Gordon 4d4a2786bb render: Updates to format-string versions of SDL_RenderDebugText.
- Removes SDL_RenderDebugTextV
- Changes SDL_RenderDebugTextF to SDL_RenderDebugTextFormat and tweaks it to
  work in a world without SDL_RenderDebugTextV.
- Tweaked rendering position of formatted text in the example program.
2024-12-18 10:40:31 -05:00
williamist 6abebca943 Fix format string in debug-text example
Co-authored-by: Anonymous Maarten <madebr@users.noreply.github.com>
2024-12-18 10:40:31 -05:00
williamistGitHub 1d0e28a5b3 Add SDL_RenderDebugTextF & SDL_RenderDebugTextV
This should make it easier to quickly put important numbers and such on
the screen without having to format them into a string manually.
2024-12-18 10:40:31 -05:00
Ryan C. Gordon bbd4eeb287
examples/audio/04-multiple-streams: Note about web browser audio in README. 2024-12-11 14:13:52 -05:00
Ryan C. Gordon 3f425b6f20
examples/audio/04-multiple-streams: Patched to compile on Visual Studio. 2024-12-11 13:25:43 -05:00
Ryan C. Gordon 1fbb8e1824
examples/audio/04-multiple-streams: Remove drag-and-drop support.
I'm going to reuse that code for an actual drag/drop example later, but for
simplicity and accessibility of the examples, this is just going to load two
wavs and loop them, so you get the music with a sword-clinking sound mixed
over it.
2024-12-10 23:10:43 -05:00
Ryan C. Gordon 0f228de48a
examples: Add some metadata to the generated webpages. 2024-12-06 13:08:26 -05:00
Nicolas Allemand 1a5b0796b4 examples: fix canvas size for small screens 2024-12-06 06:58:10 -08:00
Ryan C. Gordon 90efb63e52
examples: Improve webpage generation in various ways, add thumbnails, etc. 2024-12-05 23:58:23 -05:00
Ryan C. Gordon e50dc7265b
examples: Fix some window titles in the demos. 2024-12-05 23:58:23 -05:00
Nicolas Allemand a0b8b57afe examples: add empty placeholder image 2024-12-05 00:29:03 -08:00
Nicolas Allemand 58f8e259d1 examples: fixup URLs for project subfolder 2024-12-04 19:37:50 -05:00
Nicolas Allemand 56da4e81d8 examples: added homepage + categories pages + added CSS (similar to wiki) 2024-12-04 19:37:50 -05:00
Ryan C. Gordon e79ce2a200 asyncio: Added async i/o APIs. 2024-12-03 17:32:20 -05:00
Ryan C. Gordon 1720fc77fe
examples: Added input/02-joystick-events 2024-11-24 22:49:07 -05:00
Ryan C. Gordon a07a88c1b4
examples: added input/01-joystick-polling 2024-11-24 22:49:06 -05:00
Ryan C. Gordon 10e2ce9ba4
examples: Added audio/04-multiple-streams 2024-11-24 15:05:44 -05:00
Ryan C. Gordon 61ba8010d3
examples: Emscripten builds should allow memory growth.
Otherwise you either need to preallocate a bunch or run out of memory fast.

examples/demo/04-bytepusher runs out of memory at startup without this.
2024-11-23 00:01:18 -05:00
Ryan C. Gordon 212f0dcdb1
examples: Fix output name of demos.
Otherwise, build-web-examples.pl will fail.
2024-11-22 17:29:43 -05:00
Ryan C. Gordon f9ddb0bdea
examples/demo/04-bytepusher: No need to check NULL before destroying things. 2024-11-22 17:12:14 -05:00
Ozkan Sezer 7bf3cae02e examples: fix cmake after commit 51637495 2024-11-23 00:56:40 +03:00
Ryan C. Gordon 51637495e4
examples: Rename "game" to "demo". 2024-11-22 15:56:09 -05:00
Maia 566f3dc138 Add BytePusher example 2024-11-22 15:54:45 -05:00
ChillerDragon 7f14eb33c6 snake: improve comment 2024-11-14 22:40:07 -08:00
Wouter Wijsman e31e3caece PSP: Fix building examples in parallel 2024-11-01 09:55:20 -07:00
expikr d6b60bcc53 typo in player spawnpos, mov drawcall out of loop 2024-10-30 11:22:29 -04:00
Sam Lantinga bdf16628fb Added 03-infinite-monkeys example game
This isn't really a game, more of an exercise of that age old question...
2024-10-29 13:08:59 -07:00
Sam Lantinga 2b92dc9baa Minor updates to woodeneye-008.c from template.c 2024-10-29 13:08:59 -07:00
Sam Lantinga 9a77ee2008 Added instructions for creating Visual Studio projects for examples 2024-10-29 13:08:59 -07:00
expikr 1e7c186461
Splitcreen FPS example with multiple mouse and keyboard (#11317) 2024-10-29 07:30:10 -07:00
Anonymous Maarten 590e1196d0 snake: check allocated memory before use 2024-10-25 17:47:26 +02:00
Michael Palomas 21c91d5535 examples now using SDL_ALPHA_OPAQUE(_FLOAT) for opaque alpha value 2024-10-23 07:28:33 -07:00
Ryan C. Gordon e254c99b38
examples/game/01-snake: Update game logic in AppIterate, don't use a timer.
Reference Issue #11210.
2024-10-14 23:17:23 -04:00
Ryan C. Gordon c20918b0fb render: Add SDL_RenderDebugText().
Fixes #11201.
2024-10-14 02:45:33 -04:00
Ryan C. Gordon 659f2f4b04
examples: add basic app metadata to all existing examples. 2024-10-07 17:41:15 -04:00