## Public API Reference

- Main Page
- Classes
- Files

# tools/billboard.h

    00001 /*
    00002     Crystal Space Entity Layer
    00003     Copyright (C) 2003 by Jorrit Tyberghein
    00004
    00005     This library is free software; you can redistribute it and/or
    00006     modify it under the terms of the GNU Library General Public
    00007     License as published by the Free Software Foundation; either
    00008     version 2 of the License, or (at your option) any later version.
    00009
    00010     This library is distributed in the hope that it will be useful,
    00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
    00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00013     Library General Public License for more details.
    00014
    00015     You should have received a copy of the GNU Library General Public
    00016     License along with this library; if not, write to the Free
    00017     Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
    00018 */
    00019
    00020 #ifndef __CEL_MGR_BILLBOARD__
    00021 #define __CEL_MGR_BILLBOARD__
    00022
    00023 #include "cstypes.h"
    00024 #include "csutil/scf.h"
    00025 #include "csutil/flags.h"
    00026
    00027 struct iImage;
    00028 struct iBillboard;
    00029 class csColor;
    00030 class csVector2;
    00031
    00032 SCF_VERSION (iBillboardLayer, 0, 0, 1);
    00033
    00038 struct iBillboardLayer : public iBase
    00039 {
    00043   virtual void GetOffset (int& x, int& y) const = 0;
    00044
    00048   virtual void SetOffset (int x, int y) = 0;
    00049
    00053   virtual void Move (int dx, int dy) = 0;
    00054
    00058   virtual const char* GetName () const = 0;
    00059 };
    00060
    00067 struct iBillboardEventHandler : public virtual iBase
    00068 {
    00069   SCF_INTERFACE (iBillboardEventHandler, 0, 0, 1);
    00070
    00074   virtual void Select (iBillboard* billboard, int mouse_button,
    00075         int mousex, int mousey) = 0;
    00076
    00080   virtual void MouseMove (iBillboard* billboard, int mouse_button,
    00081         int mousex, int mousey) = 0;
    00082
    00086   virtual void Unselect (iBillboard* billboard, int mouse_button,
    00087         int mousex, int mousey) = 0;
    00088
    00092   virtual void DoubleClick (iBillboard* billboard, int mouse_button,
    00093         int mousex, int mousey) = 0;
    00094 };
    00095
    00096
    00100 #define CEL_BILLBOARD_VISIBLE 1
    00101
    00104 #define CEL_BILLBOARD_MOVABLE 2
    00105
    00109 #define CEL_BILLBOARD_CLICKABLE 4
    00110
    00114 #define CEL_BILLBOARD_RESTACK 8
    00115
    00116 SCF_VERSION (iBillboard, 0, 0, 1);
    00117
    00127 struct iBillboard : public iBase
    00128 {
    00132   virtual const char* GetName () const = 0;
    00133
    00137   virtual csFlags& GetFlags () = 0;
    00138
    00142   virtual bool SetMaterialName (const char* matname) = 0;
    00143
    00149   virtual bool SetMaterialNameFast (const char* matname) = 0;
    00150
    00154   virtual const char* GetMaterialName () = 0;
    00155
    00159   virtual void SetSize (int w, int h) = 0;
    00160
    00164   virtual void GetSize (int& w, int& h) = 0;
    00165
    00169   virtual void GetImageSize (int& w, int& h) = 0;
    00170
    00175   virtual void SetPosition (int x, int y) = 0;
    00176
    00185   virtual void MoveToPosition (csTicks delta, int x, int y) = 0;
    00186
    00191   virtual void GetPosition (int& x, int& y) const = 0;
    00192
    00197   virtual void Move (int dx, int dy) = 0;
    00198
    00202   virtual void StackTop () = 0;
    00203
    00207   virtual void StackBottom () = 0;
    00208
    00212   virtual void StackUp () = 0;
    00213
    00217   virtual void StackDown () = 0;
    00218
    00223   virtual void SetUVTopLeft (const csVector2& uv) = 0;
    00224
    00229   virtual const csVector2& GetUVTopLeft () const = 0;
    00230
    00235   virtual void SetUVBottomRight (const csVector2& uv) = 0;
    00236
    00241   virtual const csVector2& GetUVBottomRight () const = 0;
    00242
    00246   virtual void SetColor (const csColor& c) = 0;
    00247
    00251   virtual const csColor& GetColor () const = 0;
    00252
    00256   virtual void SetLayer (iBillboardLayer* layer) = 0;
    00257
    00261   virtual iBillboardLayer* GetLayer () const = 0;
    00262
    00266   virtual void AddEventHandler (iBillboardEventHandler* evh) = 0;
    00267
    00271   virtual void RemoveEventHandler (iBillboardEventHandler* evh) = 0;
    00272
    00277   virtual void SetText (const char* txt) = 0;
    00278
    00282   virtual const char* GetText () const = 0;
    00283
    00287   virtual void SetTextOffset (int dx, int dy) = 0;
    00288
    00292   virtual bool SetTextFont (const char* fontname, float fontsize) = 0;
    00293
    00298   virtual void SetTextFgColor (const csColor& color) = 0;
    00299
    00304   virtual void ClearTextFgColor () = 0;
    00305
    00310   virtual void SetTextBgColor (const csColor& color) = 0;
    00311
    00316   virtual void SetTextBgTransparent () = 0;
    00317
    00322   virtual void ClearTextBgColor () = 0;
    00323 };
    00324
    00325 SCF_VERSION (iBillboardManager, 0, 0, 1);
    00326
    00331 struct iBillboardManager : public iBase
    00332 {
    00336   virtual int ScreenToBillboardX (int x) const = 0;
    00337
    00341   virtual int ScreenToBillboardY (int y) const = 0;
    00342
    00346   virtual int BillboardToScreenX (int x) const = 0;
    00347
    00351   virtual int BillboardToScreenY (int y) const = 0;
    00352
    00357   virtual iBillboard* CreateBillboard (const char* name) = 0;
    00358
    00362   virtual iBillboard* FindBillboard (const char* name) const = 0;
    00363
    00367   virtual void RemoveBillboard (iBillboard* billboard) = 0;
    00368
    00372   virtual size_t GetBillboardCount () const = 0;
    00373
    00377   virtual iBillboard* GetBillboard (size_t idx) const = 0;
    00378
    00384   virtual iBillboardLayer* CreateBillboardLayer (const char* name) = 0;
    00385
    00389   virtual iBillboardLayer* FindBillboardLayer (const char* name) const = 0;
    00390
    00396   virtual void RemoveBillboardLayer (iBillboardLayer* layer) = 0;
    00397
    00401   virtual size_t GetBillboardLayerCount () const = 0;
    00402
    00406   virtual iBillboardLayer* GetBillboardLayer (size_t idx) const = 0;
    00407
    00411   virtual void RemoveAll () = 0;
    00412
    00416   virtual void SetFlags (uint32 flags, uint32 mask) = 0;
    00417
    00421   virtual void StackTop (iBillboard* bb) = 0;
    00422
    00426   virtual void StackBottom (iBillboard* bb) = 0;
    00427
    00431   virtual void StackUp (iBillboard* bb) = 0;
    00432
    00436   virtual void StackDown (iBillboard* bb) = 0;
    00437
    00441   virtual void StackBefore (iBillboard* bb, iBillboard* other) = 0;
    00442
    00446   virtual void StackAfter (iBillboard* bb, iBillboard* other) = 0;
    00447
    00452   virtual bool TestCollision (iBillboard* bb1, iBillboard* bb2) = 0;
    00453
    00457   virtual bool SetDefaultTextFont (const char* fontname, float fontsize) = 0;
    00458
    00462   virtual void SetDefaultTextFgColor (const csColor& color) = 0;
    00463
    00467   virtual void SetDefaultTextBgColor (const csColor& color) = 0;
    00468
    00472   virtual void SetDefaultTextBgTransparent () = 0;
    00473 };
    00474
    00475 #endif // __CEL_MGR_BILLBOARD__
    00476