TXTLABEL.CPP 6.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. //
  2. // Copyright 2020 Electronic Arts Inc.
  3. //
  4. // TiberianDawn.DLL and RedAlert.dll and corresponding source code is free
  5. // software: you can redistribute it and/or modify it under the terms of
  6. // the GNU General Public License as published by the Free Software Foundation,
  7. // either version 3 of the License, or (at your option) any later version.
  8. // TiberianDawn.DLL and RedAlert.dll and corresponding source code is distributed
  9. // in the hope that it will be useful, but with permitted additional restrictions
  10. // under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT
  11. // distributed with this program. You should have received a copy of the
  12. // GNU General Public License along with permitted additional restrictions
  13. // with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
  14. /* $Header: F:\projects\c&c\vcs\code\txtlabel.cpv 1.9 16 Oct 1995 16:49:44 JOE_BOSTIC $ */
  15. /***********************************************************************************************
  16. *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
  17. ***********************************************************************************************
  18. * *
  19. * Project Name : Command & Conquer *
  20. * *
  21. * File Name : TXTLABEL.H *
  22. * *
  23. * Programmer : Bill Randolph *
  24. * *
  25. * Start Date : 02/06/95 *
  26. * *
  27. * Last Update : February 6, 1995 [BR] *
  28. * *
  29. *---------------------------------------------------------------------------------------------*
  30. * Functions: *
  31. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  32. #include "function.h"
  33. /***********************************************************************************************
  34. * TextLabelClass -- Constructor *
  35. * *
  36. * INPUT: *
  37. * txt pointer to text buffer to print from *
  38. * x x-coord for text printing *
  39. * y y-coord for text printing *
  40. * color color to print in *
  41. * style style to print (determines the meaning of x & y) *
  42. * *
  43. * OUTPUT: *
  44. * none. *
  45. * *
  46. * WARNINGS: *
  47. * none. *
  48. * *
  49. * HISTORY: *
  50. * 03/24/1995 BRR : Created. *
  51. *=============================================================================================*/
  52. TextLabelClass::TextLabelClass(char *txt, int x, int y, int color,
  53. TextPrintType style) : GadgetClass(x,y,1,1,0,0)
  54. {
  55. Text = txt;
  56. Color = color;
  57. Style = style;
  58. UserData = 0;
  59. PixWidth = -1;
  60. Segments = 0;
  61. }
  62. /***********************************************************************************************
  63. * Draw_Me -- Graphical update routine *
  64. * *
  65. * INPUT: *
  66. * forced true = draw regardless of the current redraw flag state *
  67. * *
  68. * OUTPUT: *
  69. * true = gadget was redrawn, false = wasn't *
  70. * *
  71. * WARNINGS: *
  72. * none. *
  73. * *
  74. * HISTORY: *
  75. * 03/24/1995 BRR : Created. *
  76. *=============================================================================================*/
  77. int TextLabelClass::Draw_Me(int forced)
  78. {
  79. if (GadgetClass::Draw_Me(forced)) {
  80. if (PixWidth == -1) {
  81. Fancy_Text_Print("%s", X, Y, Color, TBLACK, Style, Text);
  82. } else {
  83. Conquer_Clip_Text_Print(Text, X, Y, Color, TBLACK, Style, PixWidth);
  84. }
  85. return(true);
  86. }
  87. return(false);
  88. }