Skip to content

[Suggestion] Relocate raylib_render_clay.zig as part of a source instead of a project #16

@Logickin-Lambda

Description

@Logickin-Lambda

Hi mate. While I am exploring and evaluate various gui libraries for my future projects, I have found the clay and I like the idea so much due to the simplicity, and just realized you did a binding which is awesome, and I can't wait to explore how this library work.

Nonetheless, I have some suggestions regarding the renders: The original clay library have a set of renderers located inside the library so that the can pick any backend other than raylib. In this version, seems like raylib_render_clay.zig is the zig version of clay_renderer_raylib.c.

I am wondering: Instead of including the renderer at the application level, I am thinking if putting raylib_render_clay.zig into a renderer folder at the library level (or under the /src folder of the library) a good idea such that users can pick their backend of choice by stating as an option in their build.zig file as shown (which is inspired by zgui):

const zclay_dep = b.dependency("zclay", .{
    .target = target,
    .optimize = optimize,
    .renderer = .raylib
});
compile_step.root_module.addImport("zclay", zclay_dep.module("zclay"));

Because of the lazy evaluation of zig, with the enum for choosing a renderer, we could conditionally compile the application with the chosen backend without including any other unused part of the library. This design would also be more future proof since instead of every user shipping their own renderer, they could contribute their own renderer into your project.

Edit: During waiting for fixes from another library, I am going to explore this idea to see if it is possible.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions