home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / tolkit45.zip / os2tk45 / samples / open32 / toybox / readme < prev    next >
Text File  |  1999-05-11  |  4KB  |  71 lines

  1. /*****************************************************************************
  2.  *
  3.  * Toybox demonstation program.
  4.  *
  5.  * This is a simple program that demonstrates how to use multiple bitmaps to
  6.  * simulate smooth motion of multiple objects on the client area.
  7.  *
  8.  * The program begins by loading into memory all of the bitmaps that are used
  9.  * by the program and then for each bitmap a DC is created. By creating the
  10.  * DC initially when the bitmaps are loaded, they can be quickly accessed
  11.  * by the BitBlt operation and then displayed onto the output client area.
  12.  *
  13.  * The user can then select several options from the main menu bar, allowing
  14.  * them to add or delete toys (both singly and rapidly to maximum and minimum
  15.  * values), to single step the toys (allowing you to see what is happening)
  16.  * start and stop of the automatic motion, and to get some basic help on the
  17.  * program (the About Box, however, is not just your normal dialog box).
  18.  *
  19.  * As objects are added to the client area, a random type of toy is selected
  20.  * from the six predefined toys, and a random starting frame of animation is
  21.  * selected. By giving each toy a different starting frame, it increases the
  22.  * apparent number of different objects, since they are not all in lock-step
  23.  * animation. The toy is MARKED as new, so initial display of the toy is
  24.  * handled correctly.
  25.  *
  26.  * When an object is deleted, it is only MARKED for deletion, but not actually
  27.  * deleted until all of the balls are drawn.
  28.  *
  29.  * When a frame/animation request is received, a loop is entered for all of the
  30.  * items currently selected. If the current object is a new toy, nothing is
  31.  * initially done, but if it is a normal toy, the object is erased using
  32.  * BitBlt with the SRCINVERT option (this allows objects to overlap each other
  33.  * without you caring about how to fix up the overlaps). Now, if the toy is
  34.  * supposed to move, we compute where/how its moving, do bounds checks (it must
  35.  * stay within the client area) and then compute the new location.
  36.  *
  37.  * Since each toy has a fixed number of animation frames that can be displayed,
  38.  * we must also compute the new frame to display for the toy. It is important
  39.  * to note that the resource file in this program determines how the frames
  40.  * are ordered, so that motion appears fluid when the toys are displayed.
  41.  * If the toy * is not Marked for delete, we BitBlt (using SRVINVERT again)
  42.  * the toy onto the client screen and repeat until all the toys are processed.
  43.  *
  44.  ******************************************************************************
  45.  *
  46.  * If the user selects the Help option and then About, a special client window
  47.  * is created that displays several lines of text about the program, and then
  48.  * displays the six toys along the border of the box in an animated style.
  49.  *
  50.  * The processing of this window is much simpler than the main client, since
  51.  * much less is done. On entry to the window, a timer is (hopefully) created
  52.  * that is used for animation. If the timer create is not successful, the
  53.  * only difference is the toys will not rotate in the help box.
  54.  *
  55.  * The animation routine is much simpler, since we do not need to move the
  56.  * toys nor worry about overlap of the toys (they are at fixed locations).
  57.  * When the timer request is received, the animation routine simply:
  58.  *  1. Erase the old object using PatBlt with the BLACKNESS attribute.
  59.  *  2. Compute the new frame of the toy (don't forget, else no rotation).
  60.  *  3. Display the toy on the screen using BitBlt with the SRCCOPY option.
  61.  *     Since we totally erase the toy every time, and then draw the new
  62.  *     toy on, we only want to see the toys picture, and this is a faster
  63.  *     way than SRVINVERT (which will work the same).
  64.  *
  65.  * This process repeats until the user closes the about box by re-selecting
  66.  * Help and About from the main client area.
  67.  *
  68.  * Copyright (C) 1995 IBM Corporation
  69.  *
  70.  *****************************************************************************/
  71.