Starting out with object orientation

This commit is contained in:
Not-Nik 2020-05-04 15:06:13 +10:00
parent a4fabdcd40
commit c481ade52f
Failed to generate hash of commit
3 changed files with 144 additions and 18 deletions

View file

@ -87,7 +87,7 @@ pub fn main() anyerror!void
ClearBackground(RAYWHITE);
BeginMode2D(camera);
camera.Begin();
DrawRectangle(-6000, 320, 13000, 8000, DARKGRAY);
@ -105,7 +105,7 @@ pub fn main() anyerror!void
DrawLine(@floatToInt(c_int, camera.target.x), -screenHeight*10, @floatToInt(c_int, camera.target.x), screenHeight*10, GREEN);
DrawLine(-screenWidth*10, @floatToInt(c_int, camera.target.y), screenWidth*10, @floatToInt(c_int, camera.target.y), GREEN);
EndMode2D();
camera.End();
DrawText("SCREEN AREA", 640, 10, 20, RED);

View file

@ -36,7 +36,7 @@ pub fn main() anyerror!void
// NOTE: bounds are calculated from the original size of the model,
// if model is scaled on drawing, bounds must be also scaled
SetCameraMode(camera, CameraMode.CAMERA_FREE); // Set a free camera mode
camera.SetMode(CameraMode.CAMERA_FREE); // Set a free camera mode
var selected = false; // Selected object flag
@ -48,7 +48,7 @@ pub fn main() anyerror!void
{
// Update
//----------------------------------------------------------------------------------
UpdateCamera(&camera);
camera.Update();
// Load new models/textures on drag&drop
if (IsFileDropped())
@ -103,7 +103,7 @@ pub fn main() anyerror!void
ClearBackground(RAYWHITE);
BeginMode3D(camera);
camera.Begin();
//DrawModel(model, position, 1.0, WHITE); // Draw 3d model with texture
@ -111,7 +111,7 @@ pub fn main() anyerror!void
if (selected) DrawBoundingBox(bounds, GREEN); // Draw selection box
EndMode3D();
camera.End();
DrawText("Drag & drop model to load mesh/texture.", 10, GetScreenHeight() - 20, 10, DARKGRAY);
if (selected) DrawText("MODEL SELECTED", GetScreenWidth() - 110, 10, 10, GREEN);