Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "raylib.h"
- #define TARGET_FPS 60
- #define SCREEN_WIDTH 800
- #define SCREEN_HEIGHT 600
- // https://en.cppreference.com/w/c/language/string_literal
- const unsigned char *example_text = u8"안녕하세요!";
- int main(void) {
- SetConfigFlags(FLAG_MSAA_4X_HINT);
- SetTargetFPS(TARGET_FPS);
- InitWindow(SCREEN_WIDTH, SCREEN_HEIGHT, "...");
- // The size of the font that we are going to load.
- const int font_size = 32;
- // The number of the Unicode codepoints in `example_text`.
- int codepoint_count = 0;
- // The Unicode codepoint array for `example_text`.
- int *codepoints = LoadCodepoints(example_text, &codepoint_count);
- // Loads the TrueType font with the given codepoint array.
- Font fnt_neodgm = LoadFontEx(
- "../res/fonts/neodgm/neodgm.ttf",
- font_size,
- codepoints,
- codepoint_count
- );
- while (!WindowShouldClose()) {
- BeginDrawing();
- ClearBackground(BLACK);
- // Draws the UTF-8 encoded text to the screen.
- DrawTextEx(
- fnt_neodgm,
- example_text,
- (Vector2) { 8.0f, 8.0f },
- font_size,
- 2,
- WHITE
- );
- EndDrawing();
- }
- // Unloads the font.
- UnloadFont(fnt_neodgm);
- CloseWindow();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement