Map C pointers to Zig and functions names use Zig naming conventions
This commit is contained in:
parent
c564af4f61
commit
e29e012981
18 changed files with 3510 additions and 879 deletions
|
|
@ -8,38 +8,38 @@ pub fn main() anyerror!void {
|
|||
const screenWidth = 800;
|
||||
const screenHeight = 450;
|
||||
|
||||
rl.InitWindow(screenWidth, screenHeight, "raylib-zig [core] example - basic window");
|
||||
rl.initWindow(screenWidth, screenHeight, "raylib-zig [core] example - basic window");
|
||||
|
||||
var boxPositionY: f32 = screenHeight / 2 - 40;
|
||||
var scrollSpeed: f32 = 4; // Scrolling speed in pixels
|
||||
|
||||
rl.SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||
rl.setTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
// Main game loop
|
||||
while (!rl.WindowShouldClose()) { // Detect window close button or ESC key
|
||||
while (!rl.windowShouldClose()) { // Detect window close button or ESC key
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
boxPositionY -= (rl.GetMouseWheelMove() * scrollSpeed);
|
||||
boxPositionY -= (rl.getMouseWheelMove() * scrollSpeed);
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
rl.BeginDrawing();
|
||||
rl.beginDrawing();
|
||||
|
||||
rl.ClearBackground(rl.Color.WHITE);
|
||||
rl.clearBackground(rl.Color.WHITE);
|
||||
|
||||
rl.DrawRectangle(screenWidth / 2 - 40, @floatToInt(c_int, boxPositionY), 80, 80, rl.Color.MAROON);
|
||||
rl.drawRectangle(screenWidth / 2 - 40, @floatToInt(c_int, boxPositionY), 80, 80, rl.Color.MAROON);
|
||||
|
||||
rl.DrawText("Use mouse wheel to move the cube up and down!", 10, 10, 20, rl.Color.GRAY);
|
||||
rl.DrawText(rl.TextFormat("Box position Y: %03i", @floatToInt(c_int, boxPositionY)), 10, 40, 20, rl.Color.LIGHTGRAY);
|
||||
rl.drawText("Use mouse wheel to move the cube up and down!", 10, 10, 20, rl.Color.GRAY);
|
||||
//rl.drawText(rl.textFormat("Box position Y: %03i", .{@floatToInt(c_int, boxPositionY)}), 10, 40, 20, rl.Color.LIGHTGRAY);
|
||||
|
||||
rl.EndDrawing();
|
||||
rl.endDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
rl.CloseWindow(); // Close window and OpenGL context
|
||||
rl.closeWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue