Ejemplo n.º 1
0
        public EditorGameScreen(Point screenSize, GraphicsDevice device, Dictionary <string, Texture2D> textureProvider, Dictionary <string, SpriteFont> fontProvider, ContentManager Content)
            : base(screenSize, device, textureProvider, fontProvider, Content)
        {
            renderer = new PanelRenderer(null, screenSize, textureProvider, fontProvider, GraphicsDevice)
            {
                BackgroundColor = Color.White,
                BorderColor     = new Color(39, 166, 204),
                WallColor       = new Color(39, 166, 204)
            };

            int minScreenDim = Math.Min(screenSize.X, screenSize.Y);

            miniRenderer = new PanelRenderer(null, new Point((int)(minScreenDim * 0.2f)), textureProvider, fontProvider, GraphicsDevice)
            {
                WallColor       = Color.Black,
                BorderColor     = Color.Black,
                BackgroundColor = Color.White
            };

            font             = fontProvider["font/fnt_constantia_big"];
            texPixel         = textureProvider["img/pixel"];
            texSquare        = textureProvider["img/square"];
            panelTexture     = new RenderTarget2D(GraphicsDevice, GraphicsDevice.PresentationParameters.BackBufferWidth, GraphicsDevice.PresentationParameters.BackBufferHeight, false, GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.Depth24);
            miniPanelTexture = new RenderTarget2D(GraphicsDevice, (int)(minScreenDim * 0.2f), (int)(minScreenDim * 0.2f), false, GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.Depth24);

            panelDimensions = new Point(4, 4);
            oneDigitSize    = font.MeasureString("8");
            dimHitboxSize   = minScreenDim / 10;
            digitScale      = dimHitboxSize / (Math.Max(oneDigitSize.X, oneDigitSize.Y));
            Point dimMatrixStart = new Point((screenSize.X - dimHitboxSize * 10) / 2 + dimHitboxSize, (screenSize.Y - dimHitboxSize * 10) / 2 + dimHitboxSize);

            for (int i = 0; i < 6; i++)
            {
                hDimensions[i] = new Rectangle(dimMatrixStart.X + dimHitboxSize * (i + 2), dimMatrixStart.Y, dimHitboxSize, dimHitboxSize);
            }
            for (int i = 0; i < 6; i++)
            {
                vDimensions[i] = new Rectangle(dimMatrixStart.X, dimMatrixStart.Y + dimHitboxSize * (i + 2), dimHitboxSize, dimHitboxSize);
            }
            for (int i = 0; i < 7; i++)
            {
                for (int j = 0; j < 7; j++)
                {
                    dimMatrix[i, j] = new Rectangle(dimMatrixStart.X + (i + 1) * dimHitboxSize, dimMatrixStart.Y + (j + 1) * dimHitboxSize, dimHitboxSize, dimHitboxSize);
                }
            }

            SpawnButtons();
        }
Ejemplo n.º 2
0
        public HistoryGameScreen(Point screenSize, GraphicsDevice device, Dictionary <string, Texture2D> textureProvider, Dictionary <string, SpriteFont> fontProvider, ContentManager Content)
            : base(screenSize, device, textureProvider, fontProvider, Content)
        {
            font         = fontProvider["font/fnt_constantia_big"];
            texPixel     = textureProvider["img/pixel"];
            texLeft      = textureProvider["img/left"];
            texRight     = textureProvider["img/right"];
            texSolved    = textureProvider["img/solved"];
            texDiscarded = textureProvider["img/delete"];
            texFavourite = textureProvider["img/like0"];
            renderer     = new PanelRenderer(null, screenSize, textureProvider, fontProvider, GraphicsDevice);

            InitializeScreenSizeDependent();
            SpawnButtons();
        }
Ejemplo n.º 3
0
        public PanelGameScreen(Puzzle panel, bool standalonePanel, Point screenSize, GraphicsDevice device, Dictionary <string, Texture2D> TextureProvider, Dictionary <string, SpriteFont> FontProvider, ContentManager Content)
            : base(screenSize, device, TextureProvider, FontProvider, Content)
        {
            if (panel == null)
            {
                panel = new Puzzle(2, 2);
            }

            this.panel        = panel;
            IsStandalonePanel = standalonePanel;
            internalBatch     = new SpriteBatch(GraphicsDevice);
            renderer          = new PanelRenderer(panel, screenSize, TextureProvider, FontProvider, device);
            startPoints       = renderer.StartPoints;
            endPoints         = renderer.EndPoints;
            walls             = renderer.Walls;

            texPixel   = TextureProvider["img/pixel"];
            texCircle  = TextureProvider["img/circle"];
            texClose   = TextureProvider["img/close"];
            texLike[0] = TextureProvider["img/like0"];
            texLike[1] = TextureProvider["img/like1"];
            texNext    = TextureProvider["img/next"];
            texDelete  = TextureProvider["img/delete"];
            fntDebug   = FontProvider["font/fnt_small"];

            // Fullscreen textures
            backgroundTexture       = new RenderTarget2D(GraphicsDevice, screenSize.X, screenSize.Y);
            tempLineTexture         = new RenderTarget2D(GraphicsDevice, screenSize.X, screenSize.Y);
            lineTexture             = new RenderTarget2D(GraphicsDevice, screenSize.X, screenSize.Y);
            lineFadeTexture         = new RenderTarget2D(GraphicsDevice, screenSize.X, screenSize.Y);
            errorsBlinkTexture      = new RenderTarget2D(GraphicsDevice, screenSize.X, screenSize.Y);
            eliminatedErrorsTexture = new RenderTarget2D(GraphicsDevice, screenSize.X, screenSize.Y);

            // Load bloom shader
            if (SettingsManager.BloomFX)
            {
                bloomFilter = new BloomFilter();
                bloomFilter.Load(GraphicsDevice, Content, screenSize.X, screenSize.Y);
                bloomFilter.BloomPreset             = BloomFilter.BloomPresets.Small;
                bloomFilter.BloomThreshold          = -1;
                bloomFilter.BloomStrengthMultiplier = 0.75f;
            }

            renderer.RenderPanelToTexture(backgroundTexture, true);

            SpawnButtons();
            UpdateButtonsColor();
        }