https://github.com/twe4ked/terminal_game_engine
🕹 Build games in terminal using Ruby
https://github.com/twe4ked/terminal_game_engine
framework gamedev ruby terminal
Last synced: 12 months ago
JSON representation
🕹 Build games in terminal using Ruby
- Host: GitHub
- URL: https://github.com/twe4ked/terminal_game_engine
- Owner: twe4ked
- License: mit
- Created: 2016-07-11T04:27:20.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2021-06-08T23:44:22.000Z (almost 5 years ago)
- Last Synced: 2025-03-29T05:11:39.699Z (about 1 year ago)
- Topics: framework, gamedev, ruby, terminal
- Language: Ruby
- Homepage: https://rubygems.org/gems/terminal_game_engine
- Size: 23.4 KB
- Stars: 2
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.markdown
- License: LICENSE.txt
- Code of conduct: CODE_OF_CONDUCT.markdown
Awesome Lists containing this project
README
# TerminalGameEngine
## Installation
Add this line to your application's Gemfile:
```ruby
gem 'terminal_game_engine'
```
And then execute:
$ bundle
Or install it yourself as:
$ gem install terminal_game_engine
## Usage
``` ruby
require 'terminal_game_engine'
TerminalGameEngine.run do
on_tick do |tick|
width = tick.to_s.length
height = 1
frame = TerminalGameEngine::Frame.new width, height
frame.draw 0, 0, tick.to_s
on_input do |key_code|
case key_code
when TerminalGameEngine::Input::Keys::CTRL_C
exit
end
end
frame.render
end
end
```
## License
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
## Origins
Most of this code was originally written as part of [hrdlr](https://github.com/twe4ked/hrdlr) at Railscamp by [@jasoncodes](https://github.com/jasoncodes), [@nathanaelkane](https://github.com/nathanaelkane), and [@twe4ked](https://github.com/twe4ked). It was then mostly copied into [snek](https://github.com/twe4ked/snek) by [@twe4ked](https://github.com/twe4ked) and then extracted into this gem.