44 lines
1.1 KiB
Zig
44 lines
1.1 KiB
Zig
pub const Scene = extern struct {
|
|
pub const ApiGen = machinery.ComponentApi(@This());
|
|
|
|
handle: core.ObjectHandle = .{},
|
|
testField: u32 = 0,
|
|
position: core.Vectorf = .{},
|
|
|
|
pub fn init(self: *@This()) void {
|
|
_ = self;
|
|
}
|
|
|
|
pub fn setPosition(self: *@This(), vector: core.Vectorf) void {
|
|
self.position = vector;
|
|
core.engine_log("position set: x={d} y={d} z={d}", self.position);
|
|
}
|
|
|
|
pub fn deinit(self: *@This()) void {
|
|
_ = self;
|
|
}
|
|
};
|
|
|
|
const hand = @import("SceneApiHand.zig");
|
|
const SceneAPI = hand.SceneAPI;
|
|
|
|
pub fn doTest() !void {
|
|
machinery.listApi(SceneAPI.Api);
|
|
machinery.listApi(Scene.ApiGen.Api);
|
|
|
|
var scene: Scene = .{};
|
|
|
|
// from this point on, we're larping like we're a different DLL that
|
|
// has no direct reference to the 'Scene' type
|
|
// load function pointers
|
|
SceneAPI.setPosition = @ptrCast(@alignCast(&Scene.setPosition));
|
|
|
|
// takes it as an opaque ptr
|
|
testmodule.callWithNoDirectLinking(&scene);
|
|
}
|
|
|
|
const testmodule = @import("testmodule.zig");
|
|
const core = @import("core");
|
|
const machinery = core.machinery;
|
|
const std = @import("std");
|