Ejemplo n.º 1
0
        protected override void Update(GameTime gameTime)
        {
            base.Update(gameTime);
            Controls();
            ControlOpacity(gameTime);
            foreach (Nova_Particle p in particles)
            {
                p.Update(gameTime, Matrix.CreateTranslation(0, 0, 0));
            }
            if (!isShow)
            {
                Nova_Particle p = new Nova_Particle();
                p.SetTexture(Nova_DataBase.GetTexture("bar"), SpriteEffects.None, Microsoft.Xna.Framework.Color.Blue);
                p.Position        = new Vector2(0, 75);
                p.LifeTime        = 1500;
                p.InitialLifeTime = 1500;
                p.SetFadeOut(1500);
                p.IsAllColorsUntilDie = true;
                p.SetDirectionSpeed(new Vector2(20, 0));
                p.inflateSizeHeight = (int)(sumPower * 3);
                p.SetInternalRotation(0, 1, Nova_Functions.GetCenterOf(p.GetCurrentTexture()), Nova_Particle.RotationDirectionEnum.clockwise);
                p.inflateSizeWidth = 10;
                emiters.Add(p);

                Nova_Particle.DoUpdateParticles(emiters, gameTime, Matrix.CreateTranslation(0, 0, 0));
            }
            UpdatePlayer();
        }
Ejemplo n.º 2
0
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Microsoft.Xna.Framework.Color.Black);
            GetForm().TopMost = true;
            GetForm().Show();
            GetForm().BringToFront();

            if (isShow)
            {
                GetForm().Location = new System.Drawing.Point(0, GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height - imageHeight);

                spriteBatch.Begin();
                Vector2 centerImagePosition = new Vector2(0, (isShow ? 300 : 150) - imageHeight);
                spriteBatch.Draw(arts[index] == null ? Nova_DataBase.GetTexture("default") : arts[index], new Microsoft.Xna.Framework.Rectangle((int)centerImagePosition.X, (int)centerImagePosition.Y, imageWidth, imageHeight), Microsoft.Xna.Framework.Color.White);
                Nova_Functions.DrawBorderString(spriteBatch, Nova_DataBase.GetFont("font"), songs[index].Name.Substring(songs[index].Name.IndexOf("Musics") + 1 + "Musics".Length), new Vector2(550, 10), Microsoft.Xna.Framework.Color.Red, Microsoft.Xna.Framework.Color.Blue);
                spriteBatch.End();
                spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive);
                foreach (Nova_Particle p in particles)
                {
                    p.Draw(spriteBatch);
                }
                spriteBatch.End();
            }
            else
            {
                GetForm().Opacity  = 0.5f;
                GetForm().Location = new System.Drawing.Point(0, GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height - imageHeight / 2);
                spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive);
                Nova_Particle.DoDrawParticles(emiters, spriteBatch);
                spriteBatch.End();
            }

            base.Draw(gameTime);
        }
Ejemplo n.º 3
0
 private void PerformNormalState()
 {
     GetForm().Opacity = 0.3f;
     timeShowed        = 0;
     Nova_Functions.ChangeResolution(Nova_Functions.View.Width, 150, true);
     for (int i = 0; i < 256; i++)
     {
         particles[i].Position = new Vector2((i * 7.4f), 160);
     }
 }
Ejemplo n.º 4
0
 public Player()
 {
     graphics = new GraphicsDeviceManager(this);
     Content.RootDirectory = "Content";
     Nova_Functions.SetGraphics(graphics);
     Nova_Functions.SetGame(this);
     Nova_Functions.ConfigureGraphics(true, true, false, SurfaceFormat.Color, DepthFormat.None);
     Nova_Functions.ChangeResolution(GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width, imageHeight, false);
     GetForm().Location = new System.Drawing.Point(0, GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height - imageHeight);
     IsMouseVisible     = true;
 }
Ejemplo n.º 5
0
 private void PerformShowOpacity()
 {
     GetForm().Opacity = 0;
     isShow            = true;
     timeShowed        = 0;
     Nova_Functions.ChangeResolution(Nova_Functions.View.Width, 300, true);
     for (int i = 0; i < 256; i++)
     {
         particles[i].Position = new Vector2(imageWidth + 50 + (i * 5), 160);
     }
 }
Ejemplo n.º 6
0
 private void LoadParticles()
 {
     for (int i = 0; i < QTD_BARS; i++)
     {
         Nova_Particle p = new Nova_Particle();
         p.SetTexture(Nova_DataBase.GetTexture("bar"), SpriteEffects.None, Microsoft.Xna.Framework.Color.White);
         p.ParticleColor = Nova_Functions.HSVToColor((6f / (float)QTD_BARS * i), 1, 1);
         // p.Position = new Vector2(((float)Nova_Functions.View.Width / QTD_BARS) * i, Nova_Functions.View.Height / 2 - p.GetCurrentTexture().Height / 2);
         p.Position = new Vector2(((float)Nova_Functions.View.Width / QTD_BARS) * i, 0);
         // p.SetAngle(-i, Nova_Functions.GetCenterOf(p.GetCurrentTexture()));
         // p.SetDirectionRotation(400, 200, 0, 0, i, i, 0, 0, true);
         p.IsInflateBothSides = true;
         particles[i]         = p;
     }
 }
Ejemplo n.º 7
0
        public Main()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
            Nova_Functions.SetGraphics(graphics);
            Nova_Functions.SetGame(this);
            int width = 0;

            foreach (var x in GraphicsAdapter.Adapters)
            {
                width += x.CurrentDisplayMode.Width;
            }
            // Nova_Functions.ConfigureGraphics(true, true, false, SurfaceFormat.Color, DepthFormat.None);
            Nova_Functions.ChangeResolution(width, GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height, false);
            graphics.PreferredBackBufferWidth  = width;
            graphics.PreferredBackBufferHeight = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height;
            GetForm().Location = new System.Drawing.Point(0, 0);
            GetForm().Size     = new Size(GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width, GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height);
            IsMouseVisible     = true;
        }
Ejemplo n.º 8
0
 protected override void LoadContent()
 {
     spriteBatch = new SpriteBatch(GraphicsDevice);
     Nova_Importer.SetContent(Content);
     Nova_Functions.SetViewport(GraphicsDevice);
     target = new RenderTarget2D(GraphicsDevice, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight);
     Nova_Importer.LoadResource("font", "font");
     Nova_Importer.LoadResource("default", "default");
     Nova_Importer.LoadResource("bar", "bar");
     starTexture = Content.Load <Texture2D>("star");
     LoadParticles();
     player.StartCaptureAudioFromDefaultPlayerDevice();
     ThreadPool.QueueUserWorkItem(async(object o) =>
     {
         while (true)
         {
             oldArray = player.GetCurrentLinearFrequencies();
             await Task.Delay(32);
         }
     });
 }
Ejemplo n.º 9
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);
            Nova_Importer.SetContent(Content);
            Nova_Functions.SetViewport(GraphicsDevice);

            int resourceNumber = 0;

            foreach (FileInfo file in new DirectoryInfo(MUSIC_PATH).GetFiles("*.mp3", SearchOption.AllDirectories))
            {
                songs.Add((Song)Nova_Importer.LoadExternalAndReturn(Path.Combine(Environment.CurrentDirectory, "Content", "Musics"), file, "MUSIC" + resourceNumber.ToString(), Nova_Importer.ImportType.Music));
                TagLib.File fileB = TagLib.File.Create(file.FullName);
                if (fileB.Tag.Pictures.Any())
                {
                    byte[] bin           = fileB.Tag.Pictures[0].Data.Data;
                    String imageFileDest = Path.Combine(Path.GetTempPath(), Nova_Functions.GetFileName(file) + "IMAGE" + ".jpg");
                    Image.FromStream(new MemoryStream(bin)).Save(imageFileDest, System.Drawing.Imaging.ImageFormat.Jpeg);
                    arts.Add((Texture2D)Nova_Importer.LoadExternalAndReturn(Path.Combine(Environment.CurrentDirectory, "Content", "Images"), new FileInfo(imageFileDest), Nova_Functions.GetFileName(file) + "IMAGE", Nova_Importer.ImportType.Texture));
                }
                else
                {
                    arts.Add(null);
                }

                resourceNumber++;
            }
            Nova_Importer.LoadResource("font", "font");
            Nova_Importer.LoadResource("default", "default");
            Nova_Importer.LoadResource("bar", "bar");

            if (arts[arts.Count - 1] == null)
            {
                arts[arts.Count - 1] = Nova_DataBase.GetTexture("default");
            }

            LoadParticles();


            Nova_Audio.playMusicViaSound(songs[0]);
        }
Ejemplo n.º 10
0
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Microsoft.Xna.Framework.Color.Black);
            GetForm().TopMost = true;
            GetForm().Opacity = opacity;
            if (change)
            {
                GetForm().Size = new Size(Nova_Functions.View.Width, Nova_Functions.View.Height);

                GetForm().Show();
                GetForm().BringToFront();
            }
            change = false;
            GraphicsDevice.SetRenderTarget(target);
            spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive);

            Nova_Particle.DoDrawParticles(emitersText, spriteBatch);
            Nova_Particle.DoDrawParticles(particles.ToList(), spriteBatch);
            //for ( int i = 0; i < emiters.Count; i++)
            //{
            //    Nova_Particle p = emiters[i];
            //    p.Draw(spriteBatch);
            //    if (p.LifeTime <= 0)
            //    {
            //        emiters.Remove(p);
            //        i--;
            //    }
            //}
            spriteBatch.End();

            GraphicsDevice.SetRenderTarget(null);
            spriteBatch.Begin(0, BlendState.Additive);
            spriteBatch.Draw(target, Vector2.Zero, Microsoft.Xna.Framework.Color.White);
            spriteBatch.Draw(target, Nova_Functions.ReturnScreenRectangle(), null, Microsoft.Xna.Framework.Color.White, 0, Vector2.Zero, SpriteEffects.FlipVertically | SpriteEffects.FlipHorizontally, 1f);
            spriteBatch.End();
            base.Draw(gameTime);
        }
Ejemplo n.º 11
0
        public void UpdatePlayer()
        {
            float aux = sumPower;

            sumPower = 0;
            if (oldArray == null)
            {
                return;
            }
            for (int i = 0; i < QTD_BARS; i++)
            {
                float maxValue = (float)(oldArray[(int)Math.Ceiling(255f / (float)QTD_BARS * (float)i)].Value * 20);
                particles[i].CustomSizeHeight = (int)Nova_Functions.ApproxNumbers(particles[i].CustomSizeHeight, maxValue, 1 + maxValue / 20);
                if (i < 20)
                {
                    sumPower += (float)oldArray[i].Value / 30;
                }
            }
            colorIndex += 0.01f;
            if (colorIndex > 6)
            {
                colorIndex = 0f;
            }
        }
Ejemplo n.º 12
0
 public Form GetForm()
 {
     return(Nova_Functions.GetWindowsFormFrom(Window.Handle));
 }