Пример #1
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            OrientationSensor = OrientationSensor.GetDefault();
            if (OrientationSensor == null)
            {
                SimpleOrientationSensor = SimpleOrientationSensor.GetDefault();
                if (SimpleOrientationSensor == null)
                {
                    throw new Exception("No way of determining orientation");
                }
            }

            TouchPanel.EnabledGestures = GestureType.Hold | GestureType.Flick | GestureType.HorizontalDrag | GestureType.VerticalDrag | GestureType.DragComplete;

            vertexBuffer = new DynamicVertexBuffer(graphics.GraphicsDevice, typeof(VertexPositionColor), 8, BufferUsage.WriteOnly);
            indexBuffer  = new DynamicIndexBuffer(graphics.GraphicsDevice, typeof(ushort), 36, BufferUsage.WriteOnly);

            basicEffect = new BasicEffect(graphics.GraphicsDevice); //(device, null);
            basicEffect.LightingEnabled    = false;
            basicEffect.VertexColorEnabled = true;
            basicEffect.TextureEnabled     = false;

            DepthStencilState depthBufferState = new DepthStencilState();

            depthBufferState.DepthBufferEnable = true;
            GraphicsDevice.DepthStencilState   = depthBufferState;

            TetrisState.Initialize(graphics.GraphicsDevice);

            Windows.UI.ViewManagement.ApplicationView.GetForCurrentView().SuppressSystemOverlays = true;
            graphics.SupportedOrientations = DisplayOrientation.Portrait;

            base.Initialize();
        }
Пример #2
0
        private void ResetSettings()
        {
            // сбрасываем настройки игры

            Properties.Settings.Default.Reset();
            Properties.Settings.Default.Save();

            Tetris.TankWidth  = Properties.Settings.Default.TankWidth;
            Tetris.TankHeight = Properties.Settings.Default.TankHeight;
            Tetris.FigureSet  = Properties.Settings.Default.FigureSet;
            Tetris.ColorSet   = Properties.Settings.Default.ColorSet;

            Tetris.Initialize();
        }