CnC_Remastered_Collection

Command and Conquer: Red Alert
Log | Files | Refs | README | LICENSE

TXTLABEL.CPP (6421B)


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