PowerVR Software Development Kit


Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

PVRTPrint3D.h

Go to the documentation of this file.
00001 /*!***************************************************************************
00002  @File          PVRTPrint3D.h
00003 
00004  @Brief         Code to print text through the 3D interface.
00005 
00006  @Author        PowerVR
00007 
00008  @Date          November 2000
00009 
00010  @Copyright     Copyright 2003-2004 by Imagination Technologies Limited.
00011                 All rights reserved. No part of this software, either
00012                 material or conceptual may be copied or distributed,
00013                 transmitted, transcribed, stored in a retrieval system
00014                 or translated into any human or computer language in any
00015                 form by any means, electronic, mechanical, manual or
00016                 other-wise, or disclosed to third parties without the
00017                 express written permission of Imagination Technologies
00018                 Limited, Unit 8, HomePark Industrial Estate,
00019                 King's Langley, Hertfordshire, WD4 8LZ, U.K.
00020 
00021  @Platform      ANSI compatible
00022 
00023  @Description   Code to print text through the 3D interface.
00024 
00025  $Revision: 1.24 $
00026 *****************************************************************************/
00027 #ifndef _PVRTPRINT3D_H_
00028 #define _PVRTPRINT3D_H_
00029 
00030 #include "PVRTContext.h"
00031 
00032 
00033 /****************************************************************************
00034 ** Enums
00035 ****************************************************************************/
00036 /*!***************************************************************************
00037  dwFlags for PVRTPrint3DSetWindowFlags
00038 *****************************************************************************/
00039 typedef enum {
00040     PRINT3D_ACTIVATE_WIN        =   0x01,
00041     PRINT3D_DEACTIVATE_WIN      =   0x02,
00042     PRINT3D_ACTIVATE_TITLE      =   0x04,
00043     PRINT3D_DEACTIVATE_TITLE    =   0x08,
00044     PRINT3D_FULL_OPAQUE         =   0x10,
00045     PRINT3D_FULL_TRANS          =   0x20,
00046     PRINT3D_ADJUST_SIZE_ALWAYS  =   0x40,
00047     PRINT3D_NO_BORDER           =   0x80
00048 } PRINT3D_FLAGS;
00049 
00050 /*!***************************************************************************
00051  Logo flags for DisplayDefaultTitle
00052 *****************************************************************************/
00053 typedef enum {
00054     NO_LOGO  = 0x00,
00055     PVR_LOGO = 0x02,
00056     IMG_LOGO = 0x04
00057 } PRINT3D_LOGO;
00058 
00059 struct PVRTPrint3DGlob; // Internal implementation data
00060 
00061 /*!***************************************************************************
00062  Class: CPVRTPrint3D
00063 *****************************************************************************/
00064 class CPVRTPrint3D
00065 {
00066 public:
00067     // constructor/destructor
00068     /*************************************************************************
00069      @Function          CPVRTPrint3D
00070      @Description       Init some values.
00071     *************************************************************************/
00072     CPVRTPrint3D( void );
00073     /*************************************************************************
00074      @Function          ~CPVRTPrint3D
00075      @Description       De-allocate the memory in case the developer didn't.
00076     *************************************************************************/
00077     ~CPVRTPrint3D( void );
00078 
00079     /****************************************************************************
00080     ** Functions
00081     ****************************************************************************/
00082 
00083     /*!***********************************************************************
00084      @Function          PVRTPrint3DSetTextures
00085      @Input             pContext        Context
00086      @Input             dwScreenX       Screen resolution along X
00087      @Input             dwScreenY       Screen resolution along Y
00088      @Return            true or false
00089      @Description       Initialization and texture upload. Should be called only once
00090                         for a given context.
00091     *************************************************************************/
00092     bool SetTextures(
00093         const SPVRTContext  * const pContext,
00094         const unsigned int  dwScreenX,
00095         const unsigned int  dwScreenY);
00096 
00097     /*!***********************************************************************
00098      @Function          PVRTPrint3DReleaseTextures
00099      @Description       Deallocate the memory allocated in PVRTPrint3DSetTextures(...)
00100     *************************************************************************/
00101     void ReleaseTextures();
00102 
00103     /*!***********************************************************************
00104      @Function          PVRTPrint3D
00105      @Input             fPosX       Position of the text along X
00106      @Input             fPosY       Position of the text along Y
00107      @Input             fScale      Scale of the text
00108      @Input             Colour      Colour of the text
00109      @Input             Format      Format string for the text
00110      @Description       Display 3D text on screen.
00111                         No window needs to be allocated to use this function.
00112                         However, PVRTPrint3DSetTextures(...) must have been called
00113                         beforehand.
00114                         This function accepts formatting in the printf way.
00115     *************************************************************************/
00116     void Print3D(float fPosX, float fPosY, float fScale, int Colour, const char *Format, ...);
00117 
00118     /*!***********************************************************************
00119      @Function          DisplayDefaultTitle
00120      @Input             sTitle              Title to display
00121      @Input             sDescription        Description to display
00122      @Input             uDisplayLogo        1 = Display the logo
00123      @Description       Creates a default title with predefined position and colours.
00124                         It displays as well company logos when requested:
00125                         0 = No logo
00126                         1 = PowerVR logo
00127                         2 = Img Tech logo
00128     *************************************************************************/
00129      void DisplayDefaultTitle(char *sTitle, char *sDescription, unsigned int uDisplayLogo);
00130 
00131     /*!***********************************************************************
00132      @Function          CreateDefaultWindow
00133      @Input             fPosX                   Position X for the new window
00134      @Input             fPosY                   Position Y for the new window
00135      @Input             nXSize_LettersPerLine
00136      @Input             sTitle                  Title of the window
00137      @Input             sBody                   Body text of the window
00138      @Return            Window handle
00139      @Description       Creates a default window.
00140                         If Title is NULL the main body will have just one line
00141                         (for InfoWin).
00142     *************************************************************************/
00143     unsigned int CreateDefaultWindow(float fPosX, float fPosY, int nXSize_LettersPerLine, char *sTitle, char *sBody);
00144 
00145     /*!***********************************************************************
00146      @Function          InitWindow
00147      @Input             dwBufferSizeX       Buffer width
00148      @Input             dwBufferSizeY       Buffer height
00149      @Return            Window handle
00150      @Description       Allocate a buffer for a newly-created window and return its
00151                         handle.
00152     *************************************************************************/
00153     unsigned int InitWindow(unsigned int dwBufferSizeX, unsigned int dwBufferSizeY);
00154 
00155     /*!***********************************************************************
00156      @Function          DeleteWindow
00157      @Input             dwWin       Window handle
00158      @Description       Delete the window referenced by dwWin.
00159     *************************************************************************/
00160     void DeleteWindow(unsigned int dwWin);
00161 
00162     /*!***********************************************************************
00163      @Function          DeleteAllWindows
00164      @Description       Delete all windows.
00165     *************************************************************************/
00166     void DeleteAllWindows();
00167 
00168     /*!***********************************************************************
00169      @Function          DisplayWindow
00170      @Input             dwWin
00171      @Description       Display window.
00172                         This function MUST be called between a BeginScene/EndScene
00173                         pair as it uses D3D render primitive calls.
00174                         PVRTPrint3DSetTextures(...) must have been called beforehand.
00175     *************************************************************************/
00176     void DisplayWindow(unsigned int dwWin);
00177 
00178     /*!***********************************************************************
00179      @Function          SetText
00180      @Input             dwWin       Window handle
00181      @Input             Format      Format string
00182      @Description       Feed the text buffer of window referenced by dwWin.
00183                         This function accepts formatting in the printf way.
00184     *************************************************************************/
00185     void SetText(unsigned int dwWin, const char *Format, ...);
00186 
00187     /*!***********************************************************************
00188      @Function          PVRTPrint3DSetWindow
00189      @Input             dwWin           Window handle
00190      @Input             dwWinColor      Window colour
00191      @Input             dwFontColor     Font colour
00192      @Input             fFontSize       Font size
00193      @Input             fPosX           Window position X
00194      @Input             fPosY           Window position Y
00195      @Input             fSizeX          Window size X
00196      @Input             fSizeY          Window size Y
00197      @Description       Set attributes of window.
00198                         Windows position and size are referred to a virtual screen
00199                         of 100x100. (0,0) is the top-left corner and (100,100) the
00200                         bottom-right corner.
00201                         These values are the same for all resolutions.
00202     *************************************************************************/
00203     void SetWindow(unsigned int dwWin, unsigned int dwWinColor, unsigned int dwFontColor, float fFontSize,
00204                               float fPosX, float fPosY, float fSizeX, float fSizeY);
00205 
00206     /*!***********************************************************************
00207      @Function          SetTitle
00208      @Input             dwWin               Window handle
00209      @Input             dwBackgroundColor   Background color
00210      @Input             fFontSize           Font size
00211      @Input             dwFontColorLeft
00212      @Input             sTitleLeft
00213      @Input             dwFontColorRight
00214      @Input             sTitleRight
00215      @Description       Set window title.
00216     *************************************************************************/
00217     void SetTitle(unsigned int dwWin, unsigned int dwBackgroundColor, float fFontSize,
00218                              unsigned int dwFontColorLeft, char *sTitleLeft,
00219                              unsigned int dwFontColorRight, char *sTitleRight);
00220 
00221     /*!***********************************************************************
00222      @Function          PVRTPrint3DSetWindowFlags
00223      @Input             dwWin               Window handle
00224      @Input             dwFlags             Flags
00225      @Description       Set flags for window referenced by dwWin.
00226                         A list of flag can be found at the top of this header.
00227     *************************************************************************/
00228     void SetWindowFlags(unsigned int dwWin, unsigned int dwFlags);
00229 
00230     /*!***********************************************************************
00231      @Function          AdjustWindowSize
00232      @Input             dwWin               Window handle
00233      @Input             dwMode              dwMode 0 = Both, dwMode 1 = X only,  dwMode 2 = Y only
00234      @Description       Calculates window size so that all text fits in the window.
00235     *************************************************************************/
00236     void AdjustWindowSize(unsigned int dwWin, unsigned int dwMode);
00237 
00238     /*!***********************************************************************
00239      @Function          GetSize
00240      @Output            pfWidth             Width of the string in pixels
00241      @Output            pfHeight            Height of the string in pixels
00242      @Input             fFontSize           Font size
00243      @Input             sString             String to take the size of
00244      @Description       Returns the size of a string in pixels.
00245     *************************************************************************/
00246     void GetSize(
00247         float       * const pfWidth,
00248         float       * const pfHeight,
00249         const float fFontSize,
00250         const char  * sString);
00251 
00252     /*!***********************************************************************
00253      @Function          GetAspectRatio
00254      @Output            dwScreenX       Screen resolution X
00255      @Output            dwScreenY       Screen resolution Y
00256      @Description       Returns the current resolution used by Print3D
00257     *************************************************************************/
00258     void GetAspectRatio(unsigned int *dwScreenX, unsigned int *dwScreenY);
00259 
00260     /*!***********************************************************************
00261      @Function          Flush
00262      @Description       Flushes all the print text commands
00263     *************************************************************************/
00264     int Flush();
00265 
00266 private:
00267     PVRTPrint3DGlob *m_pReserved;   
00268 };
00269 
00270 
00271 #endif /* _PVRTPRINT3D_H_ */
00272 
00273 /*****************************************************************************
00274  End of file (PVRTPrint3D.h)
00275 *****************************************************************************/


Copyright © 1999-2006, PowerVR Technologies and partners. PowerVR Technologies is a division of Imagination Technologies Ltd.


Generated by DOXYGEN 1.3.6