src/Graphics/MessageView.hh
author Tero Marttila <terom@fixme.fi>
Wed, 21 Jan 2009 03:33:35 +0200
branchnew_graphics
changeset 411 106aaf6eadfe
parent 394 src/GameMessageView.hh@82def222fe7d
child 412 721c60072091
permissions -rw-r--r--
there's a grain of truth in the new graphics code now...
#ifndef GRAPHICS_MESSAGE_VIEW_HH
#define GRAPHICS_MESSAGE_VIEW_HH

#include "View.hh"

#include <ClanLib/display.h>
#include <string>
#include <vector>

namespace graphics
{

/**
 * Offset between consecutive lines
 */
const PixelDimension MESSAGE_VIEW_LINE_OFFSET = 5;

struct Message {
    CL_Color color;
    std::string message;

    Message (CL_Color color, std::string message) : color(color), message(message) { }
};

class MessageView : public View {
protected:
    std::vector<Message> messages;

public:
    /**
     * Define the area where messages are drawn
     */
    MessageView (const PixelArea &area);

    /**
     * Add a message to the list of messages displayed
     */
    void add_message (CL_Color color, std::string message);
    
    /**
     * Draw as many messages as fits
     */
    virtual void draw (Display *display);
};

}

#endif