Skip to content

Commit 3cac4af

Browse files
authored
Merge pull request #184 from bensuperpc/add_text_class
Add Text class
2 parents 8fe9277 + f295c16 commit 3cac4af

17 files changed

+289
-28
lines changed

clib.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
"include/RenderTexture.hpp",
5252
"include/Shader.hpp",
5353
"include/Sound.hpp",
54+
"include/Text.hpp",
5455
"include/Texture.hpp",
5556
"include/Vector2.hpp",
5657
"include/Vector3.hpp",

examples/core/core_3d_camera_first_person.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ int main() {
7676
DrawRectangle(10, 10, 220, 70, raylib::Color::SkyBlue().Fade(0.5f));
7777
DrawRectangleLines(10, 10, 220, 70, BLUE);
7878

79-
DrawText("First person camera default controls:", 20, 20, 10, BLACK);
80-
DrawText("- Move with keys: W, A, S, D", 40, 40, 10, DARKGRAY);
81-
DrawText("- Mouse move to look around", 40, 60, 10, DARKGRAY);
79+
raylib::DrawText("First person camera default controls:", 20, 20, 10, BLACK);
80+
raylib::DrawText("- Move with keys: W, A, S, D", 40, 40, 10, DARKGRAY);
81+
raylib::DrawText("- Mouse move to look around", 40, 60, 10, DARKGRAY);
8282
}
8383
EndDrawing();
8484
//----------------------------------------------------------------------------------

examples/core/core_basic_window_web.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ void UpdateDrawFrame(void)
7171

7272
ClearBackground(RAYWHITE);
7373

74-
DrawText("Congrats! You created your first raylib-cpp window!", 190, 200, 20, LIGHTGRAY);
74+
raylib::DrawText("Congrats! You created your first raylib-cpp window!", 190, 200, 20, LIGHTGRAY);
7575

7676
EndDrawing();
7777
//----------------------------------------------------------------------------------

examples/core/core_drop_files.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ int main() {
4141

4242
// Check if there are files to process.
4343
if (droppedFiles.empty()) {
44-
DrawText("Drop your files to this window!", 100, 40, 20, DARKGRAY);
44+
raylib::DrawText("Drop your files to this window!", 100, 40, 20, DARKGRAY);
4545
} else {
46-
DrawText("Dropped files:", 100, 40, 20, DARKGRAY);
46+
raylib::DrawText("Dropped files:", 100, 40, 20, DARKGRAY);
4747

4848
// Iterate through all the dropped files.
4949
for (int i = 0; i < droppedFiles.size(); i++) {
@@ -53,10 +53,10 @@ int main() {
5353
DrawRectangle(0, 85 + 40*i, screenWidth, 40, Fade(LIGHTGRAY, 0.3f));
5454

5555
// Display the path to the dropped file.
56-
DrawText(droppedFiles[i].c_str(), 120, 100 + 40 * i, 10, GRAY);
56+
raylib::DrawText(droppedFiles[i].c_str(), 120, 100 + 40 * i, 10, GRAY);
5757
}
5858

59-
DrawText("Drop new files...", 100, 110 + 40 * droppedFiles.size(), 20, DARKGRAY);
59+
raylib::DrawText("Drop new files...", 100, 110 + 40 * droppedFiles.size(), 20, DARKGRAY);
6060
}
6161
}
6262
EndDrawing();

examples/core/core_loading_thread.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,19 +97,19 @@ int main(void)
9797
switch (state)
9898
{
9999
case STATE_WAITING:
100-
DrawText("PRESS ENTER to START LOADING DATA",
100+
raylib::DrawText("PRESS ENTER to START LOADING DATA",
101101
150, 170, 20, DARKGRAY);
102102
break;
103103

104104
case STATE_LOADING:
105105
DrawRectangle(150, 200, dataProgress, 60, SKYBLUE);
106106
if ((framesCounter/15)%2)
107-
DrawText("LOADING DATA...", 240, 210, 40, DARKBLUE);
107+
raylib::DrawText("LOADING DATA...", 240, 210, 40, DARKBLUE);
108108
break;
109109

110110
case STATE_FINISHED:
111111
DrawRectangle(150, 200, 500, 60, LIME);
112-
DrawText("DATA LOADED!", 250, 210, 40, GREEN);
112+
raylib::DrawText("DATA LOADED!", 250, 210, 40, GREEN);
113113
break;
114114
}
115115

examples/core/core_random_values.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ int main() {
4545
{
4646
window.ClearBackground(RAYWHITE);
4747

48-
DrawText("Every 2 seconds a new random value is generated:", 130, 100, 20, MAROON);
48+
raylib::DrawText("Every 2 seconds a new random value is generated:", 130, 100, 20, MAROON);
4949

50-
DrawText(TextFormat("%i", randValue), 360, 180, 80, LIGHTGRAY);
50+
raylib::DrawText(TextFormat("%i", randValue), 360, 180, 80, LIGHTGRAY);
5151
}
5252
EndDrawing();
5353
//----------------------------------------------------------------------------------

examples/core/core_world_screen.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@ int main() {
6060
}
6161
camera.EndMode();
6262

63-
DrawText("Enemy: 100 / 100",
63+
raylib::DrawText("Enemy: 100 / 100",
6464
cubeScreenPosition.x - MeasureText("Enemy: 100/100", 20) / 2,
6565
cubeScreenPosition.y, 20,
6666
BLACK);
67-
DrawText("Text is always on top of the cube",
67+
raylib::DrawText("Text is always on top of the cube",
6868
(screenWidth - MeasureText("Text is always on top of the cube", 20)) / 2,
6969
25, 20, GRAY);
7070
}

examples/physics/physics_demo.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,12 @@ int main(void)
119119
}
120120
}
121121

122-
DrawText("Left mouse button to create a polygon", 10, 10, 10, WHITE);
123-
DrawText("Right mouse button to create a circle", 10, 25, 10, WHITE);
124-
DrawText("Press 'R' to reset example", 10, 40, 10, WHITE);
122+
raylib::DrawText("Left mouse button to create a polygon", 10, 10, 10, WHITE);
123+
raylib::DrawText("Right mouse button to create a circle", 10, 25, 10, WHITE);
124+
raylib::DrawText("Press 'R' to reset example", 10, 40, 10, WHITE);
125125

126-
DrawText("Physac", logoX, logoY, 30, WHITE);
127-
DrawText("Powered by", logoX + 50, logoY - 7, 10, WHITE);
126+
raylib::DrawText("Physac", logoX, logoY, 30, WHITE);
127+
raylib::DrawText("Powered by", logoX + 50, logoY - 7, 10, WHITE);
128128
}
129129
EndDrawing();
130130
//----------------------------------------------------------------------------------

examples/shapes/shapes_collision_area.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,10 @@ int main(void)
8686
boxCollision.Draw(LIME);
8787

8888
// Draw collision message
89-
DrawText("COLLISION!", GetScreenWidth()/2 - MeasureText("COLLISION!", 20)/2, screenUpperLimit/2 - 10, 20, BLACK);
89+
raylib::DrawText("COLLISION!", GetScreenWidth()/2 - MeasureText("COLLISION!", 20)/2, screenUpperLimit/2 - 10, 20, BLACK);
9090

9191
// Draw collision area
92-
DrawText(TextFormat("Collision Area: %i", (int)boxCollision.width*(int)boxCollision.height), GetScreenWidth()/2 - 100, screenUpperLimit + 10, 20, BLACK);
92+
raylib::DrawText(TextFormat("Collision Area: %i", (int)boxCollision.width*(int)boxCollision.height), GetScreenWidth()/2 - 100, screenUpperLimit + 10, 20, BLACK);
9393
}
9494

9595
DrawFPS(10, 10);

examples/text/resources/KAISG.ttf

78 KB
Binary file not shown.

0 commit comments

Comments
 (0)