{"id":19649077,"url":"https://github.com/huzunjie/qtiled","last_synced_at":"2025-04-28T16:30:33.783Z","repository":{"id":48443336,"uuid":"127859783","full_name":"huzunjie/qtiled","owner":"huzunjie","description":"一套多边形平铺或错列布局库。Staggered arrangement method of polygon tiles.","archived":false,"fork":false,"pushed_at":"2022-02-09T11:41:09.000Z","size":583,"stargazers_count":12,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-05T09:34:01.387Z","etag":null,"topics":["canvas","game","javascript","nodejs","tile","tiled","tilemap"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/huzunjie.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}},"created_at":"2018-04-03T06:12:05.000Z","updated_at":"2025-03-21T03:43:24.000Z","dependencies_parsed_at":"2022-08-24T02:40:30.633Z","dependency_job_id":null,"html_url":"https://github.com/huzunjie/qtiled","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/huzunjie%2Fqtiled","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huzunjie%2Fqtiled/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huzunjie%2Fqtiled/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huzunjie%2Fqtiled/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/huzunjie","download_url":"https://codeload.github.com/huzunjie/qtiled/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251345739,"owners_count":21574766,"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":["canvas","game","javascript","nodejs","tile","tiled","tilemap"],"created_at":"2024-11-11T14:51:31.605Z","updated_at":"2025-04-28T16:30:33.197Z","avatar_url":"https://github.com/huzunjie.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# QTiled\n\n[![npm](https://img.shields.io/npm/v/qtiled.svg?colorB=brightgreen\u0026style=flat-square)](https://www.npmjs.com/package/qtiled)   [![tested with jest](https://img.shields.io/badge/tested_with-jest-99424f.svg)](https://github.com/facebook/jest)    [![Total Alerts](https://img.shields.io/lgtm/alerts/g/huzunjie/qtiled.svg?logo=lgtm\u0026logoWidth=18)](https://lgtm.com/projects/g/huzunjie/qtiled/alerts)\n\n这是一套 Tiled 多边形布局基础库。\n\n## DEMO\n\n结合 [spritejs](https://github.com/spritejs) 的几种基本用法示例：https://lab.pyzy.net/qtiled\n\n### 菱形布局示例\n\n![菱形布局示例](https://p1.ssl.qhimg.com/t01e8950d2debce4408.png)\n\n### 六边形布局示例\n\n![六边形布局示例](https://user-images.githubusercontent.com/3885060/130448321-ae63115e-e336-430f-a09a-a7e8186f6425.png)\n\n## 计划列表\n\n### Basic Shapes - 基础图形\n+ [x] Polygon - 多边形\n  + [x] getPolygonVertexes 获取多边形顶点坐标集\n  + [x] getPolygonPositions 按目标区间方向获取多个多边形位置坐标集\n  + [x] twoDimForEach 按目标区间方向进行二维遍历\n  + [x] getPolygonInfoByPos 根据当前任意坐标\u0026原点坐标\u0026单个瓦片尺寸等，取得目标瓦片的二维坐标及渲染坐标值\n+ [x] Rect - 矩形\n  + [x] getRectVertexes 获取矩形顶点坐标集\n  + [x] getRectPositions 获取多个矩形位置坐标集\n  + [x] getRectInfoByPos 根据当前任意坐标\u0026原点坐标\u0026单个瓦片尺寸等，取得目标瓦片的二维坐标及渲染坐标值\n  + [x] getNeighbors - 获得当前点周边的邻居，可用于寻路等\n+ [x] Rhombus - 菱形\n  + [x] getRhombusVertexes 获取菱形顶点坐标集\n  + [x] getRhombusPositions 按目标区间方向获取多个菱形的错列布局位置坐标集\n  + [x] getRhombusInfoByPos 根据当前任意坐标\u0026原点坐标\u0026单个瓦片尺寸等，取得目标瓦片的二维坐标及渲染坐标值\n  + [x] getIsometricRhombusPositions 按目标区间方向获取多个菱形的等距布局位置坐标集\n  + [x] getIsometricRhombusInfoByPos 根据任意点\u0026原点\u0026单瓦片尺寸，取得瓦片的等距二维坐标及渲染坐标\n  + [x] getNeighbors - 获得错列布局当前点周边的邻居，可用于寻路等\n  + [x] getIsometricNeighbors - 获得等距布局当前点周边的邻居，可用于寻路等\n+ [x] Hexagon - 六边形\n  + [x] getHexagonVertexes 获取六边形顶点坐标集\n  + [x] getHexagonPositions 按目标区间方向获取多个六边形的错列布局位置坐标集\n  + [x] getHexagonInfoByPos 根据当前任意坐标\u0026原点坐标\u0026单个瓦片尺寸等，取得目标瓦片的二维坐标及渲染坐标值\n  + [x] getNeighbors 获得指定tile下标周边紧邻的邻居们\n+ [x] ellipse - 椭圆形\n  + [x] angle2Radian 角度转弧度\n  + [x] radian2Angle 弧度转角度\n  + [x] getEllipsePoint 根据椭圆的原点、X轴半径、Y轴半径、旋转弧度，求得圆周上的点坐标\n  + [x] getEllipsePointByAngle 根据椭圆的原点、X轴半径、Y轴半径、旋转角度，求得圆周上的点坐标\n  + [x] getEllipseIsometryPoint 根据椭圆的X轴半径、Y轴半径、圆周等分数量、等分点序号、起始弧度，求得圆周上的点坐标\n\n### Pathfinding - 寻路\n* [x] AStar\n\n### Tile Data - 瓦片数据格式约定\n* [ ] ToDo - 待开发\n\n### Tile Renderer - 瓦片渲染器\n* [ ] ToDo - 待开发\n\n### Tile Editor - 瓦片编辑器\n* [ ] ToDo - 待开发\n\n### Sprite Editor - 精灵编辑器\n* [ ] ToDo - 待开发\n\n### Map Editor - 地图编辑器\n* [ ] ToDo - 待开发\n\n## 安装引用\n\n鉴于大家各自的业务构建场景的不同，可以从以下两种引用方式中选择适合自己的方案：\n\n1 . 将lib目录下适合的打包文件放入业务目录中，直接引用JS:\n\n```html\n\u003cscript src=\"xxx.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\nconst { shapes, pathFinding, ... } = qtiled;\n... \n\u003c/script\u003e\n```\n\n2 . 项目是基于nodejs环境构建的话，可以先在项目目录下执行命令安装依赖包：\n\n```\nnpm install qtiled --save\n```\n然后再按照自己的使用习惯，将依赖 import 或 require 到业务代码中使用：\n\n```\nimport qtiled from 'qtiled';\n```\n\n## 使用方法\n\n可以参考 `demo/index.js` 中的示例，也可以直接阅读 src 目录下源码及相应注释。\n\n## 备注\n\n目前还只是静态方法库，希望能带来些许便利，有相应问题请随时反馈。\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhuzunjie%2Fqtiled","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhuzunjie%2Fqtiled","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhuzunjie%2Fqtiled/lists"}