mirror of
https://github.com/simtactics/mysimulation.git
synced 2025-04-30 00:11:47 -04:00
Defer unloading of textures and images in group
- Added Clap to the library for future passing of CLI arguments
This commit is contained in:
parent
65f4d35bf1
commit
444f6f5bea
3 changed files with 23 additions and 6 deletions
|
@ -45,6 +45,15 @@ pub fn build(b: *std.Build) void {
|
|||
// exe.root_module.addImport("raylib-gui", raylib_gui);
|
||||
exe.root_module.addImport("rlgl", rlgl);
|
||||
|
||||
const clap_dep = b.dependency("clap", .{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
|
||||
const clap = clap_dep.module("clap"); // main clap module
|
||||
|
||||
exe.root_module.addImport("clap", clap);
|
||||
|
||||
// This declares intent for the executable to be installed into the
|
||||
// standard location when the user invokes the "install" step (the default
|
||||
// step when running `zig build`).
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
// This field is optional.
|
||||
// This is currently advisory only; Zig does not yet do anything
|
||||
// with this value.
|
||||
.minimum_zig_version = "0.12.0",
|
||||
.minimum_zig_version = "0.11.0",
|
||||
|
||||
// This field is optional.
|
||||
// Each dependency must either provide a `url` and `hash`, or a `path`.
|
||||
|
@ -19,6 +19,10 @@
|
|||
.url = "https://github.com/tonytins/raylib-zig/archive/refs/tags/v5.1.103-dev.tar.gz",
|
||||
.hash = "1220f48ef45b22a393da16f3210b61b87ad9b65d215d02c51189861a57a1b4290059",
|
||||
},
|
||||
.clap = .{
|
||||
.url = "https://github.com/Hejsil/zig-clap/archive/refs/tags/0.8.0.tar.gz",
|
||||
.hash = "1220949d4e88864579067b6d4cdad6476c6176f27e782782c2c39b7f2c4817a10efb",
|
||||
},
|
||||
},
|
||||
.paths = .{
|
||||
// This makes *all* files, recursively, included in this package. It is generally
|
||||
|
|
14
src/main.zig
14
src/main.zig
|
@ -2,6 +2,7 @@ const std = @import("std");
|
|||
const rl = @import("raylib");
|
||||
const world = @import("world.zig");
|
||||
const nso = @import("niotso.zig");
|
||||
const clap = @import("clap");
|
||||
|
||||
const dbg = std.debug;
|
||||
|
||||
|
@ -104,11 +105,14 @@ pub fn main() anyerror!void {
|
|||
const chair2_rect = rl.Rectangle.init(0, 0, @as(f32, @floatFromInt(-chair2.width)), @as(f32, @floatFromInt(chair2.height)));
|
||||
const city = rl.loadImage("resources/cities/city_0100/elevation.png");
|
||||
// const city_texture = rl.Texture.init("resources/cities/city_0100/vertexcolor.png");
|
||||
defer rl.unloadTexture(splash);
|
||||
defer rl.unloadTexture(logo);
|
||||
defer rl.unloadTexture(chair1);
|
||||
defer rl.unloadTexture(chair2);
|
||||
defer rl.unloadImage(city);
|
||||
// TODO: figure out a better way to unload all images and textures.
|
||||
defer {
|
||||
rl.unloadTexture(splash);
|
||||
rl.unloadTexture(logo);
|
||||
rl.unloadTexture(chair1);
|
||||
rl.unloadTexture(chair2);
|
||||
rl.unloadImage(city);
|
||||
}
|
||||
|
||||
const mesh = rl.genMeshHeightmap(city, rl.Vector3.init(16, 8, 16));
|
||||
const model = rl.loadModelFromMesh(mesh);
|
||||
|
|
Loading…
Add table
Reference in a new issue