#include <gLogo.h>
Public Member Functions | |
~gLogo () | |
Static Public Member Functions | |
static void | SetDisplayed (bool displayed, bool immediately=false) |
static void | SetSpinning (bool spinning) |
static void | SetBig (bool big, bool immediately=false) |
static void | Display () |
Definition at line 31 of file gLogo.h.
gLogo::~gLogo | ( | ) |
Definition at line 270 of file gLogo.cpp.
References tDESTROY.
00271 { 00272 if (sg_LogoMPTitle) 00273 { 00274 tDESTROY(sg_LogoMPTitle); 00275 } 00276 }
void gLogo::SetDisplayed | ( | bool | displayed, | |
bool | immediately = false | |||
) | [static] |
Definition at line 58 of file gLogo.cpp.
References eCoord, sg_Displayed, sg_DisplayStatus(), and sg_SpinStatus().
Referenced by gServerFavorite::Connect(), gGame::gGame(), main(), MainMenu(), and welcome().
00059 { 00060 if (sg_Displayed == false && d == true && sg_DisplayStatus < .01) 00061 sg_SpinStatus = eCoord(0, 1); 00062 00063 sg_Displayed = d; 00064 if (immediately) 00065 sg_DisplayStatus = d ? 1 : 0; 00066 }
void gLogo::SetSpinning | ( | bool | spinning | ) | [static] |
Definition at line 68 of file gLogo.cpp.
References eCoord, sg_Spinning, and sg_SpinStatus().
Referenced by main(), and welcome().
00069 { 00070 sg_Spinning = s; 00071 if (!s) 00072 sg_SpinStatus = eCoord(1, 0); 00073 }
void gLogo::SetBig | ( | bool | big, | |
bool | immediately = false | |||
) | [static] |
Definition at line 74 of file gLogo.cpp.
References sg_Big, and sg_SizeStatus().
Referenced by main(), and welcome().
00075 { 00076 sg_Big = b; 00077 if (immediately) 00078 sg_SizeStatus = b ? 1 : 0; 00079 00080 }
void gLogo::Display | ( | ) | [static] |
Definition at line 90 of file gLogo.cpp.
References BeginQuads(), Color(), rRenderer::DEPTH_TEST, dt, eCoord, rISurfaceTexture::Loaded(), REAL, RenderEnd(), renderer, rITexture::Select(), rRenderer::SetFlag(), sg_Big, sg_Displayed, sg_DisplayStatus(), sg_LogoTexture, sg_MoviePack(), sg_SizeStatus(), sg_Spinning, sg_SpinStatus(), sqrt(), sr_glOut, rTextureGroups::TEX_FONT, TexCoord(), tNEW, tSysTimeFloat(), and Vertex().
Referenced by MenuBackground(), Render(), and welcome().
00091 { 00092 #ifndef DEDICATED 00093 if (!sr_glOut) 00094 return; 00095 00096 if (sg_MoviePack() && !sg_LogoMPTitle) 00097 { 00098 sg_LogoMPTitle = tNEW(rFileTexture)(rTextureGroups::TEX_FONT, "moviepack/title.jpg",0,0,1); 00099 // sg_LogoMPTitle = tNEW(rFileTexture)(rTextureGroups::TEX_FONT, sg_mp_title, 0,0,1); 00100 sg_DisplayStatus = 1; 00101 } 00102 00103 renderer->SetFlag(rRenderer::DEPTH_TEST, false); 00104 00105 static REAL lasttime = 0; 00106 REAL time = tSysTimeFloat(); 00107 REAL dt = time - lasttime; 00108 lasttime = time; 00109 00110 if (!sg_Displayed && sg_DisplayStatus < .00001) 00111 return; 00112 00113 if (sg_LogoMPTitle) 00114 { 00115 // update state variables 00116 if (sg_Displayed && sg_Big) 00117 { 00118 sg_DisplayStatus += dt; 00119 if (sg_DisplayStatus > 1) 00120 sg_DisplayStatus = 1; 00121 } 00122 else 00123 { 00124 sg_DisplayStatus -= dt; 00125 if (sg_DisplayStatus < 0) 00126 sg_DisplayStatus = 0; 00127 } 00128 00129 sg_LogoMPTitle->Select(); 00130 00131 if (sg_DisplayStatus <= .01 || !sg_LogoMPTitle->Loaded()) 00132 return; 00133 00134 Color(1,1,1, sg_DisplayStatus); 00135 00136 BeginQuads(); 00137 TexCoord(0,0); 00138 Vertex(-1, 1); 00139 00140 TexCoord(0,1); 00141 Vertex(-1, -1); 00142 00143 TexCoord(1,1); 00144 Vertex(1, -1); 00145 00146 TexCoord(1,0); 00147 Vertex(1, 1); 00148 00149 RenderEnd(); 00150 } 00151 else 00152 { 00153 #ifndef KRAWALL 00154 sg_LogoMPTitle = tNEW(rFileTexture)(rTextureGroups::TEX_FONT, "textures/title.jpg",0,0,1); 00155 // sg_LogoMPTitle = tNEW(rFileTexture)(rTextureGroups::TEX_FONT, sg_title,0,0,1); 00156 00157 sg_DisplayStatus = 1; 00158 00159 // update state variables 00160 if (sg_Displayed && sg_Big) 00161 { 00162 sg_DisplayStatus += dt; 00163 if (sg_DisplayStatus > 1) 00164 sg_DisplayStatus = 1; 00165 } 00166 else 00167 { 00168 sg_DisplayStatus -= dt; 00169 if (sg_DisplayStatus < 0) 00170 sg_DisplayStatus = 0; 00171 } 00172 00173 sg_LogoMPTitle->Select(); 00174 00175 if (sg_DisplayStatus <= .01 || !sg_LogoMPTitle->Loaded()) 00176 return; 00177 00178 Color(1,1,1, sg_DisplayStatus); 00179 00180 BeginQuads(); 00181 TexCoord(0,0); 00182 Vertex(-1, 1); 00183 00184 TexCoord(0,1); 00185 Vertex(-1, -1); 00186 00187 TexCoord(1,1); 00188 Vertex(1, -1); 00189 00190 TexCoord(1,0); 00191 Vertex(1, 1); 00192 00193 RenderEnd(); 00194 #endif 00195 00196 #ifdef KRAWALL 00197 sg_LogoTexture.Select(); 00198 00199 if ( !sg_LogoTexture.Loaded() ) 00200 { 00201 return; 00202 } 00203 00204 // update state variables 00205 if (sg_Spinning) 00206 { 00207 sg_SpinStatus = sg_SpinStatus.Turn(1, dt * 2 * .2 / (sg_SizeStatus + .2)); 00208 sg_SpinStatus = sg_SpinStatus * (1/sqrt(sg_SpinStatus.NormSquared())); 00209 } 00210 00211 if (sg_Big) 00212 { 00213 sg_SizeStatus += dt; 00214 if (sg_SizeStatus > 1) 00215 sg_SizeStatus = 1; 00216 } 00217 else 00218 { 00219 sg_SizeStatus *= (1 - 2 * dt); 00220 // if (sg_SizeStatus < 0) 00221 // sg_SizeStatus = 0; 00222 } 00223 00224 if (sg_Displayed) 00225 { 00226 sg_DisplayStatus += dt; 00227 if (sg_DisplayStatus > 1) 00228 sg_DisplayStatus = 1; 00229 } 00230 else 00231 { 00232 sg_DisplayStatus -= dt*.3; 00233 if (sg_DisplayStatus < 0) 00234 sg_DisplayStatus = 0; 00235 } 00236 00237 if (sg_DisplayStatus < 0) 00238 return; 00239 00240 eCoord center(.8*(sg_SizeStatus*sg_SizeStatus-1), .8*(1-sg_SizeStatus)); 00241 REAL e =.8 * (sg_SizeStatus + .1); 00242 eCoord extension(e, - .7 * e * fabs(sg_SpinStatus.x)); 00243 00244 eCoord ur = center - extension; 00245 eCoord ll = center + extension; 00246 00247 Color(1,1,1, sg_DisplayStatus); 00248 00249 BeginQuads(); 00250 TexCoord(0,0); 00251 Vertex(ur.x, ur.y); 00252 00253 TexCoord(0,1); 00254 Vertex(ur.x, ll.y); 00255 00256 TexCoord(1,1); 00257 Vertex(ll.x, ll.y); 00258 00259 TexCoord(1,0); 00260 Vertex(ll.x, ur.y); 00261 00262 RenderEnd(); 00263 #endif 00264 00265 } 00266 00267 #endif 00268 }