mirror of
https://github.com/raysan5/raylib.git
synced 2025-09-11 13:58:15 +00:00
Added some functions and Updated examples
View CHANGELOG for details
This commit is contained in:
@@ -13,6 +13,8 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
// Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
int screenWidth = 800;
|
||||
int screenHeight = 450;
|
||||
|
||||
@@ -20,16 +22,14 @@ int main()
|
||||
int counter = 0;
|
||||
int mouseX, mouseY;
|
||||
|
||||
// Initialization
|
||||
//---------------------------------------------------------
|
||||
InitWindow(screenWidth, screenHeight, "raylib example 06 - mouse input");
|
||||
//----------------------------------------------------------
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
// Main game loop
|
||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||
{
|
||||
// Update
|
||||
//-----------------------------------------------------
|
||||
//----------------------------------------------------------------------------------
|
||||
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON))
|
||||
{
|
||||
mouseX = GetMouseX();
|
||||
@@ -38,26 +38,26 @@ int main()
|
||||
ballPosition.x = (float)mouseX;
|
||||
ballPosition.y = (float)mouseY;
|
||||
}
|
||||
//-----------------------------------------------------
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
//-----------------------------------------------------
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
DrawCircleV(ballPosition, 40, GOLD);
|
||||
|
||||
DrawText("mouse click to draw the ball", 10, 10, 20, 1, DARKGRAY);
|
||||
DrawText("mouse click to draw the ball", 10, 10, 20, DARKGRAY);
|
||||
|
||||
EndDrawing();
|
||||
//-----------------------------------------------------
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
// De-Initialization
|
||||
//---------------------------------------------------------
|
||||
//--------------------------------------------------------------------------------------
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//----------------------------------------------------------
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user