More defer

This commit is contained in:
Not-Nik 2023-07-20 16:23:41 +02:00
parent 183cc437ac
commit f50189fdd0
Failed to generate hash of commit
12 changed files with 21 additions and 64 deletions

View file

@ -12,6 +12,7 @@ pub fn main() anyerror!void {
const screenHeight = 450;
rl.initWindow(screenWidth, screenHeight, "raylib-zig [core] example - 2d camera");
defer rl.closeWindow(); // Close window and OpenGL context
var player = rl.Rectangle{ .x = 400, .y = 280, .width = 40, .height = 40 };
var buildings: [MAX_BUILDINGS]rl.Rectangle = undefined;
@ -117,9 +118,4 @@ pub fn main() anyerror!void {
rl.endDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
rl.closeWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
}

View file

@ -11,6 +11,7 @@ pub fn main() anyerror!void {
const screenHeight = 450;
rl.initWindow(screenWidth, screenHeight, "raylib-zig [core] example - 3d camera first person");
defer rl.closeWindow(); // Close window and OpenGL context
var camera = rl.Camera3D{
.position = rl.Vector3.init(4, 2, 4),
@ -74,9 +75,4 @@ pub fn main() anyerror!void {
rl.endDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
rl.closeWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
}

View file

@ -9,6 +9,7 @@ pub fn main() anyerror!void {
const screenHeight = 450;
rl.initWindow(screenWidth, screenHeight, "raylib-zig [core] example - basic window");
defer rl.closeWindow(); // Close window and OpenGL context
rl.setTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
@ -31,9 +32,4 @@ pub fn main() anyerror!void {
rl.endDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
rl.closeWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
}

View file

@ -9,6 +9,7 @@ pub fn main() anyerror!void {
const screenHeight = 450;
rl.initWindow(screenWidth, screenHeight, "raylib-zig [core] example - keyboard input");
defer rl.closeWindow(); // Close window and OpenGL context
var ballPosition = rl.Vector2.init(screenWidth / 2, screenHeight / 2);
@ -47,9 +48,4 @@ pub fn main() anyerror!void {
rl.endDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
rl.closeWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
}

View file

@ -9,6 +9,7 @@ pub fn main() anyerror!void {
const screenHeight = 450;
rl.initWindow(screenWidth, screenHeight, "raylib-zig [core] example - mouse input");
defer rl.closeWindow(); // Close window and OpenGL context
var ballPosition = rl.Vector2.init(-100, -100);
var ballColor = rl.Color.dark_blue;
@ -46,9 +47,4 @@ pub fn main() anyerror!void {
rl.endDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
rl.closeWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
}

View file

@ -10,6 +10,7 @@ pub fn main() anyerror!void {
const screenHeight = 450;
rl.initWindow(screenWidth, screenHeight, "raylib-zig [core] example - basic window");
defer rl.closeWindow(); // Close window and OpenGL context
var boxPositionY: f32 = screenHeight / 2 - 40;
var scrollSpeed: f32 = 4; // Scrolling speed in pixels
@ -39,9 +40,4 @@ pub fn main() anyerror!void {
rl.endDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
rl.closeWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
}

View file

@ -9,6 +9,7 @@ pub fn main() anyerror!void {
const screenHeight = 450;
rl.initWindow(screenWidth, screenHeight, "raylib-zig [core] example - basic window");
defer rl.closeWindow(); // Close window and OpenGL context
var ballPosition = rl.Vector2.init(-100, -100);
var ballColor = rl.Color.beige;
@ -80,9 +81,4 @@ pub fn main() anyerror!void {
rl.endDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
rl.closeWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
}