#gamedev #graphics #wgpu

kludgine

An asynchronous app and 2d game framework

6 releases

0.1.0-dev-1 Sep 17, 2020
0.1.0-dev.3 Oct 11, 2021
0.1.0-dev.2 Sep 3, 2021
0.1.0-dev.0 Aug 22, 2021
0.0.1 Sep 23, 2020

#74 in Game dev

Download history 2/week @ 2021-07-04 2/week @ 2021-07-11 4/week @ 2021-07-18 7/week @ 2021-07-25 12/week @ 2021-08-01 2/week @ 2021-08-08 5/week @ 2021-08-15 66/week @ 2021-08-22 64/week @ 2021-08-29 8/week @ 2021-09-05 1/week @ 2021-09-12 5/week @ 2021-09-19 6/week @ 2021-09-26 18/week @ 2021-10-03 37/week @ 2021-10-10 2/week @ 2021-10-17

70 downloads per month
Used in magrathea

MIT/Apache

32KB
282 lines

Kludgine

A 2d rendering engine for the Rust language.

Kludgine is considered experimental crate version Live Build Status HTML Coverage Report for main branch Documentation for main branch

Kludgine is named in a way to hopefully be ironic in nature, but it's being designed and written by a developer that is fairly new to modern graphics programming and rust. Thus, it is probably a kludge.

Why use Kludgine?

Kludgine is early in development and is subject to breaking API changes. That being said, the API has started to stabilize, and these are the primary benefits of Kludgine:

Fast and highly portable

Kludgine is built upon easygpu, which is based on wgpu. wgpu is an experimental WebGPU implementation, and it supports DirectX on Windows, Vulkan on Linux, Metal on iOS/Mac OS, and is close to working within the web browser. Kludgine does not yet currently work inside of the web browser, but we eventually will support it.

Apps and games written in Kludgine should have no problem running with reasonable performance on budget hardware, even without a discrete GPU.

Intelligent Redrawing

While most games want a steady framerate, many developers may want to allow their programs to not redraw constantly. Kludgine makes managing this easy with the RedrawStatus type, allowing easy scheduling of future frame redraws or immediately requesting a redraw.

If you do want a consistent redraw, implement Window::target_fps.

Multi-window support

Kludgine has multi-window support. In general, most games don't need multiple windows, but general purpose applications do.

Ease of use

This is a bit nebulous but examples include:

  • Ergonomic and consistent API: This is a work in progress, but the goal is a consistent design that is easy to read and write.
  • Modular design: Kludgine started becoming a large engine, but in the process of creating Gooey, this crate became a much leaner rendering and windowing crate. It will continue evolving to allow it to be used standalone, within other wgpu applications, or as a frontend for Gooey.
let texture = Texture::load("kludgine/examples/assets/k.png")?;
let sprite = SpriteSource::entire_texture(texture);
sprite.render_at(
    scene,
    Rect::from(scene.size()).center(),
    SpriteRotation::around_center(self.rotation_angle),
);

Getting Started

To use Kludgine, your project must be using the new features resolver. The two lines to add to your Cargo.toml look like this:

[lib]
resolver = "2"

[dependencies]
kludgine = "0.1.0-dev.3"

The resolver requirement is inherited from wgpu. This setting will become the default in the 2021 edition.

About

This is being developed by and for Khonsu Labs for Cosmic Verge. I hope it will be useful to others as well.

This code is dual-licensed under the MIT License and Apache License 2.0. Fonts in this repository are not included by default, and are solely licensed under the Apache License 2.0.

Dependencies

~19MB
~368K SLoC