Releases: AndreasHefti/firefly-zig
Releases · AndreasHefti/firefly-zig
Firefly Zig 0.3.0
Firefly Zig Version 0.2.0 now with Tiled integration and platformer game essentials.
See README for more details
Firefly Zig 0.2.0
Firefly Zig Version 0.2.0 with almost all features form former Firefly Kotlin Library
Features
Utils:
- geometry utilities
- DynArray, DynIndexArray and DynIndexMap for index mapping
- Event and EventDispatcher for define and using events
- Aspects, Aspect Groups and Kind (TODO Aspects Mixin?)
- Bitset and Bit-Mask
Firefly API:
- NamePool to store arbitrary names on the heap
- Components, Entities/Components, Systems (with Mixins)
- Attributes Component and CallContext (with Mixins)
- Composite Component (with Mixin)
- Assets Component (with Mixin)
- Control Component (with Mixin)
- Trigger Component
- Task Component
- State Engine Component
- State Engine and Entity State Engine Components
Graphics:
- Shader
- Texture Asset
- Viewport and Layer Components
- Transform Entity Component
- Sprites Entity Component
- Tiles Entity Component and TileMap Component
- Text Entity Component
- Shape Entity Component
- Rendering - Viewport and Layer based rendering --> Sprite Renderer, TileMap Renderer, Shape Renderer
- Rendering - render to texture with individual shader settings
Physics:
- Animation Component and Entity Component
- Movement Entity Component
- Collision-Detection Entity Component and Components
- Collision-Resolving Components
- Audio / Music Components
Game:
- TileSet (created in code or loaded from JSON file)
- TileMap (created in code or loaded from JSON file)
- Camera (simple pivot camera)
- Player Component
- Platformer - Jump / Move Control and Collision Resolver
- Platformer - Area (created in code or loaded from JSON file)
- Platformer - Room (created in code or loaded from JSON file)
Usage
build.zig.zon example:
.{
.name = "firefly-zig-example",
.version = "0.0.1",
.dependencies = .{
.raylib = .{
.url = "https://github.com/raysan5/raylib/archive/57b5f11e2a2595ea189fae03d41c8b1c194c8dfa.tar.gz",
.hash = "1220449c6998951906efc8c7be4bb80c270f05d0911408524a8a418bf127bfa863eb",
},
.firefly = .{
.url = "https://github.com/AndreasHefti/firefly-zig/archive/ee15ac02443f25953d8487f1212c131902ca859d.tar.gz",
.hash = "12201ffb1b2ddb00bd0fab82c5cc3c0a67ddada84b5a7fec29412b1c85346bb742c2",
},
},
.paths = .{
"build.zig",
"build.zig.zon",
"src",
},
}
build.zig example:
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = std.builtin.OptimizeMode.Debug;
// use raylib dependency
const raylib_dep = b.dependency("raylib", .{
.target = target,
// .optimize = optimize,
});
// use firefly dependency
const firefly_dep = b.dependency("firefly", .{
.target = target,
//.optimize = optimize,
});
// use firefly as module
const firefly_module = firefly_dep.module("firefly");
// we link the raylib dependency here to the firefly module
//firefly_module.addIncludePath(raylib_dep.path("src/"));
firefly_module.linkLibrary(raylib_dep.artifact("raylib"));
// build executable
const exe = b.addExecutable(.{
.name = "firefly-zig-example",
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
});
exe.root_module.addImport("firefly", firefly_module);
exe.linkLibrary(firefly_dep.artifact("firefly"));
b.installArtifact(exe);
const run_cmd = b.addRunArtifact(exe);
run_cmd.step.dependOn(b.getInstallStep());
if (b.args) |args| {
run_cmd.addArgs(args);
}
const run_step = b.step("run", "Run the app");
run_step.dependOn(&run_cmd.step);
}