Skip to content

Commit

Permalink
Sync SDL3_ttf header -> wiki
Browse files Browse the repository at this point in the history
  • Loading branch information
SDLWikiBot committed Dec 7, 2024
1 parent e0751a1 commit 8b59893
Show file tree
Hide file tree
Showing 4 changed files with 174 additions and 0 deletions.
42 changes: 42 additions & 0 deletions SDL3_ttf/TTF_CreateGPUTextEngine.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
###### (This function is part of SDL_ttf, a separate library from SDL.)
# TTF_CreateGPUTextEngine

Create a text engine for drawing text with the SDL GPU API.

## Header File

Defined in [<SDL3_ttf/SDL_ttf.h>](https://github.com/libsdl-org/SDL_ttf/blob/main/include/SDL3_ttf/SDL_ttf.h)

## Syntax

```c
TTF_TextEngine * TTF_CreateGPUTextEngine(SDL_GPUDevice *device);
```
## Function Parameters
| | | |
| --------------- | ---------- | ---------------------------------------------------------------- |
| SDL_GPUDevice * | **device** | the SDL_GPUDevice to use for creating textures and drawing text. |
## Return Value
([TTF_TextEngine](TTF_TextEngine) *) Returns a
[TTF_TextEngine](TTF_TextEngine) object or NULL on failure; call
SDL_GetError() for more information.
## Thread Safety
This function should be called on the thread that created the device.
## Version
This function is available since SDL_ttf 3.0.0.
## See Also
- [TTF_DestroyGPUTextEngine](TTF_DestroyGPUTextEngine)
----
[CategoryAPI](CategoryAPI), [CategoryAPIFunction](CategoryAPIFunction)
41 changes: 41 additions & 0 deletions SDL3_ttf/TTF_DestroyGPUTextEngine.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
###### (This function is part of SDL_ttf, a separate library from SDL.)
# TTF_DestroyGPUTextEngine

Destroy a text engine created for drawing text with the SDL GPU API.

## Header File

Defined in [<SDL3_ttf/SDL_ttf.h>](https://github.com/libsdl-org/SDL_ttf/blob/main/include/SDL3_ttf/SDL_ttf.h)

## Syntax

```c
void TTF_DestroyGPUTextEngine(TTF_TextEngine *engine);
```
## Function Parameters
| | | |
| ---------------------------------- | ---------- | ------------------------------------------------------------------------------------------------------------ |
| [TTF_TextEngine](TTF_TextEngine) * | **engine** | a [TTF_TextEngine](TTF_TextEngine) object created with [TTF_CreateGPUTextEngine](TTF_CreateGPUTextEngine)(). |
## Remarks
All text created by this engine should be destroyed before calling this
function.
## Thread Safety
This function should be called on the thread that created the engine.
## Version
This function is available since SDL_ttf 3.0.0.
## See Also
- [TTF_CreateGPUTextEngine](TTF_CreateGPUTextEngine)
----
[CategoryAPI](CategoryAPI), [CategoryAPIFunction](CategoryAPIFunction)
38 changes: 38 additions & 0 deletions SDL3_ttf/TTF_GPUAtlasDrawSequence.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
###### (This function is part of SDL_ttf, a separate library from SDL.)
# TTF_GPUAtlasDrawSequence

Draw sequence returned by [TTF_GetGPUTextDrawData](TTF_GetGPUTextDrawData)

## Header File

Defined in [<SDL3_ttf/SDL_ttf.h>](https://github.com/libsdl-org/SDL_ttf/blob/main/include/SDL3_ttf/SDL_ttf.h)

## Syntax

```c
typedef struct TTF_GPUAtlasDrawSequence
{
SDL_GPUTexture *atlas_texture; /**< Texture atlas that stores the glyphs */
float *xy; /**< Vertex positions */
int xy_stride; /**< Byte size to move from one element to the next element */
float *uv; /**< Vertex normalized texture coordinates */
int uv_stride; /**< Byte size to move from one element to the next element */
int num_vertices; /**< Number of vertices */
int *indices; /**< An array of indices into the 'vertices' arrays */
int num_indices; /**< Number of indices */

struct TTF_GPUAtlasDrawSequence *next; /**< The next sequence (will be NULL in case of the last sequence) */
} TTF_GPUAtlasDrawSequence;
```

## Version

This struct is available since SDL_ttf 3.0.0.

## See Also

- [TTF_GetGPUTextDrawData](TTF_GetGPUTextDrawData)

----
[CategoryAPI](CategoryAPI), [CategoryAPIStruct](CategoryAPIStruct)

53 changes: 53 additions & 0 deletions SDL3_ttf/TTF_GetGPUTextDrawData.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
###### (This function is part of SDL_ttf, a separate library from SDL.)
# TTF_GetGPUTextDrawData

Get the geometry data needed for drawing the text.

## Header File

Defined in [<SDL3_ttf/SDL_ttf.h>](https://github.com/libsdl-org/SDL_ttf/blob/main/include/SDL3_ttf/SDL_ttf.h)

## Syntax

```c
TTF_GPUAtlasDrawSequence* TTF_GetGPUTextDrawData(TTF_Text *text);
```
## Function Parameters
| | | |
| ---------------------- | -------- | ----------------- |
| [TTF_Text](TTF_Text) * | **text** | the text to draw. |
## Return Value
([TTF_GPUAtlasDrawSequence](TTF_GPUAtlasDrawSequence) *) Returns a NULL
terminated linked list of
[TTF_GPUAtlasDrawSequence](TTF_GPUAtlasDrawSequence) objects or NULL if the
passed text is empty or in case of failure; call SDL_GetError() for more
information.
## Remarks
`text` must have been created using a [TTF_TextEngine](TTF_TextEngine) from
[TTF_CreateGPUTextEngine](TTF_CreateGPUTextEngine)().
If the text looks blocky use linear filtering.
## Thread Safety
This function should be called on the thread that created the text.
## Version
This function is available since SDL_ttf 3.0.0.
## See Also
- [TTF_CreateGPUTextEngine](TTF_CreateGPUTextEngine)
- [TTF_CreateText](TTF_CreateText)
- [TTF_CreateText_Wrapped](TTF_CreateText_Wrapped)
----
[CategoryAPI](CategoryAPI), [CategoryAPIFunction](CategoryAPIFunction)

0 comments on commit 8b59893

Please sign in to comment.