Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

pharo-graphics/Tutorials

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

157 Commits

Repository files navigation

Tutorials for Bloc

License Tests

This repository contains examples of Bloc.

Installation

In Pharo, evaluate:

Metacello new
 baseline: 'BlocTutorials';
 repository: 'github://pharo-graphics/Tutorials:master/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 root addChild: aGameElement.
"Resize the space to the extent of the game board for the first time (this is known when the layout is applied)"
space root whenLayoutedDoOnce: [ space extent: aGameElement size ].
"Show the window"
space show.

By default, a OS "external" window will popup. It is also possible to popup a Morphic window. To do it, open "System Settings > Appearance > Bloc" and select "SDL2" in "Preferable Host".

Reordering Examples

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

To execute it, evaluate the following code:

BlPaneCreatingReorderingHandler new fittingColumnsExample

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.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Contributors 8

AltStyle によって変換されたページ (->オリジナル) /