Code Search for Developers
 
 
  

paintable.h from FreePop at Krugle


Show paintable.h syntax highlighted

/***************************************************************************
                           paintable.h
                           -------------------
    begin                : Mon Jan 10 2005
    copyright            : (C) 2005 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 PAINTABLE_H_INCLUDED
#define PAINTABLE_H_INCLUDED

#include <worldpos.h>

class WorldClient;
class Rotation;

/**
 * An interface for something that can be drawn by the client.
 * \note This was called Drawable, but that conflicted with an X11 typedef.
 */
class Paintable {
public:
    /**
     * Constructor.
     */
    Paintable();

    /**
     * Destructor.
     */
    virtual ~Paintable();

    /**
     * Update animation etc variables. Default is no-op.
     * \param w The world in which we live.
     * \param d The delay since the previous update in ms.
     * \return If the object should be deleted return false, else return true.
     * Regular entities should always return true. Only non-entity paintables
     * should ever return false to be removed from the client's list.
     * \warning Don't return false if remove is true.
     */
    virtual bool drawUpdate(const WorldClient* w, unsigned int d);

    /**
     * Perform the draw.
     */
    virtual void draw(const WorldClient* w) const = 0;

    /**
     * Get the sort index for drawing. Lower numbers are drawn first.
     */
    virtual int drawSortIndex(const WorldClient* w) const = 0;
    
    /**
     * This gets called when a player changes their designation colour.
     * You should override this when your paintable uses the player's colour.
     * \note It might be another player who's colour has changed.
     */
    virtual void playerColourChange(WorldClient* w);

    /**
     * This gets called when the display rotation changes. Default is to
     * ignore it.
     * \param w The world.
     * \param r The new display rotation.
     */
    virtual void displayRotationChange(WorldClient* w, const Rotation& r);
};

#endif /* ndef DRAWABLE_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