-
-
Notifications
You must be signed in to change notification settings - Fork 195
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Added a new `ex.NineSlice` `Graphic` for creating arbitrarily resizable rectangular regions, useful for creating UI, backgrounds, and other resizable elements. ```typescript var nineSlice = new ex.NineSlice({ width: 300, height: 100, source: inputTile, sourceConfig: { width: 64, height: 64, topMargin: 5, leftMargin: 7, bottomMargin: 5, rightMargin: 7 }, destinationConfig: { drawCenter: true, horizontalStretch: ex.NineSliceStretch.Stretch, verticalStretch: ex.NineSliceStretch.Stretch } }); actor.graphics.add(nineSlice); ```
- Loading branch information
1 parent
3510f93
commit c980349
Showing
24 changed files
with
1,087 additions
and
50 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
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
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,12 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>9-Slice</title> | ||
</head> | ||
<body> | ||
<script src="../../lib/excalibur.js"></script> | ||
<script src="./index.js"></script> | ||
</body> | ||
</html> |
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,35 @@ | ||
var game = new ex.Engine({ | ||
width: 600, | ||
height: 400, | ||
displayMode: ex.DisplayMode.FitScreenAndFill, | ||
pixelArt: true | ||
}); | ||
|
||
var inputTile = new ex.ImageSource('./InputTile.png'); | ||
|
||
var actor = new ex.Actor({ | ||
pos: ex.vec(200, 200) | ||
}); | ||
game.add(actor); | ||
var nineSlice = new ex.NineSlice({ | ||
width: 300, | ||
height: 100, | ||
source: inputTile, | ||
sourceConfig: { | ||
width: 64, | ||
height: 64, | ||
topMargin: 5, | ||
leftMargin: 7, | ||
bottomMargin: 5, | ||
rightMargin: 7 | ||
}, | ||
destinationConfig: { | ||
drawCenter: true, | ||
horizontalStretch: ex.NineSliceStretch.Stretch, | ||
verticalStretch: ex.NineSliceStretch.Stretch | ||
} | ||
}); | ||
|
||
actor.graphics.add(nineSlice); | ||
var loader = new ex.Loader([inputTile]); | ||
game.start(loader).then(() => {}); |
Oops, something went wrong.