-
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
19 changed files
with
2,189 additions
and
1,286 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 |
---|---|---|
@@ -1,46 +1,12 @@ | ||
sudo: false | ||
language: bash | ||
cache: | ||
directories: | ||
- test/elm-stuff/build-artifacts | ||
- sysconfcpus | ||
|
||
os: | ||
- osx | ||
- linux | ||
sudo: required | ||
|
||
env: | ||
matrix: | ||
- ELM_VERSION=0.18.0 TARGET_NODE_VERSION=node | ||
# - ELM_VERSION=0.18.0 TARGET_NODE_VERSION=4.0 | ||
language: elm | ||
node_js: '10' # latest 10.x | ||
|
||
before_install: | ||
- if [ ${TRAVIS_OS_NAME} == "osx" ]; | ||
then brew update; brew install nvm; mkdir ~/.nvm; export NVM_DIR=~/.nvm; source $(brew --prefix nvm)/nvm.sh; | ||
fi | ||
- echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config | ||
- | # epic build time improvement - see https://github.com/elm-lang/elm-compiler/issues/1473#issuecomment-245704142 | ||
if [ ! -d sysconfcpus/bin ]; | ||
then | ||
git clone https://github.com/obmarg/libsysconfcpus.git; | ||
cd libsysconfcpus; | ||
./configure --prefix=$TRAVIS_BUILD_DIR/sysconfcpus; | ||
make && make install; | ||
cd ..; | ||
fi | ||
elm-test: 0.19.0-rev6 | ||
elm-format: 0.8.1 | ||
|
||
install: | ||
- nvm install $TARGET_NODE_VERSION | ||
- nvm use $TARGET_NODE_VERSION | ||
- node --version | ||
- npm --version | ||
- cd tests | ||
- npm install -g elm@$ELM_VERSION elm-test | ||
- mv $(npm config get prefix)/bin/elm-make $(npm config get prefix)/bin/elm-make-old | ||
- printf '%s\n\n' '#!/bin/bash' 'echo "Running elm-make with sysconfcpus -n 2"' '$TRAVIS_BUILD_DIR/sysconfcpus/bin/sysconfcpus -n 2 elm-make-old "$@"' > $(npm config get prefix)/bin/elm-make | ||
- chmod +x $(npm config get prefix)/bin/elm-make | ||
- elm package install --yes | ||
- cd .. | ||
|
||
script: | ||
- elm-test | ||
cache: | ||
yarn: true | ||
directories: | ||
- node_modules |
This file was deleted.
Oops, something went wrong.
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,25 @@ | ||
{ | ||
"type": "package", | ||
"name": "justgook/elm-tiled", | ||
"summary": "A library for building decoders for Tiled levels.", | ||
"license": "BSD-3-Clause", | ||
"version": "1.0.0", | ||
"exposed-modules": [ | ||
"Tiled", | ||
"Tiled.Level", | ||
"Tiled.Layer", | ||
"Tiled.Tileset", | ||
"Tiled.Object", | ||
"Tiled.Properties" | ||
], | ||
"elm-version": "0.19.0 <= v < 0.20.0", | ||
"dependencies": { | ||
"NoRedInk/elm-json-decode-pipeline": "1.0.0 <= v < 2.0.0", | ||
"elm/core": "1.0.0 <= v < 2.0.0", | ||
"elm/json": "1.1.2 <= v < 2.0.0", | ||
"elm-community/json-extra": "4.0.0 <= v < 5.0.0" | ||
}, | ||
"test-dependencies": { | ||
"elm-explorations/test": "1.2.1 <= v < 2.0.0" | ||
} | ||
} |
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,84 @@ | ||
module Tiled exposing | ||
( decode, encode | ||
, GidInfo, gidInfo | ||
) | ||
|
||
{-| Use the [`decode`](#decode) to get [`Level`](Tiled-Level) | ||
# Default Decoding | ||
@docs decode, encode | ||
-} | ||
|
||
import Bitwise | ||
import Json.Decode as Json exposing (Decoder) | ||
import Tiled.Level as Level exposing (Level) | ||
|
||
|
||
{-| Alias to [`Level.encode`](Tiled.Level#encode) | ||
-} | ||
encode : Level -> Json.Value | ||
encode = | ||
Level.encode | ||
|
||
|
||
{-| Alias to [`Level.decode`](Tiled.Level#decode) | ||
-} | ||
decode : Decoder Level | ||
decode = | ||
Level.decode | ||
|
||
|
||
|
||
-- http://doc.mapeditor.org/en/latest/reference/tmx-map-format/#tile-flipping | ||
|
||
|
||
type alias GidInfo = | ||
{ gid : Int, fh : Bool, fv : Bool, fd : Bool } | ||
|
||
|
||
gidInfo : Int -> GidInfo | ||
gidInfo gid = | ||
{ gid = cleanGid gid | ||
, fh = flippedHorizontally gid | ||
, fv = flippedVertically gid | ||
, fd = flippedDiagonally gid | ||
} | ||
|
||
|
||
flippedHorizontally : Int -> Bool | ||
flippedHorizontally globalTileId = | ||
Bitwise.and globalTileId flippedHorizontalFlag /= 0 | ||
|
||
|
||
flippedVertically : Int -> Bool | ||
flippedVertically globalTileId = | ||
Bitwise.and globalTileId flippedVerticalFlag /= 0 | ||
|
||
|
||
flippedDiagonally : Int -> Bool | ||
flippedDiagonally globalTileId = | ||
Bitwise.and globalTileId flippedDiagonalFlag /= 0 | ||
|
||
|
||
cleanGid : Int -> Int | ||
cleanGid globalTileId = | ||
flippedHorizontalFlag | ||
|> Bitwise.or flippedVerticalFlag | ||
|> Bitwise.or flippedDiagonalFlag | ||
|> Bitwise.complement | ||
|> Bitwise.and globalTileId | ||
|
||
|
||
flippedHorizontalFlag = | ||
0x80000000 | ||
|
||
|
||
flippedVerticalFlag = | ||
0x40000000 | ||
|
||
|
||
flippedDiagonalFlag = | ||
0x20000000 |
Oops, something went wrong.