diff options
| author | Ray <[email protected]> | 2023-02-14 20:00:51 +0100 |
|---|---|---|
| committer | Ray <[email protected]> | 2023-02-14 20:00:51 +0100 |
| commit | ea590c44a967075b3f6b420fa76e6387075ecf1d (patch) | |
| tree | b456de45fef83507415dcc309c05e64cb9232946 /examples/core/core_world_screen.c | |
| parent | 73989a49817225f11f547d270598e93745bf7df0 (diff) | |
| download | raylib-ea590c44a967075b3f6b420fa76e6387075ecf1d.tar.gz raylib-ea590c44a967075b3f6b420fa76e6387075ecf1d.zip | |
REVIEWED: Camera redesign PR
Diffstat (limited to 'examples/core/core_world_screen.c')
| -rw-r--r-- | examples/core/core_world_screen.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/examples/core/core_world_screen.c b/examples/core/core_world_screen.c index f96690ba..6c811a50 100644 --- a/examples/core/core_world_screen.c +++ b/examples/core/core_world_screen.c @@ -27,16 +27,17 @@ int main(void) // Define the camera to look into our 3d world Camera camera = { 0 }; - camera.position = (Vector3){ 10.0f, 10.0f, 10.0f }; - camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; - camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; - camera.fovy = 45.0f; - camera.projection = CAMERA_PERSPECTIVE; + camera.position = (Vector3){ 10.0f, 10.0f, 10.0f }; // Camera position + camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; // Camera looking at point + camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target) + camera.fovy = 45.0f; // Camera field-of-view Y + camera.projection = CAMERA_PERSPECTIVE; // Camera projection type Vector3 cubePosition = { 0.0f, 0.0f, 0.0f }; Vector2 cubeScreenPosition = { 0.0f, 0.0f }; - DisableCursor(); // Catch cursor + DisableCursor(); // Limit cursor to relative movement inside the window + SetTargetFPS(60); // Set our game to run at 60 frames-per-second //-------------------------------------------------------------------------------------- @@ -67,7 +68,9 @@ int main(void) EndMode3D(); DrawText("Enemy: 100 / 100", (int)cubeScreenPosition.x - MeasureText("Enemy: 100/100", 20)/2, (int)cubeScreenPosition.y, 20, BLACK); - DrawText("Text is always on top of the cube", (screenWidth - MeasureText("Text is always on top of the cube", 20))/2, 25, 20, GRAY); + + DrawText(TextFormat("Cube position in screen space coordinates: [%i, %i]", (int)cubeScreenPosition.x, (int)cubeScreenPosition.y), 10, 10, 20, LIME); + DrawText("Text 2d should be always on top of the cube", 10, 40, 20, GRAY); EndDrawing(); //---------------------------------------------------------------------------------- |
