{"id":13721143,"url":"https://github.com/LittleB0xes/LDtkBridge","last_synced_at":"2025-05-07T13:31:43.020Z","repository":{"id":38378265,"uuid":"369969634","full_name":"LittleB0xes/LDtkBridge","owner":"LittleB0xes","description":"A bridge between LDtk and DragonRuby","archived":false,"fork":false,"pushed_at":"2024-11-10T16:18:35.000Z","size":110,"stargazers_count":21,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-12T11:17:39.719Z","etag":null,"topics":["dragonruby","game-development","gamedev","gamedev-library","ldtk"],"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/LittleB0xes.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":"2021-05-23T05:36:05.000Z","updated_at":"2025-01-12T15:13:56.000Z","dependencies_parsed_at":"2024-11-10T17:32:14.127Z","dependency_job_id":null,"html_url":"https://github.com/LittleB0xes/LDtkBridge","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/LittleB0xes%2FLDtkBridge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LittleB0xes%2FLDtkBridge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LittleB0xes%2FLDtkBridge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LittleB0xes%2FLDtkBridge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LittleB0xes","download_url":"https://codeload.github.com/LittleB0xes/LDtkBridge/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252886353,"owners_count":21819705,"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":["dragonruby","game-development","gamedev","gamedev-library","ldtk"],"created_at":"2024-08-03T01:01:12.899Z","updated_at":"2025-05-07T13:31:42.610Z","avatar_url":"https://github.com/LittleB0xes.png","language":"Ruby","funding_links":[],"categories":["Libraries, Frameworks and Wrappers"],"sub_categories":[],"readme":"# LDtkBridge\r\nA bridge between LDtk and DragonRuby\r\n\r\n\r\n⚠️  construction in progress ⚠️  \r\n\r\nDocumentation in progress too !\r\n\r\n\r\n## Usage\r\n\r\n### LDtk project init\r\nFirst you need to init your map\r\n\r\n```ruby\r\nmy_world = LDtk.create_world('path_to_your_file', 'your_ldtk_file.ldtk')\r\n```\r\nmy_world is a `Hash` and has this structure :\r\n```ruby\r\n{\r\n    folder: 'path_to_your_file/',\r\n    levels: {},             # Hash with all levels\r\n    definitions: {}         # some useful information about tilesets\r\n}\r\n```\r\n\r\n### Loading Levels and Layers\r\n#### Level\r\nIf in your LDtk file, your level is named \"Level_1\" in LDtk, LDtkBridge converts it to a symbol `:Level_1`.\r\n\r\nThis level can be load like this\r\n\r\n```ruby\r\nmy_level = LDtk.level(my_world, :Level_1)\r\n```\r\n\r\nEach level is a hash with keys :\r\n```ruby\r\n{\r\n  identifier:       # Symbol        name of the level\r\n  uid:              # Integer       Unique integer identifier\r\n  iid:              # String        Unique instance identifier\r\n  px_hei:           # Integer       height of the level in px,\r\n  px_wid:           # Integer       width of the level in px,\r\n  world_x:          # Integer       x position of the level in the world in px,\r\n  world_y:          # Integer       y position of the level in the world in px,\r\n  layers:           # Hash          hash of layer with layer identifier as key\r\n  field:            # Array\u003cHash\u003e   array of field hash`\r\n}\r\n```\r\n\r\n#### Layers\r\nIn the same way, you can load a layer named \"Ground\" in \"Level_1\" with\r\n\r\n```ruby\r\nmy_layer = LDtk.layer(my_world, :Level_1, :Ground)\r\n```\r\nEach layer is a hash with keys\r\n```ruby\r\n{\r\n     cell_width:        # Integer           width in cells\r\n     cell_height:       # Integer           height in cells\r\n     grid_size:         # Integer           cell size in px\r\n     identifier         # Symbol            name of the layer\r\n     type:              # Symbol            Layer type\r\n                        #                   (possible values: :IntGrid,:Entities, :Tiles or :AutoLayer)\r\n     iid:               # String            Unique instance identifier\r\n     tileset_def_uid:   # Integer           definition id of the layer's tileset\r\n     tileset_rel_path:  # String            relative path of tileset\r\n     grid_tiles         # Array\u003cHash\u003e       array of tiles's hash (dr friendly)\r\n     entities           # Array\u003cHash\u003e       array of entity's hash \r\n     int_grid           # Array\u003cInteger\u003e    array of int in 'dr-friendly' orientation \r\n}\r\n```\r\n\r\n### Tile Layer\r\nWhen the layer is a tiles layer (id `type: :Tiles), `grid_tiles` key link to an array of tile.\r\nLDtkBridge make DR friendly tiles (plus some useful fields). So tiles have this format :\r\n```ruby\r\n{\r\n    x:\r\n    y:\r\n    w:\r\n    h:\r\n    source_x:\r\n    source_y:\r\n    source_w:\r\n    source_h:\r\n    flip_horizontally:\r\n    flip_vertically:\r\n\r\n    tile_id:\r\n    enum_tags\r\n}\r\n```\r\n### Entities Layer\r\n\r\n### Int Grid Layer\r\n\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLittleB0xes%2FLDtkBridge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FLittleB0xes%2FLDtkBridge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLittleB0xes%2FLDtkBridge/lists"}