| ## Public API Reference

- Main Page
- Classes
- Files

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# iBillboard Struct Reference

A billboard (2D image on screen). More...

`#include <tools/billboard.h>`

List of all members.

## Public Member Functions
virtual void | AddEventHandler (iBillboardEventHandler *evh)=0
| Add an event handler to this billboard.
virtual void | ClearTextBgColor ()=0
| Clear the background color for the text so that the default color will be used instead.
virtual void | ClearTextFgColor ()=0
| Clear the foreground color for the text so that the default color will be used instead.
virtual bool | DrawMesh (const char *material_name, const char *factory, const csVector3 &rotate=csVector3(0, 0, 0), float angle=0.0f, float distance=-1.0f)=0
| Draw a mesh on this billboard.
virtual const csColor & | GetColor () const =0
| Get the color for this billboard (default white).
virtual csFlags & | GetFlags ()=0
| Get flags for this billboard.
virtual void | GetImageSize (int &w, int &h)=0
| Get the size of the image on this billboard in billboard space.
virtual iBillboardLayer * | GetLayer () const =0
| Get the layer that is used by this billboard.
virtual const char * | GetMaterialName ()=0
| Get material name.
virtual const char * | GetName () const =0
| Get the name of this billboard.
virtual void | GetPosition (int &x, int &y) const =0
| Get the position of the top-left corner of this billboard.
virtual void | GetSize (int &w, int &h)=0
| Get the size of this billboard in billboard space.
virtual const char * | GetText () const =0
| Get the text.
virtual const csColor & | GetTextBgColor () const =0
| Get the background color for the text.
virtual const csColor & | GetTextFgColor () const =0
| Get the foreground color for the text.
virtual const char * | GetTextFont () const =0
| Get the font to use for text.
virtual float | GetTextFontSize () const =0
| Get the font size to use for text.
virtual int | GetTextOffsetDX () const =0
| Get the text offset in billboard space.
virtual int | GetTextOffsetDY () const =0
| Get the text offset in billboard space.
virtual const csVector2 & | GetUVBottomRight () const =0
| Get the bottom-right coordinate of the texture (default 1,1).
virtual const csVector2 & | GetUVTopLeft () const =0
| Get the top-left coordinate of the texture (default 0,0).
virtual bool | IsTextBgTransparent () const =0
| Get true if the background color for the text is transparent.
virtual void | Move (int dx, int dy)=0
| Relative move.
virtual void | MoveToPosition (csTicks delta, int x, int y)=0
| During the given time, slowly move the billboard to the given position.
virtual void | RemoveEventHandler (iBillboardEventHandler *evh)=0
| Remove an event handler from this billboard.
virtual void | SetColor (const csColor &c)=0
| Set the color for this billboard (default white).
virtual void | SetLayer (iBillboardLayer *layer)=0
| Set the layer to use for this billboard.
virtual bool | SetMaterialName (const char *matname)=0
| Set material for this billboard.
virtual bool | SetMaterialNameFast (const char *matname)=0
| Set material for this billboard.
virtual void | SetPosition (int x, int y)=0
| Set the position of the top-left corner of this billboard.
virtual void | SetSize (int w, int h)=0
| Set the size of this billboard in pixels.
virtual void | SetText (const char *txt)=0
| Set the text to use for this billboard.
virtual void | SetTextBgColor (const csColor &color)=0
| Set the background color for the text.
virtual void | SetTextBgTransparent ()=0
| Set the background color for the text to transparent.
virtual void | SetTextFgColor (const csColor &color)=0
| Set the foreground color for the text.
virtual bool | SetTextFont (const char *fontname, float fontsize)=0
| Setup the font to use for text.
virtual void | SetTextOffset (int dx, int dy)=0
| Set the text offset in billboard space.
virtual void | SetUVBottomRight (const csVector2 &uv)=0
| Set the bottom-right coordinate of the texture (default 1,1).
virtual void | SetUVTopLeft (const csVector2 &uv)=0
| Set the top-left coordinate of the texture (default 0,0).
virtual void | StackBottom ()=0
| Bring this billboard to the bottom of the stack.
virtual void | StackDown ()=0
| Bring this billboard one closer to the bottom of the stack.
virtual void | StackTop ()=0
| Bring this billboard to the top of the stack (first visible).
virtual void | StackUp ()=0
| Bring this billboard one closer to the top of the stack (first visible).

## Detailed Description

A billboard (2D image on screen).

Billboards work in a coordinate system independent of the size of the screen. This coordinate system basically works on a virtual screen with size 307200 x 307200. These values were chosen because they can fit most other standard resolutions without requiring fractions (i.e. a 1280x1024 screen is exactly 307200/240 x 307200/300). For convenience we call this coordinate system 'billboard space'.

Definition at line 128 of file billboard.h.

## Member Function Documentation

virtual void iBillboard::AddEventHandler | ( | iBillboardEventHandler * | evh | ) | `[pure virtual]`

| Add an event handler to this billboard.

virtual void iBillboard::ClearTextBgColor | ( |  | ) | `[pure virtual]`

| Clear the background color for the text so that the default color will be used instead.

virtual void iBillboard::ClearTextFgColor | ( |  | ) | `[pure virtual]`

| Clear the foreground color for the text so that the default color will be used instead.

virtual bool iBillboard::DrawMesh | ( | const char * | material_name,
|  | const char * | factory,
|  | const csVector3 & | rotate = `csVector3(0, 0, 0)`,
|  | float | angle = `0.0f`,
|  | float | distance = `-1.0f`
| ) | `[pure virtual]`

  | Draw a mesh on this billboard. This mesh will be rendered in the 'showroom' (see the billboard manager). Parameters:
  | material_name | is the name of the material that will be used. If this material already exists then a new one will not be created. If you want to force creation of a new material with the same name then you must first remove the material.
  | factory | is the name of the mesh factory.
  | rotate | is an optional rotation vector.
  | angle | is an optional angle around the rotation vector. If not given then there will be no rotation.
  | distance | is the distance from the mesh where we put our camera. This is optional. If you set this to negative then the mesh will be fit on the billboard as good as is possible.
Returns: false on failure.

virtual const csColor& iBillboard::GetColor | ( |  | ) | const`[pure virtual]`

| Get the color for this billboard (default white).

virtual csFlags& iBillboard::GetFlags | ( |  | ) | `[pure virtual]`

| Get flags for this billboard.

virtual void iBillboard::GetImageSize | ( | int & | w,
|  | int & | h
| ) | `[pure virtual]`

| Get the size of the image on this billboard in billboard space.

virtual iBillboardLayer* iBillboard::GetLayer | ( |  | ) | const`[pure virtual]`

| Get the layer that is used by this billboard.

virtual const char* iBillboard::GetMaterialName | ( |  | ) | `[pure virtual]`

| Get material name.

virtual const char* iBillboard::GetName | ( |  | ) | const`[pure virtual]`

| Get the name of this billboard.

virtual void iBillboard::GetPosition | ( | int & | x,
|  | int & | y
| ) | const`[pure virtual]`

| Get the position of the top-left corner of this billboard. Uses billboard space.

virtual void iBillboard::GetSize | ( | int & | w,
|  | int & | h
| ) | `[pure virtual]`

| Get the size of this billboard in billboard space.

virtual const char* iBillboard::GetText | ( |  | ) | const`[pure virtual]`

| Get the text.

virtual const csColor& iBillboard::GetTextBgColor | ( |  | ) | const`[pure virtual]`

| Get the background color for the text.

virtual const csColor& iBillboard::GetTextFgColor | ( |  | ) | const`[pure virtual]`

| Get the foreground color for the text.

virtual const char* iBillboard::GetTextFont | ( |  | ) | const`[pure virtual]`

| Get the font to use for text.

virtual float iBillboard::GetTextFontSize | ( |  | ) | const`[pure virtual]`

| Get the font size to use for text.

virtual int iBillboard::GetTextOffsetDX | ( |  | ) | const`[pure virtual]`

| Get the text offset in billboard space.

virtual int iBillboard::GetTextOffsetDY | ( |  | ) | const`[pure virtual]`

| Get the text offset in billboard space.

virtual const csVector2& iBillboard::GetUVBottomRight | ( |  | ) | const`[pure virtual]`

| Get the bottom-right coordinate of the texture (default 1,1). Range from 0,0 - 1,1.

virtual const csVector2& iBillboard::GetUVTopLeft | ( |  | ) | const`[pure virtual]`

| Get the top-left coordinate of the texture (default 0,0). Range from 0,0 - 1,1.

virtual bool iBillboard::IsTextBgTransparent | ( |  | ) | const`[pure virtual]`

| Get true if the background color for the text is transparent.

virtual void iBillboard::Move | ( | int | dx,
|  | int | dy
| ) | `[pure virtual]`

| Relative move. Uses billboard space.

virtual void iBillboard::MoveToPosition | ( | csTicks | delta,
|  | int | x,
|  | int | y
| ) | `[pure virtual]`

| During the given time, slowly move the billboard to the given position. If 'delta' is 0 then this function is equivalent to calling SetPosition(). Calling this function while another move is in progress has the effect of clearing that previous move. Uses billboard space.

virtual void iBillboard::RemoveEventHandler | ( | iBillboardEventHandler * | evh | ) | `[pure virtual]`

| Remove an event handler from this billboard.

virtual void iBillboard::SetColor | ( | const csColor & | c | ) | `[pure virtual]`

| Set the color for this billboard (default white).

virtual void iBillboard::SetLayer | ( | iBillboardLayer * | layer | ) | `[pure virtual]`

| Set the layer to use for this billboard.

virtual bool iBillboard::SetMaterialName | ( | const char * | matname | ) | `[pure virtual]`

| Set material for this billboard. Returns false on failure. Important! Make sure that the material uses the <keepimage> flag! The billboard manager depends on this.

virtual bool iBillboard::SetMaterialNameFast | ( | const char * | matname | ) | `[pure virtual]`

| Set material for this billboard. Returns false on failure. This is a faster version which does not recompute the clickmap (unless there is no clickmap yet).

virtual void iBillboard::SetPosition | ( | int | x,
|  | int | y
| ) | `[pure virtual]`

| Set the position of the top-left corner of this billboard. Uses billboard space.

virtual void iBillboard::SetSize | ( | int | w,
|  | int | h
| ) | `[pure virtual]`

| Set the size of this billboard in pixels.

virtual void iBillboard::SetText | ( | const char * | txt | ) | `[pure virtual]`

| Set the text to use for this billboard. Use 'txt' is 0 to clear the text.

virtual void iBillboard::SetTextBgColor | ( | const csColor & | color | ) | `[pure virtual]`

| Set the background color for the text. If not set then the default background color will be used

virtual void iBillboard::SetTextBgTransparent | ( |  | ) | `[pure virtual]`

| Set the background color for the text to transparent. If not set then the default background transparency will be used

virtual void iBillboard::SetTextFgColor | ( | const csColor & | color | ) | `[pure virtual]`

| Set the foreground color for the text. If not set then the default foreground color will be used

virtual bool iBillboard::SetTextFont | ( | const char * | fontname,
|  | float | fontsize
| ) | `[pure virtual]`

| Setup the font to use for text.

virtual void iBillboard::SetTextOffset | ( | int | dx,
|  | int | dy
| ) | `[pure virtual]`

| Set the text offset in billboard space.

virtual void iBillboard::SetUVBottomRight | ( | const csVector2 & | uv | ) | `[pure virtual]`

| Set the bottom-right coordinate of the texture (default 1,1). Range from 0,0 - 1,1.

virtual void iBillboard::SetUVTopLeft | ( | const csVector2 & | uv | ) | `[pure virtual]`

| Set the top-left coordinate of the texture (default 0,0). Range from 0,0 - 1,1.

virtual void iBillboard::StackBottom | ( |  | ) | `[pure virtual]`

| Bring this billboard to the bottom of the stack.

virtual void iBillboard::StackDown | ( |  | ) | `[pure virtual]`

| Bring this billboard one closer to the bottom of the stack.

virtual void iBillboard::StackTop | ( |  | ) | `[pure virtual]`

| Bring this billboard to the top of the stack (first visible).

virtual void iBillboard::StackUp | ( |  | ) | `[pure virtual]`

| Bring this billboard one closer to the top of the stack (first visible).

The documentation for this struct was generated from the following file:

- tools/billboard.h