コード例 #1
0
 public void Draw(SpriteBatch pSpriteBatch, SpriteFont pFont)
 {
     foreach (Vector2 pos in list_backgroundStars)
     {
         pSpriteBatch.DrawPoint(pos, Color.White, 1);
     }
     currentSystemSolar.Draw(pSpriteBatch, pFont, myInterfaceManager);
     myInterfaceManager.Draw(pSpriteBatch);
 }
コード例 #2
0
        public void DrawGameplay()
        {
            //-- CONTROL PANEL
            Vector2 backgroundPosition     = new Vector2(0, 0 - (myGameState.defaultAltitude - myGameState.currentAltitude));
            Vector2 backgroundSkyPosition1 = backgroundPosition;

            if (backgroundPosition.Y > 0)
            {
                spriteBatch.Draw(img_backgroundsky, backgroundSkyPosition1, null, null, new Vector2(0, img_backgroundsky.Height), 0, new Vector2(resolutionFactor, resolutionFactor));
            }
            if (backgroundPosition.Y < GraphicsDevice.Viewport.Height)
            {
                spriteBatch.Draw(img_background, backgroundPosition, null, null, Vector2.Zero, 0, new Vector2(resolutionFactor, resolutionFactor));
            }
            else if (myGameState.currentAltitude > 5000)
            {
                myParticleStarManager.addParticleStar(myRandom, img_star, GraphicsDevice, 0.1f);
                myParticleStarManager.Draw(spriteBatch);
            }
            //-- DYNAMIC ROCKET AND LAUNCHPAD
            Vector2 launchpadPosition = new Vector2(GraphicsDevice.Viewport.Width / 2, panelHeight);

            spriteBatch.Draw(img_launchPad, new Vector2(launchpadPosition.X, launchpadPosition.Y - (myGameState.defaultAltitude - myGameState.currentAltitude)), null, null, new Vector2(img_launchPad.Width / 2, img_launchPad.Height), 0f, new Vector2(1, 1), Color.White, SpriteEffects.None, 0);
            myRocket.Draw(spriteBatch);
            // --
            Color panelColor = Color.Black;

            spriteBatch.Draw(img_controlpanel, new Vector2(0, panelHeight), null, null, Vector2.Zero, 0, new Vector2(resolutionFactor, resolutionFactor), Color.White, SpriteEffects.None, 0);
            //-- DYNAMIC PANEL
            if (panel_buttonElectricity.isOn)
            {
                panel_countHumans.isVisible       = true;
                panel_planetName.isVisible        = true;
                panel_planetTemperature.isVisible = true;
                panel_rocketAltitude.isVisible    = true;
                panel_textPlanet.isVisible        = true;
                panel_textRocket.isVisible        = true;
                panel_stabilized.isVisible        = true;
                panel_stabilized.UpdateDisplay(myGameState.isStabilized);
                panel_countHumans.UpdateDisplay(myGameState.count_humans + " HUMANS");
                panel_planetName.UpdateDisplay("ID: " + myGameState.currentPlanet.name);
                panel_planetTemperature.UpdateDisplay(myGameState.currentPlanet.temperature.ToString() + " F");
                panel_rocketAltitude.UpdateDisplay(myGameState.currentAltitude.ToString() + " KM");
            }
            else
            {
                panel_stabilized.isVisible        = false;
                panel_countHumans.isVisible       = false;
                panel_planetName.isVisible        = false;
                panel_planetTemperature.isVisible = false;
                panel_rocketAltitude.isVisible    = false;
                panel_planetName.isVisible        = false;
                panel_textPlanet.isVisible        = false;
                panel_textRocket.isVisible        = false;
            }
            panel_fuelJauge.UpdateDisplay(myGameState.currentFuel);
            panel_tempJauge.UpdateDisplay(myGameState.currentTemperature);
            panel_oxyJauge.UpdateDisplay(myGameState.currentOxygene);

            float   ledScale    = 0.1f;
            Vector2 ledPosition = new Vector2(panel_buttonElectricity.position.X + 7, panel_buttonElectricity.position.Y - 20);

            if (panel_buttonElectricity.isOn)
            {
                spriteBatch.Draw(img_ledOn, ledPosition, null, null, new Vector2((img_ledOn.Width * ledScale) / 2, img_ledOn.Height / 2), 0, new Vector2(ledScale, ledScale), Color.White, SpriteEffects.None, 0);
            }
            else
            {
                spriteBatch.Draw(img_ledOff, ledPosition, null, null, new Vector2((img_ledOn.Width * ledScale) / 2, img_ledOn.Height / 2), 0, new Vector2(ledScale, ledScale), Color.White, SpriteEffects.None, 0);
            }

            myInterfaceManager.Draw(spriteBatch);
        }