-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
addLayer & moveLayer Commands proof of concept added (needs refactoring)
- Loading branch information
Aleksander Morgensterns
committed
Jul 3, 2024
1 parent
044b421
commit 450e2ae
Showing
6 changed files
with
169 additions
and
5 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,59 @@ | ||
Class { | ||
#name : #GMTEAddLayerCommand, | ||
#superclass : #GMTECommand, | ||
#instVars : [ | ||
'editor' | ||
], | ||
#category : #'GM-TE-UI' | ||
} | ||
|
||
{ | ||
#category : #'as yet unclassified', | ||
#'squeak_changestamp' : 'Alex M 7/4/2024 01:30' | ||
} | ||
GMTEAddLayerCommand class >> withEditor: anEditor [ | ||
|
||
^ (self new) | ||
editor: anEditor; | ||
yourself | ||
] | ||
|
||
{ | ||
#category : #execution, | ||
#'squeak_changestamp' : 'Alex M 7/4/2024 01:43' | ||
} | ||
GMTEAddLayerCommand >> do [ | ||
"TODO: refactor this nicely by using inbuilt editor function while avoiding recursion" | ||
|
||
self editor tileMap tileMatrixStack pushLayer. | ||
self editor | ||
selectOnlyLayer: self editor layerCount; | ||
changed: #getLayerList | ||
] | ||
|
||
{ | ||
#category : #accessing, | ||
#'squeak_changestamp' : 'Alex M 7/4/2024 01:37' | ||
} | ||
GMTEAddLayerCommand >> editor [ | ||
^ editor | ||
] | ||
|
||
{ | ||
#category : #accessing, | ||
#'squeak_changestamp' : 'Alex M 7/4/2024 01:37' | ||
} | ||
GMTEAddLayerCommand >> editor: anObject [ | ||
editor := anObject | ||
] | ||
|
||
{ | ||
#category : #execution, | ||
#'squeak_changestamp' : 'Alex M 7/4/2024 01:40' | ||
} | ||
GMTEAddLayerCommand >> undo [ | ||
|
||
self editor | ||
selectLayer: self editor layerCount; | ||
deleteSelectedLayers | ||
] |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Class { | ||
#name : #GMTEDeleteLayerCommand, | ||
#superclass : #GMTETilemapSizeCommand, | ||
#category : #'GM-TE-UI' | ||
} |
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 |
---|---|---|
@@ -0,0 +1,93 @@ | ||
Class { | ||
#name : #GMTEMoveLayerCommand, | ||
#superclass : #GMTECommand, | ||
#instVars : [ | ||
'layerID', | ||
'moveDirection', | ||
'editor' | ||
], | ||
#category : #'GM-TE-UI' | ||
} | ||
|
||
{ | ||
#category : #'as yet unclassified', | ||
#'squeak_changestamp' : 'Alex M 7/4/2024 01:17' | ||
} | ||
GMTEMoveLayerCommand class >> fromLayerID: aNumber1 withDirection: aNumber2 withEditor: anEditor [ | ||
|
||
^ (self new) | ||
layerID: aNumber1; | ||
moveDirection: aNumber2; | ||
editor: anEditor; | ||
yourself | ||
] | ||
|
||
{ | ||
#category : #execution, | ||
#'squeak_changestamp' : 'Alex M 7/4/2024 01:26' | ||
} | ||
GMTEMoveLayerCommand >> do [ | ||
|
||
"moveDirection = 1 for up, -1 for down" | ||
self editor | ||
swapLayer: self layerID with: self layerID + self moveDirection | ||
] | ||
|
||
{ | ||
#category : #accessing, | ||
#'squeak_changestamp' : 'Alex M 7/4/2024 01:17' | ||
} | ||
GMTEMoveLayerCommand >> editor [ | ||
^ editor | ||
] | ||
|
||
{ | ||
#category : #accessing, | ||
#'squeak_changestamp' : 'Alex M 7/4/2024 01:17' | ||
} | ||
GMTEMoveLayerCommand >> editor: anObject [ | ||
editor := anObject | ||
] | ||
|
||
{ | ||
#category : #accessing, | ||
#'squeak_changestamp' : 'Alex M 7/4/2024 01:12' | ||
} | ||
GMTEMoveLayerCommand >> layerID [ | ||
^ layerID | ||
] | ||
|
||
{ | ||
#category : #accessing, | ||
#'squeak_changestamp' : 'Alex M 7/4/2024 01:12' | ||
} | ||
GMTEMoveLayerCommand >> layerID: anObject [ | ||
layerID := anObject | ||
] | ||
|
||
{ | ||
#category : #accessing, | ||
#'squeak_changestamp' : 'Alex M 7/4/2024 01:12' | ||
} | ||
GMTEMoveLayerCommand >> moveDirection [ | ||
^ moveDirection | ||
] | ||
|
||
{ | ||
#category : #accessing, | ||
#'squeak_changestamp' : 'Alex M 7/4/2024 01:12' | ||
} | ||
GMTEMoveLayerCommand >> moveDirection: anObject [ | ||
moveDirection := anObject | ||
] | ||
|
||
{ | ||
#category : #execution, | ||
#'squeak_changestamp' : 'Alex M 7/4/2024 01:26' | ||
} | ||
GMTEMoveLayerCommand >> undo [ | ||
|
||
"moveDirection = 1 for up, -1 for down" | ||
self editor | ||
swapLayer: self layerID + self moveDirection with: self layerID | ||
] |
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