From 85abb76fdb11d5fca8526a87cc72d791c5b20a4a Mon Sep 17 00:00:00 2001 From: Ivo Zilkenat Date: Sun, 23 Jun 2024 20:33:21 +0200 Subject: [PATCH] Fixed layer blending (again) --- source/GM-TE/GMTETileMatrixLayer.class.st | 27 ++++++-- source/GM-TE/GMTETileMatrixStack.class.st | 64 +++++++++++-------- .../instance/setUp..1.st | 2 +- .../instance/setup..2.st | 2 +- .../methodProperties.json | 1 + 5 files changed, 63 insertions(+), 33 deletions(-) diff --git a/source/GM-TE/GMTETileMatrixLayer.class.st b/source/GM-TE/GMTETileMatrixLayer.class.st index 1457312a..7effbdd1 100644 --- a/source/GM-TE/GMTETileMatrixLayer.class.st +++ b/source/GM-TE/GMTETileMatrixLayer.class.st @@ -3,7 +3,8 @@ Class { #superclass : #GMTEStaticCoordinateMatrix, #instVars : [ 'layerIdx', - 'visible' + 'visible', + 'displayName' ], #category : #'GM-TE-Core' } @@ -31,14 +32,14 @@ GMTETileMatrixLayer >> aboveLayer: aLayer [ { #category : #adding, - #'squeak_changestamp' : 'jj 6/22/2024 16:23' + #'squeak_changestamp' : 'Ivo Zilkenat 6/23/2024 20:18' } -GMTETileMatrixLayer >> addTile: aTile at: x at: y [ +GMTETileMatrixLayer >> addTile: aTile at: y at: x [ aTile ifNotNil: [ aTile morphicLayerNumber: self layerIdx. aTile visible: self visible]. - ^ self at: x at: y put: aTile + ^ self at: y at: x put: aTile. ] { @@ -69,6 +70,24 @@ GMTETileMatrixLayer >> belowLayer: aLayer [ ^ (self aboveLayer: aLayer) not ] +{ + #category : #accessing, + #'squeak_changestamp' : 'Ivo Zilkenat 6/23/2024 19:47' +} +GMTETileMatrixLayer >> displayName [ + + ^ displayName +] + +{ + #category : #accessing, + #'squeak_changestamp' : 'Ivo Zilkenat 6/23/2024 19:54' +} +GMTETileMatrixLayer >> displayName: anObject [ + + displayName := anObject +] + { #category : #enumerating, #'squeak_changestamp' : 'jj 6/23/2024 13:56' diff --git a/source/GM-TE/GMTETileMatrixStack.class.st b/source/GM-TE/GMTETileMatrixStack.class.st index 68e54aee..4e1a9239 100644 --- a/source/GM-TE/GMTETileMatrixStack.class.st +++ b/source/GM-TE/GMTETileMatrixStack.class.st @@ -56,9 +56,18 @@ GMTETileMatrixStack class >> morphicLayerOffsetDefault [ ^ 100 ] +{ + #category : #accessing, + #'squeak_changestamp' : 'Ivo Zilkenat 6/23/2024 20:23' +} +GMTETileMatrixStack >> basicVisible: aBool [ + + visible := aBool +] + { #category : #updating, - #'squeak_changestamp' : 'jj 6/22/2024 16:28' + #'squeak_changestamp' : 'Ivo Zilkenat 6/23/2024 20:19' } GMTETileMatrixStack >> blendLayer: anIdx1 with: anIdx2 [ @@ -75,14 +84,15 @@ GMTETileMatrixStack >> blendLayer: anIdx1 with: anIdx2 [ topIdx := anIdx1. bottomIdx := anIdx2]. - 1 to: bottomLayer columnCount do: [ :x | - 1 to: bottomLayer rowCount do: [ :y | - bottomCell := bottomLayer at: x at: y. - topCell := topLayer at: x at: y. + 1 to: bottomLayer columnCount do: [:x | + 1 to: bottomLayer rowCount do: [:y | + bottomCell := bottomLayer at: y at: x. + topCell := topLayer at: y at: x. bottomCell ifNil: [ - newCellEntry := topCell. - bottomLayer addTile: newCellEntry at: x at: y] + newCellEntry := topCell veryDeepCopy. + topCell ifNotNil: [topCell owner addMorph: newCellEntry]. + bottomLayer addTile: newCellEntry at: y at: x] ifNotNil: [ newCellEntry := bottomCell asBlendedWithImageMorph: topCell. bottomCell updateSprite: newCellEntry image]]]. @@ -108,31 +118,31 @@ GMTETileMatrixStack >> blendLayers: aSet [ { #category : #eumerating, - #'squeak_changestamp' : 'Valentin Teutschbein 6/7/2024 21:50' + #'squeak_changestamp' : 'Ivo Zilkenat 6/23/2024 19:53' } GMTETileMatrixStack >> doLayers: aBlock [ - self matrixLayers do: [ :layer | aBlock value: layer] + self matrixLayers do: [:layer | aBlock value: layer] ] { #category : #eumerating, - #'squeak_changestamp' : 'Valentin Teutschbein 6/7/2024 21:50' + #'squeak_changestamp' : 'Ivo Zilkenat 6/23/2024 19:53' } GMTETileMatrixStack >> doTiles: aBlock [ - self doLayers: [ :layer | layer doTiles: aBlock] + self doLayers: [:layer | layer doTiles: aBlock] ] { #category : #eumerating, - #'squeak_changestamp' : 'Ivo Zilkenat 6/19/2024 15:28' + #'squeak_changestamp' : 'Ivo Zilkenat 6/23/2024 19:53' } GMTETileMatrixStack >> doTilesXYLidx: aBlock [ - 1 to: self width do: [ :x | - 1 to: self height do: [ :y | - 1 to: self layerCount do: [ :layerIdx | + 1 to: self width do: [:x | + 1 to: self height do: [:y | + 1 to: self layerCount do: [:layerIdx | aBlock value: x value: y value: layerIdx]]] ] @@ -197,20 +207,20 @@ GMTETileMatrixStack >> layer: aLayerIdx [ { #category : #accessing, - #'squeak_changestamp' : 'jj 6/22/2024 16:29' + #'squeak_changestamp' : 'Ivo Zilkenat 6/23/2024 19:58' } -GMTETileMatrixStack >> layer: aLayerIdx at: x at: y [ +GMTETileMatrixStack >> layer: aLayerIdx at: y at: x [ - ^ (self matrixLayers at: aLayerIdx) at: x at: y + ^ (self matrixLayers at: aLayerIdx) at: y at: x ] { #category : #accessing, - #'squeak_changestamp' : 'jj 6/22/2024 16:29' + #'squeak_changestamp' : 'Ivo Zilkenat 6/23/2024 19:58' } -GMTETileMatrixStack >> layer: aLayerIdx at: x at: y put: aTile [ +GMTETileMatrixStack >> layer: aLayerIdx at: y at: x put: aTile [ - ^ (self matrixLayers at: aLayerIdx) addTile: aTile at: x at: y + ^ (self matrixLayers at: aLayerIdx) addTile: aTile at: y at: x ] { @@ -223,7 +233,7 @@ GMTETileMatrixStack >> layerCount [ ] { - #category : #'as yet unclassified', + #category : #checking, #'squeak_changestamp' : 'jj 6/22/2024 16:29' } GMTETileMatrixStack >> layerVisible: anIdx [ @@ -233,14 +243,14 @@ GMTETileMatrixStack >> layerVisible: anIdx [ { #category : #'multiselect-helpers', - #'squeak_changestamp' : 'jj 6/22/2024 16:29' + #'squeak_changestamp' : 'Ivo Zilkenat 6/23/2024 19:54' } GMTETileMatrixStack >> mapLayers: anOrderedCollection withUnaryBlock: aBlock [ | tmpResult | tmpResult := OrderedCollection new. - anOrderedCollection do: [ :layerIdx | + anOrderedCollection do: [:layerIdx | tmpResult add: (aBlock value: layerIdx)]. ^ tmpResult @@ -477,12 +487,12 @@ GMTETileMatrixStack >> visible [ { #category : #accessing, - #'squeak_changestamp' : 'Ivo Zilkenat 6/19/2024 23:10' + #'squeak_changestamp' : 'Ivo Zilkenat 6/23/2024 20:23' } GMTETileMatrixStack >> visible: aBool [ - visible := aBool. - + self basicVisible: aBool. + self doLayers: [ :aLayer | aLayer visible: aBool] ] diff --git a/source/GM-Test.package/GMTileEditorTest.class/instance/setUp..1.st b/source/GM-Test.package/GMTileEditorTest.class/instance/setUp..1.st index 84308b9e..9444092d 100644 --- a/source/GM-Test.package/GMTileEditorTest.class/instance/setUp..1.st +++ b/source/GM-Test.package/GMTileEditorTest.class/instance/setUp..1.st @@ -2,4 +2,4 @@ as yet unclassified setUp self editor ifNil: [self editor: GMTEEditor new]. - self fileUUID: nil \ No newline at end of file + self fileUUID: UUID new asString \ No newline at end of file diff --git a/source/GM-Test.package/GMTileEditorTest.class/instance/setup..2.st b/source/GM-Test.package/GMTileEditorTest.class/instance/setup..2.st index d9cb68e6..0119fa67 100644 --- a/source/GM-Test.package/GMTileEditorTest.class/instance/setup..2.st +++ b/source/GM-Test.package/GMTileEditorTest.class/instance/setup..2.st @@ -1,3 +1,3 @@ as yet unclassified setup - self editor: GMTEEditor new \ No newline at end of file + self editor: GMTEEditor new. \ No newline at end of file diff --git a/source/GM-Test.package/GMTileEditorTest.class/methodProperties.json b/source/GM-Test.package/GMTileEditorTest.class/methodProperties.json index d2fa3196..b479a842 100644 --- a/source/GM-Test.package/GMTileEditorTest.class/methodProperties.json +++ b/source/GM-Test.package/GMTileEditorTest.class/methodProperties.json @@ -9,6 +9,7 @@ "fileUUID:" : "jj 6/22/2024 16:55", "loadTestMapFileToFileDirectory" : "JS 6/23/2024 18:18", "setUp" : "jj 6/23/2024 18:55", + "setup" : " 6/23/2024 19:24:16", "tearDown" : "jj 6/22/2024 20:24", "testAddLayerButton" : "JS 6/23/2024 18:29", "testDeleteLayer" : "jj 6/22/2024 20:25",