Skip to content

Commit 1673522

Browse files
authored
Start implementing a popup for editing the player's sprite.
Merge pull request #46 from haroldo-ok/player-sprite
2 parents f251c5e + 6e5cee1 commit 1673522

3 files changed

Lines changed: 21 additions & 2 deletions

File tree

assets/tinyMapEditor.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ nav { position: absolute; left: 0; top: 0; margin: 0; width: 250px; min-height:
5050
#layers li p { margin: 5px; padding: 5px; border: 1px solid #bbb }
5151

5252
.card { border: 1px solid gray; border-radius: 4px; margin: 1em; padding: 0.3em; }
53+
.hidden { display: none; }
5354

5455

5556
/*************************************** Output */

index.html

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ <h2>This is a Work-In-Progress online tool for making Sega Master System puzzle
4141
<li id="options">
4242
<label>Map Options</label>
4343
<p><label>Tile zoom:</label><input type="text" value="1" maxlength="3" id="tileZoom" /><span>x</span></p>
44-
<p><label>Map width:</label><input type="text" value="16" maxlength="3" id="width" disabled /><span>tiles</span></p>
45-
<p><label>Map height:</label><input type="text" value="9" maxlength="3" id="height" disabled /><span>tiles</span></p>
44+
<p class="hidden"><label>Map width:</label><input type="text" value="16" maxlength="3" id="width" disabled /><span>tiles</span></p>
45+
<p class="hidden"><label>Map height:</label><input type="text" value="9" maxlength="3" id="height" disabled /><span>tiles</span></p>
4646
</li>
4747
<li id="tiles">
4848
<label>Tiles</label>
@@ -55,6 +55,7 @@ <h2>This is a Work-In-Progress online tool for making Sega Master System puzzle
5555

5656
<p><input id="tileAttrsButton" type="button" value="Edit Tile Attributes" /></p>
5757
<p><input id="tileCombinationsButton" type="button" value="Edit Tile Combinations" /></p>
58+
<p><input id="playerSpriteButton" type="button" value="Edit Player Sprite" /></p>
5859
</li>
5960
<li id="selected">
6061
<label>Selected Tile</label>
@@ -87,6 +88,8 @@ <h2>This is a Work-In-Progress online tool for making Sega Master System puzzle
8788
</dialog>
8889
<dialog id="projectInfoDialog">
8990
</dialog>
91+
<dialog id="playerSpriteDialog">
92+
</dialog>
9093

9194
<script src="RgbQuant-SMS.js/demo/js/underscore-min.js"></script>
9295
<script src="RgbQuant-SMS.js/demo/js/underscore-min.js"></script>

tileEditor.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ var tinyMapEditor = (function() {
3939
tileCombinationsDialog = getById('tileCombinationsDialog'),
4040
tileCombinationChoiceDialog = getById('tileCombinationChoiceDialog'),
4141

42+
playerSpriteButton = getById('playerSpriteButton'),
43+
playerSpriteDialog = getById('playerSpriteDialog'),
44+
4245
projectInfoButton = getById('projectInfoButton'),
4346
projectInfoDialog = getById('projectInfoDialog'),
4447
loadProjectInput = getById('loadProjectInput'),
@@ -670,6 +673,17 @@ var tinyMapEditor = (function() {
670673

671674
populateModalDialog(tileCombinationsDialog, 'Tile Combinations', table);
672675
},
676+
677+
showPlayerSpritePopup : function() {
678+
const { h, newTr, newTd, newTh, newInput, newDataCheckbox, populateModalDialog } = DomUtil;
679+
680+
populateModalDialog(playerSpriteDialog, 'Player Sprite',
681+
h('label', {},
682+
'Player sprite to load:',
683+
newInput('file', { accept: 'image/*' })
684+
)
685+
);
686+
},
673687

674688
prepareProjectInfoStructure : function() {
675689
if (!projectInfo) projectInfo = {};
@@ -835,6 +849,7 @@ var tinyMapEditor = (function() {
835849

836850
tileAttrsButton.addEventListener('click', () => _this.showTileAttrsPopup());
837851
tileCombinationsButton.addEventListener('click', () => _this.showTileCombinationsPopup());
852+
playerSpriteButton.addEventListener('click', () => _this.showPlayerSpritePopup());
838853

839854
/**
840855
* Map list events.

0 commit comments

Comments
 (0)