Skip to content

I contain the code that results from tutorials on Bloc.

License

Notifications You must be signed in to change notification settings

RalfBarkow/Tutorials

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tutorials for Bloc and Brick

License Test

This repository contains examples of Bloc and Brick.

Installation

In Pharo 9 or 10, evaluate:

Metacello new
    baseline: 'BlocBrickTutorials';
    repository: 'github://pharo-graphics/Tutorials/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

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:

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.

License

This code is licensed under the MIT license.

About

I contain the code that results from tutorials on Bloc.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Smalltalk 100.0%