Show oversprite.h syntax highlighted
/***************************************************************************
oversprite.h
-------------------
begin : Sun Dec 5 2004
copyright : (C) 2004 by Brendon Lloyd Higgins
email : bh_doc@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* 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. *
* *
***************************************************************************/
#ifndef OVERSPRITE_H_INCLUDED
#define OVERSPRITE_H_INCLUDED
#include <ClanLib/display.h>
/**
* This class acts like a CL_Sprite, but draws two images on top of each
* other, one as a background, the other as a coloured foreground. For those
* functions that are implemented this class has the same contract as
* a CL_Sprite.
*/
class OverSprite {
private:
/**
* The background sprite.
*/
CL_Sprite back;
/**
* The foreground sprite.
*/
CL_Sprite over;
public:
/**
* Constructor.
* \param resource_id The name of the resource. Two sprites make up this
* overlay such that this parameter identifies the section in which a
* "back" sprite and a "over" sprite exist.
* \param manager The resource manager.
* \param colour The colour of the front sprite.
*/
OverSprite(const std::string& resource_id, CL_ResourceManager* manager,
const CL_Color& colour = CL_Color::white);
/**
* Copy constructor.
* \param sprite The OverSprite to copy.
*/
OverSprite(const OverSprite& sprite);
/**
* Copy constructor.
* \param sprite The OverSprite to copy.
* \param colour The colour of the overlay.
*/
OverSprite(const OverSprite& sprite, const CL_Color& colour);
/**
* Set the foreground colour.
*/
void set_color(const CL_Color& c);
/**
* Draw it.
*/
void draw(int x, int y, CL_GraphicContext* gc = 0);
/**
* Update it.
*/
float update(float time_elapsed = 0);
};
#endif /* ndef OVERSPRITE_H_INCLUDED */
See more files for this project here