Example #1
0
        private void extractTextures(Color[] textureData, int textureWidth, int textureHeight, Animation animation)
        {
            int    frameIndex = 0;
            string error;

            try
            {
                int dataPerTexture = textureWidth * textureHeight;

                Rectangle[] frames  = animation.Frames;
                int         cellNum = 0;
                foreach (Rectangle frame in frames)
                {
                    Texture2D cellTexture = LHGGraphicsHelper.extractSubTexture(lhg.GraphicsDevice, textureData, textureWidth, textureHeight, frame);

                    cellTexture.Name = textureName + "[" + animation.DirectionName + ", " + Convert.ToString(cellNum) + "]";

                    // Add the texture to the array
                    this.cells[(int)animation.Direction, frameIndex] = cellTexture;
                    frameIndex++;
                    cellNum++;
                }
            }
            catch (Exception ex)
            {
                error = ex.Message;
            }
        }
Example #2
0
        private void extractSubTextures(Color[] textureData, int textureWidth, int textureHeight, SimpleFrame frame)
        {
            Texture2D cellTexture = LHGGraphicsHelper.extractSubTexture(lhg.GraphicsDevice, textureData, textureWidth, textureHeight, frame.MyExtents);

            cellTexture.Name = frame.MyReferenceName;
            textures.Add(cellTexture);
        }
        // Load graphics content for the screen.
        public override void LoadGraphicsContent(bool loadAllContent)
        {
            width  = Game.Window.ClientBounds.Width;
            height = Game.Window.ClientBounds.Height;

            Texture2D backgroundTexture = LHGGraphicsHelper.getGradientTexture(lhg.GraphicsDevice, width, height, Color.DarkBlue, Color.Chocolate);

            background = new BackgroundPanel(lhg, backgroundTexture, true);
        }
Example #4
0
        public HexSelection(LunchHourGames lhg, Hex hex, Type type, bool moveOut, int maxThickness, Color color)
            : base(lhg)
        {
            this.lhg          = lhg;
            this.hex          = hex;
            this.moveOut      = moveOut;
            this.maxThickness = maxThickness;
            this.MyColor      = color;
            this.currentStart = 0;
            this.rate         = 5;
            this.goingOut     = true;
            this.nextColor    = 0;
            this.shouldFlash  = true;

            LoadGraphicsContent(lhg.GraphicsDevice);

            MakeThickHex(maxThickness, 0);

            gradientColors = LHGGraphicsHelper.getGradientColors(Color.LightYellow, Color.Yellow, 50);
        }