{"id":17680262,"url":"https://github.com/jwoertink/crono","last_synced_at":"2025-05-12T22:17:18.126Z","repository":{"id":66471598,"uuid":"78800677","full_name":"jwoertink/crono","owner":"jwoertink","description":"2D Video Game framework","archived":false,"fork":false,"pushed_at":"2021-08-29T23:51:33.000Z","size":39,"stargazers_count":17,"open_issues_count":2,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-12T22:17:08.453Z","etag":null,"topics":["crystal","game-2d","game-development","sdl2"],"latest_commit_sha":null,"homepage":"","language":"Crystal","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/jwoertink.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}},"created_at":"2017-01-13T00:48:19.000Z","updated_at":"2021-06-18T20:28:51.000Z","dependencies_parsed_at":"2023-03-16T12:00:35.769Z","dependency_job_id":null,"html_url":"https://github.com/jwoertink/crono","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwoertink%2Fcrono","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwoertink%2Fcrono/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwoertink%2Fcrono/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwoertink%2Fcrono/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jwoertink","download_url":"https://codeload.github.com/jwoertink/crono/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253831014,"owners_count":21971008,"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":["crystal","game-2d","game-development","sdl2"],"created_at":"2024-10-24T09:06:19.066Z","updated_at":"2025-05-12T22:17:18.109Z","avatar_url":"https://github.com/jwoertink.png","language":"Crystal","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ![crono](logo.gif) crono [![Build Status](https://travis-ci.com/jwoertink/crono.svg?branch=master)](https://travis-ci.com/jwoertink/crono)\n\nCrono is a 2d video game framework based around SDL2.\n\n**NOTE** Still under development, but games can be sort of played now\n\nThe major part holding this back is animation is super choppy still. \n\n## Installation\n\nInclude in your `shard.yml`\n\n```yml\ndependencies:\n  crono:\n    github: jwoertink/crono\n    branch: master\n```\n\nBe sure to have SDL2 installed!\n\n### macOS\n\n```\nbrew install sdl2\nbrew install sdl2_image\nbrew install sdl2_ttf\nbrew install sdl2_mixer --with-flac --with-fluid-synth --with-libmikmod --with-libmodplug --with-libvorbis --with-smpeg2\n```\n\n### Linux Debian\n\n\n## Usage\n\n\"Hello World\" example.\n\n```crystal\nrequire \"crono\"\n\nclass MyGameWindow \u003c Crono::Window\n  @main_text : Crono::Font?\n  \n  def after_init\n    font_path = File.join(__DIR__, \"assets\", \"fonts\", \"lobster.ttf\")\n    @main_text = Crono::Font.new(font_path, 18)\n    @main_text.color = Crono::Color::YELLOW\n    @main_text.text = \"Hello GameWorld\"\n  end\n\n  def draw\n    brush.draw(@main_text, {100, 75})\n  end\n\nend\n\nnew_game = MyGameWindow.new(640, 480)\nnew_game.title = \"My Super cool game\"\n\n# Call this method to boot the game\nnew_game.show\n```\n\nCheck out some [Sample Games](https://github.com/jwoertink/crono-samples)\n\n## Crono::Window\n\nThis is the class that your main class will inherit from. `Crono::Window` gives you lots of important methods.\n\n* `initialize` - It's still crystal, so you can override this. Just be sure to call `initialize(width, height)` in it.\n* `after_init` - This method is called after SDL has had a chance to set things up.\n* `draw` - Define this method to draw to the screen\n* `update` - Define this method to update calulcations and such for the next draw to make\n* `key_pressed(key)` - This method is called when a key is pressed.\n* `key_down(key)` - This method is called when a key is down.\n* `key_up(key)` - This method is called when a key is released.\n\nTo boot your game, you will instantiate your custom game window class that inherits from `Crono::Window`. \n```\nnew_game = MyGameWindow.new(640, 480)\n```\n\nThen give it a title with `new_game.title = \"Whatever your game is called\"`\nFinally you call the show method `new_game.show`.\n\n\n### Colors\nCrono has a few [built in colors](https://github.com/jwoertink/crono/blob/master/src/crono/color.cr#L4) you can use.\n\n```crystal\nclass MyGameWindow \u003c Crono::Window\n  def draw\n    brush.draw(background_color, {0, 0})\n  end\n\n  private def background_color\n    Crono::Color.darken(Crono::Color::BLUE, 30)\n  end\nend\n```\n\n\n## Development\n\nHelp me understand SDL, and write some specs. \nMost importantly, need to figure out how to make animation smooth.\n\n## Contributing\n\n1. Fork it ( https://github.com/jwoertink/crono/fork )\n2. Create your feature branch (git checkout -b my-new-feature)\n3. Commit your changes (git commit -am 'Add some feature')\n4. Push to the branch (git push origin my-new-feature)\n5. Create a new Pull Request\n\n## Contributors\n\n- [jwoertink](https://github.com/jwoertink) Jeremy Woertink - creator, maintainer\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjwoertink%2Fcrono","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjwoertink%2Fcrono","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjwoertink%2Fcrono/lists"}