Esempio n. 1
0
        // ***************************************************************************
        // Läd und erzeugt das eigentliche Spiel
        private void startButtonEvent()
        {
            Debug.WriteLine("Erstelle / Lade spiel (startButtonEvent)");

            drawSub = DrawLoading;
            updateSub = UpdateLoading;

            Thread thread = new Thread(new ThreadStart(Main.MainObject.GameManager.Load));
            thread.Start();
        }
Esempio n. 2
0
        // ***************************************************************************
        // Update des Intro
        private void UpdateIntro()
        {
            // Zeit seit dem start des intros
            introTimer += (float)Main.GameTimeUpdate.ElapsedGameTime.TotalSeconds;

            // Intro überspringen
            if (Mouse.GetState().LeftButton == ButtonState.Pressed || Mouse.GetState().RightButton == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape) || introTimer > 11)
            {
                Debug.WriteLine("Intro beendet");
                drawSub = DrawStartmenu;
                updateSub = UpdateStartmenu;
            }

            // Position von hdm logo berechnen
            float faktor = 5;
            hdmPosition.X = Configuration.GetInt("resolutionWidth") / 2 - (int)(hdmLogo.Width / faktor / 2);
            hdmPosition.Y = Configuration.GetInt("resolutionHeight") / 2 - (int)(hdmLogo.Height / faktor / 2);
            hdmPosition.Width = (int)(hdmLogo.Width / faktor);
            hdmPosition.Height = (int)(hdmLogo.Height / faktor);

            // Position von Text berechnen
            Vector2 textSize = fontArialSmall.MeasureString(text);
            textPosition.X = Configuration.GetInt("resolutionWidth") / 2 - (int)(textSize.X / 2);
            textPosition.Y = Configuration.GetInt("resolutionHeight") / 2 - (int)(textSize.Y / 2);

            // Fade HDM
            if (introTimer < 5)
                fadeHdm = MathHelper.Clamp(introTimer - 1, 0, 1);
            else
                fadeHdm = MathHelper.Clamp(1 - MathHelper.Clamp(introTimer - 5, 0, 1), 0, 1);

            // Fade Text
            if (introTimer < 10)
                fadeText = MathHelper.Clamp(introTimer - 6, 0, 1);
            else
                fadeText = MathHelper.Clamp(1 - MathHelper.Clamp(introTimer - 10, 0, 1), 0, 1);
        }
Esempio n. 3
0
        // ***************************************************************************
        // Initialisierung von Variable, Laden der Texturen etc.
        private void LoadMenu()
        {
            Debug.WriteLine("Benötigter Content für Menu laden.");

            // Highscore Laden
            HighscoreHelper.LoadHighscore();

            ContentManager content = Main.ContentManager;

            // Initialisierung
            UI.MouseCursor.CurrentCursor = UI.MouseCursor.DefaultCursor;
            drawSub = DrawIntro;
            updateSub = UpdateIntro;

            hdmPosition = new Rectangle();
            textPosition = new Vector2();

            text = "PROJEKT SS 2012 - MEDIENINFORMATIK ";
            LoadingText = "";

            // Läd Texturen die bnötigt werden
            background = content.Load<Texture2D>("images/menu/background");
            pixelWhite = content.Load<Texture2D>("images/pixelWhite");
            hdmLogo = content.Load<Texture2D>("images/hdm_transparent");

            Texture2D imgStart = content.Load<Texture2D>("images/menu/start");
            Texture2D imgStartHover = content.Load<Texture2D>("images/menu/startH");

            Texture2D imgExit = content.Load<Texture2D>("images/menu/exit");
            Texture2D imgExitHover = content.Load<Texture2D>("images/menu/exitH");

            Texture2D imgCredits = content.Load<Texture2D>("images/menu/credits");
            Texture2D imgCreditsHover = content.Load<Texture2D>("images/menu/creditsH");

            Texture2D imgOptions = content.Load<Texture2D>("images/menu/options");
            Texture2D imgOptionsHover = content.Load<Texture2D>("images/menu/optionsH");

            // Fonts laden
            fontDefault = content.Load<SpriteFont>("fonts/defaultMedium");
            fontArialSmall = content.Load<SpriteFont>("fonts/arialSmall");

            // Menü erzeugen
            menuPanel = new UIPanel(0, 0, new Vector2(0, 0));

            btnStart = new UIButton(new Vector2(99, 152), imgStart, imgStartHover);
            btnExit = new UIButton(new Vector2(849, 490), imgExit, imgExitHover);
            btnCredits = new UIButton(new Vector2(0, 507), imgCredits, imgCreditsHover);
            btnHighscore = new UIButton(new Vector2(337, 209), imgOptions, imgOptionsHover);

            btnStart.AddActionListener(this);
            btnExit.AddActionListener(this);
            btnCredits.AddActionListener(this);
            btnHighscore.AddActionListener(this);

            menuPanel.Add(btnStart);
            menuPanel.Add(btnExit);
            menuPanel.Add(btnCredits);
            menuPanel.Add(btnHighscore);
        }