Exemple #1
0
        void Setup()
        {
            m_ProgramParam = new GLProgramParameter("Shader", "Shader");

            m_SpriteBatcher = new SpriteBatcher(m_GLGraphics, m_ProgramParam, 100);

            GL.FrontFace(FrontFaceDirection.Ccw);
            //GL.Enable(EnableCap.DepthTest);
            GL.Enable(EnableCap.CullFace);
        }
Exemple #2
0
        internal void DoDraw(GameTime aGameTime)
        {
            if (!_devicesLoaded)
            {
                return;
            }

            // GG EDIT
            if (_isActive && _initialized)
            {
                SpriteBatcher.startFrame();
                Draw(aGameTime);
            }
        }
		public SkeletonRenderer (GraphicsDevice device) {
			this.device = device;

			batcher = new SpriteBatcher();

			effect = new BasicEffect(device);
			effect.World = Matrix.Identity;
			effect.View = Matrix.CreateLookAt(new Vector3(0.0f, 0.0f, 1.0f), Vector3.Zero, Vector3.Up);
			effect.TextureEnabled = true;
			effect.VertexColorEnabled = true;

			rasterizerState = new RasterizerState();
			rasterizerState.CullMode = CullMode.None;

			Bone.yDown = true;
		}
Exemple #4
0
    public static void Main(string[] args)
    {
        var batcher = new SpriteBatcher();

        batcher.DrawBatch(0);
    }
Exemple #5
0
        /// <summary>
        /// Redraw the scroll button's image
        /// </summary>
        private void ReDrawImage()
        {
            // ***
            // Draw the non-highlighted version
            // ***
            int width = this.Size.x - 5;
            int height = this.Size.y - 5;
            SpriteBatcher batcher = new SpriteBatcher(width, height);

            batcher.BeginDraw(Color.Transparent);

            // Draw your card
            // build picture background
            batcher.Draw(this.buildingBack, new Rectangle(0, 15, cardImageWidth, 3), new Rectangle(1, 0, 2, 3));
            batcher.Draw(this.buildingBack, new Rectangle(0, 15, 3, cardImageHeight), new Rectangle(1, 0, 3, 2));
            batcher.Draw(this.buildingBack, new Rectangle(3, 18, cardImageWidth - 3, cardImageHeight - 3), new Rectangle(2, 2, 1, 1));

            // build picture
            double scale = Math.Min(this.cardImageWidth / (double)this.data.IconImage.Width, this.cardImageHeight / (double)this.data.IconImage.Height);
            int offsetX = (this.cardImageWidth - (int)(this.data.IconImage.Width * scale)) / 2;
            int offsetY = (this.cardImageHeight - (int)(this.data.IconImage.Height * scale)) / 2;
            batcher.Draw(this.data.IconImage, new Rectangle(offsetX, 15 + offsetY, (int)(this.data.IconImage.Width * scale), (int)(this.data.IconImage.Height * scale)));

            // text
            int textY = 15;
            batcher.DrawString(titleFont, this.data.Name, new Vector2(1, 0), Color.Black);
            batcher.DrawString(buttonFont, "$" + this.data.Cost.ToString(), new Vector2(70, textY), Color.Green);

            foreach (var spec in this.specsString)
            {
                textY += 13;
                batcher.DrawString(buttonFont, spec, new Vector2(70, textY), Color.Black);
            }

            batcher.EndDraw();
            this.image = batcher.GetTexture();

            // ***
            // Draw the highlighted version
            // This is a lot of repeated work to make a second copy of the image... but it's the easiest solution I can think of now
            // (and I've spent too much time thinking about this already)
            // ***
            batcher = new SpriteBatcher(width, height);

            batcher.BeginDraw(Color.Transparent);

            // Draw your card
            // build picture background
            batcher.Draw(this.buildingBack, new Rectangle(0, 15, cardImageWidth, 3), new Rectangle(1, 0, 2, 3));
            batcher.Draw(this.buildingBack, new Rectangle(0, 15, 3, cardImageHeight), new Rectangle(1, 0, 3, 2));
            batcher.Draw(this.buildingBack, new Rectangle(3, 18, cardImageWidth - 3, cardImageHeight - 3), new Rectangle(2, 2, 1, 1));

            // build picture
            scale = Math.Min(this.cardImageWidth / (double)this.data.IconImage.Width, this.cardImageHeight / (double)this.data.IconImage.Height);
            offsetX = (this.cardImageWidth - (int)(this.data.IconImage.Width * scale)) / 2;
            offsetY = (this.cardImageHeight - (int)(this.data.IconImage.Height * scale)) / 2;
            batcher.Draw(this.data.IconImage, new Rectangle(offsetX, 15 + offsetY, (int)(this.data.IconImage.Width * scale), (int)(this.data.IconImage.Height * scale)));

            // text
            textY = 15;
            batcher.DrawString(titleFont, this.data.Name, new Vector2(1, 0), Color.Black);
            batcher.DrawString(buttonFont, "$" + this.data.Cost.ToString(), new Vector2(70, textY), Color.Green);

            foreach (var spec in this.specsString)
            {
                textY += 13;
                batcher.DrawString(buttonFont, spec, new Vector2(70, textY), Color.Black);
            }

            // draw the highlight
            int line_width = 2;
            batcher.Draw(this.whitePixel, new Rectangle(0, 0, line_width, height));
            batcher.Draw(this.whitePixel, new Rectangle(0, 0, width, line_width));
            batcher.Draw(this.whitePixel, new Rectangle(width - line_width, 0, line_width, height));
            batcher.Draw(this.whitePixel, new Rectangle(0, height - line_width, width, line_width));

            batcher.EndDraw();
            this.imageHighlight = batcher.GetTexture();

            this.dirtyImageBit = false;
        }
        /// <summary>
        /// Redraw the scroll button's image
        /// </summary>
        private void ReDrawImage()
        {
            // ***
            // Draw the non-highlighted version
            // ***
            int           width   = this.Size.x - 5;
            int           height  = this.Size.y - 5;
            SpriteBatcher batcher = new SpriteBatcher(width, height);

            batcher.BeginDraw(Color.Transparent);

            // Draw your card
            // build picture background
            batcher.Draw(this.buildingBack, new Rectangle(0, 15, cardImageWidth, 3), new Rectangle(1, 0, 2, 3));
            batcher.Draw(this.buildingBack, new Rectangle(0, 15, 3, cardImageHeight), new Rectangle(1, 0, 3, 2));
            batcher.Draw(this.buildingBack, new Rectangle(3, 18, cardImageWidth - 3, cardImageHeight - 3), new Rectangle(2, 2, 1, 1));

            // build picture
            double scale   = Math.Min(this.cardImageWidth / (double)this.data.IconImage.Width, this.cardImageHeight / (double)this.data.IconImage.Height);
            int    offsetX = (this.cardImageWidth - (int)(this.data.IconImage.Width * scale)) / 2;
            int    offsetY = (this.cardImageHeight - (int)(this.data.IconImage.Height * scale)) / 2;

            batcher.Draw(this.data.IconImage, new Rectangle(offsetX, 15 + offsetY, (int)(this.data.IconImage.Width * scale), (int)(this.data.IconImage.Height * scale)));

            // text
            int textY = 15;

            batcher.DrawString(titleFont, this.data.Name, new Vector2(1, 0), Color.Black);
            batcher.DrawString(buttonFont, "$" + this.data.Cost.ToString(), new Vector2(70, textY), Color.Green);

            foreach (var spec in this.specsString)
            {
                textY += 13;
                batcher.DrawString(buttonFont, spec, new Vector2(70, textY), Color.Black);
            }

            batcher.EndDraw();
            this.image = batcher.GetTexture();

            // ***
            // Draw the highlighted version
            // This is a lot of repeated work to make a second copy of the image... but it's the easiest solution I can think of now
            // (and I've spent too much time thinking about this already)
            // ***
            batcher = new SpriteBatcher(width, height);

            batcher.BeginDraw(Color.Transparent);

            // Draw your card
            // build picture background
            batcher.Draw(this.buildingBack, new Rectangle(0, 15, cardImageWidth, 3), new Rectangle(1, 0, 2, 3));
            batcher.Draw(this.buildingBack, new Rectangle(0, 15, 3, cardImageHeight), new Rectangle(1, 0, 3, 2));
            batcher.Draw(this.buildingBack, new Rectangle(3, 18, cardImageWidth - 3, cardImageHeight - 3), new Rectangle(2, 2, 1, 1));

            // build picture
            scale   = Math.Min(this.cardImageWidth / (double)this.data.IconImage.Width, this.cardImageHeight / (double)this.data.IconImage.Height);
            offsetX = (this.cardImageWidth - (int)(this.data.IconImage.Width * scale)) / 2;
            offsetY = (this.cardImageHeight - (int)(this.data.IconImage.Height * scale)) / 2;
            batcher.Draw(this.data.IconImage, new Rectangle(offsetX, 15 + offsetY, (int)(this.data.IconImage.Width * scale), (int)(this.data.IconImage.Height * scale)));

            // text
            textY = 15;
            batcher.DrawString(titleFont, this.data.Name, new Vector2(1, 0), Color.Black);
            batcher.DrawString(buttonFont, "$" + this.data.Cost.ToString(), new Vector2(70, textY), Color.Green);

            foreach (var spec in this.specsString)
            {
                textY += 13;
                batcher.DrawString(buttonFont, spec, new Vector2(70, textY), Color.Black);
            }

            // draw the highlight
            int line_width = 2;

            batcher.Draw(this.whitePixel, new Rectangle(0, 0, line_width, height));
            batcher.Draw(this.whitePixel, new Rectangle(0, 0, width, line_width));
            batcher.Draw(this.whitePixel, new Rectangle(width - line_width, 0, line_width, height));
            batcher.Draw(this.whitePixel, new Rectangle(0, height - line_width, width, line_width));

            batcher.EndDraw();
            this.imageHighlight = batcher.GetTexture();

            this.dirtyImageBit = false;
        }
 public static void Main (string[] args) {
     var batcher = new SpriteBatcher();
     batcher.DrawBatch(0);
 }