wow if you turn it upside down it reads "written in C" ;D Definetly not ideal example code for beginners , but I am grateful someone actually bothered writing that code so I and other newcomers learn a bit more about Morphic. On Sun, Feb 8, 2015 at 7:56 PM, stepharo <stepharo@free.fr> wrote:
why I think that such games should be rewritten: crying for a subclass :)
drawOn: aCanvas "Draw a rectangle with a solid, inset, or raised border. Note: the raised border color *and* the inset border color are generated from the receiver's own color, instead of having the inset border color generated from the owner's color, as in BorderedMorph."
| font rct |
borderWidth = 0 ifTrue: [ "no border" aCanvas fillRectangle: bounds color: color. ^ self.].
borderColor == #raised ifTrue: [ ^ aCanvas frameAndFillRectangle: bounds fillColor: color borderWidth: borderWidth topLeftColor: color lighter lighter bottomRightColor: color darker darker darker].
borderColor == #inset ifTrue: [ aCanvas frameAndFillRectangle: bounds fillColor: color borderWidth: 1 " borderWidth" topLeftColor: (color darker darker darker) bottomRightColor: color lighter. self isMine ifTrue: [ font := StrikeFont familyName: 'Atlanta' size: 22 emphasized: 1. rct := bounds insetBy: ((bounds width) - (font widthOfString: '*'))/2@0. rct := rct top: rct top + 1. aCanvas drawString: '*' in: (rct translateBy: 1@1) font: font color: Color black. ^ aCanvas drawString: '*' in: rct font: font color: Color red .]. self nearMines > 0 ifTrue: [ font := StrikeFont familyName: 'ComicBold' size: 22 emphasized: 1. rct := bounds insetBy: ((bounds width) - (font widthOfString: nearMines asString))/2@0. rct := rct top: rct top + 1. aCanvas drawString: nearMines asString in: (rct translateBy: 1@1) font: font color: Color black. ^ aCanvas drawString: nearMines asString in: rct font: font color: ((palette at: nearMines) ) .]. ^self. ].
"solid color border" aCanvas frameAndFillRectangle: bounds fillColor: color borderWidth: borderWidth borderColor: borderColor.
Le 8/2/15 17:39, kilon alios a écrit :
Thank you Stef, its great to have some games for Pharo :)
Some issues
1) I cannot find ChineseChekers in conf browser 2) None of the 3 games comes with an easy way to open them. I had to use $GameName$ new openInWindow. 3) Tetris is giving me a MNU apparently it does not find the LedMorph class it needs. 4) Miners was displaying some weird artefacts when I hit a mine. They dont go away when I hit new game.
On Sun, Feb 8, 2015 at 2:27 PM, olivier auverlot < olivier.auverlot@gmail.com> wrote:
very cool !
2015-02-08 12:05 GMT+01:00 Ignacio Sniechowski <0800nacho@gmail.com>:
Stef, Thanks so much! I love this because its fun to analyze the code and learn from it. Best Nacho
*Lic. Ignacio Sniechowski, MBA* *Prosavic SRL*
*Tel: (011) 4542-6714*
On Sun, Feb 8, 2015 at 6:28 AM, stepharo <stepharo@free.fr> wrote:
Hi guys
It was for so long on my todo list that I decided to start addressing it. I publish games that were defined long time ago in Squeak. - Tetris - Miners - SameGame - ChineseCheckers
There are now available via the metarepository configuration browser I will continue to publish some others.
Stef