1 | /******************************************************************************************* |
2 | * |
3 | * raylib [text] example - Text formatting |
4 | * |
5 | * This example has been created using raylib 1.1 (www.raylib.com) |
6 | * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) |
7 | * |
8 | * Copyright (c) 2014 Ramon Santamaria (@raysan5) |
9 | * |
10 | ********************************************************************************************/ |
11 | |
12 | #include "raylib.h" |
13 | |
14 | int main(void) |
15 | { |
16 | // Initialization |
17 | //-------------------------------------------------------------------------------------- |
18 | const int screenWidth = 800; |
19 | const int screenHeight = 450; |
20 | |
21 | InitWindow(screenWidth, screenHeight, "raylib [text] example - text formatting" ); |
22 | |
23 | int score = 100020; |
24 | int hiscore = 200450; |
25 | int lives = 5; |
26 | |
27 | SetTargetFPS(60); // Set our game to run at 60 frames-per-second |
28 | //-------------------------------------------------------------------------------------- |
29 | |
30 | // Main game loop |
31 | while (!WindowShouldClose()) // Detect window close button or ESC key |
32 | { |
33 | // Update |
34 | //---------------------------------------------------------------------------------- |
35 | // TODO: Update your variables here |
36 | //---------------------------------------------------------------------------------- |
37 | |
38 | // Draw |
39 | //---------------------------------------------------------------------------------- |
40 | BeginDrawing(); |
41 | |
42 | ClearBackground(RAYWHITE); |
43 | |
44 | DrawText(FormatText("Score: %08i" , score), 200, 80, 20, RED); |
45 | |
46 | DrawText(FormatText("HiScore: %08i" , hiscore), 200, 120, 20, GREEN); |
47 | |
48 | DrawText(FormatText("Lives: %02i" , lives), 200, 160, 40, BLUE); |
49 | |
50 | DrawText(FormatText("Elapsed Time: %02.02f ms" , GetFrameTime()*1000), 200, 220, 20, BLACK); |
51 | |
52 | EndDrawing(); |
53 | //---------------------------------------------------------------------------------- |
54 | } |
55 | |
56 | // De-Initialization |
57 | //-------------------------------------------------------------------------------------- |
58 | CloseWindow(); // Close window and OpenGL context |
59 | //-------------------------------------------------------------------------------------- |
60 | |
61 | return 0; |
62 | } |