Skip to content

Commit

Permalink
Minor category refactoring for TileMap, ...
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivo Zilkenat committed Jun 7, 2024
1 parent c02f2c7 commit 6a384a7
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 39 deletions.
17 changes: 8 additions & 9 deletions source/GM-TE/GMTEEditableTileMap.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ GMTEEditableTileMap >> handlesMouseMove: anEvent [
]

{
#category : #updating,
#category : #'as yet unclassified',
#'squeak_changestamp' : 'TW 5/22/2024 15:48'
}
GMTEEditableTileMap >> initialize [
Expand Down Expand Up @@ -115,12 +115,12 @@ GMTEEditableTileMap >> mouseMove: anEvent [
]

{
#category : #'as yet unclassified',
#'squeak_changestamp' : 'Valentin Teutschbein 6/7/2024 21:09'
#category : #removing,
#'squeak_changestamp' : 'Ivo Zilkenat 6/7/2024 22:17'
}
GMTEEditableTileMap >> resetAll [
"TODO: maybe combine this with updatTile: inLayer: FromEvent: . Currently not working with layers."
self tileMatrixStack reset.
self tileMatrixStack setPlaceholder.
]

{
Expand All @@ -142,8 +142,8 @@ GMTEEditableTileMap >> tileSelectionSet: anObject [
]

{
#category : #'as yet unclassified',
#'squeak_changestamp' : 'Ivo Zilkenat 6/7/2024 21:28'
#category : #updating,
#'squeak_changestamp' : 'Ivo Zilkenat 6/7/2024 22:14'
}
GMTEEditableTileMap >> updateTile: aTile inLayer: aLayer FromEvent: anEvent [
| tileIdx hoveredTile |
Expand All @@ -164,12 +164,11 @@ GMTEEditableTileMap >> updateTile: aTile inLayer: aLayer FromEvent: anEvent [
tileIdx := self tileIdxFromPosition: anEvent position.
self tileMatrixStack layer: aLayer at: tileIdx y at: tileIdx x put: nil.
hoveredTile abandon].
self model savedSinceModified: false.
].
self model savedSinceModified: false.].
]

{
#category : #'as yet unclassified',
#category : #updating,
#'squeak_changestamp' : 'Alex M 5/23/2024 10:14'
}
GMTEEditableTileMap >> updateTileSprite: aTile [
Expand Down
12 changes: 6 additions & 6 deletions source/GM-TE/GMTEEditor.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -123,26 +123,26 @@ GMTEEditor class >> fromTileHeight: aHeight widht: aWidth [

{
#category : #'as yet unclassified',
#'squeak_changestamp' : 'JS 6/4/2024 18:21'
#'squeak_changestamp' : 'Ivo Zilkenat 6/7/2024 22:17'
}
GMTEEditor class >> getTileMapFromFilePath: aFilePath [

|aFileStream tileMap|
"TODO: Check if .morph is a tileMap"
aFileStream := (MultiByteBinaryOrTextStream with: ((FileStream readOnlyFileNamed: aFilePath) binary contentsOfEntireFile)) binary reset.
aFileStream := (MultiByteBinaryOrTextStream with: ((FileStream readOnlyFileNamed: aFilePath) binary contentsOfEntireFile)) binary setPlaceholder.
tileMap := aFileStream fileInObjectAndCode.
(tileMap isKindOf: GMTEEditableTileMap) ifFalse: [^nil].
^GMTETileMap newFrom: (tileMap copy).
]

{
#category : #'as yet unclassified',
#'squeak_changestamp' : 'JS 6/4/2024 18:21'
#'squeak_changestamp' : 'Ivo Zilkenat 6/7/2024 22:17'
}
GMTEEditor class >> getTileMapFromProjectName: aName withPath: aPath [

|aFileStream tileMap|
aFileStream := (MultiByteBinaryOrTextStream with: ((GitAssetLoader for: aName) loadAsset: aPath)) binary reset.
aFileStream := (MultiByteBinaryOrTextStream with: ((GitAssetLoader for: aName) loadAsset: aPath)) binary setPlaceholder.
tileMap := aFileStream fileInObjectAndCode.
(tileMap isKindOf: GMTEEditableTileMap) ifFalse: [^nil].
^GMTETileMap newFrom: (tileMap copy).
Expand Down Expand Up @@ -546,7 +546,7 @@ GMTEEditor >> import [

{
#category : #'button functions',
#'squeak_changestamp' : 'jj 6/5/2024 01:21'
#'squeak_changestamp' : 'Ivo Zilkenat 6/7/2024 22:17'
}
GMTEEditor >> importFromMorph [
"import tilemap into editor from a .morph file"
Expand All @@ -556,7 +556,7 @@ GMTEEditor >> importFromMorph [

stream ifNil: [^self].

aFileStream := (MultiByteBinaryOrTextStream with: ((FileStream readOnlyFileNamed: stream fullName) binary contentsOfEntireFile)) binary reset.
aFileStream := (MultiByteBinaryOrTextStream with: ((FileStream readOnlyFileNamed: stream fullName) binary contentsOfEntireFile)) binary setPlaceholder.
tileMap := aFileStream fileInObjectAndCode.
(tileMap isKindOf: GMTEEditableTileMap) ifFalse: [^self].

Expand Down
4 changes: 2 additions & 2 deletions source/GM-TE/GMTETile.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ GMTETile class >> position: aPoint extent: anExtent [

{
#category : #'as yet unclassified',
#'squeak_changestamp' : 'TW 5/22/2024 23:33'
#'squeak_changestamp' : 'Ivo Zilkenat 6/7/2024 22:17'
}
GMTETile >> reset [
GMTETile >> setPlaceholder [

self setPlaceholderColor: GMTETile placeHolderColor
]
2 changes: 1 addition & 1 deletion source/GM-TE/GMTETileMap.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ GMTETileMap >> generateVisualTiles [
]

{
#category : #updating,
#category : #'as yet unclassified',
#'squeak_changestamp' : 'TW 5/22/2024 15:48'
}
GMTETileMap >> initialize [
Expand Down
4 changes: 2 additions & 2 deletions source/GM-TE/GMTETileMatrixLayer.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Class {
}

{
#category : #'as yet unclassified',
#category : #enumerating,
#'squeak_changestamp' : 'Valentin Teutschbein 6/7/2024 20:55'
}
GMTETileMatrixLayer >> doTiles: aBlock [
Expand All @@ -15,7 +15,7 @@ GMTETileMatrixLayer >> doTiles: aBlock [
]

{
#category : #'as yet unclassified',
#category : #removing,
#'squeak_changestamp' : 'Valentin Teutschbein 6/7/2024 20:50'
}
GMTETileMatrixLayer >> free [
Expand Down
28 changes: 14 additions & 14 deletions source/GM-TE/GMTETileMatrixStack.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ GMTETileMatrixStack class >> fromWidth: aWidth height: aHeight [
]

{
#category : #'as yet unclassified',
#category : #eumerating,
#'squeak_changestamp' : 'Valentin Teutschbein 6/7/2024 21:50'
}
GMTETileMatrixStack >> doLayers: aBlock [
Expand All @@ -34,7 +34,7 @@ GMTETileMatrixStack >> doLayers: aBlock [
]

{
#category : #'as yet unclassified',
#category : #eumerating,
#'squeak_changestamp' : 'Valentin Teutschbein 6/7/2024 21:50'
}
GMTETileMatrixStack >> doTiles: aBlock [
Expand Down Expand Up @@ -73,7 +73,7 @@ GMTETileMatrixStack >> initialize [
]

{
#category : #'as yet unclassified',
#category : #accessing,
#'squeak_changestamp' : 'Ivo Zilkenat 5/27/2024 21:34'
}
GMTETileMatrixStack >> layer: aLayerIdx [
Expand All @@ -82,7 +82,7 @@ GMTETileMatrixStack >> layer: aLayerIdx [
]

{
#category : #'as yet unclassified',
#category : #accessing,
#'squeak_changestamp' : 'TW 5/28/2024 11:15'
}
GMTETileMatrixStack >> layer: aLayerIdx at: x at: y [
Expand All @@ -91,7 +91,7 @@ GMTETileMatrixStack >> layer: aLayerIdx at: x at: y [
]

{
#category : #'as yet unclassified',
#category : #accessing,
#'squeak_changestamp' : 'Valentin 5/28/2024 13:17'
}
GMTETileMatrixStack >> layer: aLayerIdx at: x at: y put: aTile [
Expand Down Expand Up @@ -148,7 +148,7 @@ GMTETileMatrixStack >> morphicLayerStartingOffset: anObject [
]

{
#category : #'as yet unclassified',
#category : #adding,
#'squeak_changestamp' : 'Ivo Zilkenat 5/27/2024 21:38'
}
GMTETileMatrixStack >> pushLayer [
Expand All @@ -157,7 +157,7 @@ GMTETileMatrixStack >> pushLayer [
]

{
#category : #'as yet unclassified',
#category : #removing,
#'squeak_changestamp' : 'Valentin Teutschbein 6/7/2024 21:20'
}
GMTETileMatrixStack >> removeLayerAt: idx [
Expand All @@ -170,29 +170,29 @@ GMTETileMatrixStack >> removeLayerAt: idx [
]

{
#category : #'as yet unclassified',
#'squeak_changestamp' : 'Valentin Teutschbein 6/7/2024 21:32'
#category : #removing,
#'squeak_changestamp' : 'Ivo Zilkenat 6/7/2024 22:17'
}
GMTETileMatrixStack >> reset [
GMTETileMatrixStack >> setPlaceholder [

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'
#'squeak_changestamp' : 'Ivo Zilkenat 6/7/2024 22:05'
}
GMTETileMatrixStack >> width [

^ widht
^ width
]

{
#category : #accessing,
#'squeak_changestamp' : 'Ivo Zilkenat 5/27/2024 21:19'
#'squeak_changestamp' : 'Ivo Zilkenat 6/7/2024 22:05'
}
GMTETileMatrixStack >> width: anObject [

widht := anObject.
width := anObject.
]
10 changes: 5 additions & 5 deletions source/GM-TE/GMTETileSelectionSet.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Class {
}

{
#category : #'as yet unclassified',
#category : #highlighting,
#'squeak_changestamp' : 'Ivo Zilkenat 6/7/2024 21:14'
}
GMTETileSelectionSet >> applyHighlightingVisuals: aTile [
Expand All @@ -23,7 +23,7 @@ GMTETileSelectionSet >> applyHighlightingVisuals: aTile [
]

{
#category : #'as yet unclassified',
#category : #highlighting,
#'squeak_changestamp' : 'Ivo Zilkenat 5/21/2024 21:06'
}
GMTETileSelectionSet >> clearAllHighlightings [
Expand Down Expand Up @@ -51,7 +51,7 @@ GMTETileSelectionSet >> highlightImage: anObject [
]

{
#category : #'as yet unclassified',
#category : #highlighting,
#'squeak_changestamp' : 'Ivo Zilkenat 5/21/2024 21:05'
}
GMTETileSelectionSet >> highlightTile: aTile [
Expand All @@ -73,7 +73,7 @@ GMTETileSelectionSet >> initialize: n [
]

{
#category : #'as yet unclassified',
#category : #highlighting,
#'squeak_changestamp' : 'Ivo Zilkenat 6/7/2024 21:14'
}
GMTETileSelectionSet >> removeHighlightingVisuals: aTile [
Expand All @@ -89,7 +89,7 @@ GMTETileSelectionSet >> removeHighlightingVisuals: aTile [
]

{
#category : #'as yet unclassified',
#category : #highlighting,
#'squeak_changestamp' : 'Ivo Zilkenat 5/21/2024 21:06'
}
GMTETileSelectionSet >> unhighlightTile: aTile [
Expand Down

0 comments on commit 6a384a7

Please sign in to comment.