{"id":25668164,"url":"https://github.com/kfischer-okarin/dragonruby-toolbox","last_synced_at":"2025-09-12T06:47:34.015Z","repository":{"id":46273132,"uuid":"257519570","full_name":"kfischer-okarin/dragonruby-toolbox","owner":"kfischer-okarin","description":"Useful classes \u0026 code snippets for DragonRuby GameToolkit","archived":false,"fork":false,"pushed_at":"2024-12-05T14:22:34.000Z","size":12402,"stargazers_count":48,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-22T23:51:34.928Z","etag":null,"topics":["dragonruby","game-development"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kfischer-okarin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null}},"created_at":"2020-04-21T07:48:21.000Z","updated_at":"2025-03-06T01:35:51.000Z","dependencies_parsed_at":"2025-04-22T23:50:54.132Z","dependency_job_id":"4a323a49-f106-40cb-87e6-46835a0447f7","html_url":"https://github.com/kfischer-okarin/dragonruby-toolbox","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kfischer-okarin/dragonruby-toolbox","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kfischer-okarin%2Fdragonruby-toolbox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kfischer-okarin%2Fdragonruby-toolbox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kfischer-okarin%2Fdragonruby-toolbox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kfischer-okarin%2Fdragonruby-toolbox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kfischer-okarin","download_url":"https://codeload.github.com/kfischer-okarin/dragonruby-toolbox/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kfischer-okarin%2Fdragonruby-toolbox/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274770712,"owners_count":25346211,"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","status":"online","status_checked_at":"2025-09-12T02:00:09.324Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["dragonruby","game-development"],"created_at":"2025-02-24T10:28:46.905Z","updated_at":"2025-09-12T06:47:33.959Z","avatar_url":"https://github.com/kfischer-okarin.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DragonRuby Toolbox\n\n![Github License](https://img.shields.io/badge/license-MIT-green)\n\n\n#### Useful classes \u0026amp; code snippets for DragonRuby GameToolkit\n\n\n## Table of content\n\n- [**Getting Started**](#getting-started)\n- [Contents](#contents)\n  - [Autotiles](#autotiles)\n  - [Low Resolution Canvas](#low-resolution-canvas)\n  - [Quaternions](#quaternions)\n  - [Transformations](#transformations)\n  - [Color class with HSV/HSL support](#color-class-with-hsvhsl-support)\n  - [Color accessor for attr_sprite enhanced classes](#color-accessor-for-attr_sprite-enhanced-classes)\n  - [Damage Number Animations](#damage-number-animations)\n- [Get Help](#get-help)\n- [Contributing](#contributing)\n- [License](#license)\n\n\n## Getting Started\n\nCheckout the repository into your dragonruby folder and just start the demo with:\n\n```sh\n./dragonruby dragonruby-toolbox\n```\n\nAll of the shared tools consist of one ruby file which you can copy in your game and require.\n\n\n## Contents\n\n### Autotiles\n\n![Autotiles](gifs/autotiles.gif)\n\nFile to include: [`lib/autotile.rb`](./lib/autotile.rb)\n\n1. Generate an autotile tileset from a source file like this:\n\n   ![Autotile Source](sprites/grass-autotile.png)\n\n   ```rb\n   tileset_target = args.render_target(:grass_tileset)\n   tileset_target.primitives \u003c\u003c DRT::Autotile.generate_tileset_primitives('sprites/grass-autotile.png', 32)\n   ```\n\n   Above file will create a tileset like this\n\n   ![Autotile Tileset](gifs/autotile-generated.png)\n\n   You can skip this step and handcraft a tileset with above layout yourself.\n\n2. Create a tile object using the tileset\n\n   ```rb\n   grass_tile = DRT::Autotile.new(:grass_tileset, 32)\n   ```\n\n3. Draw the correct tile by specifying which neighbor cells contain the same tile\n\n   Method 1 (recommended): Create Autotile instances\n\n   ```rb\n   tile_instance = grass_tile.create_instance(x: 200, y: 200, neighbors: DRT::Autotile::Neighbors.new(:up, :right, :up_right))\n   args.outputs.primitives \u003c\u003c tile_instance\n   ```\n\n   Method 2: Render hash primitives\n   ```rb\n   rendered_tile = grass_tile.render DRT::Autotile::Neighbors.new(:up, :right, :up_right)\n   rendered_tile[:x] = 200\n   rendered_tile[:y] = 200\n\n   args.outputs.primitives \u003c\u003c rendered_tile\n   ```\n\nSee the [example source code](./app/autotiles.rb) and [library code comments](./lib/autotile.rb) for more details.\n\n### [Low Resolution Canvas](./app/low_resolution.rb)\n\n![Low Resolution](gifs/lowresolution.png)\n\nFile to include: [`lib/low_resolution_canvas.rb`](./lib/low_resolution_canvas.rb)\n\n```rb\ndef tick(args)\n  # Specify your canvas resolution as the first constructor argument\n  args.state.canvas ||= LowResolutionCanvas.new([64, 64])\n\n  args.state.canvas.background_color = [255, 255, 255]\n  args.state.canvas.labels \u003c\u003c [20, 60, 'test']\n  args.state.canvas.primitives \u003c\u003c [2, 2, 4, 4, 255, 0, 0].solid\n  # Render your game content to your LowResolutionCanvas like you would to args.outputs\n\n  args.outputs.background_color = [0, 0, 0]\n  # Be sure to add your LowResolutionCanvas to args.outputs.primitives or args.outputs.sprites to render it to the screen\n  args.outputs.primitives \u003c\u003c args.state.canvas\nend\n```\n\n\n### [Quaternions]\n\nFile to include: [`lib/quaternion.rb`](./lib/quaternion.rb)\n\n(Example coming soon)\n\n\n### [Transformations](./app/transformations.rb)\n\n![Transformations](gifs/transformations.gif)\n\n\n### [Color class with HSV/HSL support](./app/colors_hsv_hsl.rb)\n\n![HSV and HSL](gifs/color_hsv_hsl.gif)\n\n\n### [Color accessor for attr_sprite enhanced classes](./app/color_accessor.rb)\n\n![Color accessor](gifs/color_accessor.gif)\n\n### [Damage Number Animations](./app/damage_numbers.rb)\n\n![Damage Numbers](gifs/damage_numbers.gif)\n\n\n## Get Help\n\nI'm usually online in the [DragonRuby Discord server](http://discord.dragonruby.org/) as user **kfischer_okarin**. If you have any questions or suggestions join the server and ping me. :)\n\n\n## Contributing\n\nThis repository is not intended to be a comprehensive framework of any kind, but is rather a collection of tools I made I thought might be useful to share with whoever might find them useful.\n\nIf you find any bug or have an idea how to improve the usability of the tools, feel free to open an issue. Even better, just join the DragonRuby Discord channel (see [Get Help](#get-help)) and discuss with me directly.\n\n\n## License\n\nThis project is licensed under the [MIT License](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkfischer-okarin%2Fdragonruby-toolbox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkfischer-okarin%2Fdragonruby-toolbox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkfischer-okarin%2Fdragonruby-toolbox/lists"}