Created
May 13, 2026 15:15
-
-
Save mbohun/fe7af7efdbbb9571c5a9d7e7f935fca7 to your computer and use it in GitHub Desktop.
libSDL3 DeepSeekAI generated crap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <SDL3/SDL.h> | |
| #include <SDL3_ttf/SDL_ttf.h> | |
| int main() { | |
| SDL_Init(SDL_INIT_VIDEO); | |
| TTF_Init(); // Initialize the font system | |
| SDL_Window* window = SDL_CreateWindow("Text Demo", 800, 600, 0); | |
| SDL_Renderer* renderer = SDL_CreateRenderer(window, NULL); | |
| // Load a font (TrueType or OpenType) | |
| TTF_Font* font = TTF_OpenFont("/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf", 24); | |
| // Render text to a surface (system RAM) | |
| SDL_Color white = {255, 255, 255, 255}; | |
| SDL_Surface* surface = TTF_RenderText_Blended(font, "Hello, World!", 0, white); | |
| // Upload to GPU and draw | |
| SDL_Texture* texture = SDL_CreateTextureFromSurface(renderer, surface); | |
| SDL_RenderTexture(renderer, texture, NULL, &dest_rect); | |
| SDL_RenderPresent(renderer); | |
| // Cleanup | |
| SDL_DestroyTexture(texture); | |
| SDL_DestroySurface(surface); | |
| TTF_CloseFont(font); | |
| TTF_Quit(); | |
| SDL_Quit(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment