displaying a grid of images
Robert Withers
reefedjib at yahoo.com
Wed Jan 3 04:29:00 UTC 2007
Ok, I found a way to do this. First I WarpBlt one of the source
images into a tempForm appropriately sized as a portion of the
Window. Then I BitBlt that tempForm to the appropriate place within
a Form the size of the window. I'll need to identify which grid a
mouse click lands. I also need to scroll the window. I'll explain.
I am trying to build a strategy game along the lines of StarCraft or
Civilization (I have not yet decided if it is to be a realtime or
turn-based game). The view will have a small map of the entire world
and a viewer window showing a large view of a smaller portion of the
map. Now, StarCraft ad Civ are full screen games, so they own the
mouse (the mouse never leaves the game). Currently I am shooting for
a SystemWindow that is maximized in Squeak, like if you hit the
expand button. I was hoping to capture the mouse inside of this
window and then detect when it is against one of the edges of the
window to start scrolling the viewer. Is this possible?
thanks,
Robert
On Jan 2, 2007, at 3:04 PM, Robert Withers wrote:
> Can anyone demonstrate how I could display a grid of images within
> a SystemWindow? For example, I have a 5 by 5 grid and each grid
> would display a scaled Form. I tried adding a morph for each cell
> and I ran into a couple of problems. First, as I increase the size
> of the grid, window creation takes longer and longer due to the
> processing of Splitters, it looks like. I don't need those I don't
> believe. Secondly, given this drawOn: method:
>
> drawOn: aCanvas
>
> | src dest |
> src := self form.
> dest := Form extent: self extent depth: aCanvas form depth.
> src displayScaledOn: dest.
> aCanvas drawImage: dest at: bounds origin.
>
> For each use in the grid of a particular form (I am reusing the
> source forms of which there are 7 currently) it would get
> progressively magnified. It is like the #displayScaledOn: is
> affecting the src form.
>
> I think I need to blt each grid form into a window sized form and
> build my own grid image then draw it to the canvas. Does that
> sound like the right approach? Does anyone have some example code
> of this kind of thing? I will also be needing to identify where
> mouse clicks are happening within this image and take some action.
>
> thanks fr any help,
> Robert
>
More information about the Squeak-dev
mailing list
|