Ejemplo n.º 1
0
 public override void Initialize()
 {
     //Calling Assets
     fade = new Texture2D(Globals.graphics.GraphicsDevice, 1, 1, false, SurfaceFormat.Color);//blank texture
     fade.SetData<Color>(new Color[] { Color.Black });
     font = Globals.content.Load<SpriteFont>("smallfont");
     Play = new SceneButton("Play", "start_button", new Vector2(600, 600), new Rectangle(1070,630,200,60));
     Back = new SceneButton("Back", "back_button", new Vector2(100, 600), new Rectangle(10,630,200,60));
     scenebuttons = new SceneButton[2] {Play,Back};
     BottomBar = Globals.content.Load<Texture2D>("BottomBar");
     Songs = new HashSet<SongButton>();
     int i = 0;
     int x, y, w, h;
     //makes song buttons out of folders
     foreach (String folder in Directory.GetDirectories(Options.SongFolder))
     {
         w=Options.Resolutions.X*1/5;
         h=(Options.Resolutions.Y*9/10-30)*12/45;
         x=Options.Resolutions.X/20+(w+Options.Resolutions.X/30)*(i/3);
         y=Options.Resolutions.Y/20+(h+Options.Resolutions.Y/45)*(i%3);
         Rectangle rect = new Rectangle(x, y, w, h);
         Songs.Add(new SongButton(rect,folder));
         i++;
         Width = (x + w + (double)Options.Resolutions.X/5) / (double)Options.Resolutions.X;
     }
     songbar = new SceneSlider(new Rectangle(1, Options.Resolutions.Y*4/5, Options.Resolutions.X-2, 20), Width);
     songbar.scrollable = true;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Perform any scene specific initialization.
        /// </summary>
        public override void Initialize()
        {
            focused = false;
            cancelButton = new SceneButton("Cancel", "ExitContent/cancelbutton", new Vector2(340, 120));
            exitButton = new SceneButton("Exit", "ExitContent/exitbutton", new Vector2(340, 220));

            sceneButtons = new SceneButton[2] { cancelButton, exitButton };
        }
Ejemplo n.º 3
0
 public override void Initialize()
 {
     blank = new Texture2D(Globals.graphics.GraphicsDevice, 1, 1);
     blank.SetData(new Color[] { Color.White });
     font = Globals.content.Load<SpriteFont>("NewSpriteFont");
     bigfont = Globals.content.Load<SpriteFont>("BiggerFont");
     Back = new SceneButton("Continue", "back_button", new Vector2(200, 200), new Rectangle(0, 645, 200, 75));
     points = Globals.wave.get_data_size()/10000 + hits * 100 - dmg * 300;
     tot = Globals.wave.get_data_size() / 10000 + hits * 100;
     x2 = 300 * dmg * 300 / tot;
     x1 = 300 * (tot - dmg * 300) / tot;
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Perform any scene specific initialization.
        /// </summary>
        public override void Initialize()
        {
            font = Globals.content.Load<SpriteFont>("NewSpriteFont");
            logo = Globals.content.Load<Texture2D>("models/Logo");
            bloomSelectButton = new SceneButton("Folder Select", "folder_button", new Vector2(1020, 620),new Rectangle(1020,620,260,110));
            backButton = new SceneButton("Back", "back_button", new Vector2(0,650), new Rectangle(0, 650, 200, 80));
            bgDimSlider = new SceneSlider("BG Dim", new Rectangle(340, 280, 300, 50), 5,Options.BackgroundDim);
            globalVolumeSlider = new SceneSlider("Global Volume", new Rectangle(340, 380, 300, 50), 5,Options.Volumes.GlobalVolume);//need to start at .5 since the actualy values start at .5
            sfxVolumeSlider = new SceneSlider("SFX Volume", new Rectangle(340, 480, 300, 50), 5,Options.Volumes.SoundFXVolume);
            musicVolumeSlider = new SceneSlider("Music Volume", new Rectangle(340, 580, 300, 50), 5,Options.Volumes.MusicVolume);

            sceneButtons = new SceneButton[2] { bloomSelectButton, backButton };
            sceneSliders = new SceneSlider[4] { bgDimSlider, globalVolumeSlider, sfxVolumeSlider, musicVolumeSlider };
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Return the currently selected menu button based on the previous
        /// menu parameters.
        /// </summary>
        /// <param name="current_selected">The index of the currently selected button.</param>
        /// <param name="buttons">The array of buttons.</param>
        /// <param name="increment">The key that increments the selection.</param>
        /// <param name="decrement">The key that decrements the selection.</param>
        /// <param name="wrap">
        /// Determines what happens when the selection becomes < 0 or greater than the
        /// length of the array. If true, then the selection is modded by the length of
        /// the array. If false it is clamped.
        /// </param>
        /// <returns></returns>
        public static int? GetMenuSelection(
            int? current_selected, SceneButton[] buttons, 
            Keys increment, Keys decrement, 
            bool wrap = true, int default_selection = 0)
        {
            // Local aliases for previous and current mouse and keyboard states.
            MouseState pms = Globals.previousMouseState;
            MouseState cms = Globals.currentMouseState;

            KeyboardState pks = Globals.previousKeyboardState;
            KeyboardState cks = Globals.currentKeyboardState;

            // If the mouse states are valid, and the positions are different (implying
            // the mouse has moved).
            if (pms != null && cms.Position != pms.Position)
            {
                ParticleCollider mouse_pos = new ParticleCollider(cms.Position);
                // Find the first button that collides with the mouse.
                for (int i = 0; i < buttons.Length; i++)
                {
                    if (CollisionChecker.Collision(buttons[i].CollisionMask, mouse_pos))
                        return i;
                }
            }
            // Else if the keyboard states are valid.
            else if (pks != null)
            {
                // If the increment key was pressed once.
                if (
                    cks.IsKeyDown(increment) &&
                    !pks.IsKeyDown(increment))
                {
                    // Return the default value if current_selected == null.
                    if (!current_selected.HasValue)
                        return default_selection;
                    int new_selection = current_selected.Value - 1;
                    // Clamp or wrap the selection.
                    if (wrap)
                        return new_selection % buttons.Length;
                    return wrap ? new_selection % buttons.Length
                                : (int)MathHelper.Clamp(new_selection, 0, buttons.Length);
                }
                // If the decrement key was pressed once.
                else if (
                    cks.IsKeyDown(decrement) &&
                    !pks.IsKeyDown(decrement))
                {
                    // Return the default value if current_selected == null.
                    if (!current_selected.HasValue)
                        return default_selection;
                    int new_selection = current_selected.Value - 1;
                    // Clamp or wrap the selection.
                    if (wrap)
                        return new_selection % buttons.Length;
                    return wrap ? new_selection % buttons.Length
                                : (int)MathHelper.Clamp(new_selection, 0, buttons.Length);
                }
            }
            // Return the current_selected value or null.
            return current_selected ?? null;
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Perform any scene specific initialization.
        /// </summary>
        public override void Initialize()
        {
            spectrum = new Visualizer2(Globals.wave);
            focused = true;//first interactable scene so it's guarenteed to be focused
            // NOTE: Awaiting assets.

            Vector2 centre = new Vector2(Options.Resolutions.X / 2, Options.Resolutions.Y / 2);
            // Initialize the buttons. If the buttons are sectors, the smaller angle must be first
            MainButton = new SceneButton("Main", "MainMenuContent/MainButton", new Vector2(340, 220),new Rectangle(340,210,300,300));
            startButton = new SceneButton("Exit", "MainMenuContent/ExitButton", new Vector2(340, 220), new Rectangle(290, 160, 200, 200));
            optionsButton = new SceneButton("Play", "MainMenuContent/PlayButton", new Vector2(480, 220), new Rectangle(490, 160, 200, 200));
            aboutButton = new SceneButton("Options", "MainMenuContent/OptionsButton", new Vector2(340, 360), new Rectangle(290, 360, 200, 200));
            exitButton = new SceneButton("About", "MainMenuContent/EditButton", new Vector2(480, 360), new Rectangle(490, 360, 200, 200));

            // Initialize extra components.
            /*
            logo = new SceneTexture(@"MainMenuContent/Logo");
            copyright = new SceneText("Copyright (c) 2015 FCDM", @"MainMenuContent/CopyrightFont");
             */

            sceneButtons = new SceneButton[5] {
                startButton,
                optionsButton,
                aboutButton,
                exitButton,
                MainButton
            };

            //Console.WriteLine(System.IO.Directory.GetCurrentDirectory());
        }
Ejemplo n.º 7
0
        public override void Initialize()
        {
            mainFont = Globals.content.Load<SpriteFont>("Fonts/InitSceneFont");
            pathFont = Globals.content.Load<SpriteFont>("Fonts/PathFont");
            background = Globals.content.Load<Texture2D>("Backgrounds/InitSceneBG");

            // Load the buttons
            ChooseFolderButton = new SceneButton("Button", "InitSceneContent/ChooseFolderButton", buttonPositions[0], buttonRects[0]);
            AcceptButton = new FadingSceneButton(
                "InitSceneContent/AcceptButton", "InitSceneContent/AcceptButtonHover", "InitSceneContent/AcceptButtonClicked",
                buttonPositions[1], buttonRects[1], 800d, 1);
            DenyButton = new FadingSceneButton(
                "InitSceneContent/DenyButton", "InitSceneContent/DenyButtonHover", "InitSceneContent/DenyButtonClicked",
                buttonPositions[2], buttonRects[2], 800d, 1);
        }