[squeak-dev] The Inbox: EToys-kfr.487.mcz

karl ramberg karlramberg at gmail.com
Sun Dec 18 19:34:10 UTC 2022


Yes, the fallback for StrikeFonts was not great here.
Not sure how to fix it

Best,
Karl


On Sun, Dec 18, 2022 at 8:26 PM <christoph.thiede at student.hpi.uni-potsdam.de>
wrote:

> Hi Karl,
>
> On 2022-12-14T15:54:17+00:00, commits at source.squeak.org wrote:
>
> > A new version of EToys was added to project The Inbox:
> > http://source.squeak.org/inbox/EToys-kfr.487.mcz
> >
> > ==================== Summary ====================
> >
> > Name: EToys-kfr.487
> > Author: kfr
> > Time: 14 December 2022, 4:52:54.725958 pm
> > UUID: 9e4ab847-85fd-dc47-a79a-e6f6388e33e2
> > Ancestors: EToys-ct.486
> >
> > MineGame scale to HD Display
> >
> > =============== Diff against EToys-ct.486 ===============
> >
> > Item was changed:
> > ----- Method: Mines>>defaultBorderWidth (in category 'initialization')
> -----
> > defaultBorderWidth
> >     "answer the default border width for the receiver"
> > +     ^ 2 px!
> > -     ^ 2!
> >
> > Item was changed:
> > ----- Method: Mines>>initialize (in category 'initialization') -----
> > initialize
> >     "initialize the state of the receiver"
> >
> >     super initialize.
> >
> > level := 1.
> >     self listDirection: #topToBottom;
> >      wrapCentering: #center;
> >          cellPositioning: #topCenter;
> >      vResizing: #shrinkWrap;
> >      hResizing: #shrinkWrap;
> > +      layoutInset: 3 px;
> > -      layoutInset: 3;
> >      addMorph: self makeControls;
> >      addMorph: self board.
> >     helpText := nil.
> >
> >     self newGame!
> >
> > Item was changed:
> > ----- Method: Mines>>makeControls (in category 'initialize') -----
> > makeControls
> >     | row |
> >     row := AlignmentMorph newRow color: color;
> > +                  borderWidth: 2 px;
> > +                  layoutInset: 3 px.
> > -                  borderWidth: 2;
> > -                  layoutInset: 3.
> >     row borderStyle: BorderStyle inset.
> >     row hResizing: #spaceFill;
> >          vResizing: #shrinkWrap;
> >          wrapCentering: #center;
> >          cellPositioning: #leftCenter;
> > +          extent: 5 px @ 5 px.
> > -          extent: 5 @ 5.
> >     row
> >         addMorph: (self
> >                 buildButton: SimpleSwitchMorph new
> >                 target: self
> >                 label: ' Help ' translated
> >                 selector: #help:).
> >     row
> >         addMorph: (self
> >                 buildButton: (levelButton := SimpleButtonMorph new)
> >                 target: self
> >                 label: level asString translated
> >                 selector: #nextLevel).
> >     row
> >         addMorph: (self
> >                 buildButton: SimpleButtonMorph new
> >                 target: self
> >                 label: ' Quit ' translated
> >                 selector: #delete).
> >     "row
> >     addMorph: (self
> >     buildButton: SimpleButtonMorph new
> >     target: self
> >     label: ' Hint ' translated
> >     selector: #hint)."
> >     row
> >         addMorph: (self
> >                 buildButton: SimpleButtonMorph new
> >                 target: self
> >                 label: ' New game ' translated
> >                 selector: #newGame).
> >     minesDisplay := LedMorph new digits: 2;
> > +                  extent: 2 * 10 px @ 15 px.
> > -                  extent: 2 * 10 @ 15.
> >     row
> >         addMorph: (self wrapPanel: minesDisplay label: 'Mines:'
> translated).
> > +     timeDisplay := LedTimerMorph new digits: 3; extent: 3 * 10 px @ 15
> px.
> > -     timeDisplay := LedTimerMorph new digits: 3; extent: 3 * 10 @ 15.
> >
> >     row
> >         addMorph: (self wrapPanel: timeDisplay label: 'Time:'
> translated).
> > +     hiScoreDisplay := LedMorph new digits: 3; extent: 3 * 10 px@ 15
> px.
> > -     hiScoreDisplay := LedMorph new digits: 3; extent: 3 * 10 @ 15.
> >     row
> >         addMorph: (self wrapPanel: hiScoreDisplay label: 'Hi Score:'
> translated).
> >     ^ row!
> >
> > Item was changed:
> > ----- Method: Mines>>wrapPanel:label: (in category 'initialize') -----
> > wrapPanel: anLedPanel label: aLabel
> >     "wrap an LED panel in an alignmentMorph with a label to its left"
> >
> >     | a |
> >     a := AlignmentMorph newRow
> >         wrapCentering: #center; cellPositioning: #leftCenter;
> >         hResizing: #shrinkWrap;
> >         vResizing: #shrinkWrap;
> >         borderWidth: 0;
> > +         layoutInset: 3 px;
> > -         layoutInset: 3;
> >         color: color lighter.
> >     a addMorph: anLedPanel.
> >     a addMorph: (StringMorph contents: aLabel).
> >     ^ a
> > !
> >
> > Item was changed:
> > ----- Method: MinesBoard>>defaultBorderWidth (in category
> 'initialization') -----
> > defaultBorderWidth
> >     "answer the default border width for the receiver"
> > +     ^ 2 px!
> > -     ^ 2!
> >
> > Item was changed:
> > ----- Method: MinesTile>>drawOn: (in category 'drawing') -----
> > 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 |
> >     super drawOn: aCanvas.
> >
> >     self borderStyle style == #inset ifTrue: [
> >         self isMine ifTrue: [
> > +             font := StrikeFont familyName: 'Atlanta' size: 22 px
> emphasized: 1.
> > +             rct := self bounds insetBy: ((self bounds width) - (font
> widthOfString: '*'))/2 @0.
> > -             font := StrikeFont familyName: 'Atlanta' size: 22
> emphasized: 1.
> > -             rct := self bounds insetBy: ((self bounds width) - (font
> widthOfString: '*'))/2 at 0.
> >             rct := rct top: rct top + 1.
> >             aCanvas drawString: '*' in: (rct translateBy: 1 at 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 px
> emphasized: 1.
> > +             rct := self bounds insetBy: ((self bounds width) - (font
> widthOfString: nearMines asString))/2 @0.
> > -             font := StrikeFont familyName: 'ComicBold' size: 22
> emphasized: 1.
> > -             rct := self bounds insetBy: ((self bounds width) - (font
> widthOfString: nearMines asString))/2 at 0.
> >             rct := rct top: rct top + 1.
> >             aCanvas drawString: nearMines asString in: (rct translateBy:
> 1 at 1) font: font color: Color black.
> >             ^ aCanvas drawString: nearMines asString in: rct font: font
> color: ((palette at: nearMines) ) .]].!
>
> not sure whether the use of fontSize + #px is idiomatic. Maybe Marcel can
> help with that?
>
> Otherwise, LGTM. Thanks! :-)
>
> Best,
> Christoph
>
> >
> > Item was changed:
> > ----- Method: MinesTile>>initialize (in category 'initialization') -----
> > initialize
> >
> >     super initialize.
> >     self label: ''.
> > +     self borderWidth: 3 px.
> > +     bounds := 0 at 0 corner: 20 px at 20 px.
> > -     self borderWidth: 3.
> > -     bounds := 0 at 0 corner: 20 at 20.
> >     offColor := self preferredColor.
> >     onColor := self preferredColor.
> >     switchState := false.
> >     oldSwitchState := false.
> >     disabled := false.
> >     isMine := false.
> >     nearMines := 0.
> >     self useSquareCorners.
> >     palette := (Color wheel: 8) asOrderedCollection reverse.
> > "    flashColor := palette removeLast."
> > !
> >
> >
>
>
> ---
> *Sent from **Squeak Inbox Talk
> <https://github.com/hpi-swa-lab/squeak-inbox-talk>*
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20221218/201a8c04/attachment.html>


More information about the Squeak-dev mailing list