74 lines
1.8 KiB
Zig
74 lines
1.8 KiB
Zig
allocator: std.mem.Allocator,
|
|
|
|
pub var NeonObjectTable: core.EngineObjectVTable = core.EngineObjectVTable.from(@This());
|
|
|
|
pub fn init(allocator: std.mem.Allocator) !*@This() {
|
|
const self = try allocator.create(@This());
|
|
self.* = .{
|
|
.allocator = allocator,
|
|
};
|
|
return self;
|
|
}
|
|
|
|
const assetReferences = [_]assets.AssetImportReference{
|
|
assets.MakeImportRefOptions(
|
|
"Mesh",
|
|
"m_empire",
|
|
.{ .path = "meshes/lost_empire.obj" },
|
|
),
|
|
assets.MakeImportRefOptions(
|
|
"Mesh",
|
|
"m_fox",
|
|
.{ .path = "gltf-samples/Fox/glTF/Fox.gltf" },
|
|
),
|
|
};
|
|
|
|
pub fn prepare(self: *@This()) !void {
|
|
_ = self;
|
|
core.engine_log(">>>>>>> game prepare", .{});
|
|
var z = core.tracy.ZoneN(@src(), "PREPARING GAME");
|
|
defer z.End();
|
|
try core.fs().addContentPath("sampleGame");
|
|
try script.loadTypes("scripts");
|
|
try script.runScriptFile("scripts/prepare.lua");
|
|
|
|
try assets.loadList(assetReferences);
|
|
|
|
const exitInput = try core.ActionBinding.create(core.MakeName("exit"));
|
|
exitInput.addKey(.escape, .keyDown);
|
|
_ = exitInput.data.addListener(null, onExit);
|
|
exitInput.activate();
|
|
}
|
|
|
|
pub fn onExit(ctx: ?*anyopaque, action: core.ActionEvent) void {
|
|
_ = ctx;
|
|
_ = action;
|
|
|
|
core.exitNow();
|
|
}
|
|
|
|
pub fn tick(self: *@This(), _: f64) void {
|
|
_ = self;
|
|
std.time.sleep(6000 * 1000); // just gonna put this here...
|
|
}
|
|
|
|
pub fn deinit(self: *@This()) void {
|
|
self.allocator.destroy(self);
|
|
}
|
|
|
|
pub fn main() anyerror!void {
|
|
try backlog.initializeAndRunStandardProgram(@This(), .{
|
|
.name = "Hello World",
|
|
.enabledModules = .{
|
|
.physics = true,
|
|
},
|
|
});
|
|
}
|
|
|
|
const std = @import("std");
|
|
const backlog = @import("Backlog");
|
|
const assets = backlog.assets;
|
|
const core = backlog.core;
|
|
const rend = backlog.rend;
|
|
const script = core.script;
|