home *** CD-ROM | disk | FTP | other *** search
/ NEXT Generation 27 / NEXT27.iso / pc / demos / emperor / dx3.exe / SDK / SAMPLES / IKLOWNS / CGTEXT.H < prev    next >
C/C++ Source or Header  |  1996-08-28  |  2KB  |  73 lines

  1. /*===========================================================================*\
  2. |
  3. |  File:        cgtext.h
  4. |
  5. |  Description: 
  6. |       
  7. |-----------------------------------------------------------------------------
  8. |
  9. |  Copyright (C) 1995-1996 Microsoft Corporation.  All Rights Reserved.
  10. |
  11. |  Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation
  12. |
  13. \*===========================================================================*/
  14. /**************************************************************************
  15.  
  16.     (C) Copyright 1995-1996 Microsoft Corp.  All rights reserved.
  17.  
  18.     You have a royalty-free right to use, modify, reproduce and 
  19.     distribute the Sample Files (and/or any modified version) in 
  20.     any way you find useful, provided that you agree that 
  21.     Microsoft has no warranty obligations or liability for any 
  22.     Sample Application Files which are modified. 
  23.  
  24.     we do not recomend you base your game on IKlowns, start with one of
  25.     the other simpler sample apps in the GDK
  26.  
  27.  **************************************************************************/
  28.  
  29. #ifndef _CGTEXT_H
  30. #define _CGTEXT_H
  31. #include "linklist.h"
  32.  
  33. //#define   COLOR_RED   (PALETTERGB(255,0,0))
  34. //#define   COLOR_RED   (RGB(255,0,0))
  35. #define COLOR_RED   (PALETTEINDEX(5))
  36. #define COLOR_GREEN (PALETTERGB(0,255,0))
  37. #define COLOR_BLUE  (PALETTERGB(0,0,255))
  38. #define COLOR_BLACK (PALETTERGB(0,0,0))
  39. #define COLOR_WHITE (PALETTERGB(255,255,255))
  40. //#define COLOR_YELLOW  (PALETTERGB(255, 255, 0))
  41. #define COLOR_YELLOW    (PALETTEINDEX(4))
  42. #define COLOR_GREY  (PALETTERGB(149, 149, 149))
  43.  
  44. #define NO_SHADOW   ((COLORREF)-1)
  45.  
  46. class CGameText {
  47. private:
  48.     int     maxWidth;
  49.     int     maxHeight;
  50.     RECT        rect;
  51.     int     nLines;
  52.     int     maxLines;
  53.     int     spacing;
  54.     CLinkedList *pLines;
  55.     HDC     hdcText;
  56.     HFONT       hFont;
  57.     HFONT       hOldFont;
  58.  
  59. public:
  60.     CGameText(HDC, LPRECT, int maxLines=2, int lineSpacing=2);
  61.     ~CGameText();
  62.  
  63.     void SetSpacing(int lineSpacing) { spacing = lineSpacing; };
  64.     void SetMaxLines(int lines) { maxLines = lines; };
  65.  
  66.     int AddLine(LPSTR, COLORREF Color = COLOR_RED
  67.     , COLORREF DropColor = COLOR_GREY);
  68.     void ChangeColor(int, COLORREF, COLORREF DropColor = COLOR_GREY);
  69.     LPSTR GetText(int);
  70.     int TextBlt(int ScrollPos=0);
  71. };
  72. #endif
  73.