https://github.com/konnorrogers/dragonruby-sprite-kit
An embeddable sprite manager for DragonRuby
https://github.com/konnorrogers/dragonruby-sprite-kit
dragonruby dragonruby-gtk dragonrubygtk
Last synced: 6 days ago
JSON representation
An embeddable sprite manager for DragonRuby
- Host: GitHub
- URL: https://github.com/konnorrogers/dragonruby-sprite-kit
- Owner: KonnorRogers
- Created: 2025-03-16T06:33:40.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2026-05-07T13:23:33.000Z (23 days ago)
- Last Synced: 2026-05-14T12:05:08.995Z (16 days ago)
- Topics: dragonruby, dragonruby-gtk, dragonrubygtk
- Language: Ruby
- Homepage: https://konnorrogers.github.io/dragonruby-sprite-kit/tags/main
- Size: 36.6 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# DragonRuby Sprite Kit
## What is this?
Right now Sprite Kit is a basic utility helper for me with things I want to carry between projects.
Things like
- Making spritesheets easier to work with (Most asset packs ship as spritesheets and are annoying to work with)
- Map editors / Level Editors
- Who knows what else?
Sprite Kit is built for DragonRuby with the intent of you extending it. Its designed to take the place of external tools you may use.
## Using degit
`npx degit konnorrogers/dragonruby-sprite-kit/mygame/lib ./mygame/vendor/sprite_kit`
## Download a zip from releases
## Working with Spritesheets
I personally found working with Spritesheets (images containing multiple assets inside) particularly painful with DragonRuby.
So lets start with the basics. Not everyone will need a Map Editor. But everyone will probably end up working with a spritesheets full of many sprites.
### Rendering the Canvas
The SpriteCanvas is a scene designed for viewing your sprites. Its a large "infinite" canvas where you can drop spritesheets and see them appear.
```rb
require "vendor/sprite_kit/sprite_kit.rb"
def tick(args)
args.state.spritesheet_scene ||= SpriteKit::Scenes::SpritesheetScene.new
args.state.spritesheet_scene.tick(args)
end
```
The above will render a canvas for you to select your sprites from a canvas and copy them your clipboard.
## Scene Manager
If you would like, DragonRuby Sprite Kit also ships with Scene Manager and Scenes.
```rb
class MainScene < SpriteKit::Scene
def render
draw_buffer.primitives << {
x: Grid.w / 2,
y: Grid.h / 2,
text: "Hello World"
}.label!
end
end
class Game
def initialize
@scene_manager = SpriteKit::SceneManager.new(
current_scene: :main_scene,
scenes: {
main_scene: MainScene,
}
)
end
def tick(args)
@scene_manager.tick(args)
end
end
def tick(args)
$game ||= Game.new
$game.tick(args)
end
def reset
$game = nil
end
$gtk.reset
```
## Map Editor (Maybe?)