[build][Zig] Improve project example
This commit is contained in:
parent
f0a8201733
commit
dd1809e89c
1 changed files with 2 additions and 7 deletions
|
|
@ -31,6 +31,7 @@ pub fn main() void {
|
||||||
// Initialization
|
// Initialization
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
rl.InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window");
|
rl.InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window");
|
||||||
|
defer rl.CloseWindow(); // Close window and OpenGL context
|
||||||
|
|
||||||
if (builtin.os.tag == .emscripten) {
|
if (builtin.os.tag == .emscripten) {
|
||||||
std.os.emscripten.emscripten_set_main_loop(UpdateDrawFrame, 0, 1);
|
std.os.emscripten.emscripten_set_main_loop(UpdateDrawFrame, 0, 1);
|
||||||
|
|
@ -44,11 +45,6 @@ pub fn main() void {
|
||||||
UpdateDrawFrame();
|
UpdateDrawFrame();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// De-Initialization
|
|
||||||
//--------------------------------------------------------------------------------------
|
|
||||||
rl.CloseWindow(); // Close window and OpenGL context
|
|
||||||
//--------------------------------------------------------------------------------------
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
@ -63,11 +59,10 @@ fn UpdateDrawFrame() callconv(.c) void {
|
||||||
// Draw
|
// Draw
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
rl.BeginDrawing();
|
rl.BeginDrawing();
|
||||||
|
defer rl.EndDrawing();
|
||||||
|
|
||||||
rl.ClearBackground(rl.RAYWHITE);
|
rl.ClearBackground(rl.RAYWHITE);
|
||||||
|
|
||||||
rl.DrawText("Congrats! You created your first window!", 190, 200, 20, rl.LIGHTGRAY);
|
rl.DrawText("Congrats! You created your first window!", 190, 200, 20, rl.LIGHTGRAY);
|
||||||
|
|
||||||
rl.EndDrawing();
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue