Previous Topic Tutorial Home Page Next Topic
Construct the Cycling Image for the Puzzle


Create a unit-sized image to divide up into the puzzle. The image cycles through four images upon toggleImage events.
ImageBvr createUnitImageForPuzzle() {

Create the different images that will be used in the puzzle:

time-varying solid-colored image for background
ImageBvr bkgnd = createBackgroundColorCycler();

image of time-varying elapsed time in seconds
ImageBvr counterImg = createCounterImage();

first possible image for puzzle, time over colored background
ImageBvr unitIm1 = overlay(counterImg, bkgnd);

second possibility, based on rendered geometry
ImageBvr unitIm2 = createGeoImage();

third possibility, based in imported video
ImageBvr unitIm3 = createMovieImage();

forth possibility, time in second over the video
ImageBvr unitIm4 = overlay(counterImg, unitIm3);

Have these image behaviors run just once, so that they don't get restarted when events happen.
unitIm1 = (ImageBvr)unitIm1.runOnce();
unitIm2 = (ImageBvr)unitIm2.runOnce();
unitIm3 = (ImageBvr)unitIm3.runOnce();
unitIm4 = (ImageBvr)unitIm4.runOnce();

Cycle between the four images on occurence of this app event.
ImageBvr imageToShow = ImageBvr.newUninitBvr();
_toggleImageUsed = new AppTriggeredEvent();
imageToShow.init( until(unitIm1,
_toggleImageUsed, until(unitIm2,
_toggleImageUsed, until(unitIm3,
_toggleImageUsed, until(unitIm4,
_toggleImageUsed, imageToShow)))));
return imageToShow;
}


© 1998 Microsoft Corporation. All rights reserved. Terms of Use.

Previous Topic Tutorial Home Page Next Topic