CEL

Public API Reference

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 
00037 struct iBillboardLayer : public virtual iBase
00038 {
00039   SCF_INTERFACE (iBillboardLayer, 0, 0, 1);
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 
00137 struct iBillboard : public virtual iBase
00138 {
00139   SCF_INTERFACE (iBillboard, 0, 0, 1);
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 SetRotation (float angle) = 0;
00237 
00241   virtual float GetRotation () const = 0;
00242 
00246   virtual void StackTop () = 0;
00247 
00251   virtual void StackBottom () = 0;
00252 
00256   virtual void StackUp () = 0;
00257 
00261   virtual void StackDown () = 0;
00262 
00267   virtual void SetUVTopLeft (const csVector2& uv) = 0;
00268 
00273   virtual const csVector2& GetUVTopLeft () const = 0;
00274 
00279   virtual void SetUVBottomRight (const csVector2& uv) = 0;
00280 
00285   virtual const csVector2& GetUVBottomRight () const = 0;
00286 
00290   virtual void SetColor (const csColor& c) = 0;
00291 
00295   virtual const csColor& GetColor () const = 0;
00296 
00300   virtual void SetLayer (iBillboardLayer* layer) = 0;
00301 
00305   virtual iBillboardLayer* GetLayer () const = 0;
00306 
00310   virtual void AddEventHandler (iBillboardEventHandler* evh) = 0;
00311 
00315   virtual void RemoveEventHandler (iBillboardEventHandler* evh) = 0;
00316 
00321   virtual void SetText (const char* txt) = 0;
00322 
00326   virtual const char* GetText () const = 0;
00327 
00331   virtual void GetTextDimensions (int& w, int& h) = 0;
00332 
00336   virtual void SetTextOffset (int dx, int dy) = 0;
00337 
00341   virtual int GetTextOffsetDX () const = 0;
00342 
00346   virtual int GetTextOffsetDY () const = 0;
00347 
00351   virtual bool SetTextFont (const char* fontname, float fontsize) = 0;
00352 
00356   virtual const char* GetTextFont () const = 0;
00357 
00361   virtual float GetTextFontSize () const = 0;
00362 
00367   virtual void SetTextFgColor (const csColor& color) = 0;
00368 
00372   virtual const csColor& GetTextFgColor () const = 0;
00373 
00378   virtual void ClearTextFgColor () = 0;
00379 
00384   virtual void SetTextBgColor (const csColor& color) = 0;
00385 
00389   virtual const csColor& GetTextBgColor () const = 0;
00390 
00395   virtual void SetTextBgTransparent () = 0;
00396 
00400   virtual bool IsTextBgTransparent () const = 0;
00401 
00406   virtual void ClearTextBgColor () = 0;
00407 };
00408 
00413 struct iBillboardManager : public virtual iBase
00414 {
00415   SCF_INTERFACE (iBillboardManager, 0, 0, 1);
00416 
00420   virtual int ScreenToBillboardX (int x) const = 0;
00421 
00425   virtual int ScreenToBillboardY (int y) const = 0;
00426 
00430   virtual int BillboardToScreenX (int x) const = 0;
00431 
00435   virtual int BillboardToScreenY (int y) const = 0;
00436 
00441   virtual iBillboard* CreateBillboard (const char* name) = 0;
00442 
00446   virtual iBillboard* FindBillboard (const char* name) const = 0;
00447 
00451   virtual void RemoveBillboard (iBillboard* billboard) = 0;
00452 
00456   virtual size_t GetBillboardCount () const = 0;
00457 
00461   virtual iBillboard* GetBillboard (size_t idx) const = 0;
00462 
00468   virtual iBillboardLayer* CreateBillboardLayer (const char* name) = 0;
00469 
00473   virtual iBillboardLayer* FindBillboardLayer (const char* name) const = 0;
00474 
00480   virtual void RemoveBillboardLayer (iBillboardLayer* layer) = 0;
00481 
00485   virtual size_t GetBillboardLayerCount () const = 0;
00486 
00490   virtual iBillboardLayer* GetBillboardLayer (size_t idx) const = 0;
00491 
00495   virtual void RemoveAll () = 0;
00496 
00500   virtual void SetFlags (uint32 flags, uint32 mask) = 0;
00501 
00505   virtual void StackTop (iBillboard* bb) = 0;
00506 
00510   virtual void StackBottom (iBillboard* bb) = 0;
00511 
00515   virtual void StackUp (iBillboard* bb) = 0;
00516 
00520   virtual void StackDown (iBillboard* bb) = 0;
00521 
00525   virtual void StackBefore (iBillboard* bb, iBillboard* other) = 0;
00526 
00530   virtual void StackAfter (iBillboard* bb, iBillboard* other) = 0;
00531 
00536   virtual bool TestCollision (iBillboard* bb1, iBillboard* bb2) = 0;
00537 
00541   virtual bool SetDefaultTextFont (const char* fontname, float fontsize) = 0;
00542 
00546   virtual const char* GetDefaultTextFont () const = 0;
00547 
00551   virtual float GetDefaultTextFontSize () const = 0;
00552 
00556   virtual void SetDefaultTextFgColor (const csColor& color) = 0;
00557 
00561   virtual const csColor& GetDefaultTextFgColor () const = 0;
00562 
00566   virtual void SetDefaultTextBgColor (const csColor& color) = 0;
00567 
00571   virtual const csColor& GetDefaultTextBgColor () const = 0;
00572 
00576   virtual void SetDefaultTextBgTransparent () = 0;
00577 
00586   virtual iSector* GetShowroom () = 0;
00587 };
00588 
00589 #endif // __CEL_MGR_BILLBOARD__
00590 

Generated for CEL: Crystal Entity Layer 1.2 by doxygen 1.4.7