Skip to content

Commit

Permalink
added Scrollbar to tile store
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleksander Morgensterns committed May 20, 2024
1 parent bae2070 commit b8c8b89
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 13 deletions.
23 changes: 10 additions & 13 deletions source/GM-TE/GMTEEditor.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ GMTEEditor class >> createTileViewerWithBuilder: aBuilder [

{
#category : #'as yet unclassified',
#'squeak_changestamp' : 'Alex M 5/20/2024 15:49'
#'squeak_changestamp' : 'Alex M 5/20/2024 16:46'
}
GMTEEditor class >> createTilestoreWithBuilder: aBuilder [

^aBuilder pluggablePanelSpec new
^aBuilder pluggableScrollPaneSpec new
frame: ((0 @ 0.1) corner: 0.2 @ 1);
name: 'tile store';
layout: #vertical;
Expand All @@ -83,7 +83,7 @@ GMTEEditor class >> createTrayWithBuilder: aBuilder [

{
#category : #'as yet unclassified',
#'squeak_changestamp' : 'Alex M 5/20/2024 15:55'
#'squeak_changestamp' : 'Alex M 5/20/2024 17:44'
}
GMTEEditor class >> loadTileSetWithDimensions: aPoint [

Expand All @@ -106,10 +106,10 @@ GMTEEditor class >> loadTileSetWithDimensions: aPoint [
tile_width := aPoint x.
tile_height := aPoint y.
"TODO: refactor into non C-like code"
0 to: (form width - tile_width) by: tile_width do: [:x|
0 to: (form height - tile_height) by: tile_height do:[:y|
0 to: (form height - tile_height) by: tile_height do:[:y|
0 to: (form width - tile_width) by: tile_width do: [:x|
tile := form contentsOfArea: (Rectangle origin: x@y extent: tile_width@tile_height).
image := ImageMorph new
image := GMTETileSelector new
image: (tile scaledToWidth: 50).
morphs add: image.
].
Expand All @@ -120,7 +120,7 @@ GMTEEditor class >> loadTileSetWithDimensions: aPoint [

{
#category : #'as yet unclassified',
#'squeak_changestamp' : 'Alex M 5/20/2024 16:03'
#'squeak_changestamp' : 'Alex M 5/20/2024 17:43'
}
GMTEEditor class >> new [

Expand All @@ -141,15 +141,12 @@ GMTEEditor class >> new [
commandBar := morph submorphNamed: 'command bar'.
tileStore := morph submorphNamed: 'tile store'.
tileViewer := morph submorphNamed: 'tile viewer'.

"tileStore addMorph: Morph new.
tileStore addMorph: (Morph new
color: Color red;
yourself)."

"TODO 16 by 16 is a magic number. Where do we store tile dimensions?"
(commandBar submorphNamed: 'import') action: [
tileStore addAllMorphs: (GMTEEditor loadTileSetWithDimensions: 16@16);update:nil.
"TODO make multiple sprite sets available?"
tileStore morph removeAllMorphs;
addAllMorphs: (GMTEEditor loadTileSetWithDimensions: 16@16).
].

tileMatrixMorph := GMTETileMap tileWidth: 10 tileHeight: 10 padding: 0.0 sizeRatio: 2.
Expand Down
15 changes: 15 additions & 0 deletions source/GM-TE/GMTETileSelector.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Class {
#name : #GMTETileSelector,
#superclass : #ImageMorph,
#category : #'GM-TE'
}

{
#category : #'as yet unclassified',
#'squeak_changestamp' : 'Alex M 5/20/2024 18:29'
}
GMTETileSelector >> handlesMouseDown: evt [
"handlesMouseStillDown: for tiles"
Transcript show: 'test'.
^ true.
]

0 comments on commit b8c8b89

Please sign in to comment.