ruby2d 0.12.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (619) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.md +7 -0
  3. data/README.md +141 -0
  4. data/USAGE.md +2435 -0
  5. data/assets/Rakefile +637 -0
  6. data/assets/build_support/CMakeLists.txt +94 -0
  7. data/assets/build_support/mruby/build_config.rb +34 -0
  8. data/assets/build_support/mruby/build_config_wasm.rb +30 -0
  9. data/assets/build_support/sdl_test.c +174 -0
  10. data/assets/deps.yaml +16 -0
  11. data/assets/platform/include/SDL3/SDL.h +91 -0
  12. data/assets/platform/include/SDL3/SDL_assert.h +705 -0
  13. data/assets/platform/include/SDL3/SDL_asyncio.h +550 -0
  14. data/assets/platform/include/SDL3/SDL_atomic.h +692 -0
  15. data/assets/platform/include/SDL3/SDL_audio.h +2370 -0
  16. data/assets/platform/include/SDL3/SDL_begin_code.h +553 -0
  17. data/assets/{include/SDL2 → platform/include/SDL3}/SDL_bits.h +47 -27
  18. data/assets/{include/SDL2 → platform/include/SDL3}/SDL_blendmode.h +59 -55
  19. data/assets/platform/include/SDL3/SDL_camera.h +535 -0
  20. data/assets/platform/include/SDL3/SDL_clipboard.h +331 -0
  21. data/assets/{include/SDL2/close_code.h → platform/include/SDL3/SDL_close_code.h} +9 -8
  22. data/assets/{include/SDL2 → platform/include/SDL3}/SDL_copying.h +3 -1
  23. data/assets/platform/include/SDL3/SDL_cpuinfo.h +374 -0
  24. data/assets/platform/include/SDL3/SDL_dialog.h +343 -0
  25. data/assets/platform/include/SDL3/SDL_dlopennote.h +234 -0
  26. data/assets/{include/SDL2 → platform/include/SDL3}/SDL_egl.h +11 -8
  27. data/assets/platform/include/SDL3/SDL_endian.h +645 -0
  28. data/assets/platform/include/SDL3/SDL_error.h +226 -0
  29. data/assets/platform/include/SDL3/SDL_events.h +1645 -0
  30. data/assets/platform/include/SDL3/SDL_filesystem.h +537 -0
  31. data/assets/platform/include/SDL3/SDL_gamepad.h +1656 -0
  32. data/assets/platform/include/SDL3/SDL_gpu.h +4608 -0
  33. data/assets/platform/include/SDL3/SDL_guid.h +106 -0
  34. data/assets/platform/include/SDL3/SDL_haptic.h +1461 -0
  35. data/assets/platform/include/SDL3/SDL_hidapi.h +571 -0
  36. data/assets/platform/include/SDL3/SDL_hints.h +5001 -0
  37. data/assets/platform/include/SDL3/SDL_init.h +507 -0
  38. data/assets/platform/include/SDL3/SDL_intrin.h +410 -0
  39. data/assets/platform/include/SDL3/SDL_iostream.h +1379 -0
  40. data/assets/platform/include/SDL3/SDL_joystick.h +1385 -0
  41. data/assets/platform/include/SDL3/SDL_keyboard.h +608 -0
  42. data/assets/platform/include/SDL3/SDL_keycode.h +347 -0
  43. data/assets/platform/include/SDL3/SDL_loadso.h +145 -0
  44. data/assets/{include/SDL2 → platform/include/SDL3}/SDL_locale.h +40 -24
  45. data/assets/platform/include/SDL3/SDL_log.h +541 -0
  46. data/assets/platform/include/SDL3/SDL_main.h +704 -0
  47. data/assets/platform/include/SDL3/SDL_main_impl.h +151 -0
  48. data/assets/{include/SDL2 → platform/include/SDL3}/SDL_messagebox.h +85 -48
  49. data/assets/{include/SDL2 → platform/include/SDL3}/SDL_metal.h +29 -29
  50. data/assets/{include/SDL2 → platform/include/SDL3}/SDL_misc.h +13 -12
  51. data/assets/platform/include/SDL3/SDL_mouse.h +813 -0
  52. data/assets/platform/include/SDL3/SDL_mutex.h +1117 -0
  53. data/assets/platform/include/SDL3/SDL_oldnames.h +1339 -0
  54. data/assets/{include/SDL2 → platform/include/SDL3}/SDL_opengl.h +1247 -278
  55. data/assets/{include/SDL2 → platform/include/SDL3}/SDL_opengl_glext.h +5 -1
  56. data/assets/{include/SDL2 → platform/include/SDL3}/SDL_opengles.h +6 -7
  57. data/assets/{include/SDL2 → platform/include/SDL3}/SDL_opengles2.h +10 -11
  58. data/assets/platform/include/SDL3/SDL_pen.h +198 -0
  59. data/assets/platform/include/SDL3/SDL_pixels.h +1441 -0
  60. data/assets/{include/SDL2/SDL_test_log.h → platform/include/SDL3/SDL_platform.h} +25 -26
  61. data/assets/platform/include/SDL3/SDL_platform_defines.h +497 -0
  62. data/assets/{include/SDL2 → platform/include/SDL3}/SDL_power.h +40 -20
  63. data/assets/platform/include/SDL3/SDL_process.h +441 -0
  64. data/assets/platform/include/SDL3/SDL_properties.h +572 -0
  65. data/assets/platform/include/SDL3/SDL_rect.h +528 -0
  66. data/assets/platform/include/SDL3/SDL_render.h +3028 -0
  67. data/assets/platform/include/SDL3/SDL_revision.h +59 -0
  68. data/assets/{include/SDL2 → platform/include/SDL3}/SDL_scancode.h +59 -68
  69. data/assets/platform/include/SDL3/SDL_sensor.h +321 -0
  70. data/assets/platform/include/SDL3/SDL_stdinc.h +6186 -0
  71. data/assets/platform/include/SDL3/SDL_storage.h +686 -0
  72. data/assets/platform/include/SDL3/SDL_surface.h +1769 -0
  73. data/assets/platform/include/SDL3/SDL_system.h +840 -0
  74. data/assets/{include/SDL2 → platform/include/SDL3}/SDL_test.h +16 -22
  75. data/assets/{include/SDL2 → platform/include/SDL3}/SDL_test_assert.h +27 -34
  76. data/assets/{include/SDL2 → platform/include/SDL3}/SDL_test_common.h +109 -52
  77. data/assets/{include/SDL2 → platform/include/SDL3}/SDL_test_compare.h +22 -14
  78. data/assets/{include/SDL2 → platform/include/SDL3}/SDL_test_crc32.h +27 -30
  79. data/assets/{include/SDL2 → platform/include/SDL3}/SDL_test_font.h +50 -49
  80. data/assets/{include/SDL2 → platform/include/SDL3}/SDL_test_fuzzer.h +64 -79
  81. data/assets/{include/SDL2 → platform/include/SDL3}/SDL_test_harness.h +47 -30
  82. data/assets/platform/include/SDL3/SDL_test_log.h +83 -0
  83. data/assets/{include/SDL2 → platform/include/SDL3}/SDL_test_md5.h +21 -28
  84. data/assets/{include/SDL2 → platform/include/SDL3}/SDL_test_memory.h +19 -16
  85. data/assets/platform/include/SDL3/SDL_thread.h +602 -0
  86. data/assets/platform/include/SDL3/SDL_time.h +249 -0
  87. data/assets/platform/include/SDL3/SDL_timer.h +454 -0
  88. data/assets/platform/include/SDL3/SDL_touch.h +184 -0
  89. data/assets/platform/include/SDL3/SDL_tray.h +544 -0
  90. data/assets/platform/include/SDL3/SDL_version.h +198 -0
  91. data/assets/platform/include/SDL3/SDL_video.h +3497 -0
  92. data/assets/platform/include/SDL3/SDL_vulkan.h +287 -0
  93. data/assets/platform/include/SDL3_image/SDL_image.h +3328 -0
  94. data/assets/platform/include/SDL3_mixer/SDL_mixer.h +3369 -0
  95. data/assets/platform/include/SDL3_ttf/SDL_textengine.h +181 -0
  96. data/assets/platform/include/SDL3_ttf/SDL_ttf.h +2833 -0
  97. data/assets/{include → platform/include}/mrbconf.h +42 -31
  98. data/assets/{include → platform/include}/mruby/array.h +3 -4
  99. data/assets/{include → platform/include}/mruby/boxing_nan.h +10 -0
  100. data/assets/platform/include/mruby/boxing_no.h +59 -0
  101. data/assets/{include → platform/include}/mruby/boxing_word.h +72 -26
  102. data/assets/platform/include/mruby/class.h +157 -0
  103. data/assets/{include → platform/include}/mruby/common.h +30 -1
  104. data/assets/{include → platform/include}/mruby/compile.h +52 -74
  105. data/assets/{include → platform/include}/mruby/data.h +2 -2
  106. data/assets/{include → platform/include}/mruby/debug.h +12 -5
  107. data/assets/{include → platform/include}/mruby/dump.h +7 -9
  108. data/assets/{include → platform/include}/mruby/endian.h +1 -1
  109. data/assets/platform/include/mruby/error.h +173 -0
  110. data/assets/platform/include/mruby/gc.h +79 -0
  111. data/assets/{include → platform/include}/mruby/hash.h +1 -7
  112. data/assets/platform/include/mruby/internal.h +282 -0
  113. data/assets/platform/include/mruby/irep.h +143 -0
  114. data/assets/{include → platform/include}/mruby/istruct.h +1 -1
  115. data/assets/platform/include/mruby/khash.h +455 -0
  116. data/assets/platform/include/mruby/mempool.h +19 -0
  117. data/assets/{include → platform/include}/mruby/numeric.h +7 -10
  118. data/assets/platform/include/mruby/object.h +51 -0
  119. data/assets/{include → platform/include}/mruby/opcode.h +5 -5
  120. data/assets/{include → platform/include}/mruby/ops.h +19 -6
  121. data/assets/platform/include/mruby/presym/id.h +1447 -0
  122. data/assets/{include → platform/include}/mruby/presym/scanning.h +10 -7
  123. data/assets/platform/include/mruby/presym/table.h +2893 -0
  124. data/assets/platform/include/mruby/presym.h +65 -0
  125. data/assets/platform/include/mruby/proc.h +184 -0
  126. data/assets/{include → platform/include}/mruby/range.h +0 -2
  127. data/assets/{include → platform/include}/mruby/string.h +33 -53
  128. data/assets/platform/include/mruby/throw.h +81 -0
  129. data/assets/{include → platform/include}/mruby/value.h +64 -29
  130. data/assets/{include → platform/include}/mruby/variable.h +6 -23
  131. data/assets/{include → platform/include}/mruby/version.h +7 -7
  132. data/assets/{include → platform/include}/mruby.h +238 -116
  133. data/assets/platform/macos-arm64/bin/mrbc +0 -0
  134. data/assets/platform/macos-arm64/lib/libSDL3.a +0 -0
  135. data/assets/platform/macos-arm64/lib/libSDL3_image.a +0 -0
  136. data/assets/platform/macos-arm64/lib/libSDL3_mixer.a +0 -0
  137. data/assets/platform/macos-arm64/lib/libSDL3_ttf.a +0 -0
  138. data/assets/platform/macos-arm64/lib/libmruby.a +0 -0
  139. data/assets/platform/wasm/lib/libFLAC.a +0 -0
  140. data/assets/platform/wasm/lib/libSDL3.a +0 -0
  141. data/assets/platform/wasm/lib/libSDL3_image.a +0 -0
  142. data/assets/platform/wasm/lib/libSDL3_mixer.a +0 -0
  143. data/assets/platform/wasm/lib/libSDL3_ttf.a +0 -0
  144. data/assets/platform/wasm/lib/libfreetype.a +0 -0
  145. data/assets/platform/wasm/lib/libharfbuzz.a +0 -0
  146. data/assets/platform/wasm/lib/libmruby.a +0 -0
  147. data/assets/platform/wasm/lib/libogg.a +0 -0
  148. data/assets/platform/wasm/lib/libplutosvg.a +0 -0
  149. data/assets/platform/wasm/lib/libplutovg.a +0 -0
  150. data/assets/platform/wasm/lib/libpng.a +0 -0
  151. data/assets/platform/wasm/lib/libpng16.a +0 -0
  152. data/assets/platform/wasm/lib/libvorbis.a +0 -0
  153. data/assets/platform/wasm/lib/libvorbisfile.a +0 -0
  154. data/assets/platform/wasm/lib/libzlibstatic.a +0 -0
  155. data/assets/platform/windows-arm64-mingw-ucrt/bin/mrbc.exe +0 -0
  156. data/assets/platform/windows-arm64-mingw-ucrt/lib/libSDL3.a +0 -0
  157. data/assets/platform/windows-arm64-mingw-ucrt/lib/libSDL3_image.a +0 -0
  158. data/assets/platform/windows-arm64-mingw-ucrt/lib/libSDL3_mixer.a +0 -0
  159. data/assets/platform/windows-arm64-mingw-ucrt/lib/libSDL3_ttf.a +0 -0
  160. data/assets/platform/windows-arm64-mingw-ucrt/lib/libmruby.a +0 -0
  161. data/assets/platform/windows-x86_64-mingw-ucrt/bin/mrbc.exe +0 -0
  162. data/assets/platform/windows-x86_64-mingw-ucrt/lib/libSDL3.a +0 -0
  163. data/assets/platform/windows-x86_64-mingw-ucrt/lib/libSDL3_image.a +0 -0
  164. data/assets/platform/windows-x86_64-mingw-ucrt/lib/libSDL3_mixer.a +0 -0
  165. data/assets/platform/windows-x86_64-mingw-ucrt/lib/libSDL3_ttf.a +0 -0
  166. data/assets/platform/windows-x86_64-mingw-ucrt/lib/libmruby.a +0 -0
  167. data/assets/resources/fonts/outfit/OFL.txt +93 -0
  168. data/assets/resources/fonts/outfit/outfit.ttf +0 -0
  169. data/assets/resources/fonts/roboto_mono/OFL.txt +91 -0
  170. data/assets/resources/fonts/roboto_mono/roboto_mono.ttf +0 -0
  171. data/assets/resources/icons/icon.icns +0 -0
  172. data/assets/resources/icons/icon.png +0 -0
  173. data/assets/resources/spritesheets/License.txt +28 -0
  174. data/assets/resources/spritesheets/spritesheet-backgrounds.png +0 -0
  175. data/assets/resources/spritesheets/spritesheet-backgrounds.xml +16 -0
  176. data/assets/resources/spritesheets/spritesheet-characters.png +0 -0
  177. data/assets/resources/spritesheets/spritesheet-characters.xml +47 -0
  178. data/assets/resources/spritesheets/spritesheet-enemies.png +0 -0
  179. data/assets/resources/spritesheets/spritesheet-enemies.xml +62 -0
  180. data/assets/resources/spritesheets/spritesheet-tiles.png +0 -0
  181. data/assets/resources/spritesheets/spritesheet-tiles.xml +316 -0
  182. data/assets/{wasm → resources/web}/template.html +1 -1
  183. data/assets/target.rb +131 -0
  184. data/bin/ruby2d +281 -82
  185. data/examples/astar.rb +269 -0
  186. data/examples/asteroids.rb +403 -0
  187. data/examples/bezier_editor.rb +96 -0
  188. data/examples/boids.rb +191 -0
  189. data/examples/bouncing_balls.rb +119 -0
  190. data/examples/breakout.rb +186 -0
  191. data/examples/constellations.rb +100 -0
  192. data/examples/dashboard.rb +133 -0
  193. data/examples/double_pendulum.rb +254 -0
  194. data/examples/falling_sand.rb +291 -0
  195. data/examples/fireworks.rb +110 -0
  196. data/examples/fluid_dynamics.rb +340 -0
  197. data/examples/fourier_epicycles.rb +142 -0
  198. data/examples/fractal_tree.rb +326 -0
  199. data/examples/game_of_life.rb +148 -0
  200. data/examples/gamepads.rb +333 -0
  201. data/examples/hill_driver.rb +613 -0
  202. data/examples/logo_animation.rb +251 -0
  203. data/examples/lorenz_attractor.rb +115 -0
  204. data/examples/mandelbrot.rb +207 -0
  205. data/examples/marching_squares.rb +200 -0
  206. data/examples/maze.rb +323 -0
  207. data/examples/nbody.rb +338 -0
  208. data/examples/outrun.rb +391 -0
  209. data/examples/pixel_paint.rb +313 -0
  210. data/examples/platformer.rb +335 -0
  211. data/examples/ray_casting_maze.rb +175 -0
  212. data/examples/shadow_casting.rb +151 -0
  213. data/examples/shape_recognizer.rb +908 -0
  214. data/examples/snake.rb +144 -0
  215. data/examples/sprite_sheets.rb +246 -0
  216. data/examples/swarm.rb +206 -0
  217. data/examples/tsp_annealing.rb +104 -0
  218. data/examples/ui_controls.rb +163 -0
  219. data/examples/wireframe_3d.rb +139 -0
  220. data/ext/ruby2d/audio.c +324 -0
  221. data/ext/ruby2d/canvas.c +1715 -494
  222. data/ext/ruby2d/ext.c +541 -0
  223. data/ext/ruby2d/extconf.rb +122 -145
  224. data/ext/ruby2d/font.c +566 -20
  225. data/ext/ruby2d/fps.c +92 -0
  226. data/ext/ruby2d/image.c +466 -41
  227. data/ext/ruby2d/ruby2d.c +374 -1890
  228. data/ext/ruby2d/ruby2d.h +840 -460
  229. data/ext/ruby2d/shapes.c +931 -101
  230. data/ext/ruby2d/text.c +586 -21
  231. data/ext/ruby2d/window.c +1693 -283
  232. data/lib/ruby2d/atlas_parser.rb +194 -0
  233. data/lib/ruby2d/audio.rb +73 -0
  234. data/lib/ruby2d/benchmark.rb +259 -0
  235. data/lib/ruby2d/bitmap_text.rb +155 -0
  236. data/lib/ruby2d/button.rb +402 -0
  237. data/lib/ruby2d/canvas.rb +703 -279
  238. data/lib/ruby2d/circle.rb +206 -29
  239. data/lib/ruby2d/cli/browser.rb +314 -0
  240. data/lib/ruby2d/cli/build.rb +471 -257
  241. data/lib/ruby2d/cli/colorize.rb +7 -5
  242. data/lib/ruby2d/cli/examples.rb +127 -0
  243. data/lib/ruby2d/cli/launch.rb +24 -39
  244. data/lib/ruby2d/cli/lib_files.rb +48 -0
  245. data/lib/ruby2d/cli/messages.rb +40 -0
  246. data/lib/ruby2d/cli/setup.rb +273 -0
  247. data/lib/ruby2d/cli/static_server.rb +160 -0
  248. data/lib/ruby2d/cli/usage.rb +255 -0
  249. data/lib/ruby2d/color.rb +191 -69
  250. data/lib/ruby2d/core.rb +37 -19
  251. data/lib/ruby2d/deps_help.rb +89 -0
  252. data/lib/ruby2d/dsl.rb +51 -12
  253. data/lib/ruby2d/ellipse.rb +228 -0
  254. data/lib/ruby2d/exceptions.rb +0 -2
  255. data/lib/ruby2d/font.rb +34 -74
  256. data/lib/ruby2d/gamepad.rb +323 -0
  257. data/lib/ruby2d/gem_paths.rb +19 -0
  258. data/lib/ruby2d/image.rb +155 -52
  259. data/lib/ruby2d/interactive.rb +103 -0
  260. data/lib/ruby2d/json_parser.rb +268 -0
  261. data/lib/ruby2d/line.rb +194 -85
  262. data/lib/ruby2d/mruby_compat.rb +12 -0
  263. data/lib/ruby2d/polygon.rb +297 -0
  264. data/lib/ruby2d/polyline.rb +368 -0
  265. data/lib/ruby2d/quad.rb +358 -94
  266. data/lib/ruby2d/rectangle.rb +77 -19
  267. data/lib/ruby2d/renderable.rb +411 -11
  268. data/lib/ruby2d/sprite.rb +471 -180
  269. data/lib/ruby2d/sprite_sheet.rb +64 -0
  270. data/lib/ruby2d/square.rb +29 -17
  271. data/lib/ruby2d/text.rb +196 -65
  272. data/lib/ruby2d/tileset.rb +139 -81
  273. data/lib/ruby2d/triangle.rb +324 -89
  274. data/lib/ruby2d/version.rb +1 -3
  275. data/lib/ruby2d/vertices.rb +62 -85
  276. data/lib/ruby2d/warnings.rb +29 -0
  277. data/lib/ruby2d/window/class_methods.rb +218 -0
  278. data/lib/ruby2d/window/gamepad_events.rb +141 -0
  279. data/lib/ruby2d/window/key_events.rb +74 -0
  280. data/lib/ruby2d/window/mouse_events.rb +171 -0
  281. data/lib/ruby2d/window/object_events.rb +168 -0
  282. data/lib/ruby2d/window.rb +632 -585
  283. data/lib/ruby2d.rb +14 -19
  284. metadata +275 -428
  285. data/assets/app.icns +0 -0
  286. data/assets/include/GLES2/gl2.h +0 -656
  287. data/assets/include/GLES2/gl2ext.h +0 -3949
  288. data/assets/include/GLES2/gl2ext_angle.h +0 -701
  289. data/assets/include/GLES2/gl2platform.h +0 -27
  290. data/assets/include/GLES3/gl3.h +0 -1192
  291. data/assets/include/GLES3/gl31.h +0 -1507
  292. data/assets/include/GLES3/gl32.h +0 -1808
  293. data/assets/include/GLES3/gl3platform.h +0 -27
  294. data/assets/include/KHR/khrplatform.h +0 -290
  295. data/assets/include/SDL2/SDL.h +0 -233
  296. data/assets/include/SDL2/SDL_assert.h +0 -326
  297. data/assets/include/SDL2/SDL_atomic.h +0 -415
  298. data/assets/include/SDL2/SDL_audio.h +0 -1500
  299. data/assets/include/SDL2/SDL_clipboard.h +0 -141
  300. data/assets/include/SDL2/SDL_config.h +0 -61
  301. data/assets/include/SDL2/SDL_config_android.h +0 -194
  302. data/assets/include/SDL2/SDL_config_emscripten.h +0 -218
  303. data/assets/include/SDL2/SDL_config_iphoneos.h +0 -217
  304. data/assets/include/SDL2/SDL_config_macosx.h +0 -277
  305. data/assets/include/SDL2/SDL_config_minimal.h +0 -95
  306. data/assets/include/SDL2/SDL_config_ngage.h +0 -89
  307. data/assets/include/SDL2/SDL_config_os2.h +0 -207
  308. data/assets/include/SDL2/SDL_config_pandora.h +0 -141
  309. data/assets/include/SDL2/SDL_config_windows.h +0 -331
  310. data/assets/include/SDL2/SDL_config_wingdk.h +0 -253
  311. data/assets/include/SDL2/SDL_config_winrt.h +0 -220
  312. data/assets/include/SDL2/SDL_config_xbox.h +0 -235
  313. data/assets/include/SDL2/SDL_cpuinfo.h +0 -594
  314. data/assets/include/SDL2/SDL_endian.h +0 -348
  315. data/assets/include/SDL2/SDL_error.h +0 -163
  316. data/assets/include/SDL2/SDL_events.h +0 -1166
  317. data/assets/include/SDL2/SDL_filesystem.h +0 -149
  318. data/assets/include/SDL2/SDL_gamecontroller.h +0 -1074
  319. data/assets/include/SDL2/SDL_gesture.h +0 -117
  320. data/assets/include/SDL2/SDL_guid.h +0 -100
  321. data/assets/include/SDL2/SDL_haptic.h +0 -1341
  322. data/assets/include/SDL2/SDL_hidapi.h +0 -451
  323. data/assets/include/SDL2/SDL_hints.h +0 -2569
  324. data/assets/include/SDL2/SDL_image.h +0 -2173
  325. data/assets/include/SDL2/SDL_joystick.h +0 -1066
  326. data/assets/include/SDL2/SDL_keyboard.h +0 -353
  327. data/assets/include/SDL2/SDL_keycode.h +0 -358
  328. data/assets/include/SDL2/SDL_loadso.h +0 -115
  329. data/assets/include/SDL2/SDL_log.h +0 -404
  330. data/assets/include/SDL2/SDL_main.h +0 -275
  331. data/assets/include/SDL2/SDL_mixer.h +0 -2784
  332. data/assets/include/SDL2/SDL_mouse.h +0 -465
  333. data/assets/include/SDL2/SDL_mutex.h +0 -471
  334. data/assets/include/SDL2/SDL_name.h +0 -33
  335. data/assets/include/SDL2/SDL_pixels.h +0 -644
  336. data/assets/include/SDL2/SDL_platform.h +0 -261
  337. data/assets/include/SDL2/SDL_quit.h +0 -58
  338. data/assets/include/SDL2/SDL_rect.h +0 -376
  339. data/assets/include/SDL2/SDL_render.h +0 -1919
  340. data/assets/include/SDL2/SDL_revision.h +0 -6
  341. data/assets/include/SDL2/SDL_rwops.h +0 -841
  342. data/assets/include/SDL2/SDL_sensor.h +0 -322
  343. data/assets/include/SDL2/SDL_shape.h +0 -155
  344. data/assets/include/SDL2/SDL_stdinc.h +0 -830
  345. data/assets/include/SDL2/SDL_surface.h +0 -997
  346. data/assets/include/SDL2/SDL_system.h +0 -623
  347. data/assets/include/SDL2/SDL_syswm.h +0 -386
  348. data/assets/include/SDL2/SDL_test_images.h +0 -78
  349. data/assets/include/SDL2/SDL_test_random.h +0 -115
  350. data/assets/include/SDL2/SDL_thread.h +0 -464
  351. data/assets/include/SDL2/SDL_timer.h +0 -222
  352. data/assets/include/SDL2/SDL_touch.h +0 -150
  353. data/assets/include/SDL2/SDL_ttf.h +0 -2316
  354. data/assets/include/SDL2/SDL_types.h +0 -29
  355. data/assets/include/SDL2/SDL_version.h +0 -204
  356. data/assets/include/SDL2/SDL_video.h +0 -2150
  357. data/assets/include/SDL2/SDL_vulkan.h +0 -215
  358. data/assets/include/SDL2/begin_code.h +0 -187
  359. data/assets/include/mruby/boxing_no.h +0 -58
  360. data/assets/include/mruby/class.h +0 -108
  361. data/assets/include/mruby/error.h +0 -147
  362. data/assets/include/mruby/gc.h +0 -94
  363. data/assets/include/mruby/irep.h +0 -147
  364. data/assets/include/mruby/khash.h +0 -284
  365. data/assets/include/mruby/object.h +0 -43
  366. data/assets/include/mruby/presym/disable.h +0 -70
  367. data/assets/include/mruby/presym/enable.h +0 -37
  368. data/assets/include/mruby/presym.h +0 -40
  369. data/assets/include/mruby/proc.h +0 -211
  370. data/assets/include/mruby/throw.h +0 -66
  371. data/assets/macos/universal/bin/mrbc +0 -0
  372. data/assets/macos/universal/lib/libFLAC.a +0 -0
  373. data/assets/macos/universal/lib/libSDL2.a +0 -0
  374. data/assets/macos/universal/lib/libSDL2_image.a +0 -0
  375. data/assets/macos/universal/lib/libSDL2_mixer.a +0 -0
  376. data/assets/macos/universal/lib/libSDL2_ttf.a +0 -0
  377. data/assets/macos/universal/lib/libavif.a +0 -0
  378. data/assets/macos/universal/lib/libbrotlicommon-static.a +0 -0
  379. data/assets/macos/universal/lib/libbrotlidec-static.a +0 -0
  380. data/assets/macos/universal/lib/libfreetype.a +0 -0
  381. data/assets/macos/universal/lib/libgraphite2.a +0 -0
  382. data/assets/macos/universal/lib/libharfbuzz.a +0 -0
  383. data/assets/macos/universal/lib/libhwy.a +0 -0
  384. data/assets/macos/universal/lib/libjpeg.a +0 -0
  385. data/assets/macos/universal/lib/libjxl.a +0 -0
  386. data/assets/macos/universal/lib/libmodplug.a +0 -0
  387. data/assets/macos/universal/lib/libmpg123.a +0 -0
  388. data/assets/macos/universal/lib/libmruby.a +0 -0
  389. data/assets/macos/universal/lib/libogg.a +0 -0
  390. data/assets/macos/universal/lib/libpng.a +0 -0
  391. data/assets/macos/universal/lib/libtiff.a +0 -0
  392. data/assets/macos/universal/lib/libvorbis.a +0 -0
  393. data/assets/macos/universal/lib/libvorbisfile.a +0 -0
  394. data/assets/macos/universal/lib/libwebp.a +0 -0
  395. data/assets/macos/universal/lib/libzstd.a +0 -0
  396. data/assets/test_media/README.md +0 -3
  397. data/assets/test_media/bitstream_vera/COPYRIGHT.txt +0 -124
  398. data/assets/test_media/bitstream_vera/vera.ttf +0 -0
  399. data/assets/test_media/boom.png +0 -0
  400. data/assets/test_media/coin.png +0 -0
  401. data/assets/test_media/colors.png +0 -0
  402. data/assets/test_media/controller.png +0 -0
  403. data/assets/test_media/dial.wav +0 -0
  404. data/assets/test_media/hero.png +0 -0
  405. data/assets/test_media/image.bmp +0 -0
  406. data/assets/test_media/image.jpg +0 -0
  407. data/assets/test_media/image.png +0 -0
  408. data/assets/test_media/music.flac +0 -0
  409. data/assets/test_media/music.mp3 +0 -0
  410. data/assets/test_media/music.ogg +0 -0
  411. data/assets/test_media/music.wav +0 -0
  412. data/assets/test_media/originals/boom.pxm +0 -0
  413. data/assets/test_media/originals/coin.pxm +0 -0
  414. data/assets/test_media/originals/controller.sketch +0 -0
  415. data/assets/test_media/originals/hero.pxm +0 -0
  416. data/assets/test_media/originals/image.pxm +0 -0
  417. data/assets/test_media/originals/music.caf +0 -0
  418. data/assets/test_media/originals/texture_atlas.pxm +0 -0
  419. data/assets/test_media/rondo_alla_turka.ogg +0 -0
  420. data/assets/test_media/sound.flac +0 -0
  421. data/assets/test_media/sound.mp3 +0 -0
  422. data/assets/test_media/sound.ogg +0 -0
  423. data/assets/test_media/sound.wav +0 -0
  424. data/assets/test_media/sprite_sheet.png +0 -0
  425. data/assets/test_media/texture_atlas.png +0 -0
  426. data/assets/wasm/libmruby.a +0 -0
  427. data/assets/windows/mingw-w64-ucrt-x86_64/bin/mrbc.exe +0 -0
  428. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libFLAC.a +0 -0
  429. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libLerc.a +0 -0
  430. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libSDL2.a +0 -0
  431. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libSDL2_image.a +0 -0
  432. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libSDL2_mixer.a +0 -0
  433. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libSDL2_ttf.a +0 -0
  434. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libbrotlicommon.a +0 -0
  435. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libbrotlidec.a +0 -0
  436. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libbz2.a +0 -0
  437. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libdeflate.a +0 -0
  438. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libfreetype.a +0 -0
  439. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libglew32.a +0 -0
  440. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libgraphite2.a +0 -0
  441. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libharfbuzz.a +0 -0
  442. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libhwy.a +0 -0
  443. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libjbig.a +0 -0
  444. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libjpeg.a +0 -0
  445. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libjxl.a +0 -0
  446. data/assets/windows/mingw-w64-ucrt-x86_64/lib/liblzma.a +0 -0
  447. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libmodplug.a +0 -0
  448. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libmpg123.a +0 -0
  449. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libmruby.a +0 -0
  450. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libogg.a +0 -0
  451. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libopus.a +0 -0
  452. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libopusfile.a +0 -0
  453. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libpng.a +0 -0
  454. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libsndfile.a +0 -0
  455. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libssp.a +0 -1
  456. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libstdc++.a +0 -0
  457. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libtiff.a +0 -0
  458. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libvorbis.a +0 -0
  459. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libvorbisfile.a +0 -0
  460. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libwebp.a +0 -0
  461. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libz.a +0 -0
  462. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libzstd.a +0 -0
  463. data/assets/windows/mingw-w64-x86_64/bin/mrbc.exe +0 -0
  464. data/assets/windows/mingw-w64-x86_64/lib/libFLAC.a +0 -0
  465. data/assets/windows/mingw-w64-x86_64/lib/libLerc.a +0 -0
  466. data/assets/windows/mingw-w64-x86_64/lib/libSDL2.a +0 -0
  467. data/assets/windows/mingw-w64-x86_64/lib/libSDL2_image.a +0 -0
  468. data/assets/windows/mingw-w64-x86_64/lib/libSDL2_mixer.a +0 -0
  469. data/assets/windows/mingw-w64-x86_64/lib/libSDL2_ttf.a +0 -0
  470. data/assets/windows/mingw-w64-x86_64/lib/libbrotlicommon.a +0 -0
  471. data/assets/windows/mingw-w64-x86_64/lib/libbrotlidec.a +0 -0
  472. data/assets/windows/mingw-w64-x86_64/lib/libbz2.a +0 -0
  473. data/assets/windows/mingw-w64-x86_64/lib/libdeflate.a +0 -0
  474. data/assets/windows/mingw-w64-x86_64/lib/libfreetype.a +0 -0
  475. data/assets/windows/mingw-w64-x86_64/lib/libglew32.a +0 -0
  476. data/assets/windows/mingw-w64-x86_64/lib/libgraphite2.a +0 -0
  477. data/assets/windows/mingw-w64-x86_64/lib/libharfbuzz.a +0 -0
  478. data/assets/windows/mingw-w64-x86_64/lib/libhwy.a +0 -0
  479. data/assets/windows/mingw-w64-x86_64/lib/libjbig.a +0 -0
  480. data/assets/windows/mingw-w64-x86_64/lib/libjpeg.a +0 -0
  481. data/assets/windows/mingw-w64-x86_64/lib/libjxl.a +0 -0
  482. data/assets/windows/mingw-w64-x86_64/lib/liblzma.a +0 -0
  483. data/assets/windows/mingw-w64-x86_64/lib/libmodplug.a +0 -0
  484. data/assets/windows/mingw-w64-x86_64/lib/libmpg123.a +0 -0
  485. data/assets/windows/mingw-w64-x86_64/lib/libmruby.a +0 -0
  486. data/assets/windows/mingw-w64-x86_64/lib/libogg.a +0 -0
  487. data/assets/windows/mingw-w64-x86_64/lib/libopus.a +0 -0
  488. data/assets/windows/mingw-w64-x86_64/lib/libopusfile.a +0 -0
  489. data/assets/windows/mingw-w64-x86_64/lib/libpng.a +0 -0
  490. data/assets/windows/mingw-w64-x86_64/lib/libsndfile.a +0 -0
  491. data/assets/windows/mingw-w64-x86_64/lib/libssp.a +0 -1
  492. data/assets/windows/mingw-w64-x86_64/lib/libstdc++.a +0 -0
  493. data/assets/windows/mingw-w64-x86_64/lib/libtiff.a +0 -0
  494. data/assets/windows/mingw-w64-x86_64/lib/libvorbis.a +0 -0
  495. data/assets/windows/mingw-w64-x86_64/lib/libvorbisfile.a +0 -0
  496. data/assets/windows/mingw-w64-x86_64/lib/libwebp.a +0 -0
  497. data/assets/windows/mingw-w64-x86_64/lib/libz.a +0 -0
  498. data/assets/windows/mingw-w64-x86_64/lib/libzstd.a +0 -0
  499. data/assets/xcode/ios/Assets.xcassets/AppIcon.appiconset/Contents.json +0 -98
  500. data/assets/xcode/ios/Assets.xcassets/Contents.json +0 -6
  501. data/assets/xcode/ios/Base.lproj/LaunchScreen.storyboard +0 -27
  502. data/assets/xcode/ios/Info.plist +0 -43
  503. data/assets/xcode/ios/MRuby.framework/Headers/mrbconf.h +0 -143
  504. data/assets/xcode/ios/MRuby.framework/Headers/mruby/array.h +0 -280
  505. data/assets/xcode/ios/MRuby.framework/Headers/mruby/boxing_nan.h +0 -102
  506. data/assets/xcode/ios/MRuby.framework/Headers/mruby/boxing_no.h +0 -56
  507. data/assets/xcode/ios/MRuby.framework/Headers/mruby/boxing_word.h +0 -144
  508. data/assets/xcode/ios/MRuby.framework/Headers/mruby/class.h +0 -97
  509. data/assets/xcode/ios/MRuby.framework/Headers/mruby/common.h +0 -77
  510. data/assets/xcode/ios/MRuby.framework/Headers/mruby/compile.h +0 -195
  511. data/assets/xcode/ios/MRuby.framework/Headers/mruby/data.h +0 -75
  512. data/assets/xcode/ios/MRuby.framework/Headers/mruby/debug.h +0 -67
  513. data/assets/xcode/ios/MRuby.framework/Headers/mruby/dump.h +0 -196
  514. data/assets/xcode/ios/MRuby.framework/Headers/mruby/error.h +0 -75
  515. data/assets/xcode/ios/MRuby.framework/Headers/mruby/gc.h +0 -91
  516. data/assets/xcode/ios/MRuby.framework/Headers/mruby/hash.h +0 -215
  517. data/assets/xcode/ios/MRuby.framework/Headers/mruby/irep.h +0 -75
  518. data/assets/xcode/ios/MRuby.framework/Headers/mruby/istruct.h +0 -47
  519. data/assets/xcode/ios/MRuby.framework/Headers/mruby/khash.h +0 -274
  520. data/assets/xcode/ios/MRuby.framework/Headers/mruby/numeric.h +0 -161
  521. data/assets/xcode/ios/MRuby.framework/Headers/mruby/object.h +0 -44
  522. data/assets/xcode/ios/MRuby.framework/Headers/mruby/opcode.h +0 -69
  523. data/assets/xcode/ios/MRuby.framework/Headers/mruby/ops.h +0 -117
  524. data/assets/xcode/ios/MRuby.framework/Headers/mruby/proc.h +0 -131
  525. data/assets/xcode/ios/MRuby.framework/Headers/mruby/range.h +0 -49
  526. data/assets/xcode/ios/MRuby.framework/Headers/mruby/re.h +0 -16
  527. data/assets/xcode/ios/MRuby.framework/Headers/mruby/string.h +0 -444
  528. data/assets/xcode/ios/MRuby.framework/Headers/mruby/throw.h +0 -55
  529. data/assets/xcode/ios/MRuby.framework/Headers/mruby/value.h +0 -309
  530. data/assets/xcode/ios/MRuby.framework/Headers/mruby/variable.h +0 -136
  531. data/assets/xcode/ios/MRuby.framework/Headers/mruby/version.h +0 -110
  532. data/assets/xcode/ios/MRuby.framework/Headers/mruby.h +0 -1282
  533. data/assets/xcode/ios/MRuby.framework/Info.plist +0 -20
  534. data/assets/xcode/ios/MRuby.framework/MRuby +0 -0
  535. data/assets/xcode/ios/MyApp.xcodeproj/project.pbxproj +0 -368
  536. data/assets/xcode/ios/MyApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
  537. data/assets/xcode/ios/MyApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  538. data/assets/xcode/ios/MyApp.xcodeproj/project.xcworkspace/xcshareddata/MyApp.xcscmblueprint +0 -30
  539. data/assets/xcode/ios/main.c +0 -1
  540. data/assets/xcode/tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Back.imagestacklayer/Content.imageset/Contents.json +0 -16
  541. data/assets/xcode/tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Back.imagestacklayer/Contents.json +0 -6
  542. data/assets/xcode/tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Contents.json +0 -17
  543. data/assets/xcode/tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Front.imagestacklayer/Content.imageset/Contents.json +0 -16
  544. data/assets/xcode/tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Front.imagestacklayer/Contents.json +0 -6
  545. data/assets/xcode/tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json +0 -16
  546. data/assets/xcode/tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Middle.imagestacklayer/Contents.json +0 -6
  547. data/assets/xcode/tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Back.imagestacklayer/Content.imageset/Contents.json +0 -16
  548. data/assets/xcode/tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Back.imagestacklayer/Contents.json +0 -6
  549. data/assets/xcode/tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Contents.json +0 -17
  550. data/assets/xcode/tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Front.imagestacklayer/Content.imageset/Contents.json +0 -16
  551. data/assets/xcode/tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Front.imagestacklayer/Contents.json +0 -6
  552. data/assets/xcode/tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json +0 -16
  553. data/assets/xcode/tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Middle.imagestacklayer/Contents.json +0 -6
  554. data/assets/xcode/tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Contents.json +0 -32
  555. data/assets/xcode/tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image Wide.imageset/Contents.json +0 -16
  556. data/assets/xcode/tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/Contents.json +0 -16
  557. data/assets/xcode/tvos/Assets.xcassets/Contents.json +0 -6
  558. data/assets/xcode/tvos/Assets.xcassets/LaunchImage.launchimage/Contents.json +0 -22
  559. data/assets/xcode/tvos/Info.plist +0 -30
  560. data/assets/xcode/tvos/MRuby.framework/Headers/mrbconf.h +0 -143
  561. data/assets/xcode/tvos/MRuby.framework/Headers/mruby/array.h +0 -280
  562. data/assets/xcode/tvos/MRuby.framework/Headers/mruby/boxing_nan.h +0 -102
  563. data/assets/xcode/tvos/MRuby.framework/Headers/mruby/boxing_no.h +0 -56
  564. data/assets/xcode/tvos/MRuby.framework/Headers/mruby/boxing_word.h +0 -144
  565. data/assets/xcode/tvos/MRuby.framework/Headers/mruby/class.h +0 -97
  566. data/assets/xcode/tvos/MRuby.framework/Headers/mruby/common.h +0 -77
  567. data/assets/xcode/tvos/MRuby.framework/Headers/mruby/compile.h +0 -195
  568. data/assets/xcode/tvos/MRuby.framework/Headers/mruby/data.h +0 -75
  569. data/assets/xcode/tvos/MRuby.framework/Headers/mruby/debug.h +0 -67
  570. data/assets/xcode/tvos/MRuby.framework/Headers/mruby/dump.h +0 -196
  571. data/assets/xcode/tvos/MRuby.framework/Headers/mruby/error.h +0 -75
  572. data/assets/xcode/tvos/MRuby.framework/Headers/mruby/gc.h +0 -91
  573. data/assets/xcode/tvos/MRuby.framework/Headers/mruby/hash.h +0 -215
  574. data/assets/xcode/tvos/MRuby.framework/Headers/mruby/irep.h +0 -75
  575. data/assets/xcode/tvos/MRuby.framework/Headers/mruby/istruct.h +0 -47
  576. data/assets/xcode/tvos/MRuby.framework/Headers/mruby/khash.h +0 -274
  577. data/assets/xcode/tvos/MRuby.framework/Headers/mruby/numeric.h +0 -161
  578. data/assets/xcode/tvos/MRuby.framework/Headers/mruby/object.h +0 -44
  579. data/assets/xcode/tvos/MRuby.framework/Headers/mruby/opcode.h +0 -69
  580. data/assets/xcode/tvos/MRuby.framework/Headers/mruby/ops.h +0 -117
  581. data/assets/xcode/tvos/MRuby.framework/Headers/mruby/proc.h +0 -131
  582. data/assets/xcode/tvos/MRuby.framework/Headers/mruby/range.h +0 -49
  583. data/assets/xcode/tvos/MRuby.framework/Headers/mruby/re.h +0 -16
  584. data/assets/xcode/tvos/MRuby.framework/Headers/mruby/string.h +0 -444
  585. data/assets/xcode/tvos/MRuby.framework/Headers/mruby/throw.h +0 -55
  586. data/assets/xcode/tvos/MRuby.framework/Headers/mruby/value.h +0 -309
  587. data/assets/xcode/tvos/MRuby.framework/Headers/mruby/variable.h +0 -136
  588. data/assets/xcode/tvos/MRuby.framework/Headers/mruby/version.h +0 -110
  589. data/assets/xcode/tvos/MRuby.framework/Headers/mruby.h +0 -1282
  590. data/assets/xcode/tvos/MRuby.framework/Info.plist +0 -20
  591. data/assets/xcode/tvos/MRuby.framework/MRuby +0 -0
  592. data/assets/xcode/tvos/MyApp.xcodeproj/project.pbxproj +0 -350
  593. data/assets/xcode/tvos/MyApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
  594. data/assets/xcode/tvos/MyApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  595. data/assets/xcode/tvos/MyApp.xcodeproj/project.xcworkspace/xcshareddata/MyApp.xcscmblueprint +0 -30
  596. data/assets/xcode/tvos/main.c +0 -1
  597. data/ext/ruby2d/common.c +0 -185
  598. data/ext/ruby2d/controllers.c +0 -110
  599. data/ext/ruby2d/gl.c +0 -398
  600. data/ext/ruby2d/gl2.c +0 -86
  601. data/ext/ruby2d/gl3.c +0 -304
  602. data/ext/ruby2d/gles.c +0 -302
  603. data/ext/ruby2d/input.c +0 -48
  604. data/ext/ruby2d/music.c +0 -127
  605. data/ext/ruby2d/sound.c +0 -132
  606. data/lib/ruby2d/cli/console.rb +0 -65
  607. data/lib/ruby2d/cli/enable_console.rb +0 -7
  608. data/lib/ruby2d/cli/platform.rb +0 -17
  609. data/lib/ruby2d/music.rb +0 -77
  610. data/lib/ruby2d/pixel.rb +0 -18
  611. data/lib/ruby2d/pixmap.rb +0 -39
  612. data/lib/ruby2d/pixmap_atlas.rb +0 -56
  613. data/lib/ruby2d/sound.rb +0 -61
  614. data/lib/ruby2d/texture.rb +0 -38
  615. /data/assets/{include/SDL2 → platform/include/SDL3}/SDL_opengles2_gl2.h +0 -0
  616. /data/assets/{include/SDL2 → platform/include/SDL3}/SDL_opengles2_gl2ext.h +0 -0
  617. /data/assets/{include/SDL2 → platform/include/SDL3}/SDL_opengles2_gl2platform.h +0 -0
  618. /data/assets/{include/SDL2 → platform/include/SDL3}/SDL_opengles2_khrplatform.h +0 -0
  619. /data/assets/{include → platform/include}/mruby/re.h +0 -0
@@ -0,0 +1,2833 @@
1
+ /*
2
+ SDL_ttf: A companion library to SDL for working with TrueType (tm) fonts
3
+ Copyright (C) 2001-2025 Sam Lantinga <slouken@libsdl.org>
4
+
5
+ This software is provided 'as-is', without any express or implied
6
+ warranty. In no event will the authors be held liable for any damages
7
+ arising from the use of this software.
8
+
9
+ Permission is granted to anyone to use this software for any purpose,
10
+ including commercial applications, and to alter it and redistribute it
11
+ freely, subject to the following restrictions:
12
+
13
+ 1. The origin of this software must not be misrepresented; you must not
14
+ claim that you wrote the original software. If you use this software
15
+ in a product, an acknowledgment in the product documentation would be
16
+ appreciated but is not required.
17
+ 2. Altered source versions must be plainly marked as such, and must not be
18
+ misrepresented as being the original software.
19
+ 3. This notice may not be removed or altered from any source distribution.
20
+ */
21
+
22
+ /* WIKI CATEGORY: SDLTTF */
23
+
24
+ /**
25
+ * # CategorySDLTTF
26
+ *
27
+ * Header file for SDL_ttf library
28
+ *
29
+ * This library is a wrapper around the excellent FreeType 2.0 library,
30
+ * available at: https://www.freetype.org/
31
+ */
32
+
33
+ #ifndef SDL_TTF_H_
34
+ #define SDL_TTF_H_
35
+
36
+ #include <SDL3/SDL.h>
37
+ #include <SDL3/SDL_begin_code.h>
38
+
39
+ /* Set up for C function definitions, even when using C++ */
40
+ #ifdef __cplusplus
41
+ extern "C" {
42
+ #endif
43
+
44
+ /**
45
+ * Printable format: "%d.%d.%d", MAJOR, MINOR, MICRO
46
+ */
47
+ #define SDL_TTF_MAJOR_VERSION 3
48
+ #define SDL_TTF_MINOR_VERSION 2
49
+ #define SDL_TTF_MICRO_VERSION 2
50
+
51
+ /**
52
+ * This is the version number macro for the current SDL_ttf version.
53
+ */
54
+ #define SDL_TTF_VERSION \
55
+ SDL_VERSIONNUM(SDL_TTF_MAJOR_VERSION, SDL_TTF_MINOR_VERSION, SDL_TTF_MICRO_VERSION)
56
+
57
+ /**
58
+ * This macro will evaluate to true if compiled with SDL_ttf at least X.Y.Z.
59
+ */
60
+ #define SDL_TTF_VERSION_ATLEAST(X, Y, Z) \
61
+ ((SDL_TTF_MAJOR_VERSION >= X) && \
62
+ (SDL_TTF_MAJOR_VERSION > X || SDL_TTF_MINOR_VERSION >= Y) && \
63
+ (SDL_TTF_MAJOR_VERSION > X || SDL_TTF_MINOR_VERSION > Y || SDL_TTF_MICRO_VERSION >= Z))
64
+
65
+ /**
66
+ * This function gets the version of the dynamically linked SDL_ttf library.
67
+ *
68
+ * \returns SDL_ttf version.
69
+ *
70
+ * \threadsafety It is safe to call this function from any thread.
71
+ *
72
+ * \since This function is available since SDL_ttf 3.0.0.
73
+ */
74
+ extern SDL_DECLSPEC int SDLCALL TTF_Version(void);
75
+
76
+ /**
77
+ * Query the version of the FreeType library in use.
78
+ *
79
+ * TTF_Init() should be called before calling this function.
80
+ *
81
+ * \param major to be filled in with the major version number. Can be NULL.
82
+ * \param minor to be filled in with the minor version number. Can be NULL.
83
+ * \param patch to be filled in with the param version number. Can be NULL.
84
+ *
85
+ * \threadsafety It is safe to call this function from any thread.
86
+ *
87
+ * \since This function is available since SDL_ttf 3.0.0.
88
+ *
89
+ * \sa TTF_Init
90
+ */
91
+ extern SDL_DECLSPEC void SDLCALL TTF_GetFreeTypeVersion(int *major, int *minor, int *patch);
92
+
93
+ /**
94
+ * Query the version of the HarfBuzz library in use.
95
+ *
96
+ * If HarfBuzz is not available, the version reported is 0.0.0.
97
+ *
98
+ * \param major to be filled in with the major version number. Can be NULL.
99
+ * \param minor to be filled in with the minor version number. Can be NULL.
100
+ * \param patch to be filled in with the param version number. Can be NULL.
101
+ *
102
+ * \threadsafety It is safe to call this function from any thread.
103
+ *
104
+ * \since This function is available since SDL_ttf 3.0.0.
105
+ */
106
+ extern SDL_DECLSPEC void SDLCALL TTF_GetHarfBuzzVersion(int *major, int *minor, int *patch);
107
+
108
+ /**
109
+ * The internal structure containing font information.
110
+ *
111
+ * Opaque data!
112
+ */
113
+ typedef struct TTF_Font TTF_Font;
114
+
115
+ /**
116
+ * Initialize SDL_ttf.
117
+ *
118
+ * You must successfully call this function before it is safe to call any
119
+ * other function in this library.
120
+ *
121
+ * It is safe to call this more than once, and each successful TTF_Init() call
122
+ * should be paired with a matching TTF_Quit() call.
123
+ *
124
+ * \returns true on success or false on failure; call SDL_GetError() for more
125
+ * information.
126
+ *
127
+ * \since This function is available since SDL_ttf 3.0.0.
128
+ *
129
+ * \sa TTF_Quit
130
+ */
131
+ extern SDL_DECLSPEC bool SDLCALL TTF_Init(void);
132
+
133
+ /**
134
+ * Create a font from a file, using a specified point size.
135
+ *
136
+ * Some .fon fonts will have several sizes embedded in the file, so the point
137
+ * size becomes the index of choosing which size. If the value is too high,
138
+ * the last indexed size will be the default.
139
+ *
140
+ * When done with the returned TTF_Font, use TTF_CloseFont() to dispose of it.
141
+ *
142
+ * \param file path to font file.
143
+ * \param ptsize point size to use for the newly-opened font.
144
+ * \returns a valid TTF_Font, or NULL on failure; call SDL_GetError() for more
145
+ * information.
146
+ *
147
+ * \threadsafety It is safe to call this function from any thread.
148
+ *
149
+ * \since This function is available since SDL_ttf 3.0.0.
150
+ *
151
+ * \sa TTF_CloseFont
152
+ */
153
+ extern SDL_DECLSPEC TTF_Font * SDLCALL TTF_OpenFont(const char *file, float ptsize);
154
+
155
+ /**
156
+ * Create a font from an SDL_IOStream, using a specified point size.
157
+ *
158
+ * Some .fon fonts will have several sizes embedded in the file, so the point
159
+ * size becomes the index of choosing which size. If the value is too high,
160
+ * the last indexed size will be the default.
161
+ *
162
+ * If `closeio` is true, `src` will be automatically closed once the font is
163
+ * closed. Otherwise you should close `src` yourself after closing the font.
164
+ *
165
+ * When done with the returned TTF_Font, use TTF_CloseFont() to dispose of it.
166
+ *
167
+ * \param src an SDL_IOStream to provide a font file's data.
168
+ * \param closeio true to close `src` when the font is closed, false to leave
169
+ * it open.
170
+ * \param ptsize point size to use for the newly-opened font.
171
+ * \returns a valid TTF_Font, or NULL on failure; call SDL_GetError() for more
172
+ * information.
173
+ *
174
+ * \threadsafety It is safe to call this function from any thread.
175
+ *
176
+ * \since This function is available since SDL_ttf 3.0.0.
177
+ *
178
+ * \sa TTF_CloseFont
179
+ */
180
+ extern SDL_DECLSPEC TTF_Font * SDLCALL TTF_OpenFontIO(SDL_IOStream *src, bool closeio, float ptsize);
181
+
182
+ /**
183
+ * Create a font with the specified properties.
184
+ *
185
+ * These are the supported properties:
186
+ *
187
+ * - `TTF_PROP_FONT_CREATE_FILENAME_STRING`: the font file to open, if an
188
+ * SDL_IOStream isn't being used. This is required if
189
+ * `TTF_PROP_FONT_CREATE_IOSTREAM_POINTER` and
190
+ * `TTF_PROP_FONT_CREATE_EXISTING_FONT` aren't set.
191
+ * - `TTF_PROP_FONT_CREATE_IOSTREAM_POINTER`: an SDL_IOStream containing the
192
+ * font to be opened. This should not be closed until the font is closed.
193
+ * This is required if `TTF_PROP_FONT_CREATE_FILENAME_STRING` and
194
+ * `TTF_PROP_FONT_CREATE_EXISTING_FONT` aren't set.
195
+ * - `TTF_PROP_FONT_CREATE_IOSTREAM_OFFSET_NUMBER`: the offset in the iostream
196
+ * for the beginning of the font, defaults to 0.
197
+ * - `TTF_PROP_FONT_CREATE_IOSTREAM_AUTOCLOSE_BOOLEAN`: true if closing the
198
+ * font should also close the associated SDL_IOStream.
199
+ * - `TTF_PROP_FONT_CREATE_SIZE_FLOAT`: the point size of the font. Some .fon
200
+ * fonts will have several sizes embedded in the file, so the point size
201
+ * becomes the index of choosing which size. If the value is too high, the
202
+ * last indexed size will be the default.
203
+ * - `TTF_PROP_FONT_CREATE_FACE_NUMBER`: the face index of the font, if the
204
+ * font contains multiple font faces.
205
+ * - `TTF_PROP_FONT_CREATE_HORIZONTAL_DPI_NUMBER`: the horizontal DPI to use
206
+ * for font rendering, defaults to
207
+ * `TTF_PROP_FONT_CREATE_VERTICAL_DPI_NUMBER` if set, or 72 otherwise.
208
+ * - `TTF_PROP_FONT_CREATE_VERTICAL_DPI_NUMBER`: the vertical DPI to use for
209
+ * font rendering, defaults to `TTF_PROP_FONT_CREATE_HORIZONTAL_DPI_NUMBER`
210
+ * if set, or 72 otherwise.
211
+ * - `TTF_PROP_FONT_CREATE_EXISTING_FONT`: an optional TTF_Font that, if set,
212
+ * will be used as the font data source and the initial size and style of
213
+ * the new font.
214
+ *
215
+ * \param props the properties to use.
216
+ * \returns a valid TTF_Font, or NULL on failure; call SDL_GetError() for more
217
+ * information.
218
+ *
219
+ * \threadsafety It is safe to call this function from any thread.
220
+ *
221
+ * \since This function is available since SDL_ttf 3.0.0.
222
+ *
223
+ * \sa TTF_CloseFont
224
+ */
225
+ extern SDL_DECLSPEC TTF_Font * SDLCALL TTF_OpenFontWithProperties(SDL_PropertiesID props);
226
+
227
+ #define TTF_PROP_FONT_CREATE_FILENAME_STRING "SDL_ttf.font.create.filename"
228
+ #define TTF_PROP_FONT_CREATE_IOSTREAM_POINTER "SDL_ttf.font.create.iostream"
229
+ #define TTF_PROP_FONT_CREATE_IOSTREAM_OFFSET_NUMBER "SDL_ttf.font.create.iostream.offset"
230
+ #define TTF_PROP_FONT_CREATE_IOSTREAM_AUTOCLOSE_BOOLEAN "SDL_ttf.font.create.iostream.autoclose"
231
+ #define TTF_PROP_FONT_CREATE_SIZE_FLOAT "SDL_ttf.font.create.size"
232
+ #define TTF_PROP_FONT_CREATE_FACE_NUMBER "SDL_ttf.font.create.face"
233
+ #define TTF_PROP_FONT_CREATE_HORIZONTAL_DPI_NUMBER "SDL_ttf.font.create.hdpi"
234
+ #define TTF_PROP_FONT_CREATE_VERTICAL_DPI_NUMBER "SDL_ttf.font.create.vdpi"
235
+ #define TTF_PROP_FONT_CREATE_EXISTING_FONT "SDL_ttf.font.create.existing_font"
236
+
237
+ /**
238
+ * Create a copy of an existing font.
239
+ *
240
+ * The copy will be distinct from the original, but will share the font file
241
+ * and have the same size and style as the original.
242
+ *
243
+ * When done with the returned TTF_Font, use TTF_CloseFont() to dispose of it.
244
+ *
245
+ * \param existing_font the font to copy.
246
+ * \returns a valid TTF_Font, or NULL on failure; call SDL_GetError() for more
247
+ * information.
248
+ *
249
+ * \threadsafety This function should be called on the thread that created the
250
+ * original font.
251
+ *
252
+ * \since This function is available since SDL_ttf 3.0.0.
253
+ *
254
+ * \sa TTF_CloseFont
255
+ */
256
+ extern SDL_DECLSPEC TTF_Font * SDLCALL TTF_CopyFont(TTF_Font *existing_font);
257
+
258
+ /**
259
+ * Get the properties associated with a font.
260
+ *
261
+ * The following read-write properties are provided by SDL:
262
+ *
263
+ * - `TTF_PROP_FONT_OUTLINE_LINE_CAP_NUMBER`: The FT_Stroker_LineCap value
264
+ * used when setting the font outline, defaults to
265
+ * `FT_STROKER_LINECAP_ROUND`.
266
+ * - `TTF_PROP_FONT_OUTLINE_LINE_JOIN_NUMBER`: The FT_Stroker_LineJoin value
267
+ * used when setting the font outline, defaults to
268
+ * `FT_STROKER_LINEJOIN_ROUND`.
269
+ * - `TTF_PROP_FONT_OUTLINE_MITER_LIMIT_NUMBER`: The FT_Fixed miter limit used
270
+ * when setting the font outline, defaults to 0.
271
+ *
272
+ * \param font the font to query.
273
+ * \returns a valid property ID on success or 0 on failure; call
274
+ * SDL_GetError() for more information.
275
+ *
276
+ * \threadsafety It is safe to call this function from any thread.
277
+ *
278
+ * \since This function is available since SDL_ttf 3.0.0.
279
+ */
280
+ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL TTF_GetFontProperties(TTF_Font *font);
281
+
282
+ #define TTF_PROP_FONT_OUTLINE_LINE_CAP_NUMBER "SDL_ttf.font.outline.line_cap"
283
+ #define TTF_PROP_FONT_OUTLINE_LINE_JOIN_NUMBER "SDL_ttf.font.outline.line_join"
284
+ #define TTF_PROP_FONT_OUTLINE_MITER_LIMIT_NUMBER "SDL_ttf.font.outline.miter_limit"
285
+
286
+ /**
287
+ * Get the font generation.
288
+ *
289
+ * The generation is incremented each time font properties change that require
290
+ * rebuilding glyphs, such as style, size, etc.
291
+ *
292
+ * \param font the font to query.
293
+ * \returns the font generation or 0 on failure; call SDL_GetError() for more
294
+ * information.
295
+ *
296
+ * \threadsafety This function should be called on the thread that created the
297
+ * font.
298
+ *
299
+ * \since This function is available since SDL_ttf 3.0.0.
300
+ */
301
+ extern SDL_DECLSPEC Uint32 SDLCALL TTF_GetFontGeneration(TTF_Font *font);
302
+
303
+ /**
304
+ * Add a fallback font.
305
+ *
306
+ * Add a font that will be used for glyphs that are not in the current font.
307
+ * The fallback font should have the same size and style as the current font.
308
+ *
309
+ * If there are multiple fallback fonts, they are used in the order added.
310
+ *
311
+ * This updates any TTF_Text objects using this font.
312
+ *
313
+ * \param font the font to modify.
314
+ * \param fallback the font to add as a fallback.
315
+ * \returns true on success or false on failure; call SDL_GetError() for more
316
+ * information.
317
+ *
318
+ * \threadsafety This function should be called on the thread that created
319
+ * both fonts.
320
+ *
321
+ * \since This function is available since SDL_ttf 3.0.0.
322
+ *
323
+ * \sa TTF_ClearFallbackFonts
324
+ * \sa TTF_RemoveFallbackFont
325
+ */
326
+ extern SDL_DECLSPEC bool SDLCALL TTF_AddFallbackFont(TTF_Font *font, TTF_Font *fallback);
327
+
328
+ /**
329
+ * Remove a fallback font.
330
+ *
331
+ * This updates any TTF_Text objects using this font.
332
+ *
333
+ * \param font the font to modify.
334
+ * \param fallback the font to remove as a fallback.
335
+ *
336
+ * \threadsafety This function should be called on the thread that created
337
+ * both fonts.
338
+ *
339
+ * \since This function is available since SDL_ttf 3.0.0.
340
+ *
341
+ * \sa TTF_AddFallbackFont
342
+ * \sa TTF_ClearFallbackFonts
343
+ */
344
+ extern SDL_DECLSPEC void SDLCALL TTF_RemoveFallbackFont(TTF_Font *font, TTF_Font *fallback);
345
+
346
+ /**
347
+ * Remove all fallback fonts.
348
+ *
349
+ * This updates any TTF_Text objects using this font.
350
+ *
351
+ * \param font the font to modify.
352
+ *
353
+ * \threadsafety This function should be called on the thread that created the
354
+ * font.
355
+ *
356
+ * \since This function is available since SDL_ttf 3.0.0.
357
+ *
358
+ * \sa TTF_AddFallbackFont
359
+ * \sa TTF_RemoveFallbackFont
360
+ */
361
+ extern SDL_DECLSPEC void SDLCALL TTF_ClearFallbackFonts(TTF_Font *font);
362
+
363
+ /**
364
+ * Set a font's size dynamically.
365
+ *
366
+ * This updates any TTF_Text objects using this font, and clears
367
+ * already-generated glyphs, if any, from the cache.
368
+ *
369
+ * \param font the font to resize.
370
+ * \param ptsize the new point size.
371
+ * \returns true on success or false on failure; call SDL_GetError() for more
372
+ * information.
373
+ *
374
+ * \threadsafety This function should be called on the thread that created the
375
+ * font.
376
+ *
377
+ * \since This function is available since SDL_ttf 3.0.0.
378
+ *
379
+ * \sa TTF_GetFontSize
380
+ */
381
+ extern SDL_DECLSPEC bool SDLCALL TTF_SetFontSize(TTF_Font *font, float ptsize);
382
+
383
+ /**
384
+ * Set font size dynamically with target resolutions, in dots per inch.
385
+ *
386
+ * This updates any TTF_Text objects using this font, and clears
387
+ * already-generated glyphs, if any, from the cache.
388
+ *
389
+ * \param font the font to resize.
390
+ * \param ptsize the new point size.
391
+ * \param hdpi the target horizontal DPI.
392
+ * \param vdpi the target vertical DPI.
393
+ * \returns true on success or false on failure; call SDL_GetError() for more
394
+ * information.
395
+ *
396
+ * \threadsafety This function should be called on the thread that created the
397
+ * font.
398
+ *
399
+ * \since This function is available since SDL_ttf 3.0.0.
400
+ *
401
+ * \sa TTF_GetFontSize
402
+ * \sa TTF_GetFontSizeDPI
403
+ */
404
+ extern SDL_DECLSPEC bool SDLCALL TTF_SetFontSizeDPI(TTF_Font *font, float ptsize, int hdpi, int vdpi);
405
+
406
+ /**
407
+ * Get the size of a font.
408
+ *
409
+ * \param font the font to query.
410
+ * \returns the size of the font, or 0.0f on failure; call SDL_GetError() for
411
+ * more information.
412
+ *
413
+ * \threadsafety This function should be called on the thread that created the
414
+ * font.
415
+ *
416
+ * \since This function is available since SDL_ttf 3.0.0.
417
+ *
418
+ * \sa TTF_SetFontSize
419
+ * \sa TTF_SetFontSizeDPI
420
+ */
421
+ extern SDL_DECLSPEC float SDLCALL TTF_GetFontSize(TTF_Font *font);
422
+
423
+ /**
424
+ * Get font target resolutions, in dots per inch.
425
+ *
426
+ * \param font the font to query.
427
+ * \param hdpi a pointer filled in with the target horizontal DPI.
428
+ * \param vdpi a pointer filled in with the target vertical DPI.
429
+ * \returns true on success or false on failure; call SDL_GetError() for more
430
+ * information.
431
+ *
432
+ * \threadsafety This function should be called on the thread that created the
433
+ * font.
434
+ *
435
+ * \since This function is available since SDL_ttf 3.0.0.
436
+ *
437
+ * \sa TTF_SetFontSizeDPI
438
+ */
439
+ extern SDL_DECLSPEC bool SDLCALL TTF_GetFontDPI(TTF_Font *font, int *hdpi, int *vdpi);
440
+
441
+ /**
442
+ * Font style flags for TTF_Font
443
+ *
444
+ * These are the flags which can be used to set the style of a font in
445
+ * SDL_ttf. A combination of these flags can be used with functions that set
446
+ * or query font style, such as TTF_SetFontStyle or TTF_GetFontStyle.
447
+ *
448
+ * \since This datatype is available since SDL_ttf 3.0.0.
449
+ *
450
+ * \sa TTF_SetFontStyle
451
+ * \sa TTF_GetFontStyle
452
+ */
453
+ typedef Uint32 TTF_FontStyleFlags;
454
+
455
+ #define TTF_STYLE_NORMAL 0x00 /**< No special style */
456
+ #define TTF_STYLE_BOLD 0x01 /**< Bold style */
457
+ #define TTF_STYLE_ITALIC 0x02 /**< Italic style */
458
+ #define TTF_STYLE_UNDERLINE 0x04 /**< Underlined text */
459
+ #define TTF_STYLE_STRIKETHROUGH 0x08 /**< Strikethrough text */
460
+
461
+ /**
462
+ * Set a font's current style.
463
+ *
464
+ * This updates any TTF_Text objects using this font, and clears
465
+ * already-generated glyphs, if any, from the cache.
466
+ *
467
+ * The font styles are a set of bit flags, OR'd together:
468
+ *
469
+ * - `TTF_STYLE_NORMAL` (is zero)
470
+ * - `TTF_STYLE_BOLD`
471
+ * - `TTF_STYLE_ITALIC`
472
+ * - `TTF_STYLE_UNDERLINE`
473
+ * - `TTF_STYLE_STRIKETHROUGH`
474
+ *
475
+ * \param font the font to set a new style on.
476
+ * \param style the new style values to set, OR'd together.
477
+ *
478
+ * \threadsafety This function should be called on the thread that created the
479
+ * font.
480
+ *
481
+ * \since This function is available since SDL_ttf 3.0.0.
482
+ *
483
+ * \sa TTF_GetFontStyle
484
+ */
485
+ extern SDL_DECLSPEC void SDLCALL TTF_SetFontStyle(TTF_Font *font, TTF_FontStyleFlags style);
486
+
487
+ /**
488
+ * Query a font's current style.
489
+ *
490
+ * The font styles are a set of bit flags, OR'd together:
491
+ *
492
+ * - `TTF_STYLE_NORMAL` (is zero)
493
+ * - `TTF_STYLE_BOLD`
494
+ * - `TTF_STYLE_ITALIC`
495
+ * - `TTF_STYLE_UNDERLINE`
496
+ * - `TTF_STYLE_STRIKETHROUGH`
497
+ *
498
+ * \param font the font to query.
499
+ * \returns the current font style, as a set of bit flags.
500
+ *
501
+ * \threadsafety It is safe to call this function from any thread.
502
+ *
503
+ * \since This function is available since SDL_ttf 3.0.0.
504
+ *
505
+ * \sa TTF_SetFontStyle
506
+ */
507
+ extern SDL_DECLSPEC TTF_FontStyleFlags SDLCALL TTF_GetFontStyle(const TTF_Font *font);
508
+
509
+ /**
510
+ * Set a font's current outline.
511
+ *
512
+ * This uses the font properties `TTF_PROP_FONT_OUTLINE_LINE_CAP_NUMBER`,
513
+ * `TTF_PROP_FONT_OUTLINE_LINE_JOIN_NUMBER`, and
514
+ * `TTF_PROP_FONT_OUTLINE_MITER_LIMIT_NUMBER` when setting the font outline.
515
+ *
516
+ * This updates any TTF_Text objects using this font, and clears
517
+ * already-generated glyphs, if any, from the cache.
518
+ *
519
+ * \param font the font to set a new outline on.
520
+ * \param outline positive outline value, 0 to default.
521
+ * \returns true on success or false on failure; call SDL_GetError() for more
522
+ * information.
523
+ *
524
+ * \threadsafety This function should be called on the thread that created the
525
+ * font.
526
+ *
527
+ * \since This function is available since SDL_ttf 3.0.0.
528
+ *
529
+ * \sa TTF_GetFontOutline
530
+ */
531
+ extern SDL_DECLSPEC bool SDLCALL TTF_SetFontOutline(TTF_Font *font, int outline);
532
+
533
+ /**
534
+ * Query a font's current outline.
535
+ *
536
+ * \param font the font to query.
537
+ * \returns the font's current outline value.
538
+ *
539
+ * \threadsafety It is safe to call this function from any thread.
540
+ *
541
+ * \since This function is available since SDL_ttf 3.0.0.
542
+ *
543
+ * \sa TTF_SetFontOutline
544
+ */
545
+ extern SDL_DECLSPEC int SDLCALL TTF_GetFontOutline(const TTF_Font *font);
546
+
547
+ /**
548
+ * Hinting flags for TTF (TrueType Fonts)
549
+ *
550
+ * This enum specifies the level of hinting to be applied to the font
551
+ * rendering. The hinting level determines how much the font's outlines are
552
+ * adjusted for better alignment on the pixel grid.
553
+ *
554
+ * \since This enum is available since SDL_ttf 3.0.0.
555
+ *
556
+ * \sa TTF_SetFontHinting
557
+ * \sa TTF_GetFontHinting
558
+ */
559
+ typedef enum TTF_HintingFlags
560
+ {
561
+ TTF_HINTING_INVALID = -1,
562
+ TTF_HINTING_NORMAL, /**< Normal hinting applies standard grid-fitting. */
563
+ TTF_HINTING_LIGHT, /**< Light hinting applies subtle adjustments to improve rendering. */
564
+ TTF_HINTING_MONO, /**< Monochrome hinting adjusts the font for better rendering at lower resolutions. */
565
+ TTF_HINTING_NONE, /**< No hinting, the font is rendered without any grid-fitting. */
566
+ TTF_HINTING_LIGHT_SUBPIXEL /**< Light hinting with subpixel rendering for more precise font edges. */
567
+ } TTF_HintingFlags;
568
+
569
+ /**
570
+ * Set a font's current hinter setting.
571
+ *
572
+ * This updates any TTF_Text objects using this font, and clears
573
+ * already-generated glyphs, if any, from the cache.
574
+ *
575
+ * The hinter setting is a single value:
576
+ *
577
+ * - `TTF_HINTING_NORMAL`
578
+ * - `TTF_HINTING_LIGHT`
579
+ * - `TTF_HINTING_MONO`
580
+ * - `TTF_HINTING_NONE`
581
+ * - `TTF_HINTING_LIGHT_SUBPIXEL` (available in SDL_ttf 3.0.0 and later)
582
+ *
583
+ * \param font the font to set a new hinter setting on.
584
+ * \param hinting the new hinter setting.
585
+ *
586
+ * \threadsafety This function should be called on the thread that created the
587
+ * font.
588
+ *
589
+ * \since This function is available since SDL_ttf 3.0.0.
590
+ *
591
+ * \sa TTF_GetFontHinting
592
+ */
593
+ extern SDL_DECLSPEC void SDLCALL TTF_SetFontHinting(TTF_Font *font, TTF_HintingFlags hinting);
594
+
595
+ /**
596
+ * Query the number of faces of a font.
597
+ *
598
+ * \param font the font to query.
599
+ * \returns the number of FreeType font faces.
600
+ *
601
+ * \threadsafety It is safe to call this function from any thread.
602
+ *
603
+ * \since This function is available since SDL_ttf 3.0.0.
604
+ */
605
+ extern SDL_DECLSPEC int SDLCALL TTF_GetNumFontFaces(const TTF_Font *font);
606
+
607
+ /**
608
+ * Query a font's current FreeType hinter setting.
609
+ *
610
+ * The hinter setting is a single value:
611
+ *
612
+ * - `TTF_HINTING_NORMAL`
613
+ * - `TTF_HINTING_LIGHT`
614
+ * - `TTF_HINTING_MONO`
615
+ * - `TTF_HINTING_NONE`
616
+ * - `TTF_HINTING_LIGHT_SUBPIXEL` (available in SDL_ttf 3.0.0 and later)
617
+ *
618
+ * \param font the font to query.
619
+ * \returns the font's current hinter value, or TTF_HINTING_INVALID if the
620
+ * font is invalid.
621
+ *
622
+ * \threadsafety It is safe to call this function from any thread.
623
+ *
624
+ * \since This function is available since SDL_ttf 3.0.0.
625
+ *
626
+ * \sa TTF_SetFontHinting
627
+ */
628
+ extern SDL_DECLSPEC TTF_HintingFlags SDLCALL TTF_GetFontHinting(const TTF_Font *font);
629
+
630
+ /**
631
+ * Enable Signed Distance Field rendering for a font.
632
+ *
633
+ * SDF is a technique that helps fonts look sharp even when scaling and
634
+ * rotating, and requires special shader support for display.
635
+ *
636
+ * This works with Blended APIs, and generates the raw signed distance values
637
+ * in the alpha channel of the resulting texture.
638
+ *
639
+ * This updates any TTF_Text objects using this font, and clears
640
+ * already-generated glyphs, if any, from the cache.
641
+ *
642
+ * \param font the font to set SDF support on.
643
+ * \param enabled true to enable SDF, false to disable.
644
+ * \returns true on success or false on failure; call SDL_GetError() for more
645
+ * information.
646
+ *
647
+ * \threadsafety This function should be called on the thread that created the
648
+ * font.
649
+ *
650
+ * \since This function is available since SDL_ttf 3.0.0.
651
+ *
652
+ * \sa TTF_GetFontSDF
653
+ */
654
+ extern SDL_DECLSPEC bool SDLCALL TTF_SetFontSDF(TTF_Font *font, bool enabled);
655
+
656
+ /**
657
+ * Query whether Signed Distance Field rendering is enabled for a font.
658
+ *
659
+ * \param font the font to query.
660
+ * \returns true if enabled, false otherwise.
661
+ *
662
+ * \threadsafety It is safe to call this function from any thread.
663
+ *
664
+ * \since This function is available since SDL_ttf 3.0.0.
665
+ *
666
+ * \sa TTF_SetFontSDF
667
+ */
668
+ extern SDL_DECLSPEC bool SDLCALL TTF_GetFontSDF(const TTF_Font *font);
669
+
670
+ /**
671
+ * Query a font's weight, in terms of the lightness/heaviness of the strokes.
672
+ *
673
+ * \param font the font to query.
674
+ * \returns the font's current weight.
675
+ *
676
+ * \threadsafety This function should be called on the thread that created the
677
+ * font.
678
+ *
679
+ * \since This function is available since SDL_ttf 3.4.0.
680
+ */
681
+ extern SDL_DECLSPEC int SDLCALL TTF_GetFontWeight(const TTF_Font *font);
682
+
683
+ #define TTF_FONT_WEIGHT_THIN 100 /**< Thin (100) named font weight value */
684
+ #define TTF_FONT_WEIGHT_EXTRA_LIGHT 200 /**< ExtraLight (200) named font weight value */
685
+ #define TTF_FONT_WEIGHT_LIGHT 300 /**< Light (300) named font weight value */
686
+ #define TTF_FONT_WEIGHT_NORMAL 400 /**< Normal (400) named font weight value */
687
+ #define TTF_FONT_WEIGHT_MEDIUM 500 /**< Medium (500) named font weight value */
688
+ #define TTF_FONT_WEIGHT_SEMI_BOLD 600 /**< SemiBold (600) named font weight value */
689
+ #define TTF_FONT_WEIGHT_BOLD 700 /**< Bold (700) named font weight value */
690
+ #define TTF_FONT_WEIGHT_EXTRA_BOLD 800 /**< ExtraBold (800) named font weight value */
691
+ #define TTF_FONT_WEIGHT_BLACK 900 /**< Black (900) named font weight value */
692
+ #define TTF_FONT_WEIGHT_EXTRA_BLACK 950 /**< ExtraBlack (950) named font weight value */
693
+
694
+ /**
695
+ * The horizontal alignment used when rendering wrapped text.
696
+ *
697
+ * \since This enum is available since SDL_ttf 3.0.0.
698
+ */
699
+ typedef enum TTF_HorizontalAlignment
700
+ {
701
+ TTF_HORIZONTAL_ALIGN_INVALID = -1,
702
+ TTF_HORIZONTAL_ALIGN_LEFT,
703
+ TTF_HORIZONTAL_ALIGN_CENTER,
704
+ TTF_HORIZONTAL_ALIGN_RIGHT
705
+ } TTF_HorizontalAlignment;
706
+
707
+ /**
708
+ * Set a font's current wrap alignment option.
709
+ *
710
+ * This updates any TTF_Text objects using this font.
711
+ *
712
+ * \param font the font to set a new wrap alignment option on.
713
+ * \param align the new wrap alignment option.
714
+ *
715
+ * \threadsafety This function should be called on the thread that created the
716
+ * font.
717
+ *
718
+ * \since This function is available since SDL_ttf 3.0.0.
719
+ *
720
+ * \sa TTF_GetFontWrapAlignment
721
+ */
722
+ extern SDL_DECLSPEC void SDLCALL TTF_SetFontWrapAlignment(TTF_Font *font, TTF_HorizontalAlignment align);
723
+
724
+ /**
725
+ * Query a font's current wrap alignment option.
726
+ *
727
+ * \param font the font to query.
728
+ * \returns the font's current wrap alignment option.
729
+ *
730
+ * \threadsafety It is safe to call this function from any thread.
731
+ *
732
+ * \since This function is available since SDL_ttf 3.0.0.
733
+ *
734
+ * \sa TTF_SetFontWrapAlignment
735
+ */
736
+ extern SDL_DECLSPEC TTF_HorizontalAlignment SDLCALL TTF_GetFontWrapAlignment(const TTF_Font *font);
737
+
738
+ /**
739
+ * Query the total height of a font.
740
+ *
741
+ * This is usually equal to point size.
742
+ *
743
+ * \param font the font to query.
744
+ * \returns the font's height.
745
+ *
746
+ * \threadsafety It is safe to call this function from any thread.
747
+ *
748
+ * \since This function is available since SDL_ttf 3.0.0.
749
+ */
750
+ extern SDL_DECLSPEC int SDLCALL TTF_GetFontHeight(const TTF_Font *font);
751
+
752
+ /**
753
+ * Query the offset from the baseline to the top of a font.
754
+ *
755
+ * This is a positive value, relative to the baseline.
756
+ *
757
+ * \param font the font to query.
758
+ * \returns the font's ascent.
759
+ *
760
+ * \threadsafety It is safe to call this function from any thread.
761
+ *
762
+ * \since This function is available since SDL_ttf 3.0.0.
763
+ */
764
+ extern SDL_DECLSPEC int SDLCALL TTF_GetFontAscent(const TTF_Font *font);
765
+
766
+ /**
767
+ * Query the offset from the baseline to the bottom of a font.
768
+ *
769
+ * This is a negative value, relative to the baseline.
770
+ *
771
+ * \param font the font to query.
772
+ * \returns the font's descent.
773
+ *
774
+ * \threadsafety It is safe to call this function from any thread.
775
+ *
776
+ * \since This function is available since SDL_ttf 3.0.0.
777
+ */
778
+ extern SDL_DECLSPEC int SDLCALL TTF_GetFontDescent(const TTF_Font *font);
779
+
780
+ /**
781
+ * Set the spacing between lines of text for a font.
782
+ *
783
+ * This updates any TTF_Text objects using this font.
784
+ *
785
+ * \param font the font to modify.
786
+ * \param lineskip the new line spacing for the font.
787
+ *
788
+ * \threadsafety This function should be called on the thread that created the
789
+ * font.
790
+ *
791
+ * \since This function is available since SDL_ttf 3.0.0.
792
+ *
793
+ * \sa TTF_GetFontLineSkip
794
+ */
795
+ extern SDL_DECLSPEC void SDLCALL TTF_SetFontLineSkip(TTF_Font *font, int lineskip);
796
+
797
+ /**
798
+ * Query the spacing between lines of text for a font.
799
+ *
800
+ * \param font the font to query.
801
+ * \returns the font's recommended spacing.
802
+ *
803
+ * \threadsafety It is safe to call this function from any thread.
804
+ *
805
+ * \since This function is available since SDL_ttf 3.0.0.
806
+ *
807
+ * \sa TTF_SetFontLineSkip
808
+ */
809
+ extern SDL_DECLSPEC int SDLCALL TTF_GetFontLineSkip(const TTF_Font *font);
810
+
811
+ /**
812
+ * Set if kerning is enabled for a font.
813
+ *
814
+ * Newly-opened fonts default to allowing kerning. This is generally a good
815
+ * policy unless you have a strong reason to disable it, as it tends to
816
+ * produce better rendering (with kerning disabled, some fonts might render
817
+ * the word `kerning` as something that looks like `keming` for example).
818
+ *
819
+ * This updates any TTF_Text objects using this font.
820
+ *
821
+ * \param font the font to set kerning on.
822
+ * \param enabled true to enable kerning, false to disable.
823
+ *
824
+ * \threadsafety This function should be called on the thread that created the
825
+ * font.
826
+ *
827
+ * \since This function is available since SDL_ttf 3.0.0.
828
+ *
829
+ * \sa TTF_GetFontKerning
830
+ */
831
+ extern SDL_DECLSPEC void SDLCALL TTF_SetFontKerning(TTF_Font *font, bool enabled);
832
+
833
+ /**
834
+ * Query whether or not kerning is enabled for a font.
835
+ *
836
+ * \param font the font to query.
837
+ * \returns true if kerning is enabled, false otherwise.
838
+ *
839
+ * \threadsafety It is safe to call this function from any thread.
840
+ *
841
+ * \since This function is available since SDL_ttf 3.0.0.
842
+ *
843
+ * \sa TTF_SetFontKerning
844
+ */
845
+ extern SDL_DECLSPEC bool SDLCALL TTF_GetFontKerning(const TTF_Font *font);
846
+
847
+ /**
848
+ * Query whether a font is fixed-width.
849
+ *
850
+ * A "fixed-width" font means all glyphs are the same width across; a
851
+ * lowercase 'i' will be the same size across as a capital 'W', for example.
852
+ * This is common for terminals and text editors, and other apps that treat
853
+ * text as a grid. Most other things (WYSIWYG word processors, web pages, etc)
854
+ * are more likely to not be fixed-width in most cases.
855
+ *
856
+ * \param font the font to query.
857
+ * \returns true if the font is fixed-width, false otherwise.
858
+ *
859
+ * \threadsafety It is safe to call this function from any thread.
860
+ *
861
+ * \since This function is available since SDL_ttf 3.0.0.
862
+ */
863
+ extern SDL_DECLSPEC bool SDLCALL TTF_FontIsFixedWidth(const TTF_Font *font);
864
+
865
+ /**
866
+ * Query whether a font is scalable or not.
867
+ *
868
+ * Scalability lets us distinguish between outline and bitmap fonts.
869
+ *
870
+ * \param font the font to query.
871
+ * \returns true if the font is scalable, false otherwise.
872
+ *
873
+ * \threadsafety It is safe to call this function from any thread.
874
+ *
875
+ * \since This function is available since SDL_ttf 3.0.0.
876
+ *
877
+ * \sa TTF_SetFontSDF
878
+ */
879
+ extern SDL_DECLSPEC bool SDLCALL TTF_FontIsScalable(const TTF_Font *font);
880
+
881
+ /**
882
+ * Query a font's family name.
883
+ *
884
+ * This string is dictated by the contents of the font file.
885
+ *
886
+ * Note that the returned string is to internal storage, and should not be
887
+ * modified or free'd by the caller. The string becomes invalid, with the rest
888
+ * of the font, when `font` is handed to TTF_CloseFont().
889
+ *
890
+ * \param font the font to query.
891
+ * \returns the font's family name.
892
+ *
893
+ * \threadsafety It is safe to call this function from any thread.
894
+ *
895
+ * \since This function is available since SDL_ttf 3.0.0.
896
+ */
897
+ extern SDL_DECLSPEC const char * SDLCALL TTF_GetFontFamilyName(const TTF_Font *font);
898
+
899
+ /**
900
+ * Query a font's style name.
901
+ *
902
+ * This string is dictated by the contents of the font file.
903
+ *
904
+ * Note that the returned string is to internal storage, and should not be
905
+ * modified or free'd by the caller. The string becomes invalid, with the rest
906
+ * of the font, when `font` is handed to TTF_CloseFont().
907
+ *
908
+ * \param font the font to query.
909
+ * \returns the font's style name.
910
+ *
911
+ * \threadsafety It is safe to call this function from any thread.
912
+ *
913
+ * \since This function is available since SDL_ttf 3.0.0.
914
+ */
915
+ extern SDL_DECLSPEC const char * SDLCALL TTF_GetFontStyleName(const TTF_Font *font);
916
+
917
+ /**
918
+ * Direction flags
919
+ *
920
+ * The values here are chosen to match
921
+ * [hb_direction_t](https://harfbuzz.github.io/harfbuzz-hb-common.html#hb-direction-t)
922
+ * .
923
+ *
924
+ * \since This enum is available since SDL_ttf 3.0.0.
925
+ *
926
+ * \sa TTF_SetFontDirection
927
+ */
928
+ typedef enum TTF_Direction
929
+ {
930
+ TTF_DIRECTION_INVALID = 0,
931
+ TTF_DIRECTION_LTR = 4, /**< Left to Right */
932
+ TTF_DIRECTION_RTL, /**< Right to Left */
933
+ TTF_DIRECTION_TTB, /**< Top to Bottom */
934
+ TTF_DIRECTION_BTT /**< Bottom to Top */
935
+ } TTF_Direction;
936
+
937
+ /**
938
+ * Set the direction to be used for text shaping by a font.
939
+ *
940
+ * This function only supports left-to-right text shaping if SDL_ttf was not
941
+ * built with HarfBuzz support.
942
+ *
943
+ * This updates any TTF_Text objects using this font.
944
+ *
945
+ * \param font the font to modify.
946
+ * \param direction the new direction for text to flow.
947
+ * \returns true on success or false on failure; call SDL_GetError() for more
948
+ * information.
949
+ *
950
+ * \threadsafety This function should be called on the thread that created the
951
+ * font.
952
+ *
953
+ * \since This function is available since SDL_ttf 3.0.0.
954
+ */
955
+ extern SDL_DECLSPEC bool SDLCALL TTF_SetFontDirection(TTF_Font *font, TTF_Direction direction);
956
+
957
+ /**
958
+ * Get the direction to be used for text shaping by a font.
959
+ *
960
+ * This defaults to TTF_DIRECTION_INVALID if it hasn't been set.
961
+ *
962
+ * \param font the font to query.
963
+ * \returns the direction to be used for text shaping.
964
+ *
965
+ * \threadsafety This function should be called on the thread that created the
966
+ * font.
967
+ *
968
+ * \since This function is available since SDL_ttf 3.0.0.
969
+ */
970
+ extern SDL_DECLSPEC TTF_Direction SDLCALL TTF_GetFontDirection(TTF_Font *font);
971
+
972
+ /**
973
+ * Convert from a 4 character string to a 32-bit tag.
974
+ *
975
+ * \param string the 4 character string to convert.
976
+ * \returns the 32-bit representation of the string.
977
+ *
978
+ * \threadsafety It is safe to call this function from any thread.
979
+ *
980
+ * \since This function is available since SDL_ttf 3.0.0.
981
+ *
982
+ * \sa TTF_TagToString
983
+ */
984
+ extern SDL_DECLSPEC Uint32 SDLCALL TTF_StringToTag(const char *string);
985
+
986
+ /**
987
+ * Convert from a 32-bit tag to a 4 character string.
988
+ *
989
+ * \param tag the 32-bit tag to convert.
990
+ * \param string a pointer filled in with the 4 character representation of
991
+ * the tag.
992
+ * \param size the size of the buffer pointed at by string, should be at least
993
+ * 4.
994
+ *
995
+ * \threadsafety It is safe to call this function from any thread.
996
+ *
997
+ * \since This function is available since SDL_ttf 3.0.0.
998
+ *
999
+ * \sa TTF_TagToString
1000
+ */
1001
+ extern SDL_DECLSPEC void SDLCALL TTF_TagToString(Uint32 tag, char *string, size_t size);
1002
+
1003
+ /**
1004
+ * Set the script to be used for text shaping by a font.
1005
+ *
1006
+ * This returns false if SDL_ttf isn't built with HarfBuzz support.
1007
+ *
1008
+ * This updates any TTF_Text objects using this font.
1009
+ *
1010
+ * \param font the font to modify.
1011
+ * \param script an
1012
+ * [ISO 15924 code](https://unicode.org/iso15924/iso15924-codes.html)
1013
+ * .
1014
+ * \returns true on success or false on failure; call SDL_GetError() for more
1015
+ * information.
1016
+ *
1017
+ * \threadsafety This function should be called on the thread that created the
1018
+ * font.
1019
+ *
1020
+ * \since This function is available since SDL_ttf 3.0.0.
1021
+ *
1022
+ * \sa TTF_StringToTag
1023
+ */
1024
+ extern SDL_DECLSPEC bool SDLCALL TTF_SetFontScript(TTF_Font *font, Uint32 script);
1025
+
1026
+ /**
1027
+ * Get the script used for text shaping a font.
1028
+ *
1029
+ * \param font the font to query.
1030
+ * \returns an
1031
+ * [ISO 15924 code](https://unicode.org/iso15924/iso15924-codes.html)
1032
+ * or 0 if a script hasn't been set.
1033
+ *
1034
+ * \threadsafety This function should be called on the thread that created the
1035
+ * font.
1036
+ *
1037
+ * \since This function is available since SDL_ttf 3.0.0.
1038
+ *
1039
+ * \sa TTF_TagToString
1040
+ */
1041
+ extern SDL_DECLSPEC Uint32 SDLCALL TTF_GetFontScript(TTF_Font *font);
1042
+
1043
+ /**
1044
+ * Get the script used by a 32-bit codepoint.
1045
+ *
1046
+ * \param ch the character code to check.
1047
+ * \returns an
1048
+ * [ISO 15924 code](https://unicode.org/iso15924/iso15924-codes.html)
1049
+ * on success, or 0 on failure; call SDL_GetError() for more
1050
+ * information.
1051
+ *
1052
+ * \threadsafety This function is thread-safe.
1053
+ *
1054
+ * \since This function is available since SDL_ttf 3.0.0.
1055
+ *
1056
+ * \sa TTF_TagToString
1057
+ */
1058
+ extern SDL_DECLSPEC Uint32 SDLCALL TTF_GetGlyphScript(Uint32 ch);
1059
+
1060
+ /**
1061
+ * Set language to be used for text shaping by a font.
1062
+ *
1063
+ * If SDL_ttf was not built with HarfBuzz support, this function returns
1064
+ * false.
1065
+ *
1066
+ * This updates any TTF_Text objects using this font.
1067
+ *
1068
+ * \param font the font to specify a language for.
1069
+ * \param language_bcp47 a null-terminated string containing the desired
1070
+ * language's BCP47 code. Or null to reset the value.
1071
+ * \returns true on success or false on failure; call SDL_GetError() for more
1072
+ * information.
1073
+ *
1074
+ * \threadsafety This function should be called on the thread that created the
1075
+ * font.
1076
+ *
1077
+ * \since This function is available since SDL_ttf 3.0.0.
1078
+ */
1079
+ extern SDL_DECLSPEC bool SDLCALL TTF_SetFontLanguage(TTF_Font *font, const char *language_bcp47);
1080
+
1081
+ /**
1082
+ * Check whether a glyph is provided by the font for a UNICODE codepoint.
1083
+ *
1084
+ * \param font the font to query.
1085
+ * \param ch the codepoint to check.
1086
+ * \returns true if font provides a glyph for this character, false if not.
1087
+ *
1088
+ * \threadsafety This function should be called on the thread that created the
1089
+ * font.
1090
+ *
1091
+ * \since This function is available since SDL_ttf 3.0.0.
1092
+ */
1093
+ extern SDL_DECLSPEC bool SDLCALL TTF_FontHasGlyph(TTF_Font *font, Uint32 ch);
1094
+
1095
+ /**
1096
+ * The type of data in a glyph image
1097
+ *
1098
+ * \since This enum is available since SDL_ttf 3.0.0.
1099
+ */
1100
+ typedef enum TTF_ImageType
1101
+ {
1102
+ TTF_IMAGE_INVALID,
1103
+ TTF_IMAGE_ALPHA, /**< The color channels are white */
1104
+ TTF_IMAGE_COLOR, /**< The color channels have image data */
1105
+ TTF_IMAGE_SDF, /**< The alpha channel has signed distance field information */
1106
+ } TTF_ImageType;
1107
+
1108
+ /**
1109
+ * Get the pixel image for a UNICODE codepoint.
1110
+ *
1111
+ * \param font the font to query.
1112
+ * \param ch the codepoint to check.
1113
+ * \param image_type a pointer filled in with the glyph image type, may be
1114
+ * NULL.
1115
+ * \returns an SDL_Surface containing the glyph, or NULL on failure; call
1116
+ * SDL_GetError() for more information.
1117
+ *
1118
+ * \threadsafety This function should be called on the thread that created the
1119
+ * font.
1120
+ *
1121
+ * \since This function is available since SDL_ttf 3.0.0.
1122
+ */
1123
+ extern SDL_DECLSPEC SDL_Surface * SDLCALL TTF_GetGlyphImage(TTF_Font *font, Uint32 ch, TTF_ImageType *image_type);
1124
+
1125
+ /**
1126
+ * Get the pixel image for a character index.
1127
+ *
1128
+ * This is useful for text engine implementations, which can call this with
1129
+ * the `glyph_index` in a TTF_CopyOperation
1130
+ *
1131
+ * \param font the font to query.
1132
+ * \param glyph_index the index of the glyph to return.
1133
+ * \param image_type a pointer filled in with the glyph image type, may be
1134
+ * NULL.
1135
+ * \returns an SDL_Surface containing the glyph, or NULL on failure; call
1136
+ * SDL_GetError() for more information.
1137
+ *
1138
+ * \threadsafety This function should be called on the thread that created the
1139
+ * font.
1140
+ *
1141
+ * \since This function is available since SDL_ttf 3.0.0.
1142
+ */
1143
+ extern SDL_DECLSPEC SDL_Surface * SDLCALL TTF_GetGlyphImageForIndex(TTF_Font *font, Uint32 glyph_index, TTF_ImageType *image_type);
1144
+
1145
+ /**
1146
+ * Query the metrics (dimensions) of a font's glyph for a UNICODE codepoint.
1147
+ *
1148
+ * To understand what these metrics mean, here is a useful link:
1149
+ *
1150
+ * https://freetype.sourceforge.net/freetype2/docs/tutorial/step2.html
1151
+ *
1152
+ * \param font the font to query.
1153
+ * \param ch the codepoint to check.
1154
+ * \param minx a pointer filled in with the minimum x coordinate of the glyph
1155
+ * from the left edge of its bounding box. This value may be
1156
+ * negative.
1157
+ * \param maxx a pointer filled in with the maximum x coordinate of the glyph
1158
+ * from the left edge of its bounding box.
1159
+ * \param miny a pointer filled in with the minimum y coordinate of the glyph
1160
+ * from the bottom edge of its bounding box. This value may be
1161
+ * negative.
1162
+ * \param maxy a pointer filled in with the maximum y coordinate of the glyph
1163
+ * from the bottom edge of its bounding box.
1164
+ * \param advance a pointer filled in with the distance to the next glyph from
1165
+ * the left edge of this glyph's bounding box.
1166
+ * \returns true on success or false on failure; call SDL_GetError() for more
1167
+ * information.
1168
+ *
1169
+ * \threadsafety This function should be called on the thread that created the
1170
+ * font.
1171
+ *
1172
+ * \since This function is available since SDL_ttf 3.0.0.
1173
+ */
1174
+ extern SDL_DECLSPEC bool SDLCALL TTF_GetGlyphMetrics(TTF_Font *font, Uint32 ch, int *minx, int *maxx, int *miny, int *maxy, int *advance);
1175
+
1176
+ /**
1177
+ * Query the kerning size between the glyphs of two UNICODE codepoints.
1178
+ *
1179
+ * \param font the font to query.
1180
+ * \param previous_ch the previous codepoint.
1181
+ * \param ch the current codepoint.
1182
+ * \param kerning a pointer filled in with the kerning size between the two
1183
+ * glyphs, in pixels, may be NULL.
1184
+ * \returns true on success or false on failure; call SDL_GetError() for more
1185
+ * information.
1186
+ *
1187
+ * \threadsafety This function should be called on the thread that created the
1188
+ * font.
1189
+ *
1190
+ * \since This function is available since SDL_ttf 3.0.0.
1191
+ */
1192
+ extern SDL_DECLSPEC bool SDLCALL TTF_GetGlyphKerning(TTF_Font *font, Uint32 previous_ch, Uint32 ch, int *kerning);
1193
+
1194
+ /**
1195
+ * Calculate the dimensions of a rendered string of UTF-8 text.
1196
+ *
1197
+ * This will report the width and height, in pixels, of the space that the
1198
+ * specified string will take to fully render.
1199
+ *
1200
+ * \param font the font to query.
1201
+ * \param text text to calculate, in UTF-8 encoding.
1202
+ * \param length the length of the text, in bytes, or 0 for null terminated
1203
+ * text.
1204
+ * \param w will be filled with width, in pixels, on return.
1205
+ * \param h will be filled with height, in pixels, on return.
1206
+ * \returns true on success or false on failure; call SDL_GetError() for more
1207
+ * information.
1208
+ *
1209
+ * \threadsafety This function should be called on the thread that created the
1210
+ * font.
1211
+ *
1212
+ * \since This function is available since SDL_ttf 3.0.0.
1213
+ */
1214
+ extern SDL_DECLSPEC bool SDLCALL TTF_GetStringSize(TTF_Font *font, const char *text, size_t length, int *w, int *h);
1215
+
1216
+ /**
1217
+ * Calculate the dimensions of a rendered string of UTF-8 text.
1218
+ *
1219
+ * This will report the width and height, in pixels, of the space that the
1220
+ * specified string will take to fully render.
1221
+ *
1222
+ * Text is wrapped to multiple lines on line endings and on word boundaries if
1223
+ * it extends beyond `wrap_width` in pixels.
1224
+ *
1225
+ * If wrap_width is 0, this function will only wrap on newline characters.
1226
+ *
1227
+ * \param font the font to query.
1228
+ * \param text text to calculate, in UTF-8 encoding.
1229
+ * \param length the length of the text, in bytes, or 0 for null terminated
1230
+ * text.
1231
+ * \param wrap_width the maximum width or 0 to wrap on newline characters.
1232
+ * \param w will be filled with width, in pixels, on return.
1233
+ * \param h will be filled with height, in pixels, on return.
1234
+ * \returns true on success or false on failure; call SDL_GetError() for more
1235
+ * information.
1236
+ *
1237
+ * \threadsafety This function should be called on the thread that created the
1238
+ * font.
1239
+ *
1240
+ * \since This function is available since SDL_ttf 3.0.0.
1241
+ */
1242
+ extern SDL_DECLSPEC bool SDLCALL TTF_GetStringSizeWrapped(TTF_Font *font, const char *text, size_t length, int wrap_width, int *w, int *h);
1243
+
1244
+ /**
1245
+ * Calculate how much of a UTF-8 string will fit in a given width.
1246
+ *
1247
+ * This reports the number of characters that can be rendered before reaching
1248
+ * `max_width`.
1249
+ *
1250
+ * This does not need to render the string to do this calculation.
1251
+ *
1252
+ * \param font the font to query.
1253
+ * \param text text to calculate, in UTF-8 encoding.
1254
+ * \param length the length of the text, in bytes, or 0 for null terminated
1255
+ * text.
1256
+ * \param max_width maximum width, in pixels, available for the string, or 0
1257
+ * for unbounded width.
1258
+ * \param measured_width a pointer filled in with the width, in pixels, of the
1259
+ * string that will fit, may be NULL.
1260
+ * \param measured_length a pointer filled in with the length, in bytes, of
1261
+ * the string that will fit, may be NULL.
1262
+ * \returns true on success or false on failure; call SDL_GetError() for more
1263
+ * information.
1264
+ *
1265
+ * \threadsafety This function should be called on the thread that created the
1266
+ * font.
1267
+ *
1268
+ * \since This function is available since SDL_ttf 3.0.0.
1269
+ */
1270
+ extern SDL_DECLSPEC bool SDLCALL TTF_MeasureString(TTF_Font *font, const char *text, size_t length, int max_width, int *measured_width, size_t *measured_length);
1271
+
1272
+ /**
1273
+ * Render UTF-8 text at fast quality to a new 8-bit surface.
1274
+ *
1275
+ * This function will allocate a new 8-bit, palettized surface. The surface's
1276
+ * 0 pixel will be the colorkey, giving a transparent background. The 1 pixel
1277
+ * will be set to the text color.
1278
+ *
1279
+ * This will not word-wrap the string; you'll get a surface with a single line
1280
+ * of text, as long as the string requires. You can use
1281
+ * TTF_RenderText_Solid_Wrapped() instead if you need to wrap the output to
1282
+ * multiple lines.
1283
+ *
1284
+ * This will not wrap on newline characters.
1285
+ *
1286
+ * You can render at other quality levels with TTF_RenderText_Shaded,
1287
+ * TTF_RenderText_Blended, and TTF_RenderText_LCD.
1288
+ *
1289
+ * \param font the font to render with.
1290
+ * \param text text to render, in UTF-8 encoding.
1291
+ * \param length the length of the text, in bytes, or 0 for null terminated
1292
+ * text.
1293
+ * \param fg the foreground color for the text.
1294
+ * \returns a new 8-bit, palettized surface, or NULL if there was an error.
1295
+ *
1296
+ * \threadsafety This function should be called on the thread that created the
1297
+ * font.
1298
+ *
1299
+ * \since This function is available since SDL_ttf 3.0.0.
1300
+ *
1301
+ * \sa TTF_RenderText_Blended
1302
+ * \sa TTF_RenderText_LCD
1303
+ * \sa TTF_RenderText_Shaded
1304
+ * \sa TTF_RenderText_Solid
1305
+ * \sa TTF_RenderText_Solid_Wrapped
1306
+ */
1307
+ extern SDL_DECLSPEC SDL_Surface * SDLCALL TTF_RenderText_Solid(TTF_Font *font, const char *text, size_t length, SDL_Color fg);
1308
+
1309
+ /**
1310
+ * Render word-wrapped UTF-8 text at fast quality to a new 8-bit surface.
1311
+ *
1312
+ * This function will allocate a new 8-bit, palettized surface. The surface's
1313
+ * 0 pixel will be the colorkey, giving a transparent background. The 1 pixel
1314
+ * will be set to the text color.
1315
+ *
1316
+ * Text is wrapped to multiple lines on line endings and on word boundaries if
1317
+ * it extends beyond `wrapLength` in pixels.
1318
+ *
1319
+ * If wrapLength is 0, this function will only wrap on newline characters.
1320
+ *
1321
+ * You can render at other quality levels with TTF_RenderText_Shaded_Wrapped,
1322
+ * TTF_RenderText_Blended_Wrapped, and TTF_RenderText_LCD_Wrapped.
1323
+ *
1324
+ * \param font the font to render with.
1325
+ * \param text text to render, in UTF-8 encoding.
1326
+ * \param length the length of the text, in bytes, or 0 for null terminated
1327
+ * text.
1328
+ * \param fg the foreground color for the text.
1329
+ * \param wrapLength the maximum width of the text surface or 0 to wrap on
1330
+ * newline characters.
1331
+ * \returns a new 8-bit, palettized surface, or NULL if there was an error.
1332
+ *
1333
+ * \threadsafety This function should be called on the thread that created the
1334
+ * font.
1335
+ *
1336
+ * \since This function is available since SDL_ttf 3.0.0.
1337
+ *
1338
+ * \sa TTF_RenderText_Blended_Wrapped
1339
+ * \sa TTF_RenderText_LCD_Wrapped
1340
+ * \sa TTF_RenderText_Shaded_Wrapped
1341
+ * \sa TTF_RenderText_Solid
1342
+ */
1343
+ extern SDL_DECLSPEC SDL_Surface * SDLCALL TTF_RenderText_Solid_Wrapped(TTF_Font *font, const char *text, size_t length, SDL_Color fg, int wrapLength);
1344
+
1345
+ /**
1346
+ * Render a single 32-bit glyph at fast quality to a new 8-bit surface.
1347
+ *
1348
+ * This function will allocate a new 8-bit, palettized surface. The surface's
1349
+ * 0 pixel will be the colorkey, giving a transparent background. The 1 pixel
1350
+ * will be set to the text color.
1351
+ *
1352
+ * The glyph is rendered without any padding or centering in the X direction,
1353
+ * and aligned normally in the Y direction.
1354
+ *
1355
+ * You can render at other quality levels with TTF_RenderGlyph_Shaded,
1356
+ * TTF_RenderGlyph_Blended, and TTF_RenderGlyph_LCD.
1357
+ *
1358
+ * \param font the font to render with.
1359
+ * \param ch the character to render.
1360
+ * \param fg the foreground color for the text.
1361
+ * \returns a new 8-bit, palettized surface, or NULL if there was an error.
1362
+ *
1363
+ * \threadsafety This function should be called on the thread that created the
1364
+ * font.
1365
+ *
1366
+ * \since This function is available since SDL_ttf 3.0.0.
1367
+ *
1368
+ * \sa TTF_RenderGlyph_Blended
1369
+ * \sa TTF_RenderGlyph_LCD
1370
+ * \sa TTF_RenderGlyph_Shaded
1371
+ */
1372
+ extern SDL_DECLSPEC SDL_Surface * SDLCALL TTF_RenderGlyph_Solid(TTF_Font *font, Uint32 ch, SDL_Color fg);
1373
+
1374
+ /**
1375
+ * Render UTF-8 text at high quality to a new 8-bit surface.
1376
+ *
1377
+ * This function will allocate a new 8-bit, palettized surface. The surface's
1378
+ * 0 pixel will be the specified background color, while other pixels have
1379
+ * varying degrees of the foreground color. This function returns the new
1380
+ * surface, or NULL if there was an error.
1381
+ *
1382
+ * This will not word-wrap the string; you'll get a surface with a single line
1383
+ * of text, as long as the string requires. You can use
1384
+ * TTF_RenderText_Shaded_Wrapped() instead if you need to wrap the output to
1385
+ * multiple lines.
1386
+ *
1387
+ * This will not wrap on newline characters.
1388
+ *
1389
+ * You can render at other quality levels with TTF_RenderText_Solid,
1390
+ * TTF_RenderText_Blended, and TTF_RenderText_LCD.
1391
+ *
1392
+ * \param font the font to render with.
1393
+ * \param text text to render, in UTF-8 encoding.
1394
+ * \param length the length of the text, in bytes, or 0 for null terminated
1395
+ * text.
1396
+ * \param fg the foreground color for the text.
1397
+ * \param bg the background color for the text.
1398
+ * \returns a new 8-bit, palettized surface, or NULL if there was an error.
1399
+ *
1400
+ * \threadsafety This function should be called on the thread that created the
1401
+ * font.
1402
+ *
1403
+ * \since This function is available since SDL_ttf 3.0.0.
1404
+ *
1405
+ * \sa TTF_RenderText_Blended
1406
+ * \sa TTF_RenderText_LCD
1407
+ * \sa TTF_RenderText_Shaded_Wrapped
1408
+ * \sa TTF_RenderText_Solid
1409
+ */
1410
+ extern SDL_DECLSPEC SDL_Surface * SDLCALL TTF_RenderText_Shaded(TTF_Font *font, const char *text, size_t length, SDL_Color fg, SDL_Color bg);
1411
+
1412
+ /**
1413
+ * Render word-wrapped UTF-8 text at high quality to a new 8-bit surface.
1414
+ *
1415
+ * This function will allocate a new 8-bit, palettized surface. The surface's
1416
+ * 0 pixel will be the specified background color, while other pixels have
1417
+ * varying degrees of the foreground color. This function returns the new
1418
+ * surface, or NULL if there was an error.
1419
+ *
1420
+ * Text is wrapped to multiple lines on line endings and on word boundaries if
1421
+ * it extends beyond `wrap_width` in pixels.
1422
+ *
1423
+ * If wrap_width is 0, this function will only wrap on newline characters.
1424
+ *
1425
+ * You can render at other quality levels with TTF_RenderText_Solid_Wrapped,
1426
+ * TTF_RenderText_Blended_Wrapped, and TTF_RenderText_LCD_Wrapped.
1427
+ *
1428
+ * \param font the font to render with.
1429
+ * \param text text to render, in UTF-8 encoding.
1430
+ * \param length the length of the text, in bytes, or 0 for null terminated
1431
+ * text.
1432
+ * \param fg the foreground color for the text.
1433
+ * \param bg the background color for the text.
1434
+ * \param wrap_width the maximum width of the text surface or 0 to wrap on
1435
+ * newline characters.
1436
+ * \returns a new 8-bit, palettized surface, or NULL if there was an error.
1437
+ *
1438
+ * \threadsafety This function should be called on the thread that created the
1439
+ * font.
1440
+ *
1441
+ * \since This function is available since SDL_ttf 3.0.0.
1442
+ *
1443
+ * \sa TTF_RenderText_Blended_Wrapped
1444
+ * \sa TTF_RenderText_LCD_Wrapped
1445
+ * \sa TTF_RenderText_Shaded
1446
+ * \sa TTF_RenderText_Solid_Wrapped
1447
+ */
1448
+ extern SDL_DECLSPEC SDL_Surface * SDLCALL TTF_RenderText_Shaded_Wrapped(TTF_Font *font, const char *text, size_t length, SDL_Color fg, SDL_Color bg, int wrap_width);
1449
+
1450
+ /**
1451
+ * Render a single UNICODE codepoint at high quality to a new 8-bit surface.
1452
+ *
1453
+ * This function will allocate a new 8-bit, palettized surface. The surface's
1454
+ * 0 pixel will be the specified background color, while other pixels have
1455
+ * varying degrees of the foreground color. This function returns the new
1456
+ * surface, or NULL if there was an error.
1457
+ *
1458
+ * The glyph is rendered without any padding or centering in the X direction,
1459
+ * and aligned normally in the Y direction.
1460
+ *
1461
+ * You can render at other quality levels with TTF_RenderGlyph_Solid,
1462
+ * TTF_RenderGlyph_Blended, and TTF_RenderGlyph_LCD.
1463
+ *
1464
+ * \param font the font to render with.
1465
+ * \param ch the codepoint to render.
1466
+ * \param fg the foreground color for the text.
1467
+ * \param bg the background color for the text.
1468
+ * \returns a new 8-bit, palettized surface, or NULL if there was an error.
1469
+ *
1470
+ * \threadsafety This function should be called on the thread that created the
1471
+ * font.
1472
+ *
1473
+ * \since This function is available since SDL_ttf 3.0.0.
1474
+ *
1475
+ * \sa TTF_RenderGlyph_Blended
1476
+ * \sa TTF_RenderGlyph_LCD
1477
+ * \sa TTF_RenderGlyph_Solid
1478
+ */
1479
+ extern SDL_DECLSPEC SDL_Surface * SDLCALL TTF_RenderGlyph_Shaded(TTF_Font *font, Uint32 ch, SDL_Color fg, SDL_Color bg);
1480
+
1481
+ /**
1482
+ * Render UTF-8 text at high quality to a new ARGB surface.
1483
+ *
1484
+ * This function will allocate a new 32-bit, ARGB surface, using alpha
1485
+ * blending to dither the font with the given color. This function returns the
1486
+ * new surface, or NULL if there was an error.
1487
+ *
1488
+ * This will not word-wrap the string; you'll get a surface with a single line
1489
+ * of text, as long as the string requires. You can use
1490
+ * TTF_RenderText_Blended_Wrapped() instead if you need to wrap the output to
1491
+ * multiple lines.
1492
+ *
1493
+ * This will not wrap on newline characters.
1494
+ *
1495
+ * You can render at other quality levels with TTF_RenderText_Solid,
1496
+ * TTF_RenderText_Shaded, and TTF_RenderText_LCD.
1497
+ *
1498
+ * \param font the font to render with.
1499
+ * \param text text to render, in UTF-8 encoding.
1500
+ * \param length the length of the text, in bytes, or 0 for null terminated
1501
+ * text.
1502
+ * \param fg the foreground color for the text.
1503
+ * \returns a new 32-bit, ARGB surface, or NULL if there was an error.
1504
+ *
1505
+ * \threadsafety This function should be called on the thread that created the
1506
+ * font.
1507
+ *
1508
+ * \since This function is available since SDL_ttf 3.0.0.
1509
+ *
1510
+ * \sa TTF_RenderText_Blended_Wrapped
1511
+ * \sa TTF_RenderText_LCD
1512
+ * \sa TTF_RenderText_Shaded
1513
+ * \sa TTF_RenderText_Solid
1514
+ */
1515
+ extern SDL_DECLSPEC SDL_Surface * SDLCALL TTF_RenderText_Blended(TTF_Font *font, const char *text, size_t length, SDL_Color fg);
1516
+
1517
+ /**
1518
+ * Render word-wrapped UTF-8 text at high quality to a new ARGB surface.
1519
+ *
1520
+ * This function will allocate a new 32-bit, ARGB surface, using alpha
1521
+ * blending to dither the font with the given color. This function returns the
1522
+ * new surface, or NULL if there was an error.
1523
+ *
1524
+ * Text is wrapped to multiple lines on line endings and on word boundaries if
1525
+ * it extends beyond `wrap_width` in pixels.
1526
+ *
1527
+ * If wrap_width is 0, this function will only wrap on newline characters.
1528
+ *
1529
+ * You can render at other quality levels with TTF_RenderText_Solid_Wrapped,
1530
+ * TTF_RenderText_Shaded_Wrapped, and TTF_RenderText_LCD_Wrapped.
1531
+ *
1532
+ * \param font the font to render with.
1533
+ * \param text text to render, in UTF-8 encoding.
1534
+ * \param length the length of the text, in bytes, or 0 for null terminated
1535
+ * text.
1536
+ * \param fg the foreground color for the text.
1537
+ * \param wrap_width the maximum width of the text surface or 0 to wrap on
1538
+ * newline characters.
1539
+ * \returns a new 32-bit, ARGB surface, or NULL if there was an error.
1540
+ *
1541
+ * \threadsafety This function should be called on the thread that created the
1542
+ * font.
1543
+ *
1544
+ * \since This function is available since SDL_ttf 3.0.0.
1545
+ *
1546
+ * \sa TTF_RenderText_Blended
1547
+ * \sa TTF_RenderText_LCD_Wrapped
1548
+ * \sa TTF_RenderText_Shaded_Wrapped
1549
+ * \sa TTF_RenderText_Solid_Wrapped
1550
+ */
1551
+ extern SDL_DECLSPEC SDL_Surface * SDLCALL TTF_RenderText_Blended_Wrapped(TTF_Font *font, const char *text, size_t length, SDL_Color fg, int wrap_width);
1552
+
1553
+ /**
1554
+ * Render a single UNICODE codepoint at high quality to a new ARGB surface.
1555
+ *
1556
+ * This function will allocate a new 32-bit, ARGB surface, using alpha
1557
+ * blending to dither the font with the given color. This function returns the
1558
+ * new surface, or NULL if there was an error.
1559
+ *
1560
+ * The glyph is rendered without any padding or centering in the X direction,
1561
+ * and aligned normally in the Y direction.
1562
+ *
1563
+ * You can render at other quality levels with TTF_RenderGlyph_Solid,
1564
+ * TTF_RenderGlyph_Shaded, and TTF_RenderGlyph_LCD.
1565
+ *
1566
+ * \param font the font to render with.
1567
+ * \param ch the codepoint to render.
1568
+ * \param fg the foreground color for the text.
1569
+ * \returns a new 32-bit, ARGB surface, or NULL if there was an error.
1570
+ *
1571
+ * \threadsafety This function should be called on the thread that created the
1572
+ * font.
1573
+ *
1574
+ * \since This function is available since SDL_ttf 3.0.0.
1575
+ *
1576
+ * \sa TTF_RenderGlyph_LCD
1577
+ * \sa TTF_RenderGlyph_Shaded
1578
+ * \sa TTF_RenderGlyph_Solid
1579
+ */
1580
+ extern SDL_DECLSPEC SDL_Surface * SDLCALL TTF_RenderGlyph_Blended(TTF_Font *font, Uint32 ch, SDL_Color fg);
1581
+
1582
+ /**
1583
+ * Render UTF-8 text at LCD subpixel quality to a new ARGB surface.
1584
+ *
1585
+ * This function will allocate a new 32-bit, ARGB surface, and render
1586
+ * alpha-blended text using FreeType's LCD subpixel rendering. This function
1587
+ * returns the new surface, or NULL if there was an error.
1588
+ *
1589
+ * This will not word-wrap the string; you'll get a surface with a single line
1590
+ * of text, as long as the string requires. You can use
1591
+ * TTF_RenderText_LCD_Wrapped() instead if you need to wrap the output to
1592
+ * multiple lines.
1593
+ *
1594
+ * This will not wrap on newline characters.
1595
+ *
1596
+ * You can render at other quality levels with TTF_RenderText_Solid,
1597
+ * TTF_RenderText_Shaded, and TTF_RenderText_Blended.
1598
+ *
1599
+ * \param font the font to render with.
1600
+ * \param text text to render, in UTF-8 encoding.
1601
+ * \param length the length of the text, in bytes, or 0 for null terminated
1602
+ * text.
1603
+ * \param fg the foreground color for the text.
1604
+ * \param bg the background color for the text.
1605
+ * \returns a new 32-bit, ARGB surface, or NULL if there was an error.
1606
+ *
1607
+ * \threadsafety This function should be called on the thread that created the
1608
+ * font.
1609
+ *
1610
+ * \since This function is available since SDL_ttf 3.0.0.
1611
+ *
1612
+ * \sa TTF_RenderText_Blended
1613
+ * \sa TTF_RenderText_LCD_Wrapped
1614
+ * \sa TTF_RenderText_Shaded
1615
+ * \sa TTF_RenderText_Solid
1616
+ */
1617
+ extern SDL_DECLSPEC SDL_Surface * SDLCALL TTF_RenderText_LCD(TTF_Font *font, const char *text, size_t length, SDL_Color fg, SDL_Color bg);
1618
+
1619
+ /**
1620
+ * Render word-wrapped UTF-8 text at LCD subpixel quality to a new ARGB
1621
+ * surface.
1622
+ *
1623
+ * This function will allocate a new 32-bit, ARGB surface, and render
1624
+ * alpha-blended text using FreeType's LCD subpixel rendering. This function
1625
+ * returns the new surface, or NULL if there was an error.
1626
+ *
1627
+ * Text is wrapped to multiple lines on line endings and on word boundaries if
1628
+ * it extends beyond `wrap_width` in pixels.
1629
+ *
1630
+ * If wrap_width is 0, this function will only wrap on newline characters.
1631
+ *
1632
+ * You can render at other quality levels with TTF_RenderText_Solid_Wrapped,
1633
+ * TTF_RenderText_Shaded_Wrapped, and TTF_RenderText_Blended_Wrapped.
1634
+ *
1635
+ * \param font the font to render with.
1636
+ * \param text text to render, in UTF-8 encoding.
1637
+ * \param length the length of the text, in bytes, or 0 for null terminated
1638
+ * text.
1639
+ * \param fg the foreground color for the text.
1640
+ * \param bg the background color for the text.
1641
+ * \param wrap_width the maximum width of the text surface or 0 to wrap on
1642
+ * newline characters.
1643
+ * \returns a new 32-bit, ARGB surface, or NULL if there was an error.
1644
+ *
1645
+ * \threadsafety This function should be called on the thread that created the
1646
+ * font.
1647
+ *
1648
+ * \since This function is available since SDL_ttf 3.0.0.
1649
+ *
1650
+ * \sa TTF_RenderText_Blended_Wrapped
1651
+ * \sa TTF_RenderText_LCD
1652
+ * \sa TTF_RenderText_Shaded_Wrapped
1653
+ * \sa TTF_RenderText_Solid_Wrapped
1654
+ */
1655
+ extern SDL_DECLSPEC SDL_Surface * SDLCALL TTF_RenderText_LCD_Wrapped(TTF_Font *font, const char *text, size_t length, SDL_Color fg, SDL_Color bg, int wrap_width);
1656
+
1657
+ /**
1658
+ * Render a single UNICODE codepoint at LCD subpixel quality to a new ARGB
1659
+ * surface.
1660
+ *
1661
+ * This function will allocate a new 32-bit, ARGB surface, and render
1662
+ * alpha-blended text using FreeType's LCD subpixel rendering. This function
1663
+ * returns the new surface, or NULL if there was an error.
1664
+ *
1665
+ * The glyph is rendered without any padding or centering in the X direction,
1666
+ * and aligned normally in the Y direction.
1667
+ *
1668
+ * You can render at other quality levels with TTF_RenderGlyph_Solid,
1669
+ * TTF_RenderGlyph_Shaded, and TTF_RenderGlyph_Blended.
1670
+ *
1671
+ * \param font the font to render with.
1672
+ * \param ch the codepoint to render.
1673
+ * \param fg the foreground color for the text.
1674
+ * \param bg the background color for the text.
1675
+ * \returns a new 32-bit, ARGB surface, or NULL if there was an error.
1676
+ *
1677
+ * \threadsafety This function should be called on the thread that created the
1678
+ * font.
1679
+ *
1680
+ * \since This function is available since SDL_ttf 3.0.0.
1681
+ *
1682
+ * \sa TTF_RenderGlyph_Blended
1683
+ * \sa TTF_RenderGlyph_Shaded
1684
+ * \sa TTF_RenderGlyph_Solid
1685
+ */
1686
+ extern SDL_DECLSPEC SDL_Surface * SDLCALL TTF_RenderGlyph_LCD(TTF_Font *font, Uint32 ch, SDL_Color fg, SDL_Color bg);
1687
+
1688
+
1689
+ /**
1690
+ * A text engine used to create text objects.
1691
+ *
1692
+ * This is a public interface that can be used by applications and libraries
1693
+ * to perform customize rendering with text objects. See
1694
+ * <SDL3_ttf/SDL_textengine.h> for details.
1695
+ *
1696
+ * There are three text engines provided with the library:
1697
+ *
1698
+ * - Drawing to an SDL_Surface, created with TTF_CreateSurfaceTextEngine()
1699
+ * - Drawing with an SDL 2D renderer, created with
1700
+ * TTF_CreateRendererTextEngine()
1701
+ * - Drawing with the SDL GPU API, created with TTF_CreateGPUTextEngine()
1702
+ *
1703
+ * \since This struct is available since SDL_ttf 3.0.0.
1704
+ */
1705
+ typedef struct TTF_TextEngine TTF_TextEngine;
1706
+
1707
+ /**
1708
+ * Internal data for TTF_Text
1709
+ *
1710
+ * \since This struct is available since SDL_ttf 3.0.0.
1711
+ */
1712
+ typedef struct TTF_TextData TTF_TextData;
1713
+
1714
+ /**
1715
+ * Text created with TTF_CreateText()
1716
+ *
1717
+ * \since This struct is available since SDL_ttf 3.0.0.
1718
+ *
1719
+ * \sa TTF_CreateText
1720
+ * \sa TTF_GetTextProperties
1721
+ * \sa TTF_DestroyText
1722
+ */
1723
+ typedef struct TTF_Text
1724
+ {
1725
+ char *text; /**< A copy of the UTF-8 string that this text object represents, useful for layout, debugging and retrieving substring text. This is updated when the text object is modified and will be freed automatically when the object is destroyed. */
1726
+ int num_lines; /**< The number of lines in the text, 0 if it's empty */
1727
+
1728
+ int refcount; /**< Application reference count, used when freeing surface */
1729
+
1730
+ TTF_TextData *internal; /**< Private */
1731
+
1732
+ } TTF_Text;
1733
+
1734
+ /**
1735
+ * Create a text engine for drawing text on SDL surfaces.
1736
+ *
1737
+ * \returns a TTF_TextEngine object or NULL on failure; call SDL_GetError()
1738
+ * for more information.
1739
+ *
1740
+ * \threadsafety It is safe to call this function from any thread.
1741
+ *
1742
+ * \since This function is available since SDL_ttf 3.0.0.
1743
+ *
1744
+ * \sa TTF_DestroySurfaceTextEngine
1745
+ * \sa TTF_DrawSurfaceText
1746
+ */
1747
+ extern SDL_DECLSPEC TTF_TextEngine * SDLCALL TTF_CreateSurfaceTextEngine(void);
1748
+
1749
+ /**
1750
+ * Draw text to an SDL surface.
1751
+ *
1752
+ * `text` must have been created using a TTF_TextEngine from
1753
+ * TTF_CreateSurfaceTextEngine().
1754
+ *
1755
+ * \param text the text to draw.
1756
+ * \param x the x coordinate in pixels, positive from the left edge towards
1757
+ * the right.
1758
+ * \param y the y coordinate in pixels, positive from the top edge towards the
1759
+ * bottom.
1760
+ * \param surface the surface to draw on.
1761
+ * \returns true on success or false on failure; call SDL_GetError() for more
1762
+ * information.
1763
+ *
1764
+ * \threadsafety This function should be called on the thread that created the
1765
+ * text.
1766
+ *
1767
+ * \since This function is available since SDL_ttf 3.0.0.
1768
+ *
1769
+ * \sa TTF_CreateSurfaceTextEngine
1770
+ * \sa TTF_CreateText
1771
+ */
1772
+ extern SDL_DECLSPEC bool SDLCALL TTF_DrawSurfaceText(TTF_Text *text, int x, int y, SDL_Surface *surface);
1773
+
1774
+ /**
1775
+ * Destroy a text engine created for drawing text on SDL surfaces.
1776
+ *
1777
+ * All text created by this engine should be destroyed before calling this
1778
+ * function.
1779
+ *
1780
+ * \param engine a TTF_TextEngine object created with
1781
+ * TTF_CreateSurfaceTextEngine().
1782
+ *
1783
+ * \threadsafety This function should be called on the thread that created the
1784
+ * engine.
1785
+ *
1786
+ * \since This function is available since SDL_ttf 3.0.0.
1787
+ *
1788
+ * \sa TTF_CreateSurfaceTextEngine
1789
+ */
1790
+ extern SDL_DECLSPEC void SDLCALL TTF_DestroySurfaceTextEngine(TTF_TextEngine *engine);
1791
+
1792
+ /**
1793
+ * Create a text engine for drawing text on an SDL renderer.
1794
+ *
1795
+ * \param renderer the renderer to use for creating textures and drawing text.
1796
+ * \returns a TTF_TextEngine object or NULL on failure; call SDL_GetError()
1797
+ * for more information.
1798
+ *
1799
+ * \threadsafety This function should be called on the thread that created the
1800
+ * renderer.
1801
+ *
1802
+ * \since This function is available since SDL_ttf 3.0.0.
1803
+ *
1804
+ * \sa TTF_DestroyRendererTextEngine
1805
+ * \sa TTF_DrawRendererText
1806
+ * \sa TTF_CreateRendererTextEngineWithProperties
1807
+ */
1808
+ extern SDL_DECLSPEC TTF_TextEngine * SDLCALL TTF_CreateRendererTextEngine(SDL_Renderer *renderer);
1809
+
1810
+ /**
1811
+ * Create a text engine for drawing text on an SDL renderer, with the
1812
+ * specified properties.
1813
+ *
1814
+ * These are the supported properties:
1815
+ *
1816
+ * - `TTF_PROP_RENDERER_TEXT_ENGINE_RENDERER`: the renderer to use for
1817
+ * creating textures and drawing text
1818
+ * - `TTF_PROP_RENDERER_TEXT_ENGINE_ATLAS_TEXTURE_SIZE`: the size of the
1819
+ * texture atlas
1820
+ *
1821
+ * \param props the properties to use.
1822
+ * \returns a TTF_TextEngine object or NULL on failure; call SDL_GetError()
1823
+ * for more information.
1824
+ *
1825
+ * \threadsafety This function should be called on the thread that created the
1826
+ * renderer.
1827
+ *
1828
+ * \since This function is available since SDL_ttf 3.0.0.
1829
+ *
1830
+ * \sa TTF_CreateRendererTextEngine
1831
+ * \sa TTF_DestroyRendererTextEngine
1832
+ * \sa TTF_DrawRendererText
1833
+ */
1834
+ extern SDL_DECLSPEC TTF_TextEngine * SDLCALL TTF_CreateRendererTextEngineWithProperties(SDL_PropertiesID props);
1835
+
1836
+ #define TTF_PROP_RENDERER_TEXT_ENGINE_RENDERER "SDL_ttf.renderer_text_engine.create.renderer"
1837
+ #define TTF_PROP_RENDERER_TEXT_ENGINE_ATLAS_TEXTURE_SIZE "SDL_ttf.renderer_text_engine.create.atlas_texture_size"
1838
+
1839
+ /**
1840
+ * Draw text to an SDL renderer.
1841
+ *
1842
+ * `text` must have been created using a TTF_TextEngine from
1843
+ * TTF_CreateRendererTextEngine(), and will draw using the renderer passed to
1844
+ * that function.
1845
+ *
1846
+ * \param text the text to draw.
1847
+ * \param x the x coordinate in pixels, positive from the left edge towards
1848
+ * the right.
1849
+ * \param y the y coordinate in pixels, positive from the top edge towards the
1850
+ * bottom.
1851
+ * \returns true on success or false on failure; call SDL_GetError() for more
1852
+ * information.
1853
+ *
1854
+ * \threadsafety This function should be called on the thread that created the
1855
+ * text.
1856
+ *
1857
+ * \since This function is available since SDL_ttf 3.0.0.
1858
+ *
1859
+ * \sa TTF_CreateRendererTextEngine
1860
+ * \sa TTF_CreateText
1861
+ */
1862
+ extern SDL_DECLSPEC bool SDLCALL TTF_DrawRendererText(TTF_Text *text, float x, float y);
1863
+
1864
+ /**
1865
+ * Destroy a text engine created for drawing text on an SDL renderer.
1866
+ *
1867
+ * All text created by this engine should be destroyed before calling this
1868
+ * function.
1869
+ *
1870
+ * \param engine a TTF_TextEngine object created with
1871
+ * TTF_CreateRendererTextEngine().
1872
+ *
1873
+ * \threadsafety This function should be called on the thread that created the
1874
+ * engine.
1875
+ *
1876
+ * \since This function is available since SDL_ttf 3.0.0.
1877
+ *
1878
+ * \sa TTF_CreateRendererTextEngine
1879
+ */
1880
+ extern SDL_DECLSPEC void SDLCALL TTF_DestroyRendererTextEngine(TTF_TextEngine *engine);
1881
+
1882
+ /**
1883
+ * Create a text engine for drawing text with the SDL GPU API.
1884
+ *
1885
+ * \param device the SDL_GPUDevice to use for creating textures and drawing
1886
+ * text.
1887
+ * \returns a TTF_TextEngine object or NULL on failure; call SDL_GetError()
1888
+ * for more information.
1889
+ *
1890
+ * \threadsafety This function should be called on the thread that created the
1891
+ * device.
1892
+ *
1893
+ * \since This function is available since SDL_ttf 3.0.0.
1894
+ *
1895
+ * \sa TTF_CreateGPUTextEngineWithProperties
1896
+ * \sa TTF_DestroyGPUTextEngine
1897
+ * \sa TTF_GetGPUTextDrawData
1898
+ */
1899
+ extern SDL_DECLSPEC TTF_TextEngine * SDLCALL TTF_CreateGPUTextEngine(SDL_GPUDevice *device);
1900
+
1901
+ /**
1902
+ * Create a text engine for drawing text with the SDL GPU API, with the
1903
+ * specified properties.
1904
+ *
1905
+ * These are the supported properties:
1906
+ *
1907
+ * - `TTF_PROP_GPU_TEXT_ENGINE_DEVICE`: the SDL_GPUDevice to use for creating
1908
+ * textures and drawing text.
1909
+ * - `TTF_PROP_GPU_TEXT_ENGINE_ATLAS_TEXTURE_SIZE`: the size of the texture
1910
+ * atlas
1911
+ *
1912
+ * \param props the properties to use.
1913
+ * \returns a TTF_TextEngine object or NULL on failure; call SDL_GetError()
1914
+ * for more information.
1915
+ *
1916
+ * \threadsafety This function should be called on the thread that created the
1917
+ * device.
1918
+ *
1919
+ * \since This function is available since SDL_ttf 3.0.0.
1920
+ *
1921
+ * \sa TTF_CreateGPUTextEngine
1922
+ * \sa TTF_DestroyGPUTextEngine
1923
+ * \sa TTF_GetGPUTextDrawData
1924
+ */
1925
+ extern SDL_DECLSPEC TTF_TextEngine * SDLCALL TTF_CreateGPUTextEngineWithProperties(SDL_PropertiesID props);
1926
+
1927
+ #define TTF_PROP_GPU_TEXT_ENGINE_DEVICE "SDL_ttf.gpu_text_engine.create.device"
1928
+ #define TTF_PROP_GPU_TEXT_ENGINE_ATLAS_TEXTURE_SIZE "SDL_ttf.gpu_text_engine.create.atlas_texture_size"
1929
+
1930
+ /**
1931
+ * Draw sequence returned by TTF_GetGPUTextDrawData
1932
+ *
1933
+ * \since This struct is available since SDL_ttf 3.0.0.
1934
+ *
1935
+ * \sa TTF_GetGPUTextDrawData
1936
+ */
1937
+ typedef struct TTF_GPUAtlasDrawSequence
1938
+ {
1939
+ SDL_GPUTexture *atlas_texture; /**< Texture atlas that stores the glyphs */
1940
+ SDL_FPoint *xy; /**< An array of vertex positions */
1941
+ SDL_FPoint *uv; /**< An array of normalized texture coordinates for each vertex */
1942
+ int num_vertices; /**< Number of vertices */
1943
+ int *indices; /**< An array of indices into the 'vertices' arrays */
1944
+ int num_indices; /**< Number of indices */
1945
+ TTF_ImageType image_type; /**< The image type of this draw sequence */
1946
+
1947
+ struct TTF_GPUAtlasDrawSequence *next; /**< The next sequence (will be NULL in case of the last sequence) */
1948
+ } TTF_GPUAtlasDrawSequence;
1949
+
1950
+ /**
1951
+ * Get the geometry data needed for drawing the text.
1952
+ *
1953
+ * `text` must have been created using a TTF_TextEngine from
1954
+ * TTF_CreateGPUTextEngine().
1955
+ *
1956
+ * The positive X-axis is taken towards the right and the positive Y-axis is
1957
+ * taken upwards for both the vertex and the texture coordinates, i.e, it
1958
+ * follows the same convention used by the SDL_GPU API. If you want to use a
1959
+ * different coordinate system you will need to transform the vertices
1960
+ * yourself.
1961
+ *
1962
+ * If the text looks blocky use linear filtering.
1963
+ *
1964
+ * \param text the text to draw.
1965
+ * \returns a NULL terminated linked list of TTF_GPUAtlasDrawSequence objects
1966
+ * or NULL if the passed text is empty or in case of failure; call
1967
+ * SDL_GetError() for more information.
1968
+ *
1969
+ * \threadsafety This function should be called on the thread that created the
1970
+ * text.
1971
+ *
1972
+ * \since This function is available since SDL_ttf 3.0.0.
1973
+ *
1974
+ * \sa TTF_CreateGPUTextEngine
1975
+ * \sa TTF_CreateText
1976
+ */
1977
+ extern SDL_DECLSPEC TTF_GPUAtlasDrawSequence * SDLCALL TTF_GetGPUTextDrawData(TTF_Text *text);
1978
+
1979
+ /**
1980
+ * Destroy a text engine created for drawing text with the SDL GPU API.
1981
+ *
1982
+ * All text created by this engine should be destroyed before calling this
1983
+ * function.
1984
+ *
1985
+ * \param engine a TTF_TextEngine object created with
1986
+ * TTF_CreateGPUTextEngine().
1987
+ *
1988
+ * \threadsafety This function should be called on the thread that created the
1989
+ * engine.
1990
+ *
1991
+ * \since This function is available since SDL_ttf 3.0.0.
1992
+ *
1993
+ * \sa TTF_CreateGPUTextEngine
1994
+ */
1995
+ extern SDL_DECLSPEC void SDLCALL TTF_DestroyGPUTextEngine(TTF_TextEngine *engine);
1996
+
1997
+ /**
1998
+ * The winding order of the vertices returned by TTF_GetGPUTextDrawData
1999
+ *
2000
+ * \since This enum is available since SDL_ttf 3.0.0.
2001
+ */
2002
+ typedef enum TTF_GPUTextEngineWinding
2003
+ {
2004
+ TTF_GPU_TEXTENGINE_WINDING_INVALID = -1,
2005
+ TTF_GPU_TEXTENGINE_WINDING_CLOCKWISE,
2006
+ TTF_GPU_TEXTENGINE_WINDING_COUNTER_CLOCKWISE
2007
+ } TTF_GPUTextEngineWinding;
2008
+
2009
+ /**
2010
+ * Sets the winding order of the vertices returned by TTF_GetGPUTextDrawData
2011
+ * for a particular GPU text engine.
2012
+ *
2013
+ * \param engine a TTF_TextEngine object created with
2014
+ * TTF_CreateGPUTextEngine().
2015
+ * \param winding the new winding order option.
2016
+ *
2017
+ * \threadsafety This function should be called on the thread that created the
2018
+ * engine.
2019
+ *
2020
+ * \since This function is available since SDL_ttf 3.0.0.
2021
+ *
2022
+ * \sa TTF_GetGPUTextEngineWinding
2023
+ */
2024
+ extern SDL_DECLSPEC void SDLCALL TTF_SetGPUTextEngineWinding(TTF_TextEngine *engine, TTF_GPUTextEngineWinding winding);
2025
+
2026
+ /**
2027
+ * Get the winding order of the vertices returned by TTF_GetGPUTextDrawData
2028
+ * for a particular GPU text engine
2029
+ *
2030
+ * \param engine a TTF_TextEngine object created with
2031
+ * TTF_CreateGPUTextEngine().
2032
+ * \returns the winding order used by the GPU text engine or
2033
+ * TTF_GPU_TEXTENGINE_WINDING_INVALID in case of error.
2034
+ *
2035
+ * \threadsafety This function should be called on the thread that created the
2036
+ * engine.
2037
+ *
2038
+ * \since This function is available since SDL_ttf 3.0.0.
2039
+ *
2040
+ * \sa TTF_SetGPUTextEngineWinding
2041
+ */
2042
+ extern SDL_DECLSPEC TTF_GPUTextEngineWinding SDLCALL TTF_GetGPUTextEngineWinding(const TTF_TextEngine *engine);
2043
+
2044
+ /**
2045
+ * Create a text object from UTF-8 text and a text engine.
2046
+ *
2047
+ * \param engine the text engine to use when creating the text object, may be
2048
+ * NULL.
2049
+ * \param font the font to render with.
2050
+ * \param text the text to use, in UTF-8 encoding.
2051
+ * \param length the length of the text, in bytes, or 0 for null terminated
2052
+ * text.
2053
+ * \returns a TTF_Text object or NULL on failure; call SDL_GetError() for more
2054
+ * information.
2055
+ *
2056
+ * \threadsafety This function should be called on the thread that created the
2057
+ * font and text engine.
2058
+ *
2059
+ * \since This function is available since SDL_ttf 3.0.0.
2060
+ *
2061
+ * \sa TTF_DestroyText
2062
+ */
2063
+ extern SDL_DECLSPEC TTF_Text * SDLCALL TTF_CreateText(TTF_TextEngine *engine, TTF_Font *font, const char *text, size_t length);
2064
+
2065
+ /**
2066
+ * Get the properties associated with a text object.
2067
+ *
2068
+ * \param text the TTF_Text to query.
2069
+ * \returns a valid property ID on success or 0 on failure; call
2070
+ * SDL_GetError() for more information.
2071
+ *
2072
+ * \threadsafety This function should be called on the thread that created the
2073
+ * text.
2074
+ *
2075
+ * \since This function is available since SDL_ttf 3.0.0.
2076
+ */
2077
+ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL TTF_GetTextProperties(TTF_Text *text);
2078
+
2079
+ /**
2080
+ * Set the text engine used by a text object.
2081
+ *
2082
+ * This function may cause the internal text representation to be rebuilt.
2083
+ *
2084
+ * \param text the TTF_Text to modify.
2085
+ * \param engine the text engine to use for drawing.
2086
+ * \returns true on success or false on failure; call SDL_GetError() for more
2087
+ * information.
2088
+ *
2089
+ * \threadsafety This function should be called on the thread that created the
2090
+ * text.
2091
+ *
2092
+ * \since This function is available since SDL_ttf 3.0.0.
2093
+ *
2094
+ * \sa TTF_GetTextEngine
2095
+ */
2096
+ extern SDL_DECLSPEC bool SDLCALL TTF_SetTextEngine(TTF_Text *text, TTF_TextEngine *engine);
2097
+
2098
+ /**
2099
+ * Get the text engine used by a text object.
2100
+ *
2101
+ * \param text the TTF_Text to query.
2102
+ * \returns the TTF_TextEngine used by the text on success or NULL on failure;
2103
+ * call SDL_GetError() for more information.
2104
+ *
2105
+ * \threadsafety This function should be called on the thread that created the
2106
+ * text.
2107
+ *
2108
+ * \since This function is available since SDL_ttf 3.0.0.
2109
+ *
2110
+ * \sa TTF_SetTextEngine
2111
+ */
2112
+ extern SDL_DECLSPEC TTF_TextEngine * SDLCALL TTF_GetTextEngine(TTF_Text *text);
2113
+
2114
+ /**
2115
+ * Set the font used by a text object.
2116
+ *
2117
+ * When a text object has a font, any changes to the font will automatically
2118
+ * regenerate the text. If you set the font to NULL, the text will continue to
2119
+ * render but changes to the font will no longer affect the text.
2120
+ *
2121
+ * This function may cause the internal text representation to be rebuilt.
2122
+ *
2123
+ * \param text the TTF_Text to modify.
2124
+ * \param font the font to use, may be NULL.
2125
+ * \returns false if the text pointer is null; otherwise, true. call
2126
+ * SDL_GetError() for more information.
2127
+ *
2128
+ * \threadsafety This function should be called on the thread that created the
2129
+ * text.
2130
+ *
2131
+ * \since This function is available since SDL_ttf 3.0.0.
2132
+ *
2133
+ * \sa TTF_GetTextFont
2134
+ */
2135
+ extern SDL_DECLSPEC bool SDLCALL TTF_SetTextFont(TTF_Text *text, TTF_Font *font);
2136
+
2137
+ /**
2138
+ * Get the font used by a text object.
2139
+ *
2140
+ * \param text the TTF_Text to query.
2141
+ * \returns the TTF_Font used by the text on success or NULL on failure; call
2142
+ * SDL_GetError() for more information.
2143
+ *
2144
+ * \threadsafety This function should be called on the thread that created the
2145
+ * text.
2146
+ *
2147
+ * \since This function is available since SDL_ttf 3.0.0.
2148
+ *
2149
+ * \sa TTF_SetTextFont
2150
+ */
2151
+ extern SDL_DECLSPEC TTF_Font * SDLCALL TTF_GetTextFont(TTF_Text *text);
2152
+
2153
+ /**
2154
+ * Set the direction to be used for text shaping a text object.
2155
+ *
2156
+ * This function only supports left-to-right text shaping if SDL_ttf was not
2157
+ * built with HarfBuzz support.
2158
+ *
2159
+ * \param text the text to modify.
2160
+ * \param direction the new direction for text to flow.
2161
+ * \returns true on success or false on failure; call SDL_GetError() for more
2162
+ * information.
2163
+ *
2164
+ * \threadsafety This function should be called on the thread that created the
2165
+ * text.
2166
+ *
2167
+ * \since This function is available since SDL_ttf 3.0.0.
2168
+ */
2169
+ extern SDL_DECLSPEC bool SDLCALL TTF_SetTextDirection(TTF_Text *text, TTF_Direction direction);
2170
+
2171
+ /**
2172
+ * Get the direction to be used for text shaping a text object.
2173
+ *
2174
+ * This defaults to the direction of the font used by the text object.
2175
+ *
2176
+ * \param text the text to query.
2177
+ * \returns the direction to be used for text shaping.
2178
+ *
2179
+ * \threadsafety This function should be called on the thread that created the
2180
+ * text.
2181
+ *
2182
+ * \since This function is available since SDL_ttf 3.0.0.
2183
+ */
2184
+ extern SDL_DECLSPEC TTF_Direction SDLCALL TTF_GetTextDirection(TTF_Text *text);
2185
+
2186
+ /**
2187
+ * Set the script to be used for text shaping a text object.
2188
+ *
2189
+ * This returns false if SDL_ttf isn't built with HarfBuzz support.
2190
+ *
2191
+ * \param text the text to modify.
2192
+ * \param script an
2193
+ * [ISO 15924 code](https://unicode.org/iso15924/iso15924-codes.html)
2194
+ * .
2195
+ * \returns true on success or false on failure; call SDL_GetError() for more
2196
+ * information.
2197
+ *
2198
+ * \threadsafety This function should be called on the thread that created the
2199
+ * text.
2200
+ *
2201
+ * \since This function is available since SDL_ttf 3.0.0.
2202
+ *
2203
+ * \sa TTF_StringToTag
2204
+ */
2205
+ extern SDL_DECLSPEC bool SDLCALL TTF_SetTextScript(TTF_Text *text, Uint32 script);
2206
+
2207
+ /**
2208
+ * Get the script used for text shaping a text object.
2209
+ *
2210
+ * This defaults to the script of the font used by the text object.
2211
+ *
2212
+ * \param text the text to query.
2213
+ * \returns an
2214
+ * [ISO 15924 code](https://unicode.org/iso15924/iso15924-codes.html)
2215
+ * or 0 if a script hasn't been set on either the text object or the
2216
+ * font.
2217
+ *
2218
+ * \threadsafety This function should be called on the thread that created the
2219
+ * text.
2220
+ *
2221
+ * \since This function is available since SDL_ttf 3.0.0.
2222
+ *
2223
+ * \sa TTF_TagToString
2224
+ */
2225
+ extern SDL_DECLSPEC Uint32 SDLCALL TTF_GetTextScript(TTF_Text *text);
2226
+
2227
+ /**
2228
+ * Set the color of a text object.
2229
+ *
2230
+ * The default text color is white (255, 255, 255, 255).
2231
+ *
2232
+ * \param text the TTF_Text to modify.
2233
+ * \param r the red color value in the range of 0-255.
2234
+ * \param g the green color value in the range of 0-255.
2235
+ * \param b the blue color value in the range of 0-255.
2236
+ * \param a the alpha value in the range of 0-255.
2237
+ * \returns true on success or false on failure; call SDL_GetError() for more
2238
+ * information.
2239
+ *
2240
+ * \threadsafety This function should be called on the thread that created the
2241
+ * text.
2242
+ *
2243
+ * \since This function is available since SDL_ttf 3.0.0.
2244
+ *
2245
+ * \sa TTF_GetTextColor
2246
+ * \sa TTF_SetTextColorFloat
2247
+ */
2248
+ extern SDL_DECLSPEC bool SDLCALL TTF_SetTextColor(TTF_Text *text, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
2249
+
2250
+ /**
2251
+ * Set the color of a text object.
2252
+ *
2253
+ * The default text color is white (1.0f, 1.0f, 1.0f, 1.0f).
2254
+ *
2255
+ * \param text the TTF_Text to modify.
2256
+ * \param r the red color value, normally in the range of 0-1.
2257
+ * \param g the green color value, normally in the range of 0-1.
2258
+ * \param b the blue color value, normally in the range of 0-1.
2259
+ * \param a the alpha value in the range of 0-1.
2260
+ * \returns true on success or false on failure; call SDL_GetError() for more
2261
+ * information.
2262
+ *
2263
+ * \threadsafety This function should be called on the thread that created the
2264
+ * text.
2265
+ *
2266
+ * \since This function is available since SDL_ttf 3.0.0.
2267
+ *
2268
+ * \sa TTF_GetTextColorFloat
2269
+ * \sa TTF_SetTextColor
2270
+ */
2271
+ extern SDL_DECLSPEC bool SDLCALL TTF_SetTextColorFloat(TTF_Text *text, float r, float g, float b, float a);
2272
+
2273
+ /**
2274
+ * Get the color of a text object.
2275
+ *
2276
+ * \param text the TTF_Text to query.
2277
+ * \param r a pointer filled in with the red color value in the range of
2278
+ * 0-255, may be NULL.
2279
+ * \param g a pointer filled in with the green color value in the range of
2280
+ * 0-255, may be NULL.
2281
+ * \param b a pointer filled in with the blue color value in the range of
2282
+ * 0-255, may be NULL.
2283
+ * \param a a pointer filled in with the alpha value in the range of 0-255,
2284
+ * may be NULL.
2285
+ * \returns true on success or false on failure; call SDL_GetError() for more
2286
+ * information.
2287
+ *
2288
+ * \threadsafety This function should be called on the thread that created the
2289
+ * text.
2290
+ *
2291
+ * \since This function is available since SDL_ttf 3.0.0.
2292
+ *
2293
+ * \sa TTF_GetTextColorFloat
2294
+ * \sa TTF_SetTextColor
2295
+ */
2296
+ extern SDL_DECLSPEC bool SDLCALL TTF_GetTextColor(TTF_Text *text, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a);
2297
+
2298
+ /**
2299
+ * Get the color of a text object.
2300
+ *
2301
+ * \param text the TTF_Text to query.
2302
+ * \param r a pointer filled in with the red color value, normally in the
2303
+ * range of 0-1, may be NULL.
2304
+ * \param g a pointer filled in with the green color value, normally in the
2305
+ * range of 0-1, may be NULL.
2306
+ * \param b a pointer filled in with the blue color value, normally in the
2307
+ * range of 0-1, may be NULL.
2308
+ * \param a a pointer filled in with the alpha value in the range of 0-1, may
2309
+ * be NULL.
2310
+ * \returns true on success or false on failure; call SDL_GetError() for more
2311
+ * information.
2312
+ *
2313
+ * \threadsafety This function should be called on the thread that created the
2314
+ * text.
2315
+ *
2316
+ * \since This function is available since SDL_ttf 3.0.0.
2317
+ *
2318
+ * \sa TTF_GetTextColor
2319
+ * \sa TTF_SetTextColorFloat
2320
+ */
2321
+ extern SDL_DECLSPEC bool SDLCALL TTF_GetTextColorFloat(TTF_Text *text, float *r, float *g, float *b, float *a);
2322
+
2323
+ /**
2324
+ * Set the position of a text object.
2325
+ *
2326
+ * This can be used to position multiple text objects within a single wrapping
2327
+ * text area.
2328
+ *
2329
+ * This function may cause the internal text representation to be rebuilt.
2330
+ *
2331
+ * \param text the TTF_Text to modify.
2332
+ * \param x the x offset of the upper left corner of this text in pixels.
2333
+ * \param y the y offset of the upper left corner of this text in pixels.
2334
+ *
2335
+ * \threadsafety This function should be called on the thread that created the
2336
+ * text.
2337
+ *
2338
+ * \since This function is available since SDL_ttf 3.0.0.
2339
+ *
2340
+ * \sa TTF_GetTextPosition
2341
+ */
2342
+ extern SDL_DECLSPEC bool SDLCALL TTF_SetTextPosition(TTF_Text *text, int x, int y);
2343
+
2344
+ /**
2345
+ * Get the position of a text object.
2346
+ *
2347
+ * \param text the TTF_Text to query.
2348
+ * \param x a pointer filled in with the x offset of the upper left corner of
2349
+ * this text in pixels, may be NULL.
2350
+ * \param y a pointer filled in with the y offset of the upper left corner of
2351
+ * this text in pixels, may be NULL.
2352
+ *
2353
+ * \threadsafety This function should be called on the thread that created the
2354
+ * text.
2355
+ *
2356
+ * \since This function is available since SDL_ttf 3.0.0.
2357
+ *
2358
+ * \sa TTF_SetTextPosition
2359
+ */
2360
+ extern SDL_DECLSPEC bool SDLCALL TTF_GetTextPosition(TTF_Text *text, int *x, int *y);
2361
+
2362
+ /**
2363
+ * Set whether wrapping is enabled on a text object.
2364
+ *
2365
+ * This function may cause the internal text representation to be rebuilt.
2366
+ *
2367
+ * \param text the TTF_Text to modify.
2368
+ * \param wrap_width the maximum width in pixels, 0 to wrap on newline
2369
+ * characters.
2370
+ * \returns true on success or false on failure; call SDL_GetError() for more
2371
+ * information.
2372
+ *
2373
+ * \threadsafety This function should be called on the thread that created the
2374
+ * text.
2375
+ *
2376
+ * \since This function is available since SDL_ttf 3.0.0.
2377
+ *
2378
+ * \sa TTF_GetTextWrapWidth
2379
+ */
2380
+ extern SDL_DECLSPEC bool SDLCALL TTF_SetTextWrapWidth(TTF_Text *text, int wrap_width);
2381
+
2382
+ /**
2383
+ * Get whether wrapping is enabled on a text object.
2384
+ *
2385
+ * \param text the TTF_Text to query.
2386
+ * \param wrap_width a pointer filled in with the maximum width in pixels or 0
2387
+ * if the text is being wrapped on newline characters.
2388
+ * \returns true on success or false on failure; call SDL_GetError() for more
2389
+ * information.
2390
+ *
2391
+ * \threadsafety This function should be called on the thread that created the
2392
+ * text.
2393
+ *
2394
+ * \since This function is available since SDL_ttf 3.0.0.
2395
+ *
2396
+ * \sa TTF_SetTextWrapWidth
2397
+ */
2398
+ extern SDL_DECLSPEC bool SDLCALL TTF_GetTextWrapWidth(TTF_Text *text, int *wrap_width);
2399
+
2400
+ /**
2401
+ * Set whether whitespace should be visible when wrapping a text object.
2402
+ *
2403
+ * If the whitespace is visible, it will take up space for purposes of
2404
+ * alignment and wrapping. This is good for editing, but looks better when
2405
+ * centered or aligned if whitespace around line wrapping is hidden. This
2406
+ * defaults false.
2407
+ *
2408
+ * This function may cause the internal text representation to be rebuilt.
2409
+ *
2410
+ * \param text the TTF_Text to modify.
2411
+ * \param visible true to show whitespace when wrapping text, false to hide
2412
+ * it.
2413
+ * \returns true on success or false on failure; call SDL_GetError() for more
2414
+ * information.
2415
+ *
2416
+ * \threadsafety This function should be called on the thread that created the
2417
+ * text.
2418
+ *
2419
+ * \since This function is available since SDL_ttf 3.0.0.
2420
+ *
2421
+ * \sa TTF_TextWrapWhitespaceVisible
2422
+ */
2423
+ extern SDL_DECLSPEC bool SDLCALL TTF_SetTextWrapWhitespaceVisible(TTF_Text *text, bool visible);
2424
+
2425
+ /**
2426
+ * Return whether whitespace is shown when wrapping a text object.
2427
+ *
2428
+ * \param text the TTF_Text to query.
2429
+ * \returns true if whitespace is shown when wrapping text, or false
2430
+ * otherwise.
2431
+ *
2432
+ * \threadsafety This function should be called on the thread that created the
2433
+ * text.
2434
+ *
2435
+ * \since This function is available since SDL_ttf 3.0.0.
2436
+ *
2437
+ * \sa TTF_SetTextWrapWhitespaceVisible
2438
+ */
2439
+ extern SDL_DECLSPEC bool SDLCALL TTF_TextWrapWhitespaceVisible(TTF_Text *text);
2440
+
2441
+ /**
2442
+ * Set the UTF-8 text used by a text object.
2443
+ *
2444
+ * This function may cause the internal text representation to be rebuilt.
2445
+ *
2446
+ * \param text the TTF_Text to modify.
2447
+ * \param string the UTF-8 text to use, may be NULL.
2448
+ * \param length the length of the text, in bytes, or 0 for null terminated
2449
+ * text.
2450
+ * \returns true on success or false on failure; call SDL_GetError() for more
2451
+ * information.
2452
+ *
2453
+ * \threadsafety This function should be called on the thread that created the
2454
+ * text.
2455
+ *
2456
+ * \since This function is available since SDL_ttf 3.0.0.
2457
+ *
2458
+ * \sa TTF_AppendTextString
2459
+ * \sa TTF_DeleteTextString
2460
+ * \sa TTF_InsertTextString
2461
+ */
2462
+ extern SDL_DECLSPEC bool SDLCALL TTF_SetTextString(TTF_Text *text, const char *string, size_t length);
2463
+
2464
+ /**
2465
+ * Insert UTF-8 text into a text object.
2466
+ *
2467
+ * This function may cause the internal text representation to be rebuilt.
2468
+ *
2469
+ * \param text the TTF_Text to modify.
2470
+ * \param offset the offset, in bytes, from the beginning of the string if >=
2471
+ * 0, the offset from the end of the string if < 0. Note that
2472
+ * this does not do UTF-8 validation, so you should only insert
2473
+ * at UTF-8 sequence boundaries.
2474
+ * \param string the UTF-8 text to insert.
2475
+ * \param length the length of the text, in bytes, or 0 for null terminated
2476
+ * text.
2477
+ * \returns true on success or false on failure; call SDL_GetError() for more
2478
+ * information.
2479
+ *
2480
+ * \threadsafety This function should be called on the thread that created the
2481
+ * text.
2482
+ *
2483
+ * \since This function is available since SDL_ttf 3.0.0.
2484
+ *
2485
+ * \sa TTF_AppendTextString
2486
+ * \sa TTF_DeleteTextString
2487
+ * \sa TTF_SetTextString
2488
+ */
2489
+ extern SDL_DECLSPEC bool SDLCALL TTF_InsertTextString(TTF_Text *text, int offset, const char *string, size_t length);
2490
+
2491
+ /**
2492
+ * Append UTF-8 text to a text object.
2493
+ *
2494
+ * This function may cause the internal text representation to be rebuilt.
2495
+ *
2496
+ * \param text the TTF_Text to modify.
2497
+ * \param string the UTF-8 text to insert.
2498
+ * \param length the length of the text, in bytes, or 0 for null terminated
2499
+ * text.
2500
+ * \returns true on success or false on failure; call SDL_GetError() for more
2501
+ * information.
2502
+ *
2503
+ * \threadsafety This function should be called on the thread that created the
2504
+ * text.
2505
+ *
2506
+ * \since This function is available since SDL_ttf 3.0.0.
2507
+ *
2508
+ * \sa TTF_DeleteTextString
2509
+ * \sa TTF_InsertTextString
2510
+ * \sa TTF_SetTextString
2511
+ */
2512
+ extern SDL_DECLSPEC bool SDLCALL TTF_AppendTextString(TTF_Text *text, const char *string, size_t length);
2513
+
2514
+ /**
2515
+ * Delete UTF-8 text from a text object.
2516
+ *
2517
+ * This function may cause the internal text representation to be rebuilt.
2518
+ *
2519
+ * \param text the TTF_Text to modify.
2520
+ * \param offset the offset, in bytes, from the beginning of the string if >=
2521
+ * 0, the offset from the end of the string if < 0. Note that
2522
+ * this does not do UTF-8 validation, so you should only delete
2523
+ * at UTF-8 sequence boundaries.
2524
+ * \param length the length of text to delete, in bytes, or -1 for the
2525
+ * remainder of the string.
2526
+ * \returns true on success or false on failure; call SDL_GetError() for more
2527
+ * information.
2528
+ *
2529
+ * \threadsafety This function should be called on the thread that created the
2530
+ * text.
2531
+ *
2532
+ * \since This function is available since SDL_ttf 3.0.0.
2533
+ *
2534
+ * \sa TTF_AppendTextString
2535
+ * \sa TTF_InsertTextString
2536
+ * \sa TTF_SetTextString
2537
+ */
2538
+ extern SDL_DECLSPEC bool SDLCALL TTF_DeleteTextString(TTF_Text *text, int offset, int length);
2539
+
2540
+ /**
2541
+ * Get the size of a text object.
2542
+ *
2543
+ * The size of the text may change when the font or font style and size
2544
+ * change.
2545
+ *
2546
+ * \param text the TTF_Text to query.
2547
+ * \param w a pointer filled in with the width of the text, in pixels, may be
2548
+ * NULL.
2549
+ * \param h a pointer filled in with the height of the text, in pixels, may be
2550
+ * NULL.
2551
+ * \returns true on success or false on failure; call SDL_GetError() for more
2552
+ * information.
2553
+ *
2554
+ * \threadsafety This function should be called on the thread that created the
2555
+ * text.
2556
+ *
2557
+ * \since This function is available since SDL_ttf 3.0.0.
2558
+ */
2559
+ extern SDL_DECLSPEC bool SDLCALL TTF_GetTextSize(TTF_Text *text, int *w, int *h);
2560
+
2561
+ /**
2562
+ * Flags for TTF_SubString
2563
+ *
2564
+ * \since This datatype is available since SDL_ttf 3.0.0.
2565
+ *
2566
+ * \sa TTF_SubString
2567
+ */
2568
+ typedef Uint32 TTF_SubStringFlags;
2569
+
2570
+ #define TTF_SUBSTRING_DIRECTION_MASK 0x000000FF /**< The mask for the flow direction for this substring */
2571
+ #define TTF_SUBSTRING_TEXT_START 0x00000100 /**< This substring contains the beginning of the text */
2572
+ #define TTF_SUBSTRING_LINE_START 0x00000200 /**< This substring contains the beginning of line `line_index` */
2573
+ #define TTF_SUBSTRING_LINE_END 0x00000400 /**< This substring contains the end of line `line_index` */
2574
+ #define TTF_SUBSTRING_TEXT_END 0x00000800 /**< This substring contains the end of the text */
2575
+
2576
+ /**
2577
+ * The representation of a substring within text.
2578
+ *
2579
+ * \since This struct is available since SDL_ttf 3.0.0.
2580
+ *
2581
+ * \sa TTF_GetNextTextSubString
2582
+ * \sa TTF_GetPreviousTextSubString
2583
+ * \sa TTF_GetTextSubString
2584
+ * \sa TTF_GetTextSubStringForLine
2585
+ * \sa TTF_GetTextSubStringForPoint
2586
+ * \sa TTF_GetTextSubStringsForRange
2587
+ */
2588
+ typedef struct TTF_SubString
2589
+ {
2590
+ TTF_SubStringFlags flags; /**< The flags for this substring */
2591
+ int offset; /**< The byte offset from the beginning of the text */
2592
+ int length; /**< The byte length starting at the offset */
2593
+ int line_index; /**< The index of the line that contains this substring */
2594
+ int cluster_index; /**< The internal cluster index, used for quickly iterating */
2595
+ SDL_Rect rect; /**< The rectangle, relative to the top left of the text, containing the substring */
2596
+ } TTF_SubString;
2597
+
2598
+ /**
2599
+ * Get the substring of a text object that surrounds a text offset.
2600
+ *
2601
+ * If `offset` is less than 0, this will return a zero length substring at the
2602
+ * beginning of the text with the TTF_SUBSTRING_TEXT_START flag set. If
2603
+ * `offset` is greater than or equal to the length of the text string, this
2604
+ * will return a zero length substring at the end of the text with the
2605
+ * TTF_SUBSTRING_TEXT_END flag set.
2606
+ *
2607
+ * \param text the TTF_Text to query.
2608
+ * \param offset a byte offset into the text string.
2609
+ * \param substring a pointer filled in with the substring containing the
2610
+ * offset.
2611
+ * \returns true on success or false on failure; call SDL_GetError() for more
2612
+ * information.
2613
+ *
2614
+ * \threadsafety This function should be called on the thread that created the
2615
+ * text.
2616
+ *
2617
+ * \since This function is available since SDL_ttf 3.0.0.
2618
+ */
2619
+ extern SDL_DECLSPEC bool SDLCALL TTF_GetTextSubString(TTF_Text *text, int offset, TTF_SubString *substring);
2620
+
2621
+ /**
2622
+ * Get the substring of a text object that contains the given line.
2623
+ *
2624
+ * If `line` is less than 0, this will return a zero length substring at the
2625
+ * beginning of the text with the TTF_SUBSTRING_TEXT_START flag set. If `line`
2626
+ * is greater than or equal to `text->num_lines` this will return a zero
2627
+ * length substring at the end of the text with the TTF_SUBSTRING_TEXT_END
2628
+ * flag set.
2629
+ *
2630
+ * \param text the TTF_Text to query.
2631
+ * \param line a zero-based line index, in the range [0 .. text->num_lines-1].
2632
+ * \param substring a pointer filled in with the substring containing the
2633
+ * offset.
2634
+ * \returns true on success or false on failure; call SDL_GetError() for more
2635
+ * information.
2636
+ *
2637
+ * \threadsafety This function should be called on the thread that created the
2638
+ * text.
2639
+ *
2640
+ * \since This function is available since SDL_ttf 3.0.0.
2641
+ */
2642
+ extern SDL_DECLSPEC bool SDLCALL TTF_GetTextSubStringForLine(TTF_Text *text, int line, TTF_SubString *substring);
2643
+
2644
+ /**
2645
+ * Get the substrings of a text object that contain a range of text.
2646
+ *
2647
+ * \param text the TTF_Text to query.
2648
+ * \param offset a byte offset into the text string.
2649
+ * \param length the length of the range being queried, in bytes, or -1 for
2650
+ * the remainder of the string.
2651
+ * \param count a pointer filled in with the number of substrings returned,
2652
+ * may be NULL.
2653
+ * \returns a NULL terminated array of substring pointers or NULL on failure;
2654
+ * call SDL_GetError() for more information. This is a single
2655
+ * allocation that should be freed with SDL_free() when it is no
2656
+ * longer needed.
2657
+ *
2658
+ * \threadsafety This function should be called on the thread that created the
2659
+ * text.
2660
+ *
2661
+ * \since This function is available since SDL_ttf 3.0.0.
2662
+ */
2663
+ extern SDL_DECLSPEC TTF_SubString ** SDLCALL TTF_GetTextSubStringsForRange(TTF_Text *text, int offset, int length, int *count);
2664
+
2665
+ /**
2666
+ * Get the portion of a text string that is closest to a point.
2667
+ *
2668
+ * This will return the closest substring of text to the given point.
2669
+ *
2670
+ * \param text the TTF_Text to query.
2671
+ * \param x the x coordinate relative to the left side of the text, may be
2672
+ * outside the bounds of the text area.
2673
+ * \param y the y coordinate relative to the top side of the text, may be
2674
+ * outside the bounds of the text area.
2675
+ * \param substring a pointer filled in with the closest substring of text to
2676
+ * the given point.
2677
+ * \returns true on success or false on failure; call SDL_GetError() for more
2678
+ * information.
2679
+ *
2680
+ * \threadsafety This function should be called on the thread that created the
2681
+ * text.
2682
+ *
2683
+ * \since This function is available since SDL_ttf 3.0.0.
2684
+ */
2685
+ extern SDL_DECLSPEC bool SDLCALL TTF_GetTextSubStringForPoint(TTF_Text *text, int x, int y, TTF_SubString *substring);
2686
+
2687
+ /**
2688
+ * Get the previous substring in a text object
2689
+ *
2690
+ * If called at the start of the text, this will return a zero length
2691
+ * substring with the TTF_SUBSTRING_TEXT_START flag set.
2692
+ *
2693
+ * \param text the TTF_Text to query.
2694
+ * \param substring the TTF_SubString to query.
2695
+ * \returns true on success or false on failure; call SDL_GetError() for more
2696
+ * information.
2697
+ *
2698
+ * \threadsafety This function should be called on the thread that created the
2699
+ * text.
2700
+ *
2701
+ * \since This function is available since SDL_ttf 3.0.0.
2702
+ */
2703
+ extern SDL_DECLSPEC bool SDLCALL TTF_GetPreviousTextSubString(TTF_Text *text, const TTF_SubString *substring, TTF_SubString *previous);
2704
+
2705
+ /**
2706
+ * Get the next substring in a text object
2707
+ *
2708
+ * If called at the end of the text, this will return a zero length substring
2709
+ * with the TTF_SUBSTRING_TEXT_END flag set.
2710
+ *
2711
+ * \param text the TTF_Text to query.
2712
+ * \param substring the TTF_SubString to query.
2713
+ * \param next a pointer filled in with the next substring.
2714
+ * \returns true on success or false on failure; call SDL_GetError() for more
2715
+ * information.
2716
+ *
2717
+ * \threadsafety This function should be called on the thread that created the
2718
+ * text.
2719
+ *
2720
+ * \since This function is available since SDL_ttf 3.0.0.
2721
+ */
2722
+ extern SDL_DECLSPEC bool SDLCALL TTF_GetNextTextSubString(TTF_Text *text, const TTF_SubString *substring, TTF_SubString *next);
2723
+
2724
+ /**
2725
+ * Update the layout of a text object.
2726
+ *
2727
+ * This is automatically done when the layout is requested or the text is
2728
+ * rendered, but you can call this if you need more control over the timing of
2729
+ * when the layout and text engine representation are updated.
2730
+ *
2731
+ * \param text the TTF_Text to update.
2732
+ * \returns true on success or false on failure; call SDL_GetError() for more
2733
+ * information.
2734
+ *
2735
+ * \threadsafety This function should be called on the thread that created the
2736
+ * text.
2737
+ *
2738
+ * \since This function is available since SDL_ttf 3.0.0.
2739
+ */
2740
+ extern SDL_DECLSPEC bool SDLCALL TTF_UpdateText(TTF_Text *text);
2741
+
2742
+ /**
2743
+ * Destroy a text object created by a text engine.
2744
+ *
2745
+ * \param text the text to destroy.
2746
+ *
2747
+ * \threadsafety This function should be called on the thread that created the
2748
+ * text.
2749
+ *
2750
+ * \since This function is available since SDL_ttf 3.0.0.
2751
+ *
2752
+ * \sa TTF_CreateText
2753
+ */
2754
+ extern SDL_DECLSPEC void SDLCALL TTF_DestroyText(TTF_Text *text);
2755
+
2756
+ /**
2757
+ * Dispose of a previously-created font.
2758
+ *
2759
+ * Call this when done with a font. This function will free any resources
2760
+ * associated with it. It is safe to call this function on NULL, for example
2761
+ * on the result of a failed call to TTF_OpenFont().
2762
+ *
2763
+ * The font is not valid after being passed to this function. String pointers
2764
+ * from functions that return information on this font, such as
2765
+ * TTF_GetFontFamilyName() and TTF_GetFontStyleName(), are no longer valid
2766
+ * after this call, as well.
2767
+ *
2768
+ * \param font the font to dispose of.
2769
+ *
2770
+ * \threadsafety This function should not be called while any other thread is
2771
+ * using the font.
2772
+ *
2773
+ * \since This function is available since SDL_ttf 3.0.0.
2774
+ *
2775
+ * \sa TTF_OpenFont
2776
+ * \sa TTF_OpenFontIO
2777
+ */
2778
+ extern SDL_DECLSPEC void SDLCALL TTF_CloseFont(TTF_Font *font);
2779
+
2780
+ /**
2781
+ * Deinitialize SDL_ttf.
2782
+ *
2783
+ * You must call this when done with the library, to free internal resources.
2784
+ * It is safe to call this when the library isn't initialized, as it will just
2785
+ * return immediately.
2786
+ *
2787
+ * Once you have as many quit calls as you have had successful calls to
2788
+ * TTF_Init, the library will actually deinitialize.
2789
+ *
2790
+ * Please note that this does not automatically close any fonts that are still
2791
+ * open at the time of deinitialization, and it is possibly not safe to close
2792
+ * them afterwards, as parts of the library will no longer be initialized to
2793
+ * deal with it. A well-written program should call TTF_CloseFont() on any
2794
+ * open fonts before calling this function!
2795
+ *
2796
+ * \threadsafety It is safe to call this function from any thread.
2797
+ *
2798
+ * \since This function is available since SDL_ttf 3.0.0.
2799
+ */
2800
+ extern SDL_DECLSPEC void SDLCALL TTF_Quit(void);
2801
+
2802
+ /**
2803
+ * Check if SDL_ttf is initialized.
2804
+ *
2805
+ * This reports the number of times the library has been initialized by a call
2806
+ * to TTF_Init(), without a paired deinitialization request from TTF_Quit().
2807
+ *
2808
+ * In short: if it's greater than zero, the library is currently initialized
2809
+ * and ready to work. If zero, it is not initialized.
2810
+ *
2811
+ * Despite the return value being a signed integer, this function should not
2812
+ * return a negative number.
2813
+ *
2814
+ * \returns the current number of initialization calls, that need to
2815
+ * eventually be paired with this many calls to TTF_Quit().
2816
+ *
2817
+ * \threadsafety It is safe to call this function from any thread.
2818
+ *
2819
+ * \since This function is available since SDL_ttf 3.0.0.
2820
+ *
2821
+ * \sa TTF_Init
2822
+ * \sa TTF_Quit
2823
+ */
2824
+ extern SDL_DECLSPEC int SDLCALL TTF_WasInit(void);
2825
+
2826
+ /* Ends C function definitions when using C++ */
2827
+ #ifdef __cplusplus
2828
+ }
2829
+ #endif
2830
+ #include <SDL3/SDL_close_code.h>
2831
+
2832
+ #endif /* SDL_TTF_H_ */
2833
+