| ## 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 struct iSector;
    00030 class csColor;
    00031 class csVector2;
    00032
    00033 SCF_VERSION (iBillboardLayer, 0, 0, 1);
    00034
    00039 struct iBillboardLayer : public iBase
    00040 {
    00044   virtual void GetOffset (int& x, int& y) const = 0;
    00045
    00049   virtual void SetOffset (int x, int y) = 0;
    00050
    00054   virtual void Move (int dx, int dy) = 0;
    00055
    00059   virtual const char* GetName () const = 0;
    00060 };
    00061
    00068 struct iBillboardEventHandler : public virtual iBase
    00069 {
    00070   SCF_INTERFACE (iBillboardEventHandler, 0, 0, 1);
    00071
    00075   virtual void Select (iBillboard* billboard, int mouse_button,
    00076         int mousex, int mousey) = 0;
    00077
    00081   virtual void MouseMove (iBillboard* billboard, int mouse_button,
    00082         int mousex, int mousey) = 0;
    00083
    00087   virtual void Unselect (iBillboard* billboard, int mouse_button,
    00088         int mousex, int mousey) = 0;
    00089
    00093   virtual void DoubleClick (iBillboard* billboard, int mouse_button,
    00094         int mousex, int mousey) = 0;
    00095 };
    00096
    00097
    00101 #define CEL_BILLBOARD_VISIBLE 1
    00102
    00105 #define CEL_BILLBOARD_MOVABLE 2
    00106
    00110 #define CEL_BILLBOARD_CLICKABLE 4
    00111
    00115 #define CEL_BILLBOARD_RESTACK 8
    00116
    00117 SCF_VERSION (iBillboard, 0, 0, 1);
    00118
    00128 struct iBillboard : public iBase
    00129 {
    00133   virtual const char* GetName () const = 0;
    00134
    00138   virtual csFlags& GetFlags () = 0;
    00139
    00145   virtual bool SetMaterialName (const char* matname) = 0;
    00146
    00152   virtual bool SetMaterialNameFast (const char* matname) = 0;
    00153
    00157   virtual const char* GetMaterialName () = 0;
    00158
    00175   virtual bool DrawMesh (const char* material_name,
    00176         const char* factory, const csVector3& rotate = csVector3 (0, 0, 0),
    00177         float angle = 0.0f, float distance = -1.0f) = 0;
    00178
    00182   virtual void SetSize (int w, int h) = 0;
    00183
    00187   virtual void GetSize (int& w, int& h) = 0;
    00188
    00192   virtual void GetImageSize (int& w, int& h) = 0;
    00193
    00198   virtual void SetPosition (int x, int y) = 0;
    00199
    00208   virtual void MoveToPosition (csTicks delta, int x, int y) = 0;
    00209
    00214   virtual void GetPosition (int& x, int& y) const = 0;
    00215
    00220   virtual void Move (int dx, int dy) = 0;
    00221
    00225   virtual void StackTop () = 0;
    00226
    00230   virtual void StackBottom () = 0;
    00231
    00235   virtual void StackUp () = 0;
    00236
    00240   virtual void StackDown () = 0;
    00241
    00246   virtual void SetUVTopLeft (const csVector2& uv) = 0;
    00247
    00252   virtual const csVector2& GetUVTopLeft () const = 0;
    00253
    00258   virtual void SetUVBottomRight (const csVector2& uv) = 0;
    00259
    00264   virtual const csVector2& GetUVBottomRight () const = 0;
    00265
    00269   virtual void SetColor (const csColor& c) = 0;
    00270
    00274   virtual const csColor& GetColor () const = 0;
    00275
    00279   virtual void SetLayer (iBillboardLayer* layer) = 0;
    00280
    00284   virtual iBillboardLayer* GetLayer () const = 0;
    00285
    00289   virtual void AddEventHandler (iBillboardEventHandler* evh) = 0;
    00290
    00294   virtual void RemoveEventHandler (iBillboardEventHandler* evh) = 0;
    00295
    00300   virtual void SetText (const char* txt) = 0;
    00301
    00305   virtual const char* GetText () const = 0;
    00306
    00310   virtual void SetTextOffset (int dx, int dy) = 0;
    00311
    00315   virtual int GetTextOffsetDX () const = 0;
    00316
    00320   virtual int GetTextOffsetDY () const = 0;
    00321
    00325   virtual bool SetTextFont (const char* fontname, float fontsize) = 0;
    00326
    00330   virtual const char* GetTextFont () const = 0;
    00331
    00335   virtual float GetTextFontSize () const = 0;
    00336
    00341   virtual void SetTextFgColor (const csColor& color) = 0;
    00342
    00346   virtual const csColor& GetTextFgColor () const = 0;
    00347
    00352   virtual void ClearTextFgColor () = 0;
    00353
    00358   virtual void SetTextBgColor (const csColor& color) = 0;
    00359
    00363   virtual const csColor& GetTextBgColor () const = 0;
    00364
    00369   virtual void SetTextBgTransparent () = 0;
    00370
    00374   virtual bool IsTextBgTransparent () const = 0;
    00375
    00380   virtual void ClearTextBgColor () = 0;
    00381 };
    00382
    00383 SCF_VERSION (iBillboardManager, 0, 0, 1);
    00384
    00389 struct iBillboardManager : public iBase
    00390 {
    00394   virtual int ScreenToBillboardX (int x) const = 0;
    00395
    00399   virtual int ScreenToBillboardY (int y) const = 0;
    00400
    00404   virtual int BillboardToScreenX (int x) const = 0;
    00405
    00409   virtual int BillboardToScreenY (int y) const = 0;
    00410
    00415   virtual iBillboard* CreateBillboard (const char* name) = 0;
    00416
    00420   virtual iBillboard* FindBillboard (const char* name) const = 0;
    00421
    00425   virtual void RemoveBillboard (iBillboard* billboard) = 0;
    00426
    00430   virtual size_t GetBillboardCount () const = 0;
    00431
    00435   virtual iBillboard* GetBillboard (size_t idx) const = 0;
    00436
    00442   virtual iBillboardLayer* CreateBillboardLayer (const char* name) = 0;
    00443
    00447   virtual iBillboardLayer* FindBillboardLayer (const char* name) const = 0;
    00448
    00454   virtual void RemoveBillboardLayer (iBillboardLayer* layer) = 0;
    00455
    00459   virtual size_t GetBillboardLayerCount () const = 0;
    00460
    00464   virtual iBillboardLayer* GetBillboardLayer (size_t idx) const = 0;
    00465
    00469   virtual void RemoveAll () = 0;
    00470
    00474   virtual void SetFlags (uint32 flags, uint32 mask) = 0;
    00475
    00479   virtual void StackTop (iBillboard* bb) = 0;
    00480
    00484   virtual void StackBottom (iBillboard* bb) = 0;
    00485
    00489   virtual void StackUp (iBillboard* bb) = 0;
    00490
    00494   virtual void StackDown (iBillboard* bb) = 0;
    00495
    00499   virtual void StackBefore (iBillboard* bb, iBillboard* other) = 0;
    00500
    00504   virtual void StackAfter (iBillboard* bb, iBillboard* other) = 0;
    00505
    00510   virtual bool TestCollision (iBillboard* bb1, iBillboard* bb2) = 0;
    00511
    00515   virtual bool SetDefaultTextFont (const char* fontname, float fontsize) = 0;
    00516
    00520   virtual const char* GetDefaultTextFont () const = 0;
    00521
    00525   virtual float GetDefaultTextFontSize () const = 0;
    00526
    00530   virtual void SetDefaultTextFgColor (const csColor& color) = 0;
    00531
    00535   virtual const csColor& GetDefaultTextFgColor () const = 0;
    00536
    00540   virtual void SetDefaultTextBgColor (const csColor& color) = 0;
    00541
    00545   virtual const csColor& GetDefaultTextBgColor () const = 0;
    00546
    00550   virtual void SetDefaultTextBgTransparent () = 0;
    00551
    00560   virtual iSector* GetShowroom () = 0;
    00561 };
    00562
    00563 #endif // __CEL_MGR_BILLBOARD__
    00564