|
|
@ -145,5 +145,25 @@ pub fn World(comptime ctx: anytype) type { |
|
|
|
context.func(iter); |
|
|
|
context.func(iter); |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// Gets the current scope of this `World`. See also: `setScope()`. |
|
|
|
|
|
|
|
pub fn getScope(self: *Self) ?Entity(ctx) { |
|
|
|
|
|
|
|
const result = c.ecs_get_scope(self.raw); |
|
|
|
|
|
|
|
return if (result != 0) Entity(ctx).fromRaw(self, result) else null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// Sets the current scope of this `World` to the specified entity. |
|
|
|
|
|
|
|
/// |
|
|
|
|
|
|
|
/// Setting a scope causes certain operations to be made in relation |
|
|
|
|
|
|
|
/// to the scope entity, rather than the world root. Passing `null` |
|
|
|
|
|
|
|
/// causes the scope to be set to the world root. |
|
|
|
|
|
|
|
/// |
|
|
|
|
|
|
|
/// Returns the previously set scope, if any. It's recommended to set |
|
|
|
|
|
|
|
/// the scope back to the previous value after you're done operating |
|
|
|
|
|
|
|
/// in the desired scope. |
|
|
|
|
|
|
|
pub fn setScope(self: *Self, value: anytype) ?Entity(ctx) { |
|
|
|
|
|
|
|
const result = c.ecs_set_scope(self.raw, util.anyToEntity(ctx, value)); |
|
|
|
|
|
|
|
return if (result != 0) Entity(ctx).fromRaw(self, result) else null; |
|
|
|
|
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|