/***************************************************************************
backgnd.h - description
-------------------
begin : Wed Jul 18 2001
copyright : (C) 2001 by Gaël de Chalendar
email : Gael.de.Chalendar@libertysurf.fr
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#define KDE_NO_COMPAT
#ifndef BACKGND_H
#define BACKGND_H
#include "decoratedgameframe.h"
class DecoratedGameFrame;
/**
* BackGnd is the sprite used to display the background map image
* Using a sprite allow to move it quickly on the fixed canvas. As for
* AnimSprite, the individual images are taken from a Graphics Pool storing
* all images of the game. In the same time, the graphics pool is the canvas
* where all sprites (background and animated) are stored. It is viewed by
* the frame (a DecoratedGameFrame, a kind of CanvasView).
*
* The background can be scrolled in the four directions with specialized
* methods
*/
class BackGnd : public QCanvasSprite
{
public:
enum TDir {state, right, left, up, down, N, S, E, O, NO, SO, SE, NE};
/**
* The QCanvas is the canvas where all the sprites are set up.
* aFrame is the view used to display the background.
*/
BackGnd(QCanvas *canvas, DecoratedGameFrame *aFrame);
~BackGnd();
/**
* These four scroll methods allow to easilly scroll the background on its
* canvas in a simple and transparent manner
*/
void scrollUp(const int step = DefaultScrollStep);
void scrollDown(const int step = DefaultScrollStep);
void scrollLeft(const int step = DefaultScrollStep);
void scrollRight(const int step = DefaultScrollStep);
private:
/**
* This static member allow to simplify the call to scroll functions
*/
static int DefaultScrollStep;
/**
* The frame is the view on which the background and the animated sprites
* are painted.
*/
DecoratedGameFrame *frame;
/**
* The scroll method is used by the scrollX public methods to call the
* native scrollBy methods in the good direction. Its arguments are a
* named direction and a number of pixels step
*/
void scroll(TDir dir, int step);
};
#endif // BACKGND_H
| Generated by: gael on noirdes.limsi.u-psud.fr on Fri Jan 3 17:03:38 2003, using kdoc 2.0a53. |