{"id":15137863,"url":"https://github.com/djeedai/bevy_keith","last_synced_at":"2025-10-23T13:30:58.297Z","repository":{"id":249428320,"uuid":"831476948","full_name":"djeedai/bevy_keith","owner":"djeedai","description":"🐕 Bevy Keith — 2D graphic library for the Bevy game engine","archived":false,"fork":false,"pushed_at":"2024-07-22T21:12:26.000Z","size":3387,"stargazers_count":7,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-30T18:48:19.157Z","etag":null,"topics":["2d","2d-graphics","2d-graphics-library","bevy","bevy-engine","game-development","game-engine","gamedev","sdf"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/djeedai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE2","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-20T17:01:18.000Z","updated_at":"2025-01-13T14:12:28.000Z","dependencies_parsed_at":"2024-07-20T19:02:08.228Z","dependency_job_id":null,"html_url":"https://github.com/djeedai/bevy_keith","commit_stats":null,"previous_names":["djeedai/bevy_keith"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/djeedai%2Fbevy_keith","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/djeedai%2Fbevy_keith/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/djeedai%2Fbevy_keith/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/djeedai%2Fbevy_keith/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/djeedai","download_url":"https://codeload.github.com/djeedai/bevy_keith/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237834623,"owners_count":19373759,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["2d","2d-graphics","2d-graphics-library","bevy","bevy-engine","game-development","game-engine","gamedev","sdf"],"created_at":"2024-09-26T07:02:57.326Z","updated_at":"2025-10-23T13:30:52.763Z","avatar_url":"https://github.com/djeedai.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🐕 Bevy Keith\n\n[![License: MIT or Apache 2.0](https://img.shields.io/badge/License-MIT%20or%20Apache2-blue.svg)](./LICENSE)\n[![Doc](https://docs.rs/bevy_keith/badge.svg)](https://docs.rs/bevy_keith)\n[![Crate](https://img.shields.io/crates/v/bevy_keith.svg)](https://crates.io/crates/bevy_keith)\n[![Bevy tracking](https://img.shields.io/badge/Bevy%20tracking-v0.14-lightblue)](https://github.com/bevyengine/bevy/blob/main/docs/plugins_guidelines.md#main-branch-tracking)\n\n2D graphic library inspired by Piet (📦 [`piet`](https://crates.io/crates/piet)) for the [Bevy game engine](https://bevyengine.org/).\n\nThe library uses a custom Signed Distance Field (SDF) renderer, enabling anti-aliased shapes of any scale with very few draw calls (typically, single draw call per canvas). The pipeline renders at physical resolution even with high DPI, for crisp details.\n\n![Preview of canvas drawing with bevy_keith](https://raw.githubusercontent.com/djeedai/bevy_keith/b434cb16661846746acbceef2cbc38c3849c3afd/media/demo.gif)\n\n## Usage\n\nAdd a dependency to `Cargo.toml`:\n\n```toml\n[dependencies]\nbevy_keith = \"0.1\"\n```\n\nAdd the `KeithPlugin` to your Bevy app:\n\n```rust\nApp::default()\n    .add_plugins(DefaultPlugins)\n    .add_plugins(KeithPlugin);\n```\n\nAdd a `Canvas` component where you want to draw. If you add the `Canvas` on the same `Entity` as an `OrthographicProjection` component, then the canvas automatically resizes to the full orthographic camera area.\n\n```rust\n// Only for initial setup, or if controlled manually\nlet mut canvas = Canvas::new(Rect {\n    min: Vec2::splat(-400.),\n    max: Vec2::splat(100.),\n});\n\n// Optionally clear the canvas with a given color before drawing\ncanvas.background_color = Some(BEIGE.into());\n\n// Spawn on the same Entity as an OrthographicProjection for auto-resize\ncommands\n    .spawn_bundle(Camera2dBundle::default())\n    .insert(canvas);\n```\n\nDraw something on the `Canvas` via a `RenderContext`:\n\n```rust\nfn run(mut query: Query\u003c\u0026mut Canvas\u003e) {\n    let mut canvas = query.single_mut();\n    canvas.clear();\n\n    let mut ctx = canvas.render_context();\n\n    // Draw a filled rectangle\n    let brush = ctx.solid_brush(PINK.into());\n    let rect = Rect {\n        min: Vec2::ZERO,\n        max: Vec2::splat(50.),\n    };\n    ctx.fill(rect, \u0026brush);\n\n    // Draw a text\n    let font_handle: Handle\u003cFont\u003e = [...]\n    let text = ctx\n        .new_layout(\"Hello World!\")\n        .color(ORANGE_RED.into())\n        .font(font_handle)\n        .font_size(24.)\n        .build();\n    ctx.draw_text(text, Vec2::ZERO);\n\n    // Draw a textured rectangle\n    let rect = Rect {\n        min: Vec2::new(100., 150.),\n        max: Vec2::new(116., 166.),\n    };\n    ctx.draw_image(rect, my_res.image.clone());\n\n    // Draw some lines\n    let brush = ctx.solid_brush(GREEN.into());\n    for i in 0..=10 {\n        ctx.line(Vec2::new(-200.5, 0.5 + i as f32 * 15.), Vec2::new(0.5, 0.5 + i as f32 * 40.), \u0026brush, 1. + i as f32);\n    }\n}\n```\n\n## Features\n\n- [ ] Primitives\n  - [x] Text\n  - [x] Axis-aligned rectangle\n    - [x] Fill\n    - [x] Stroke\n    - [x] Rounded corners\n  - [x] Single line\n  - [ ] Polyline\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdjeedai%2Fbevy_keith","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdjeedai%2Fbevy_keith","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdjeedai%2Fbevy_keith/lists"}