|
|
@ -49,8 +49,8 @@ pub fn World(comptime ctx: anytype) type { |
|
|
|
flecszigble.allocator.destroy(self); |
|
|
|
flecszigble.allocator.destroy(self); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
pub fn enableRest(self: *Self, options: struct { port: u16 = 0, addr: ?[:0]const u8 = null }) !void { |
|
|
|
pub fn enableRest(self: *Self, port: u16) !void { |
|
|
|
try self.set(flecs.rest.Rest, .{ .port = options.port, .ipaddr = @constCast(options.addr) }); |
|
|
|
try self.set(flecs.rest.Rest, .{ .port = port }); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
pub fn progress(self: *Self, delta_time: f32) bool { |
|
|
|
pub fn progress(self: *Self, delta_time: f32) bool { |
|
|
@ -297,7 +297,7 @@ test "World REST API" { |
|
|
|
flecszigble.init(alloc); |
|
|
|
flecszigble.init(alloc); |
|
|
|
var world = try World(void).init(); |
|
|
|
var world = try World(void).init(); |
|
|
|
defer world.deinit(); |
|
|
|
defer world.deinit(); |
|
|
|
try world.enableRest(.{ .port = 42666 }); |
|
|
|
try world.enableRest(42666); |
|
|
|
|
|
|
|
|
|
|
|
const Runner = struct { |
|
|
|
const Runner = struct { |
|
|
|
pub fn run(w: *World(void)) void { |
|
|
|
pub fn run(w: *World(void)) void { |
|
|
|