Move colors into color struct
This commit is contained in:
parent
642ca0513f
commit
c564af4f61
11 changed files with 124 additions and 124 deletions
|
|
@ -11,7 +11,7 @@ pub fn main() anyerror!void {
|
|||
rl.InitWindow(screenWidth, screenHeight, "raylib-zig [core] example - basic window");
|
||||
|
||||
var ballPosition = rl.Vector2.init(-100, -100);
|
||||
var ballColor = rl.BEIGE;
|
||||
var ballColor = rl.Color.BEIGE;
|
||||
|
||||
var touchCounter: f32 = 0;
|
||||
var touchPosition = rl.Vector2.init(0, 0);
|
||||
|
|
@ -25,16 +25,16 @@ pub fn main() anyerror!void {
|
|||
//----------------------------------------------------------------------------------
|
||||
ballPosition = rl.GetMousePosition();
|
||||
|
||||
ballColor = rl.BEIGE;
|
||||
ballColor = rl.Color.BEIGE;
|
||||
|
||||
if (rl.IsMouseButtonDown(rl.MouseButton.MOUSE_BUTTON_LEFT)) {
|
||||
ballColor = rl.MAROON;
|
||||
ballColor = rl.Color.MAROON;
|
||||
}
|
||||
if (rl.IsMouseButtonDown(rl.MouseButton.MOUSE_BUTTON_MIDDLE)) {
|
||||
ballColor = rl.LIME;
|
||||
ballColor = rl.Color.LIME;
|
||||
}
|
||||
if (rl.IsMouseButtonDown(rl.MouseButton.MOUSE_BUTTON_RIGHT)) {
|
||||
ballColor = rl.DARKBLUE;
|
||||
ballColor = rl.Color.DARKBLUE;
|
||||
}
|
||||
|
||||
if (rl.IsMouseButtonPressed(rl.MouseButton.MOUSE_BUTTON_LEFT)) {
|
||||
|
|
@ -56,7 +56,7 @@ pub fn main() anyerror!void {
|
|||
//----------------------------------------------------------------------------------
|
||||
rl.BeginDrawing();
|
||||
|
||||
rl.ClearBackground(rl.RAYWHITE);
|
||||
rl.ClearBackground(rl.Color.RAYWHITE);
|
||||
|
||||
const nums = [_]i32{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
|
||||
for (nums) |i| {
|
||||
|
|
@ -66,16 +66,16 @@ pub fn main() anyerror!void {
|
|||
if ((touchPosition.x >= 0) and (touchPosition.y >= 0)) {
|
||||
|
||||
// Draw circle and touch index number
|
||||
rl.DrawCircleV(touchPosition, 34, rl.ORANGE);
|
||||
rl.DrawText(rl.TextFormat("%d", i), @floatToInt(c_int, touchPosition.x) - 10, @floatToInt(c_int, touchPosition.y) - 70, 40, rl.BLACK);
|
||||
rl.DrawCircleV(touchPosition, 34, rl.Color.ORANGE);
|
||||
rl.DrawText(rl.TextFormat("%d", i), @floatToInt(c_int, touchPosition.x) - 10, @floatToInt(c_int, touchPosition.y) - 70, 40, rl.Color.BLACK);
|
||||
}
|
||||
}
|
||||
|
||||
// Draw the normal mouse location
|
||||
rl.DrawCircleV(ballPosition, 30 + (touchCounter * 3), ballColor);
|
||||
|
||||
rl.DrawText("move ball with mouse and click mouse button to change color", 10, 10, 20, rl.DARKGRAY);
|
||||
rl.DrawText("touch the screen at multiple locations to get multiple balls", 10, 30, 20, rl.DARKGRAY);
|
||||
rl.DrawText("move ball with mouse and click mouse button to change color", 10, 10, 20, rl.Color.DARKGRAY);
|
||||
rl.DrawText("touch the screen at multiple locations to get multiple balls", 10, 30, 20, rl.Color.DARKGRAY);
|
||||
|
||||
rl.EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue