Skip to content

Commit

Permalink
added tile rotation proof of concept
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleksander Morgensterns committed Jun 25, 2024
1 parent 1ddd7a7 commit 2e7e591
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
23 changes: 19 additions & 4 deletions source/GM-TE/GMTEEditor.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -1333,6 +1333,16 @@ GMTEEditor >> resetSelectedLayers [
self resetLayers: self selectedLayers
]

{
#category : #TODO,
#'squeak_changestamp' : 'Alex M 6/25/2024 18:26'
}
GMTEEditor >> rotateSelectedTile [

self selectedTile: (self selectedTile rotateBy: #right centerAt: (self selectedTile extent / 2)).
self tileMap tileSelectionSet highlightImage: self selectedTile
]

{
#category : #accessing,
#'squeak_changestamp' : 'jj 6/22/2024 21:31'
Expand Down Expand Up @@ -1395,7 +1405,7 @@ GMTEEditor >> selectOnlyLayer: anIndex [

{
#category : #accessing,
#'squeak_changestamp' : 'jj 6/24/2024 11:33'
#'squeak_changestamp' : 'Alex M 6/25/2024 18:26'
}
GMTEEditor >> selectTile: anObject [
"selects a tile from the tile store"
Expand All @@ -1404,8 +1414,8 @@ GMTEEditor >> selectTile: anObject [
(anObject = self selectedTile)
ifTrue: [self unselectTile]
ifFalse: [
self selectedTile: anObject.
self tileMap tileSelectionSet highlightImage: anObject fullResolutionSprite.
self selectedTile: anObject fullResolutionSprite.
self tileMap tileSelectionSet highlightImage: self selectedTile.
self trayViewer morph submorphs first
visible: true;
updateSprite: anObject fullResolutionSprite;
Expand Down Expand Up @@ -1498,7 +1508,7 @@ GMTEEditor >> setPadding: aText [

{
#category : #building,
#'squeak_changestamp' : 'jj 6/22/2024 21:42'
#'squeak_changestamp' : 'Alex M 6/25/2024 18:17'
}
GMTEEditor >> settingsMenu [
"opens the setting menu"
Expand All @@ -1516,6 +1526,11 @@ GMTEEditor >> settingsMenu [
add: 'Toggle Background'
target: self
selector: #toggleBackgroundTiles
argumentList: {};

add: 'Rotate Tile'
target: self
selector: #rotateSelectedTile
argumentList: {}.

builder open: aMenuSpec
Expand Down
4 changes: 2 additions & 2 deletions source/GM-TE/GMTEEditorTileMap.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,10 @@ GMTEEditorTileMap >> updateTile: aTile inLayer: aLayer FromEvent: anEvent [

{
#category : #updating,
#'squeak_changestamp' : 'Ivo Zilkenat 6/24/2024 11:38'
#'squeak_changestamp' : 'Alex M 6/25/2024 18:08'
}
GMTEEditorTileMap >> updateTileSprite: aTile [
"Helper function to apply sprite from tile selection to aTile"

self model selectedTile ifNotNil: [aTile applyTileSprite: self model selectedTile]
self model selectedTile ifNotNil: [aTile updateSprite: self model selectedTile]
]

0 comments on commit 2e7e591

Please sign in to comment.