Skip to content

Commit

Permalink
fixed reset button
Browse files Browse the repository at this point in the history
  • Loading branch information
valteu committed Jun 7, 2024
1 parent 7c3848e commit ec7b882
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 16 deletions.
4 changes: 2 additions & 2 deletions source/GM-TE/GMTEEditableTileMap.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,11 @@ GMTEEditableTileMap >> mouseMove: anEvent [

{
#category : #'as yet unclassified',
#'squeak_changestamp' : 'Alex M 5/28/2024 15:04'
#'squeak_changestamp' : 'Valentin Teutschbein 6/7/2024 21:09'
}
GMTEEditableTileMap >> resetAll [
"TODO: maybe combine this with updatTile: inLayer: FromEvent: . Currently not working with layers."
self gridTileMatrix do: [:aTile | aTile reset]
self tileMatrixStack reset.
]

{
Expand Down
3 changes: 2 additions & 1 deletion source/GM-TE/GMTEEditor.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -782,10 +782,11 @@ GMTEEditor >> ratio: anObject [

{
#category : #'button functions',
#'squeak_changestamp' : 'TW 5/23/2024 00:13'
#'squeak_changestamp' : 'Valentin Teutschbein 6/7/2024 21:47'
}
GMTEEditor >> resetAll [

self selectedLayer: 1.
self tileMapMatrix resetAll
]

Expand Down
9 changes: 0 additions & 9 deletions source/GM-TE/GMTETileMap.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,6 @@ GMTETileMap >> borderTileWidth: anObject [
borderTileWidth := anObject.
]

{
#category : #updating,
#'squeak_changestamp' : 'Valentin Teutschbein 5/20/2024 20:30'
}
GMTETileMap >> clearTiles [

self gridTileMatrix do: [:aTile | aTile delete]
]

{
#category : #conversion,
#'squeak_changestamp' : 'Ivo Zilkenat 5/21/2024 21:16'
Expand Down
14 changes: 12 additions & 2 deletions source/GM-TE/GMTETileMatrixLayer.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,19 @@ Class {

{
#category : #'as yet unclassified',
#'squeak_changestamp' : 'Ivo Zilkenat 5/27/2024 21:40'
#'squeak_changestamp' : 'Valentin Teutschbein 6/7/2024 20:55'
}
GMTETileMatrixLayer >> doTiles: aBlock [

self contents do: [ :tile |
tile ifNotNil: [aBlock value: tile]]
]

{
#category : #'as yet unclassified',
#'squeak_changestamp' : 'Valentin Teutschbein 6/7/2024 20:50'
}
GMTETileMatrixLayer >> free [

self contents do: [ :imageMorph | imageMorph abandon]
self doTiles: [ :imageMorph | imageMorph abandon]
]
32 changes: 30 additions & 2 deletions source/GM-TE/GMTETileMatrixStack.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,24 @@ GMTETileMatrixStack class >> fromWidth: aWidth height: aHeight [

]

{
#category : #'as yet unclassified',
#'squeak_changestamp' : 'Valentin Teutschbein 6/7/2024 21:50'
}
GMTETileMatrixStack >> doLayers: aBlock [

self matrixLayers do: [ :layer | aBlock value: layer]
]

{
#category : #'as yet unclassified',
#'squeak_changestamp' : 'Valentin Teutschbein 6/7/2024 21:50'
}
GMTETileMatrixStack >> doTiles: aBlock [

self doLayers: [ :layer | layer doTiles: aBlock]
]

{
#category : #accessing,
#'squeak_changestamp' : 'Ivo Zilkenat 5/27/2024 21:16'
Expand Down Expand Up @@ -140,17 +158,27 @@ GMTETileMatrixStack >> pushLayer [

{
#category : #'as yet unclassified',
#'squeak_changestamp' : 'Ivo Zilkenat 5/27/2024 21:46'
#'squeak_changestamp' : 'Valentin Teutschbein 6/7/2024 21:20'
}
GMTETileMatrixStack >> removeLayerAt: idx [

| removedLayer |.
self assert: idx ~= 1 description: 'Base layer cannot be removed!'.

removedLayer := self matrixLayers removeLink: (self matrixLayers linkAt: idx) value.
removedLayer := (self matrixLayers removeLink: (self matrixLayers linkAt: idx)) value.
removedLayer free.
]

{
#category : #'as yet unclassified',
#'squeak_changestamp' : 'Valentin Teutschbein 6/7/2024 21:32'
}
GMTETileMatrixStack >> reset [

self layerCount to: 2 by: -1 do: [ :layer | self removeLayerAt: layer].
(self layer: 1) free
]

{
#category : #accessing,
#'squeak_changestamp' : 'Ivo Zilkenat 5/27/2024 21:19'
Expand Down

0 comments on commit ec7b882

Please sign in to comment.