This repository contains examples of Bloc and Brick.
In Pharo 9 or 10, evaluate:
Metacello new
baseline: 'BlocBrickTutorials';
repository: 'github://pharo-graphics/Tutorials/src';
load
This is a Memory Card game.
Please, find the code at the Bloc-Memory
package.
The present code is the result of following the Bloc tutorial in this booklet, with some little name adaptations. The source code for such booklet can be found here.
To start it, evaluate this code:
"Create the game model and the Bloc element."
aGameElement := MGGameElement new
memoryGame: MGGame withNumbers;
yourself.
"The space represents the window"
space := BlSpace new.
space addChild: aGameElement.
"Calculate the extent of the game board for the first time, to set it to the window."
space pulse.
space extent: aGameElement extent.
"Show the window"
space show.
By default, a Morphic window will popup. It is also possible to open a OS "external" window. To do it, open "System Settings > Appearance > Bloc" and select "OSWindow - SDL2" in "Preferable Host".
This example shows how to use drag-and-drop, and it's written using Bloc and Brick.
To execute it, evaluate the following code:
pane := DTPaneCreatingReorderingHandler new
fittingColumns
constraintsDo: [ :c |
c horizontal matchParent.
c vertical matchParent ];
yourself.
space := BlSpace new extent: 800@600.
space root addChild: pane.
space show.
Thanks @StephanEggermont for the contribution.
This code is licensed under the MIT license.