Code Search for Developers
 
 
  

oversprite.h from FreePop at Krugle


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

FreePop

FreePop is a multi-platform tile-based game based on the great old game Populous 2 by Bullfrog Productions Ltd., but much improved.

Project homepage: http://sourceforge.net/projects/freepop
Programming language(s): C++
License: other

  Makefile.am
  client.cpp
  client.h
  clientmisc.cpp
  clientmisc.h
  clientstate.cpp
  clientstate.h
  connectstate.cpp
  connectstate.h
  cropsclient.cpp
  cropsclient.h
  entityclient.cpp
  entityclient.h
  entityclientfactory.cpp
  entityclientfactory.h
  firecolumnclient.cpp
  firecolumnclient.h
  gamestate.cpp
  gamestate.h
  loadstate.cpp
  loadstate.h
  mapclient.cpp
  mapclient.h
  maptileclient.cpp
  maptileclient.h
  messagebox.cpp
  messagebox.h
  oversprite.cpp
  oversprite.h
  paintable.cpp
  paintable.h
  pausefader.cpp
  pausefader.h
  peepclient.cpp
  peepclient.h
  peepmagnetclient.cpp
  peepmagnetclient.h
  playerclient.cpp
  playerclient.h
  playeroptionsdialog.cpp
  playeroptionsdialog.h
  rockclient.cpp
  rockclient.h
  swampclient.cpp
  swampclient.h
  townclient.cpp
  townclient.h
  treeclient.cpp
  treeclient.h
  worldclient.cpp
  worldclient.h