コード例 #1
0
ファイル: OptionsMenu.cs プロジェクト: rubna/MetroidClone
        public OptionsMenu(DrawWrapper Drawing, GraphicsDeviceManager Graphics, AudioWrapper Audio, InputHelper Input)
        {
            drawing = Drawing;
            audio = Audio;
            graphics = Graphics;
            input = Input;
            Quit = false;
            selectedButton = MenuButton.None;

            soundColor = audio.AudioIsEnabled ? Color.DarkGreen : Color.DarkRed;
            musicColor = audio.MusicIsEnabled ? Color.DarkGreen : Color.DarkRed;
            controllerColor = input.ControllerInUse ? Color.DarkGreen : Color.DarkRed;
            fullscreenColor = graphics.IsFullScreen ? Color.DarkGreen : Color.DarkRed;

            soundButton = new Rectangle((int)drawing.GUISize.X / 2 - 100, (int)drawing.GUISize.Y / 2 - 300, 200, 100);
            musicButton = new Rectangle((int)drawing.GUISize.X / 2 - 100, (int)drawing.GUISize.Y / 2 - 150, 200, 100);
            //controllerButton = new Rectangle((int)drawing.GUISize.X / 2 - 100, (int)drawing.GUISize.Y / 2 - 50, 200, 100);
            fullscreenButton = new Rectangle((int)drawing.GUISize.X / 2 - 100, (int)drawing.GUISize.Y / 2, 200, 100);
            quitButton = new Rectangle((int)drawing.GUISize.X / 2 - 100, (int)drawing.GUISize.Y / 2 + 150, 200, 100);
        }
コード例 #2
0
ファイル: MainGame.cs プロジェクト: rubna/MetroidClone
        protected override void Initialize()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);
            drawWrapper = new DrawWrapper(spriteBatch, GraphicsDevice, assetManager);
            audioWrapper = new AudioWrapper(assetManager);

            world = new World();
            mainMenu = new MainMenu(drawWrapper);

            Graphics.PreferMultiSampling = true;
            Graphics.SynchronizeWithVerticalRetrace = true;
            Graphics.PreferredBackBufferWidth = 24 * 20 * 2;
            Graphics.PreferredBackBufferHeight = 24 * 15 * 2;

            Graphics.ApplyChanges();

            IsFixedTimeStep = true;

            TargetElapsedTime = TimeSpan.FromMilliseconds(1000f / 60f);

            IsMouseVisible = true;

            base.Initialize();
        }