Reviewed examples for consistency
This commit is contained in:
parent
2d5d0c2999
commit
1896268775
17 changed files with 481 additions and 229 deletions
|
@ -28,6 +28,9 @@ int main(void)
|
|||
|
||||
Vector2 start = { 0, 0 };
|
||||
Vector2 end = { (float)screenWidth, (float)screenHeight };
|
||||
|
||||
Vector2 startControl = { 100, 0 };
|
||||
Vector2 endControl = { GetScreenWidth() - 100, GetScreenHeight() };
|
||||
|
||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
@ -37,8 +40,16 @@ int main(void)
|
|||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
if (IsMouseButtonDown(MOUSE_BUTTON_LEFT)) start = GetMousePosition();
|
||||
else if (IsMouseButtonDown(MOUSE_BUTTON_RIGHT)) end = GetMousePosition();
|
||||
if (IsKeyDown(KEY_LEFT_CONTROL))
|
||||
{
|
||||
if (IsMouseButtonDown(MOUSE_BUTTON_LEFT)) startControl = GetMousePosition();
|
||||
else if (IsMouseButtonDown(MOUSE_BUTTON_RIGHT)) endControl = GetMousePosition();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (IsMouseButtonDown(MOUSE_BUTTON_LEFT)) start = GetMousePosition();
|
||||
else if (IsMouseButtonDown(MOUSE_BUTTON_RIGHT)) end = GetMousePosition();
|
||||
}
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
|
@ -49,7 +60,14 @@ int main(void)
|
|||
|
||||
DrawText("USE MOUSE LEFT-RIGHT CLICK to DEFINE LINE START and END POINTS", 15, 20, 20, GRAY);
|
||||
|
||||
DrawLineBezier(start, end, 2.0f, RED);
|
||||
//DrawLineBezier(start, end, 2.0f, RED);
|
||||
|
||||
DrawLineBezierCubic(start, end, startControl, endControl, 2.0f, RED);
|
||||
|
||||
DrawLineEx(start, startControl, 1.0, LIGHTGRAY);
|
||||
DrawLineEx(end, endControl, 1.0, LIGHTGRAY);
|
||||
DrawCircleV(startControl, 10, RED);
|
||||
DrawCircleV(endControl, 10, RED);
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue