-
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
77 changed files
with
7,615 additions
and
2 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,15 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "HashLink", | ||
"request": "launch", | ||
"type": "hl", | ||
"cwd": "${workspaceFolder}", | ||
"preLaunchTask": { | ||
"type": "haxe", | ||
"args": "active configuration" | ||
} | ||
} | ||
] | ||
} |
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
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,13 @@ | ||
# editor | ||
# Heaps Editor | ||
Minimal 2D editor written in Haxe Heaps | ||
|
||
![Editor](/editor.png "Heaps Editor") | ||
|
||
**Heaps Editor** is an open-source 2D editor designed for quick and easy level creation, especially suited for non-grid-based physics. The editor also supports images, texture atlases, grid layers for pathfinding or grid-based collisions and the creation of pathways for objects. | ||
|
||
|
||
## Minimal manual | ||
Check out manual on [nayata.github.io/editor](https://nayata.github.io/editor/). | ||
|
||
## Examples | ||
In the **examples** folder you can find various examples of how to parse and use scenes created with the editor. |
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,7 @@ | ||
-cp src | ||
-lib heaps | ||
-lib hldx | ||
-hl main.hl | ||
-main Editor | ||
-D windowSize=1600x900 | ||
-D windowFixed=0 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,15 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "HashLink", | ||
"request": "launch", | ||
"type": "hl", | ||
"cwd": "${workspaceFolder}", | ||
"preLaunchTask": { | ||
"type": "haxe", | ||
"args": "active configuration" | ||
} | ||
} | ||
] | ||
} |
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,34 @@ | ||
class DebugRender extends hxd.App { | ||
var label:h2d.Text; | ||
|
||
|
||
static function main() { | ||
new DebugRender(); | ||
} | ||
|
||
|
||
override function init() { | ||
engine.backgroundColor = 0x2e2b44; | ||
s2d.scaleMode = LetterBox(960, 600, false, Center, Center); | ||
hxd.Res.initLocal(); | ||
|
||
var project = new Project(); | ||
project.load("Platformer.json"); | ||
|
||
var obj = project.renderDebugLayer("Collisions"); | ||
s2d.addChild(obj); | ||
|
||
obj = project.renderDebugLayer("Entities"); | ||
s2d.addChild(obj); | ||
|
||
label = new h2d.Text(hxd.res.DefaultFont.get(), s2d); | ||
label.x = label.y = 10; | ||
} | ||
|
||
|
||
override function update(dt:Float) { | ||
super.update(dt); | ||
|
||
label.text = "Draw calls: " + engine.drawCalls; | ||
} | ||
} |
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,61 @@ | ||
class GridExample extends hxd.App { | ||
var grid:Map<Int, Bool> = new Map(); | ||
var gridWidth:Int; | ||
var gridSize:Int; | ||
|
||
var label:h2d.Text; | ||
|
||
inline function setGridCell(cx, cy, value) grid.set(gridCell(cx, cy), value); | ||
inline function gridCell(cx, cy) return cx + cy*gridWidth; | ||
inline function snap(value:Float, step:Int = 10) return Math.round(value / step); | ||
|
||
|
||
static function main() { | ||
new GridExample(); | ||
} | ||
|
||
|
||
override function init() { | ||
engine.backgroundColor = 0x2e2b44; | ||
s2d.scaleMode = LetterBox(960, 600, false, Center, Center); | ||
hxd.Res.initLocal(); | ||
|
||
|
||
var project = new Project(); | ||
var scene = project.load("grid.json"); | ||
|
||
var obj = project.debugRender(); | ||
s2d.addChild(obj); | ||
|
||
var cWid:Int = Math.round(scene.width/scene.gridSize); | ||
var cHei:Int = Math.round(scene.height/scene.gridSize); | ||
|
||
gridWidth = cWid; | ||
gridSize = scene.gridSize; | ||
|
||
for (cy in 0...cHei) { | ||
for(cx in 0...cWid) { | ||
setGridCell(cx,cy, true); | ||
} | ||
} | ||
|
||
var layer = project.defaultLayer(); | ||
for (cell in layer.grid) { | ||
setGridCell(cell.cellX, cell.cellY, false); | ||
} | ||
|
||
label = new h2d.Text(hxd.res.DefaultFont.get(), s2d); | ||
label.textColor = 0xffffff; | ||
label.x = label.y = 64; | ||
} | ||
|
||
|
||
override function update(dt:Float) { | ||
super.update(dt); | ||
|
||
var cx = snap(s2d.mouseX-gridSize*0.5, gridSize); | ||
var cy = snap(s2d.mouseY-gridSize*0.5, gridSize); | ||
|
||
label.text = "cell x: " + cx + "\ncell y: " + cy + "\nwalkable: " + grid.get(gridCell(cx, cy)); | ||
} | ||
} |
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,33 @@ | ||
class ImageRender extends hxd.App { | ||
var title:h2d.Object; | ||
var button:h2d.Object; | ||
var bounce:Float = 0; | ||
|
||
|
||
static function main() { | ||
new ImageRender(); | ||
} | ||
|
||
|
||
override function init() { | ||
engine.backgroundColor = 0x2e2b44; | ||
s2d.scaleMode = LetterBox(960, 600, false, Center, Center); | ||
hxd.Res.initLocal(); | ||
|
||
var project = new Project(); | ||
project.load("UI.json"); | ||
|
||
var obj = project.render(); | ||
s2d.addChild(obj); | ||
|
||
title = obj.getObjectByName("Title"); | ||
button = obj.getObjectByName("Button"); | ||
} | ||
|
||
|
||
override function update(dt:Float) { | ||
super.update(dt); | ||
|
||
title.y += Math.sin(bounce += 0.075) * 0.25; | ||
} | ||
} |
Oops, something went wrong.