Skip to content
This repository has been archived by the owner on Sep 21, 2023. It is now read-only.

Porting to zig 0.9.0 #3

Open
realgdman opened this issue Jan 13, 2022 · 2 comments
Open

Porting to zig 0.9.0 #3

realgdman opened this issue Jan 13, 2022 · 2 comments

Comments

@realgdman
Copy link

realgdman commented Jan 13, 2022

Hello, I'm new to zig and don't have a PR, but here's my findings on what need to be changed

  1. Allocator now is object itself, not pointer
    1.1. Replace declarations allocator: *Allocator with allocator: Allocator
    1.2. Replace usage &allocator.allocator with allocator.allocator()
    There are cases with ?Allocator, I'm not sure if that's valid.
  2. Mutex is now locking itself, doesn't return held object
    2.1. Replace declarations: held: blabla @TypeOf(std.Thread.Mutex.acquire)... to mutex: std.Thread.Mutex
    2.2. Replace lock held = lock.acquire() to mutex.lock()
    2.3. Replace defer held.release() to defer mutex.unlock() and held.release() to mutex.unlock()
  3. c_void changed to anyopaque. Not sure, may be it need to be *allowzero anyopaque.
  4. There is package in buld.zig that named zlm but refers to zalgebra, not sure if they're interchangable
  5. Example in README.md somewhat outdated, I have changed some parts according to karts example
    5.1. Changed .rotation = Vec3.new(-120.0, -15.0, 0).toRadians() to .rotation = Quat.fromEulerAngle(Vec3.new(-120, -15, 0))
    5.2. primitive name need to be asset var cube = try didot_obj.GameObject.createObject(allocator, asset.get("Mesh/Cube"));
    asset is referenced as const asset = &app.scene.assetManager;
    5.3. usingnamespace @import(...) not working anymore, I ended up with const didot_gfx = @import("didot-graphics"); etc.
  6. Some deprecated std.debug.warn changed to std.debug.print

This is where I ended up now. I have trouble building glfw on windows, so I replaced all cImports with https://github.com/JonSnowbd/ZT/ but that's another story.

@zenith391
Copy link
Owner

zenith391 commented Jan 13, 2022

Thanks!
It's been long since I have touched Didot's code (last commit was October last year!) but I'll try to address those issues in the current week and maybe work a bit on adding a few new features to Didot. I'll close this issue once it compiles on Zig 0.9.0

@realgdman
Copy link
Author

Hello, I have made some progress (basic rendering on windows- im using ZT for GL, mouselook - disabled physics for now).
I'll post link here, it's pretty messed up, but probably have some use for reference. https://github.com/realgdman/didot
image
Have no idea why karts going purple.

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

No branches or pull requests

2 participants