Section 2

Rendering The Cells

What do we want these new renderer classes to do? We'll begin with the blank cell. If we supply a grid for our cell and a target form, we can draw the basics of our blank cell.

When it comes to graphics and user interfaces, my own style of work is to get something visual quickly and then explore what is right and what doesn't work directly by changing the code. Squeak is an excellent environment for trying out graphics ideas as we will see. It's normal during this activity to throw code away as we learn.

Open up a new workspace and use it for experimenting with our new graphics. We know we will need a grid and a form to draw on. Fortunately the default grid is full of blank cells so we can begin by drawing those, without too much effort.

Choose an arbitrary cell location from the grid and get the renderer we will use.

If we send the #render message to our rendering object we want it to draw onto the target form. Of course we have not implemented this yet. We'll tell Squeak to display the form at a location near the upper left corner of our World. Move the Workspace window down about half way so we can draw without disturbing our workspace contents.

Of course we cannot execute this workspace code yet. Let's write the #render method.

Index Page Next Page

Copyright © 2007, 2008, 2009, 2010 Stephan B Wessels