Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flecs identifiers #536

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

robinheydon
Copy link
Contributor

This adds a number of flecs identifiers into zig-gamedev. This is done either by just adding the external symbol definition or by using ecs_id (which uses @extern to reference the symbol created by the C macro used to create the symbol).

This also changes the interface for flecs.init to take an allocator, and then use that allocator within flecs. This allows the use of tracy allocator or a logging allocator to watch what flecs is doing with memory.

Added componentWithOptions for defining a component with additional options, such as an explicit name / symbol rather than just relying on @typeName. Also added tagWithOptions for defining a tag with additional options.

Also added setMonitor into the zglfw Window struct.

Also fixed ztracy allocator to the latest zig allocator interface.

@hazeycode
Copy link
Member

@Srekel Could you help review this?

@hazeycode
Copy link
Member

@robinheydon which verison of Zig are you using/targeting?

Copy link
Member

@hazeycode hazeycode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

zflecs/src/tests.zig needs updating

Copy link
Member

@hazeycode hazeycode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use zig fmt . in repo root

@@ -13,6 +13,7 @@ pub fn build(b: *std.Build) void {
.target = target,
.optimize = optimize,
});
b.installArtifact(flecs);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what's going on with the diff, but installArtifact(flecs) is already being called on main branch, albeit not on this exact line. Can you try rebasing this branch?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, will do.

Comment on lines +27 to +33
const ztracy = b.addModule("root", .{
.root_source_file = .{ .path = "src/ztracy.zig" },
.imports = &.{
.{ .name = "ztracy_options", .module = options_module },
},
});
ztracy.addIncludePath(.{ .path = "libs/tracy/tracy" });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likewise here (changes present on main not showing in diff)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

strange... I'll have a look

libs/ztracy/src/ztracy.zig Show resolved Hide resolved
@Srekel
Copy link
Contributor

Srekel commented Apr 3, 2024

@Srekel Could you help review this?

Yeah I'll take a look after your initial concerns have been addressed :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants