Graphics Help Please!!

RH>I need the help of the graphics guru's in the group. I have been trying
RH>to write the simplest screen saver. I have found a freeware example and
RH>am using that as my guide. I have looked in the help, and all my
RH>reference books, but it's still stumping me.

RH>All I'm trying to do is load a bitmap, and bounce it around the screen,
RH>when it hits the side, have it change direction. Please send any hints,
RH>tips, or code fragment, if you can.

I'm not giving any functional code, but pseudo-code:

    XPos,YPos       : Integer;  {bitmap current pos}
    OldXPos,OldYPos : Integer;  {bitmap previous pos}
    XDir,YDir       : Integer;  {current direction}


  <load bitmap>
  XPos := 0; YPos := 0;
  OldXPos := XPos; OldYPos := YPos;
  XDir := 1; YDir := 1;

  {OnTimer event}

  <remove bitmap from (OldXPos,OldYPos)>
  <draw bitmap to (XPos,YPos)>
  OldXPos := XPos; OldYPos := YPos; {save old position}
  XPos := XPos+XDir; {move}
  YPos := YPos+YDir;

  {check border collisions and change directions}
  If (XPos <= 0) Then XDir := -XDir;
  If (YPos <= 0) Then YDir := -YDir;
  If (XPos >= <ScreenXRes>) Then XDir := -XDir;
  If (YPos >= <ScreenYRes>) Then YDir := -YDir;


That's basically what you need to do. Pseudo-code is in angle
brackets. The most thoughest task displaying and erasing the bitmap
without flicker, but I'm sure you can manage.

Also, you could add almost anything to the code you want ie.
palette fading, transparency, sound, whatever. Happy programming!



Jani Jarvinen, Helsinki Finland

Check out Help Editor 2.0 for Windows at:

1996: Only four years to computer confusion!
What have you done to avoid it?
 * SLMR 2.1a *