void CGameStatePlay::render(Graphics &con){ CLog *pLog = CLog::Instance(); CGameData *pData = CGameData::Instance(); ::ShowCursor(true); // POINT pt; // pt.x = g_Global.g_mouse.x; // pt.y = g_Global.g_mouse.y; int dx = 0; //used to convert object coordinates to screen coordinates int dy = 0; //HRESULT hr; float playerAngle; int lastHeight = 0; //used for adding hanging icicles int skyOffsetY = 0; //moves sky mountain int skyOffsetX = 0; std::ostringstream oss; static int m_winFrame = 0;//used to animate You Win //Clear buffer and draw graphics con.ClearBuffer(0, 0, 30, 0); con.BeginDrawing(); GRAPHIC_IMAGE gi; gi = g_Sprite.GetSpriteData(32); con.RenderGraphicModulate(con.GetScreenCenterX() - gi.width/2 , con.GetScreenCenterY() - gi.height/2, gi, m_red, m_green, m_blue); //display orders for(int i = 0; i < pData->m_orders.size(); ++i) con.Draw2DText(pData->m_orders[i],F_V20, con.GetScreenCenterX() - 150, con.GetScreenCenterY() - 180 + (i * 20), 0,0,0); //accept...mouse hover outline if(g_Global.g_mouse.x > 290 && g_Global.g_mouse.x < 407 && g_Global.g_mouse.y > 684 && g_Global.g_mouse.y < 718){ gi = g_Sprite.GetSpriteData(54); con.RenderGraphicModulate(278, 653, gi, m_red, m_green, m_blue); } //reject..mouse hover outline if(g_Global.g_mouse.x > 627 && g_Global.g_mouse.x < 743 && g_Global.g_mouse.y > 684 && g_Global.g_mouse.y < 718){ gi = g_Sprite.GetSpriteData(54); con.RenderGraphicModulate(615, 653, gi, m_red, m_green, m_blue); } con.Draw2DText("Left click to continue.", F_V20, con.GetScreenCenterX() - 150, con.GetScreenCenterY() + 30, 0,0,0); con.EndDrawing (); con.Present(); }
void cGameStateFireControl::render(Graphics &con){ //Clear buffer and draw graphics con.ClearBuffer(0, 0, 0, 0); con.BeginDrawing(); GRAPHIC_IMAGE gi; //display ship and sub data CGameData *pData = CGameData::Instance(); //display short cuts gi = g_Sprite.GetSpriteData(36);//sonar con.RenderGraphicModulate(10,10,gi,m_red, m_green, m_blue); gi = g_Sprite.GetSpriteData(37);//radar con.RenderGraphicModulate(120,10,gi,m_red, m_green, m_blue); gi = g_Sprite.GetSpriteData(38);//conn selected con.RenderGraphicModulate(230,10,gi,m_red, m_green, m_blue); gi = g_Sprite.GetSpriteData(45);//fire control con.RenderGraphicModulate(694,10,gi,m_red, m_green, m_blue); gi = g_Sprite.GetSpriteData(40);//damage control con.RenderGraphicModulate(804,10,gi,m_red, m_green, m_blue); gi = g_Sprite.GetSpriteData(41);//chart con.RenderGraphicModulate(914,10,gi,m_red, m_green, m_blue); //draw tool tips for short cuts if(g_Global.g_mouse.y > 10 && g_Global.g_mouse.y < 130){ if(g_Global.g_mouse.x > 10 & g_Global.g_mouse.x < 104) con.Draw2DText("Sonar", F_V20, 20, 10, 0,255,255); else if(g_Global.g_mouse.x > 120 & g_Global.g_mouse.x < 207) con.Draw2DText("Radar", F_V20, 130, 10, 0,255,255); else if(g_Global.g_mouse.x > 230 & g_Global.g_mouse.x < 310) con.Draw2DText("Conn", F_V20, 240, 10, 0,255,255); //else if(g_Global.g_mouse.x > 694 & g_Global.g_mouse.x < 794) // con.Draw2DText("Torpedos", F_V20, 704, 10, 0,255,255); else if(g_Global.g_mouse.x > 804 & g_Global.g_mouse.x < 904) con.Draw2DText("Damage", F_V20, 814, 10, 0,255,255); else if(g_Global.g_mouse.x > 914 & g_Global.g_mouse.x < 1014) con.Draw2DText("Chart", F_V20, 924, 10, 0,255,255); } con.Draw2DText("Torpedo Fire Control state", F_V20, con.GetScreenCenterX() - 150, con.GetScreenCenterY() - 10, 0,255,255); // SMJ - 11/13/2007 Draw FPS on screen //if(g_Global.g_bDisplayFramerate == true) con.Draw2DText(g_Global.g_strFPS, F_V20, 0, 180, 0,0,255); con.Draw2DTextValue("X", (float)g_Global.g_mouse.x, F_V20, 0, 140, 255, 0, 0); con.Draw2DTextValue("Y", (float)g_Global.g_mouse.y, F_V20, 0, 160, 255, 0, 0); con.Draw2DTextValue("T", (float)pData->m_torpedos.size(), F_V20, 0, 200, 255, 0, 0); for(int i = 0; i < pData->m_torpedos.size(); ++i){ con.Draw2DTextValue("X", (float)pData->m_torpedos[i].GetPositionX(), F_V20, 0, 220 + i * 20, 255, 0, 0); con.Draw2DTextValue("Y", (float)pData->m_torpedos[i].GetPositionY(), F_V20, 220, 220 + i * 20, 255, 0, 0); con.Draw2DTextValue("S", (float)pData->m_torpedos[i].GetSpeed(), F_V20, 440, 220 + i * 20, 255, 0, 0); con.Draw2DTextValue("H", (float)pData->m_torpedos[i].GetHeading(), F_V20, 660, 220 + i * 20, 255, 0, 0); } con.EndDrawing (); con.Present(); }
void cGameStateHistory::render(Graphics &con){ //Clear buffer and draw graphics con.ClearBuffer(0, 0, 0, 0); con.BeginDrawing(); GRAPHIC_IMAGE gi; gi = g_Sprite.GetSpriteData(10); con.RenderGraphicModulate(con.GetScreenCenterX() - (float)(gi.width/2) , con.GetScreenCenterY() - (gi.height/2), gi, m_red, m_green, m_blue); con.Draw2DText("History state - Press SPACE to return.", F_V20, con.GetScreenCenterX() - 150, con.GetScreenCenterY() + (gi.height/2) + 20, 0,255,255); // SMJ - 11/13/2007 Draw FPS on screen if(g_Global.g_bDisplayFramerate == true) con.Draw2DText(g_Global.g_strFPS, F_V20, 0, 0, 0,0,255); con.EndDrawing (); con.Present(); }
void cGameStateIntro::render(Graphics &con){ //Clear buffer and draw graphics con.ClearBuffer(0, 0, 0, 0); con.BeginDrawing(); //render splash screen GRAPHIC_IMAGE gi; //flag is advanced by this amount m_motionStep = 1;//con.GetScreenWidth() / 256; //render splash - Tautog at sea gi = g_Sprite.GetSpriteData(1); gi.scale = 0.5; con.RenderGraphicModulate(con.GetScreenCenterX() - ((float)(gi.width * gi.scale)/2) , con.GetScreenCenterY() - (gi.height * gi.scale)/2, gi, 255, 255, 255);// m_red, m_green, m_blue); //TIGRS Rating gi = g_Sprite.GetSpriteData(31); con.RenderGraphicModulate(con.GetScreenWidth() - 180, con.GetScreenHeight() - 100, gi, 255, 255, 255);// m_red, m_green, m_blue); //move flag gi = g_Sprite.GetSpriteData(11); gi.scale = 1.0; con.RenderGraphicModulate(m_motionCount, m_motionCount * 2, gi, m_red, m_green, m_blue); if(m_motionCount > 200){ gi = g_Sprite.GetSpriteData(12); gi.scale = 1.0; con.RenderGraphicModulate(con.GetScreenCenterX() - ((float)(gi.width * gi.scale)/2), 100, gi, m_red, m_green, m_blue); con.Draw2DText("Left click to continue...", F_V20, con.GetScreenCenterX() - 120, con.GetScreenHeight() - 50, 200, 0, 0); } // SMJ - 11/13/2007 Draw FPS on screen if(g_Global.g_bDisplayFramerate == true) con.Draw2DText(g_Global.g_strFPS, F_V20, 0, 0, 0,0,255); con.EndDrawing (); con.Present(); }
void cGameStateSonar::render(Graphics &con){ //Clear buffer and draw graphics con.ClearBuffer(0, 0, 0, 0); con.BeginDrawing(); GRAPHIC_IMAGE gi; //display short cuts gi = g_Sprite.GetSpriteData(42);//sonar con.RenderGraphicModulate(10,10,gi,m_red, m_green, m_blue); gi = g_Sprite.GetSpriteData(37);//radar con.RenderGraphicModulate(120,10,gi,m_red, m_green, m_blue); gi = g_Sprite.GetSpriteData(38);//conn selected con.RenderGraphicModulate(230,10,gi,m_red, m_green, m_blue); gi = g_Sprite.GetSpriteData(39);//fire control con.RenderGraphicModulate(694,10,gi,m_red, m_green, m_blue); gi = g_Sprite.GetSpriteData(40);//damage control con.RenderGraphicModulate(804,10,gi,m_red, m_green, m_blue); gi = g_Sprite.GetSpriteData(41);//chart con.RenderGraphicModulate(914,10,gi,m_red, m_green, m_blue); //draw tool tips for short cuts if(g_Global.g_mouse.y > 10 && g_Global.g_mouse.y < 130){ // if(g_Global.g_mouse.x > 10 & g_Global.g_mouse.x < 104) // con.Draw2DText("Sonar", F_V20, 20, 10, 0,255,255); if(g_Global.g_mouse.x > 120 & g_Global.g_mouse.x < 207) con.Draw2DText("Radar", F_V20, 130, 10, 0,255,255); else if(g_Global.g_mouse.x > 230 & g_Global.g_mouse.x < 310) con.Draw2DText("Conn", F_V20, 240, 10, 0,255,255); else if(g_Global.g_mouse.x > 694 & g_Global.g_mouse.x < 794) con.Draw2DText("Torpedos", F_V20, 704, 10, 0,255,255); else if(g_Global.g_mouse.x > 804 & g_Global.g_mouse.x < 904) con.Draw2DText("Damage", F_V20, 814, 10, 0,255,255); else if(g_Global.g_mouse.x > 914 & g_Global.g_mouse.x < 1014) con.Draw2DText("Chart", F_V20, 924, 10, 0,255,255); } con.Draw2DText("Sonar state", F_V20, con.GetScreenCenterX() - 150, con.GetScreenCenterY() - 10, 0,255,255); // SMJ - 11/13/2007 Draw FPS on screen //if(g_Global.g_bDisplayFramerate == true) con.Draw2DText(g_Global.g_strFPS, F_V20, 0, 180, 0,0,255); con.Draw2DTextValue("X", (float)g_Global.g_mouse.x, F_V20, 0, 140, 255, 0, 0); con.Draw2DTextValue("Y", (float)g_Global.g_mouse.y, F_V20, 0, 160, 255, 0, 0); con.EndDrawing (); con.Present(); }
void cGameStateChart::render(Graphics &con){ //Clear buffer and draw graphics con.ClearBuffer(0, 0, 0, 0); con.BeginDrawing(); GRAPHIC_IMAGE gi; CGameData *pData = CGameData::Instance(); //draw chart stuff gi = g_Sprite.GetSpriteData(48);//white square for chart background gi.scale = 5.05; con.RenderGraphicModulate(262 + pData->m_shockX, 134 + pData->m_shockX, gi, m_red, m_green, m_blue); //chart highlights and reference lines con.DrawRect(262, 134, 762, 634,255, 0, 0); con.DrawLine(512, 134, 512, 634, 0, 0, 120); con.DrawLine(262, 384, 762, 384, 0, 0, 120); //draw user interface on right side of chart con.DrawLine(780, 134, 800, 134, 0, 255, 0);//horizontal tick marks con.DrawLine(780, 249, 800, 249, 0, 255, 0); con.DrawLine(780, 269, 800, 269, 0, 255, 0); con.DrawLine(780, 384, 800, 384, 0, 255, 0); con.DrawLine(790, 134, 790, 249, 0, 255, 0);//vertical lines con.DrawLine(790, 269, 790, 384, 0, 255, 0); //draw range con.Draw2DTextValue("SCALE", (float)m_chartScale[m_chartScaleIndex], F_V20, 780, 249, 0, 255, 0); //zoom in and zoom out if(g_Global.g_mouse.x > 806 && g_Global.g_mouse.x < 1006 && ::GetActiveWindow() == g_hWnd){ if(g_Global.g_mouse.y > 134 && g_Global.g_mouse.y < 249 && m_chartScaleIndex < 4){//zoom in gi = g_Sprite.GetSpriteData(30); con.RenderGraphicModulate(811,139,gi,m_red, m_green, m_blue); } else if(g_Global.g_mouse.y > 269 && g_Global.g_mouse.y < 384 && m_chartScaleIndex > 0){//zoom out gi = g_Sprite.GetSpriteData(29); con.RenderGraphicModulate(811,274,gi,m_red, m_green, m_blue); } } //display ship and sub data // CGameData *pData = CGameData::Instance(); float posX = 0, posY = 0; float range = (float)m_chartScale[m_chartScaleIndex]; //ships for(int i = 0; i < pData->m_targets.size(); ++i){ posX = (pData->m_targets[i].m_posX - pData->m_Player.m_posX) * 250/range; posY = (pData->m_targets[i].m_posY - pData->m_Player.m_posY) * 250/range; if(pData->m_targets[i].m_bAlive == true && posX >= -250 && posX <= 250 && posY >= -250 && posY <= 250)//{ con.DrawCircle(512 + posX,384 - posY, 255,0,0,(pData->m_targets[i].m_length/500) * (20000/(range * 2) )); } //torpedo for(int i = 0; i < pData->m_torpedos.size(); ++i){ posX = (pData->m_torpedos[i].GetPositionX()- pData->m_Player.m_posX) * 250/range; posY = (pData->m_torpedos[i].GetPositionY() - pData->m_Player.m_posY) * 250/range; if(pData->m_torpedos[i].IsRunning() == true && posX >= -250 && posX <= 250 && posY >= -250 && posY <= 250)//{ con.DrawCircle(512 + posX,384 - posY, 0, 0, 0,2 * (20000/(range * 8))); } //draw scope bearing line to indicate which target is being viewed float s = 0, t = 0; s = 512 + 250 * cos(pData->ConvertDegreesToRadians( pData->m_Player.m_heading + pData->m_scopeRotateAngle/5.689)); t = 384 - 250 * sin(pData->ConvertDegreesToRadians( pData->m_Player.m_heading + pData->m_scopeRotateAngle/ 5.689)); con.DrawLine(512,384,s,t, 0, 255,0); //draw sub in center of chart gi = g_Sprite.GetSpriteData(57); gi.rotationAngle = pData->m_Player.m_heading * 3.141592654/180; gi.scale = 1;// (1000/range); con.RenderGraphicModulate(512 - (gi.width/2)* gi.scale, 384 - (gi.height/2) * gi.scale, gi, m_red, m_green, m_blue); //display short cuts gi = g_Sprite.GetSpriteData(36);//sonar con.RenderGraphicModulate(10,10,gi,m_red, m_green, m_blue); gi = g_Sprite.GetSpriteData(37);//radar con.RenderGraphicModulate(120,10,gi,m_red, m_green, m_blue); gi = g_Sprite.GetSpriteData(38);//conn selected con.RenderGraphicModulate(230,10,gi,m_red, m_green, m_blue); gi = g_Sprite.GetSpriteData(39);//fire control con.RenderGraphicModulate(694,10,gi,m_red, m_green, m_blue); gi = g_Sprite.GetSpriteData(40);//damage control con.RenderGraphicModulate(804,10,gi,m_red, m_green, m_blue); gi = g_Sprite.GetSpriteData(47);//chart con.RenderGraphicModulate(914,10,gi,m_red, m_green, m_blue); //draw tool tips for short cuts if(g_Global.g_mouse.y > 10 && g_Global.g_mouse.y < 130){ //if(g_Global.g_mouse.x > 10 & g_Global.g_mouse.x < 104) // con.Draw2DText("Sonar", F_V20, 20, 10, 0,255,255); //else if(g_Global.g_mouse.x > 120 & g_Global.g_mouse.x < 207) // con.Draw2DText("Radar", F_V20, 130, 10, 0,255,255); if(g_Global.g_mouse.x > 230 & g_Global.g_mouse.x < 310) con.Draw2DText("Conn", F_V20, 240, 10, 0,255,255); //else if(g_Global.g_mouse.x > 694 & g_Global.g_mouse.x < 794) // con.Draw2DText("Torpedos", F_V20, 704, 10, 0,255,255); //else if(g_Global.g_mouse.x > 804 & g_Global.g_mouse.x < 904) // con.Draw2DText("Damage", F_V20, 814, 10, 0,255,255); } // SMJ - 11/13/2007 Draw FPS on screen if(g_Global.g_bDisplayFramerate == true) con.Draw2DText(g_Global.g_strFPS, F_V20, 0, 720, 0,255,255); //con.Draw2DTextValue("subX", (long)pData->m_Player.m_posX, F_V20, 0, 140, 255, 0, 0); //con.Draw2DTextValue("subY", (long)pData->m_Player.m_posY, F_V20, 0, 160, 255, 0, 0); //con.Draw2DTextValue("T", (long)pData->m_torpedos.size(), F_V20, 0, 200, 255, 0, 0); con.Draw2DTextValue("BRG", (long)( (float)pData->m_scopeRotateAngle/5.689),F_V20,484, 640, 255, 255, 0); con.Draw2DTextValue("Damage", (long)( (float)pData->m_Player.m_damage),F_V20,474, 660, 255, 0, 0); //display target data //for(int i = 0; i < pData->m_targets.size(); ++i){ /// con.Draw2DTextValue("X", (long)pData->m_targets[i].m_posX, F_V20, 0, 220 + (i * 20), 255, 0, 0); // con.Draw2DTextValue("Y", (long)pData->m_targets[i].m_posY, F_V20, 120, 220 + (i * 20), 255, 0, 0); //} con.EndDrawing (); con.Present(); }