{"id":13483330,"url":"https://github.com/denisdefreyne/glove","last_synced_at":"2025-03-27T14:31:15.206Z","repository":{"id":66209939,"uuid":"69858307","full_name":"denisdefreyne/glove","owner":"denisdefreyne","description":"Crystal framework for making games","archived":true,"fork":false,"pushed_at":"2021-08-01T10:26:49.000Z","size":251,"stargazers_count":70,"open_issues_count":2,"forks_count":5,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-05-22T22:08:12.909Z","etag":null,"topics":["crystal","game-engine"],"latest_commit_sha":null,"homepage":"http://ddfreyne.github.io/glove","language":"Crystal","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/denisdefreyne.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2016-10-03T09:45:08.000Z","updated_at":"2024-06-21T17:31:28.954Z","dependencies_parsed_at":null,"dependency_job_id":"4f24ebb4-cdf9-45fd-a5ee-3c4b57f537b7","html_url":"https://github.com/denisdefreyne/glove","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/denisdefreyne%2Fglove","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denisdefreyne%2Fglove/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denisdefreyne%2Fglove/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denisdefreyne%2Fglove/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/denisdefreyne","download_url":"https://codeload.github.com/denisdefreyne/glove/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245863068,"owners_count":20684782,"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-engine"],"created_at":"2024-07-31T17:01:10.163Z","updated_at":"2025-03-27T14:31:14.696Z","avatar_url":"https://github.com/denisdefreyne.png","language":"Crystal","funding_links":[],"categories":["Game Development"],"sub_categories":[],"readme":"[![Build status](http://img.shields.io/travis/ddfreyne/glove.svg)](https://travis-ci.org/ddfreyne/glove)\n\n# Glove\n\nGlove is a framework for making games. It is implemented in [Crystal](https://crystal-lang.org/).\n\n**⚠ Caution! ⚠** Glove is experimental. Expect breaking changes. There are few tests. Do not use this for your own projects (yet). (Or do, and contribute back to Glove? That’d be cool. I’ll give you commit access. You can be one of the first people to write a proper game engine in Crystal.)\n\n## Usage\n\nTo use this shard, add the following lines to your `shard.yml`:\n\n```yaml\ndependencies:\n  glove:\n    git: git@github.com:ddfreyne/glove.git\n```\n\nGlove comes with shaders in its `shaders/` directory, which needs to be copied to where the executable is located. For example, the following will create a `target/` directory that contains the executable and the shaders directory:\n\n```bash\nrm -rf target/\nmkdir -p target\n\ncrystal build -o target/mygame src/mygame.cr\n\ncp -r lib/glove/src/shaders target/shaders\n```\n\nIt is useful to let the executable `cd` to the directory it is located in, before doing anything else, so that it can find the shaders easily:\n\n```crystal\nif full_path = Process.executable_path\n  Dir.cd(File.dirname(full_path))\nend\n```\n\nThe `target/` directory should also include any assets that the game needs to run; a more complete build script could therefore look as follows:\n\n```bash\nrm -rf target/\nmkdir -p target\n\ncrystal build -o target/mygame src/mygame.cr\n\ncp -r lib/glove/src/shaders target/shaders\ncp -r assets target/assets # \u003c- added\n```\n\n## Example code\n\nHere is a trivial example that renders a card (from `assets/card.png`):\n\n```crystal\nrequire \"glove\"\n\nif full_path = Process.executable_path\n  Dir.cd(File.dirname(full_path))\nend\n\ncard =\n  Glove::Entity.new.tap do |e|\n    e \u003c\u003c Glove::Components::Texture.new(\"assets/card.png\")\n    e \u003c\u003c Glove::Components::Transform.new.tap do |t|\n      t.width = 140_f32\n      t.height = 190_f32\n      t.translate_x = 400_f32\n      t.translate_y = 300_f32\n    end\n  end\n\nscene =\n  Glove::Scene.new.tap do |scene|\n    scene.spaces \u003c\u003c Glove::Space.new.tap do |space|\n      space.entities \u003c\u003c card\n    end\n  end\n\ngame = Glove::EntityApp.new(800, 600, \"Inari\")\ngame.clear_color = Glove::Color::WHITE\ngame.replace_scene(scene)\ngame.run\n```\n\n## Architecture\n\n* `Glove::EntityApp` is a generic game superclass that provides functionality for handling entities, and everything associated with it. Here is how a typical game would build an instance and run the game:\n\n  ```crystal\n  game = Glove::EntityApp.new(800, 600, \"Inari\")\n  game.clear_color = Glove::Color::WHITE\n  scene = Glove::Scene.new.tap do |scene|\n    # … build scene here …\n  end\n  game.replace_scene(scene)\n  game.run\n  ```\n\n* `Glove::Entity` is a game object that is visible and/or reacts to user input.\n\n* `Glove::Component` is a property of an entity. A common component is `Glove::Components::Transform`, which adds width, height, rotation, scale, … to an entity. Another common component is `Glove::Components::Camera`, which marks an entity as being a camera, and defines which part of a space (see below) will be rendered, with what rotation, etc.\n\n* `Glove::Action` defines a change to an entity. It can either be instant (e.g. remove entity) or act over time (e.g. move).\n\n* `Glove::Space` groups entities in a scene that logically belong together and can interact with each other. Entities in different spaces never interact. For example, one space might contain the game entities, and another space might contain UI elements.\n\n* `Glove::Scene` describes a scene (such as the main menu, credits, or in-game screen). It contains one or more spaces.\n\n* `Glove::System` describes logic for making changes to a space. A common system is a physics system, which would calculate velocities and update positions.\n\nThere are also a handful of simple data classes:\n\n* `Glove::Color`\n* `Glove::Point`\n* `Glove::Quad`\n* `Glove::Rect`\n* `Glove::Size`\n* `Glove::Vector`\n\n## Acknowledgements\n\nThis project started out by playing with [crystal-gl](https://github.com/ggiraldez/crystal-gl) by Gustavo Giráldez.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdenisdefreyne%2Fglove","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdenisdefreyne%2Fglove","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdenisdefreyne%2Fglove/lists"}