00001 /* ************************************************************************************* 00002 Writer: Sebastien Bloc 00003 Copyright: 2003-2004 00004 eMail: sebastien.bloc@free.fr 00005 URL: http://mignonsoft.free.fr 00006 00007 This program is free software; you can redistribute it and/or 00008 modify it under the terms of the GNU General Public License 00009 as published by the Free Software Foundation; either version 2 00010 of the License, or (at your option) any later version. 00011 00012 This program is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU General Public License for more details. 00016 http://www.gnu.org/copyleft/gpl.html 00017 ************************************************************************************* */ 00018 00019 #include "3d.h" 00020 #include "MyString.h" 00021 #include "controlEngine.h" 00022 #include "textTexture.h" 00023 00024 extern ControlEngine ce; 00025 00026 TextTexture::TextTexture() 00027 { 00028 texture=NULL; 00029 faceText=NULL; 00030 background=RGB(128,128,128); 00031 color=RGB(0,0,0); 00032 xFormat=-1; 00033 yFormat=-1; 00034 } 00035 00036 void TextTexture::BindTexture(Face *face) 00037 { 00038 faceText=face; 00039 } 00040 00041 void TextTexture::operator=(char *newText) 00042 { 00043 SetText(newText); 00044 } 00045 00046 void TextTexture::SetText(char *newText) 00047 { 00048 text=newText; 00049 RefreshText(); 00050 } 00051 00052 void TextTexture::RefreshText() 00053 { 00054 if (texture) 00055 { 00056 texture->Delete(); 00057 delete texture; 00058 texture=NULL; 00059 } 00060 texture = new Texture; 00061 texture->FromText("text",text,color,background,xFormat,yFormat); 00062 MajTexture(); 00063 } 00064 00065 BOOL TextTexture::MajTexture() 00066 { 00067 if (!texture||!faceText) return FALSE; 00068 faceText->texture = texture; 00069 return TRUE; 00070 }