CEL: Crystal Entity Layer: tools/billboard.h Source File (CEL: Crystal Entity Layer Public API Reference)

| ## 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 MouseMoveAway (iBillboard* billboard, int mouse_button,
    00088         int mousex, int mousey) = 0;
    00089
    00093   virtual void Unselect (iBillboard* billboard, int mouse_button,
    00094         int mousex, int mousey) = 0;
    00095
    00099   virtual void DoubleClick (iBillboard* billboard, int mouse_button,
    00100         int mousex, int mousey) = 0;
    00101 };
    00102
    00103
    00107 #define CEL_BILLBOARD_VISIBLE 1
    00108
    00111 #define CEL_BILLBOARD_MOVABLE 2
    00112
    00116 #define CEL_BILLBOARD_CLICKABLE 4
    00117
    00121 #define CEL_BILLBOARD_RESTACK 8
    00122
    00126 #define CEL_BILLBOARD_SENDMOVE 16
    00127
    00128 SCF_VERSION (iBillboard, 0, 0, 1);
    00129
    00139 struct iBillboard : public iBase
    00140 {
    00144   virtual const char* GetName () const = 0;
    00145
    00149   virtual csFlags& GetFlags () = 0;
    00150
    00156   virtual bool SetMaterialName (const char* matname) = 0;
    00157
    00163   virtual bool SetMaterialNameFast (const char* matname) = 0;
    00164
    00168   virtual const char* GetMaterialName () = 0;
    00169
    00186   virtual bool DrawMesh (const char* material_name,
    00187         const char* factory, const csVector3& rotate = csVector3 (0, 0, 0),
    00188         float angle = 0.0f, float distance = -1.0f) = 0;
    00189
    00193   virtual void SetSize (int w, int h) = 0;
    00194
    00198   virtual void GetSize (int& w, int& h) = 0;
    00199
    00203   virtual void GetImageSize (int& w, int& h) = 0;
    00204
    00209   virtual void SetPosition (int x, int y) = 0;
    00210
    00219   virtual void MoveToPosition (csTicks delta, int x, int y) = 0;
    00220
    00225   virtual void GetPosition (int& x, int& y) const = 0;
    00226
    00231   virtual void Move (int dx, int dy) = 0;
    00232
    00236   virtual void StackTop () = 0;
    00237
    00241   virtual void StackBottom () = 0;
    00242
    00246   virtual void StackUp () = 0;
    00247
    00251   virtual void StackDown () = 0;
    00252
    00257   virtual void SetUVTopLeft (const csVector2& uv) = 0;
    00258
    00263   virtual const csVector2& GetUVTopLeft () const = 0;
    00264
    00269   virtual void SetUVBottomRight (const csVector2& uv) = 0;
    00270
    00275   virtual const csVector2& GetUVBottomRight () const = 0;
    00276
    00280   virtual void SetColor (const csColor& c) = 0;
    00281
    00285   virtual const csColor& GetColor () const = 0;
    00286
    00290   virtual void SetLayer (iBillboardLayer* layer) = 0;
    00291
    00295   virtual iBillboardLayer* GetLayer () const = 0;
    00296
    00300   virtual void AddEventHandler (iBillboardEventHandler* evh) = 0;
    00301
    00305   virtual void RemoveEventHandler (iBillboardEventHandler* evh) = 0;
    00306
    00311   virtual void SetText (const char* txt) = 0;
    00312
    00316   virtual const char* GetText () const = 0;
    00317
    00321   virtual void SetTextOffset (int dx, int dy) = 0;
    00322
    00326   virtual int GetTextOffsetDX () const = 0;
    00327
    00331   virtual int GetTextOffsetDY () const = 0;
    00332
    00336   virtual bool SetTextFont (const char* fontname, float fontsize) = 0;
    00337
    00341   virtual const char* GetTextFont () const = 0;
    00342
    00346   virtual float GetTextFontSize () const = 0;
    00347
    00352   virtual void SetTextFgColor (const csColor& color) = 0;
    00353
    00357   virtual const csColor& GetTextFgColor () const = 0;
    00358
    00363   virtual void ClearTextFgColor () = 0;
    00364
    00369   virtual void SetTextBgColor (const csColor& color) = 0;
    00370
    00374   virtual const csColor& GetTextBgColor () const = 0;
    00375
    00380   virtual void SetTextBgTransparent () = 0;
    00381
    00385   virtual bool IsTextBgTransparent () const = 0;
    00386
    00391   virtual void ClearTextBgColor () = 0;
    00392 };
    00393
    00394 SCF_VERSION (iBillboardManager, 0, 0, 1);
    00395
    00400 struct iBillboardManager : public iBase
    00401 {
    00405   virtual int ScreenToBillboardX (int x) const = 0;
    00406
    00410   virtual int ScreenToBillboardY (int y) const = 0;
    00411
    00415   virtual int BillboardToScreenX (int x) const = 0;
    00416
    00420   virtual int BillboardToScreenY (int y) const = 0;
    00421
    00426   virtual iBillboard* CreateBillboard (const char* name) = 0;
    00427
    00431   virtual iBillboard* FindBillboard (const char* name) const = 0;
    00432
    00436   virtual void RemoveBillboard (iBillboard* billboard) = 0;
    00437
    00441   virtual size_t GetBillboardCount () const = 0;
    00442
    00446   virtual iBillboard* GetBillboard (size_t idx) const = 0;
    00447
    00453   virtual iBillboardLayer* CreateBillboardLayer (const char* name) = 0;
    00454
    00458   virtual iBillboardLayer* FindBillboardLayer (const char* name) const = 0;
    00459
    00465   virtual void RemoveBillboardLayer (iBillboardLayer* layer) = 0;
    00466
    00470   virtual size_t GetBillboardLayerCount () const = 0;
    00471
    00475   virtual iBillboardLayer* GetBillboardLayer (size_t idx) const = 0;
    00476
    00480   virtual void RemoveAll () = 0;
    00481
    00485   virtual void SetFlags (uint32 flags, uint32 mask) = 0;
    00486
    00490   virtual void StackTop (iBillboard* bb) = 0;
    00491
    00495   virtual void StackBottom (iBillboard* bb) = 0;
    00496
    00500   virtual void StackUp (iBillboard* bb) = 0;
    00501
    00505   virtual void StackDown (iBillboard* bb) = 0;
    00506
    00510   virtual void StackBefore (iBillboard* bb, iBillboard* other) = 0;
    00511
    00515   virtual void StackAfter (iBillboard* bb, iBillboard* other) = 0;
    00516
    00521   virtual bool TestCollision (iBillboard* bb1, iBillboard* bb2) = 0;
    00522
    00526   virtual bool SetDefaultTextFont (const char* fontname, float fontsize) = 0;
    00527
    00531   virtual const char* GetDefaultTextFont () const = 0;
    00532
    00536   virtual float GetDefaultTextFontSize () const = 0;
    00537
    00541   virtual void SetDefaultTextFgColor (const csColor& color) = 0;
    00542
    00546   virtual const csColor& GetDefaultTextFgColor () const = 0;
    00547
    00551   virtual void SetDefaultTextBgColor (const csColor& color) = 0;
    00552
    00556   virtual const csColor& GetDefaultTextBgColor () const = 0;
    00557
    00561   virtual void SetDefaultTextBgTransparent () = 0;
    00562
    00571   virtual iSector* GetShowroom () = 0;
    00572 };
    00573
    00574 #endif // __CEL_MGR_BILLBOARD__
    00575