Merge branch 'raysan5:master' into master
BIN
examples/text/resources/NotoSansTC-Regular.ttf
Normal file
|
|
@ -15,5 +15,5 @@ void main()
|
|||
{
|
||||
vec4 texelColor = texture(texture0, fragTexCoord);
|
||||
if (texelColor.a == 0.0) discard;
|
||||
finalColor = texelColor * fragColor * colDiffuse;
|
||||
finalColor = texelColor*fragColor*colDiffuse;
|
||||
}
|
||||
|
|
|
|||
BIN
examples/text/resources/sprite_fonts/alagard.png
Normal file
|
After Width: | Height: | Size: 3.5 KiB |
BIN
examples/text/resources/sprite_fonts/alpha_beta.png
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
BIN
examples/text/resources/sprite_fonts/jupiter_crash.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
examples/text/resources/sprite_fonts/mecha.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
examples/text/resources/sprite_fonts/pixantiqua.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
examples/text/resources/sprite_fonts/pixelplay.png
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
BIN
examples/text/resources/sprite_fonts/romulus.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
examples/text/resources/sprite_fonts/setback.png
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
|
|
@ -1,6 +1,6 @@
|
|||
/*******************************************************************************************
|
||||
*
|
||||
* raylib [text] example - text codepoints loading
|
||||
* raylib [text] example - codepoints loading
|
||||
*
|
||||
* Example complexity rating: [★★★☆] 3/4
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*******************************************************************************************
|
||||
*
|
||||
* raylib [text] example - drawing 3d text
|
||||
* raylib [text] example - 3d text drawing
|
||||
*
|
||||
* Example complexity rating: [★★★★] 4/4
|
||||
*
|
||||
|
|
@ -87,7 +87,7 @@ int main(void)
|
|||
int screenHeight = 450;
|
||||
|
||||
SetConfigFlags(FLAG_MSAA_4X_HINT|FLAG_VSYNC_HINT);
|
||||
InitWindow(screenWidth, screenHeight, "raylib [text] example - draw 2D text in 3D");
|
||||
InitWindow(screenWidth, screenHeight, "raylib [text] example - 3d text drawing");
|
||||
|
||||
bool spin = true; // Spin the camera?
|
||||
bool multicolor = false; // Multicolor mode
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ int main(void)
|
|||
const int screenWidth = 800;
|
||||
const int screenHeight = 450;
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [text] example - font filters");
|
||||
InitWindow(screenWidth, screenHeight, "raylib [text] example - font texture filters");
|
||||
|
||||
const char msg[50] = "Loaded Font";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*******************************************************************************************
|
||||
*
|
||||
* raylib [text] example - Font loading
|
||||
* raylib [text] example - font loading
|
||||
*
|
||||
* Example complexity rating: [★☆☆☆] 1/4
|
||||
*
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ int main(void)
|
|||
const int screenWidth = 800;
|
||||
const int screenHeight = 450;
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [text] example - SDF fonts");
|
||||
InitWindow(screenWidth, screenHeight, "raylib [text] example - font SDF loading");
|
||||
|
||||
// NOTE: Textures/Fonts MUST be loaded after Window initialization (OpenGL context is required)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*******************************************************************************************
|
||||
*
|
||||
* raylib [text] example - text formating
|
||||
* raylib [text] example - text formatting
|
||||
*
|
||||
* Example complexity rating: [★☆☆☆] 1/4
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*******************************************************************************************
|
||||
*
|
||||
* raylib [text] example - text input box
|
||||
* raylib [text] example - input box
|
||||
*
|
||||
* Example complexity rating: [★★☆☆] 2/4
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*******************************************************************************************
|
||||
*
|
||||
* raylib [text] example - raylib fonts loading
|
||||
* raylib [text] example - sprite fonts
|
||||
*
|
||||
* Example complexity rating: [★☆☆☆] 1/4
|
||||
*
|
||||
|
|
@ -30,19 +30,19 @@ int main(void)
|
|||
const int screenWidth = 800;
|
||||
const int screenHeight = 450;
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [text] example - raylib fonts");
|
||||
InitWindow(screenWidth, screenHeight, "raylib [text] example - sprite fonts");
|
||||
|
||||
// NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
|
||||
Font fonts[MAX_FONTS] = { 0 };
|
||||
|
||||
fonts[0] = LoadFont("resources/fonts/alagard.png");
|
||||
fonts[1] = LoadFont("resources/fonts/pixelplay.png");
|
||||
fonts[2] = LoadFont("resources/fonts/mecha.png");
|
||||
fonts[3] = LoadFont("resources/fonts/setback.png");
|
||||
fonts[4] = LoadFont("resources/fonts/romulus.png");
|
||||
fonts[5] = LoadFont("resources/fonts/pixantiqua.png");
|
||||
fonts[6] = LoadFont("resources/fonts/alpha_beta.png");
|
||||
fonts[7] = LoadFont("resources/fonts/jupiter_crash.png");
|
||||
fonts[0] = LoadFont("resources/sprite_fonts/alagard.png");
|
||||
fonts[1] = LoadFont("resources/sprite_fonts/pixelplay.png");
|
||||
fonts[2] = LoadFont("resources/sprite_fonts/mecha.png");
|
||||
fonts[3] = LoadFont("resources/sprite_fonts/setback.png");
|
||||
fonts[4] = LoadFont("resources/sprite_fonts/romulus.png");
|
||||
fonts[5] = LoadFont("resources/sprite_fonts/pixantiqua.png");
|
||||
fonts[6] = LoadFont("resources/sprite_fonts/alpha_beta.png");
|
||||
fonts[7] = LoadFont("resources/sprite_fonts/jupiter_crash.png");
|
||||
|
||||
const char *messages[MAX_FONTS] = { "ALAGARD FONT designed by Hewett Tsoi",
|
||||
"PIXELPLAY FONT designed by Aleksander Shevchuk",
|
||||
|
|
@ -87,8 +87,8 @@ int main(void)
|
|||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
DrawText("free fonts included with raylib", 250, 20, 20, DARKGRAY);
|
||||
DrawLine(220, 50, 590, 50, DARKGRAY);
|
||||
DrawText("free sprite fonts included with raylib", 220, 20, 20, DARKGRAY);
|
||||
DrawLine(220, 50, 600, 50, DARKGRAY);
|
||||
|
||||
for (int i = 0; i < MAX_FONTS; i++)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -17,8 +17,13 @@
|
|||
|
||||
#include "raylib.h"
|
||||
|
||||
static void DrawTextBoxed(Font font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint); // Draw text using font inside rectangle limits
|
||||
static void DrawTextBoxedSelectable(Font font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint, int selectStart, int selectLength, Color selectTint, Color selectBackTint); // Draw text using font inside rectangle limits with support for text selection
|
||||
//----------------------------------------------------------------------------------
|
||||
// Module functions declaration
|
||||
//----------------------------------------------------------------------------------
|
||||
// Draw text using font inside rectangle limits
|
||||
static void DrawTextBoxed(Font font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint);
|
||||
// Draw text using font inside rectangle limits with support for text selection
|
||||
static void DrawTextBoxedSelectable(Font font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint, int selectStart, int selectLength, Color selectTint, Color selectBackTint);
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Program main entry point
|
||||
|
|
@ -30,7 +35,7 @@ int main(void)
|
|||
const int screenWidth = 800;
|
||||
const int screenHeight = 450;
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [text] example - draw text inside a rectangle");
|
||||
InitWindow(screenWidth, screenHeight, "raylib [text] example - rectangle bounds");
|
||||
|
||||
const char text[] = "Text cannot escape\tthis container\t...word wrap also works when active so here's \
|
||||
a long text for testing.\n\nLorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod \
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*******************************************************************************************
|
||||
*
|
||||
* raylib [text] example - unicode text drawing
|
||||
* raylib [text] example - unicode emojis emojis
|
||||
*
|
||||
* Example complexity rating: [★★★★] 4/4
|
||||
*
|
||||
|
|
@ -163,7 +163,7 @@ int main(void)
|
|||
const int screenHeight = 450;
|
||||
|
||||
SetConfigFlags(FLAG_MSAA_4X_HINT | FLAG_VSYNC_HINT);
|
||||
InitWindow(screenWidth, screenHeight, "raylib [text] example - unicode");
|
||||
InitWindow(screenWidth, screenHeight, "raylib [text] example - unicode emojis");
|
||||
|
||||
// Load the font resources
|
||||
// NOTE: fontAsian is for asian languages,
|
||||
|
|
|
|||