-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
9,105 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#root = true | ||
|
||
[*] | ||
indent_style = space | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
max_line_length = 100 | ||
indent_size = 4 | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,11 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
node_modules | ||
coverage | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# TypeScript v1 declaration files | ||
typings/ | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
.env | ||
|
||
# next.js build output | ||
.next | ||
.DS_Store | ||
*.log | ||
.vscode | ||
.idea | ||
compiled | ||
.awcache | ||
.rpt2_cache | ||
docs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
.idea | ||
.tscache | ||
asset_source | ||
assets/ | ||
!build/assets | ||
example | ||
src | ||
test | ||
tools | ||
vendor | ||
config/* | ||
rollup.config.ts | ||
tslint.json | ||
tsconfig.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Changelog | ||
|
||
## [0.0.1] - 2019-11-01 | ||
### Added | ||
- Initial setup and release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Contributor Covenant Code of Conduct | ||
|
||
## Our Pledge | ||
|
||
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. | ||
|
||
## Our Standards | ||
|
||
Examples of behavior that contributes to creating a positive environment include: | ||
|
||
* Using welcoming and inclusive language | ||
* Being respectful of differing viewpoints and experiences | ||
* Gracefully accepting constructive criticism | ||
* Focusing on what is best for the community | ||
* Showing empathy towards other community members | ||
|
||
Examples of unacceptable behavior by participants include: | ||
|
||
* The use of sexualized language or imagery and unwelcome sexual attention or advances | ||
* Trolling, insulting/derogatory comments, and personal or political attacks | ||
* Public or private harassment | ||
* Publishing others' private information, such as a physical or electronic address, without explicit permission | ||
* Other conduct which could reasonably be considered inappropriate in a professional setting | ||
|
||
## Our Responsibilities | ||
|
||
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. | ||
|
||
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. | ||
|
||
## Scope | ||
|
||
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. | ||
|
||
## Enforcement | ||
|
||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [email protected]. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. | ||
|
||
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. | ||
|
||
## Attribution | ||
|
||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] | ||
|
||
[homepage]: http://contributor-covenant.org | ||
[version]: http://contributor-covenant.org/version/1/4/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
Before contributing, please read the [code of conduct](CODE_OF_CONDUCT.md). | ||
|
||
## Reporting issues | ||
|
||
[GitHub Issues][0] is the place to report bugs you may have found. When submitting a bug please do the following: | ||
|
||
**1. Search for existing issues.** Your bug may have already been fixed, or cannot, or will not, be fixed. So be sure to search the issues first before putting in a duplicate issue. | ||
|
||
**2. Not sure if it's a bug?.** Please ask on the Phaser's slack or discord servers, @AleBles is usually there. | ||
|
||
**3. Create an isolated and reproducible test case.** If you are reporting a bug, make sure you also have a minimal, runnable, code example that reproduces the problem you have. | ||
|
||
**4. Include a live example.** After narrowing your code down to only the problem areas please provide some basic code that show it, or a link to your live site so that we can view a live example of the problem. | ||
|
||
**5. Share as much information as possible.** Include browser version affected, your OS, version of the library, steps to reproduce, etc. "X isn't working!!!!!" will probably just be closed. | ||
|
||
## Making Changes | ||
|
||
To take advantage of our grunt build script and tslint config it will be easiest for you if you have node.js and grunt installed locally. | ||
|
||
You can download node.js from [nodejs.org][3]. After it has been installed open a console and run `npm i -g grunt-cli` to install the global `grunt` executable. | ||
|
||
After that you can clone the repository and run `npm i` inside the cloned folder. This will install dependencies necessary for building the project. Once that is ready, make your changes and submit a Pull Request: | ||
|
||
- **Send Pull Requests to the `dev` branch.** This'll make it much easier for to keep a clear track between development and releases. | ||
|
||
- **Ensure changes are tslint validated.** Our TSlint configuration file is provided in the repository and you should check against it before submitting. | ||
|
||
- **Never commit new builds.** When making a code change you should always run `grunt dist` which will rebuild the project so you can test, *however* please do not commit these new builds or your PR will be closed. Builds by default are placed in the `build` folder. | ||
|
||
- **Only commit relevant changes.** Don't include changes that are not directly relevant to the fix you are making. The more focused a PR is, the faster it will get attention and be merged. Extra files changing only whitespace or trash files will likely get your PR closed. | ||
|
||
|
||
## Coding style preferences are not contributions | ||
|
||
If your PR is doing little more than changing the source code into a format / coding style that you prefer then we will automatically close it. All PRs must adhere to the coding style already set-out across the code. Your personal preferences for how things should "look" or be structured do not apply here, sorry. PRs should fix bugs, fix documentation or add features. No changes for the sake of change. | ||
|
||
|
||
## I don't really like git / node.js, but I can fix this bug | ||
|
||
That is fine too. While Pull Requests are the best thing in the world for us, they are not the only way to help. You're welcome to post fixes to our forum or even just email them to us. All we ask is that you still adhere to the guidelines presented here re: TSlint, etc. | ||
|
||
|
||
## Code Style Guide | ||
|
||
- Use 4 spaces for tabs, never tab characters. | ||
|
||
- No trailing whitespace, blank lines should have no whitespace. | ||
|
||
- Always favor strict equals `===` unless you *need* to use type coercion. | ||
|
||
- Follow conventions already in the code, and listen to tslint. Our config is set-up for a reason. | ||
|
||
[3]: http://nodejs.org |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,55 @@ | ||
[![npm version](https://badge.fury.io/js/%40azerion%2Fh5-texture-unpacker.svg)](https://badge.fury.io/js/%40azerion%2Fh5-texture-unpacker) | ||
|
||
# h5-texture-unpacker | ||
Allows you to unpack your Html 5 texture files | ||
Simple CLI tool that allows you to unpack your existing Texture atlasses provided that you have the JSON file available | ||
|
||
Getting Started | ||
--------------- | ||
First you want to install a fresh copy of the plugin. | ||
``` | ||
ale@computer:~$ npm install @azerion/h5-texture-unpacker -g | ||
``` | ||
Now you'll be able to use the command: | ||
``` | ||
ale@computer:~$ unpack | ||
Usage: unpack [imageFile] [jsonFile] [outputDir] | ||
``` | ||
|
||
Usage | ||
----- | ||
``` | ||
ale@NL0NTB032:/media/ale/dev/tools/h5-texture-unpacker$ unpack | ||
Usage: unpack [imageFile] [jsonFile] [outputDir] | ||
Options: | ||
--version Show version number [boolean] | ||
--imageFile, -i The input texture image [string] [required] | ||
--jsonFile, -j The input JSON configuration [string] [required] | ||
--outputDir, -o The output folder [string] [required] | ||
-h, --help Show help [boolean] | ||
copyright Azerion 2019 | ||
``` | ||
|
||
TODO | ||
---- | ||
- [ ] Add support for format | ||
- [ ] Format validation | ||
- [ ] parse/process trimmed/rotation from json | ||
|
||
F.A.Q. | ||
------ | ||
### My atlas format [json/xml/csv] is not supported! | ||
We'd love to include more format as we go, but for now will only add the ones we need, if there's anything you'd like to add or suggest feel free to add a ticker or create a Pull Request | ||
|
||
Credits | ||
======= | ||
Created with https://github.com/alexjoverm/typescript-library-starter.git | ||
|
||
Disclaimer | ||
---------- | ||
We at Azerion just love playing and creating awesome games. We aren't affiliated with Phaser.io. We just needed to unpack some awesome texture for our awesome HTML5 games. Feel free to use it for enhancing your own awesome games! | ||
h5-texture-unpacker is distributed under the MIT license. All 3rd party libraries and components are distributed under their | ||
respective license terms. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/usr/bin/env node | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var Sharp = require('sharp'); | ||
var path = require('path'); | ||
var fs = require('fs'); | ||
var yargs = require('yargs'); | ||
var basePath = path.join(__dirname, '../'); | ||
var argv = yargs | ||
.usage('Usage: $0 [imageFile] [jsonFile] [outputDir]') | ||
.option('imageFile', { | ||
alias: 'i', | ||
demandOption: true, | ||
describe: 'The input texture image', | ||
type: 'string' | ||
}) | ||
.option('jsonFile', { | ||
alias: 'j', | ||
demandOption: true, | ||
describe: 'The input JSON configuration', | ||
type: 'string' | ||
}) | ||
.option('outputDir', { | ||
alias: 'o', | ||
demandOption: true, | ||
describe: 'The output folder', | ||
type: 'string' | ||
}) | ||
.help('h') | ||
.alias('h', 'help') | ||
.epilog('copyright Azerion 2019') | ||
.argv; | ||
var imgUrl = path.join(argv.i); | ||
var jsonUrl = path.join(argv.j); | ||
var outputDir = path.join(argv.o, '/'); | ||
var json = JSON.parse(fs.readFileSync(jsonUrl)); | ||
if (!fs.existsSync(outputDir)) { | ||
fs.mkdirSync(outputDir); | ||
} | ||
json.frames.forEach(function (source) { | ||
Sharp(imgUrl).extract({ | ||
width: source.frame.w, | ||
height: source.frame.h, | ||
left: source.frame.x, | ||
top: source.frame.y | ||
}).toFile(path.join(outputDir, '/', source.filename + '.png')).then(function (fileInfo) { | ||
console.log('File: ', source.filename, ' written'); | ||
}).catch(function (err) { | ||
console.log('Unable to write file ', source.filename, ':', err); | ||
}); | ||
}); |
Oops, something went wrong.