The Trunk: EToys-ct.406.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: EToys-ct.406.mcz

commits-2
Marcel Taeumel uploaded a new version of EToys to project The Trunk:
http://source.squeak.org/trunk/EToys-ct.406.mcz

==================== Summary ====================

Name: EToys-ct.406
Author: ct
Time: 17 September 2020, 12:23:18.233813 pm
UUID: 0b76e3b6-1567-c542-8350-de5b7a28fcf2
Ancestors: EToys-eem.400

Minor Tetris refactorings. Expose action selectors for game control as part of the public Tetris protocol. This will be used to play/pause a tetris game from the outside. Recategorize some methods.

This commit is part of reconstruction of Objectland (also known as "The Worlds of Squeak"). For more information, see: http://forum.world.st/The-Inbox-MorphicExtras-ct-267-mcz-td5104764.html

=============== Diff against EToys-eem.400 ===============

Item was changed:
+ ----- Method: Tetris class>>colors (in category 'constants') -----
- ----- Method: Tetris class>>colors (in category 'as yet unclassified') -----
  colors
 
  ^{
  Color r: 0.5 g: 0 b: 0.
  Color r: 0 g: 0.5 b: 0.
  Color r: 0 g: 0 b: 0.5.
  Color r: 0.5 g: 0.5 b: 0.
  Color r: 0.5 g: 0 b: 0.5.
  Color r: 0 g: 0.5 b: 0.5
  }
  !

Item was changed:
  ----- Method: Tetris>>makeGameControls (in category 'initialization') -----
  makeGameControls
  ^ self rowForButtons
  addMorph: (self
  buildButtonTarget: self
  label: 'Quit' translated
  selector: #delete
  help: 'quit' translated);
 
  addMorph: (self
+ buildButtonTarget: self
- buildButtonTarget: board
  label: 'Pause' translated
  selector: #pause
  help: 'pause' translated);
 
  addMorph: (self
+ buildButtonTarget: self
- buildButtonTarget: board
  label: 'New game' translated
  selector: #newGame
  help: 'new game' translated)!

Item was added:
+ ----- Method: Tetris>>newGame (in category 'actions') -----
+ newGame
+
+ board newGame.!

Item was added:
+ ----- Method: Tetris>>pause (in category 'actions') -----
+ pause
+
+ board pause.!

Item was changed:
+ ----- Method: TetrisBlock class>>flipShapes: (in category 'support') -----
- ----- Method: TetrisBlock class>>flipShapes: (in category 'as yet unclassified') -----
  flipShapes: anArray
 
  ^OrderedCollection new
  add: anArray;
  add: (anArray collect: [ :each | each y negated @ each x]);
  add: (anArray collect: [ :each | each x negated @ each y negated]);
  add: (anArray collect: [ :each | each y @ each x negated]);
  yourself
 
  !

Item was changed:
+ ----- Method: TetrisBlock class>>shapeChoices (in category 'constants') -----
- ----- Method: TetrisBlock class>>shapeChoices (in category 'as yet unclassified') -----
  shapeChoices
 
  ^ ShapeChoices ifNil: [
  ShapeChoices := {
  { {  0 @ 0 .  1 @ 0 .  0 @ 1 .  1 @ 1  } }. "square - one is sufficient here"
  self flipShapes: {  0 @  0 . -1 @  0 .  1 @  0 .  0 @ -1  }. "T"
  {
  {  0 @ 0 . -1 @ 0 .  1 @ 0 .  2 @ 0  }.
  {  0 @ 0 .  0 @ -1 .  0 @ 1 .  0 @ 2  } "long - two are sufficient here"
  }.
  self flipShapes: { 0 @ 0 .  0 @ -1 .  0 @  1 .  1 @  1  }. "L"
  self flipShapes: { 0 @ 0 .  0 @ -1 .  0 @  1 . -1 @  1  }. "inverted L"
  self flipShapes: { 0 @ 0 . -1 @  0 .  0 @ -1 .  1 @ -1  }. "S"
  self flipShapes: {  0 @ 0 .  1 @ 0 .  0 @ -1 . -1 @ -1  } "Z"
  }.
  ]
  !

Item was changed:
+ ----- Method: TetrisBoard>>cellSize (in category 'accessing') -----
- ----- Method: TetrisBoard>>cellSize (in category 'as yet unclassified') -----
  cellSize
 
  ^12@12!

Item was changed:
+ ----- Method: TetrisBoard>>originForCell: (in category 'accessing') -----
- ----- Method: TetrisBoard>>originForCell: (in category 'as yet unclassified') -----
  originForCell: aPoint
 
  ^aPoint - (1@1) * self cellSize + self position
 
  !