Skip to content

Latest commit

 

History

History
74 lines (45 loc) · 2.08 KB

README.md

File metadata and controls

74 lines (45 loc) · 2.08 KB

Tutorials for Bloc

License Tests

This repository contains examples of Bloc.

Installation

In Pharo 11, evaluate:

Metacello new
    baseline: 'BlocTutorials';
    repository: 'github://pharo-graphics/Tutorials:dev-1.0/src';
    load

Memory Game Tutorial

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.

Window

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".

Reordering Examples

This example shows how to use drag-and-drop, and it's written using Bloc and Brick.

Reordering Capture

To execute it, evaluate the following code:

BlPaneCreatingReorderingHandler new 
        fittingColumnsExample

Thanks @StephanEggermont for the contribution.

License

This code is licensed under the MIT license.