Beispiel #1
0
        protected override void Update(XGame.XGameTime gameTime)
        {
            this.rot += (float)((float)Math.PI / 30000000f) * (float)gameTime.ElapsedGameTime.Ticks;
            if (this.rot >= 2 * Math.PI)
            {
                this.rot = 0f;
            }

            this.text = String.Format("Game Template ( {0:F2} fps )", 10000000f / (float)gameTime.ElapsedGameTime.Ticks);
        }
Beispiel #2
0
        protected override void Update(XGame.XGameTime gameTime)
        {
            this.rot += (float)((float)Math.PI / 30000000f) * (float)gameTime.ElapsedGameTime.Ticks;
            if (this.rot >= 2 * Math.PI)
            {
                this.rot = 0f;
            }

            float fps = 10000000f / (float)gameTime.ElapsedGameTime.Ticks;

            this.text = String.Format("GameTime : {0}  , Fps : {1:F2} , Frame : {2}", gameTime.TotalGameTime, fps, gameTime.FrameCount);
        }
Beispiel #3
0
        protected override void Draw(XGame.XGameTime gameTime)
        {
            this.form.Invoke(setTitle, new object[] { this.text });
            Vector2 pos = new Vector2(this.Window.Width * 0.66f, this.Window.Height * 0.5f);

            this.GraphicsDevice.Clear(Color.Black);
            Rectangle dest   = new Rectangle(0, 0, (int)this.Window.Width, (int)this.Window.Height);
            float     colVal = (float)(this.rot / (2 * Math.PI));

            spritebatch.Begin(spritemode: SpriteSortMode.Immediate);
            spritebatch.Draw(this.texture, dest, Color.White);
            spritebatch.Draw(this.texture, pos, null, new Color(.5f, .5f, .5f, colVal), this.rot, this.origin, 0.5f, SpriteEffects.None, 0.5f);
            spritebatch.End();
        }
Beispiel #4
0
        protected override void Draw(XGame.XGameTime gameTime)
        {
            this.GraphicsDevice.Clear(this.backColor);

            if (this.OnDraw != null)
            {
                this.OnDraw(this, EventArgs.Empty);
            }

            if (this.DrawGrid && this.Window != null)
            {
                this.gridDrawer.Draw(this.Scroll, this.ReferenceLength);
            }

            if (this.form.nodeViewer.Root != null)
            {
                spritebatch.Begin(spritemode: SpriteSortMode.BackToFront);
                this.form.nodeViewer.Root.Draw(spritebatch);
                spritebatch.End();
            }

            if (this.selectedNode != null)
            {
                TextureNode n = this.selectedNode;

                textureBorderDrawer.Draw(n, (this.Window as DXGameWindow).Control.ClientSize.Width, (this.Window as DXGameWindow).Control.ClientSize.Height);

                spritebatch.Begin();

                spritebatch.Draw(
                    this.overlayTex.Texture, n.Destination, null, this.overlayColor,
                    n.GlobalRotation, n.Center * this.overlayTex.Size, SpriteEffects.None, 0.6f);

                if (n.Texture != null)
                {
                    Color c = n.Color;
                    c.A = byte.MaxValue;
                    spritebatch.Draw(n.Texture, n.Destination, null, c, n.GlobalRotation, n.Origin, SpriteEffects.None, 0.5f);
                }

                if (this.Mode.BasePoseSelected)
                {
                    spritebatch.Draw(
                        this.centerTex.Texture, n.GlobalPosition, null, Color.Red, 0,
                        this.centerTex.Origin, 0.25f, SpriteEffects.None, 0f);
                }

                Vector4 point;
                Vector2 vec;
                for (int index = 0; index < (this.Mode.BasePoseSelected ? 8 : 4); index++)
                {
                    vec   = GameMode.ModePoints[index];
                    point = Vector2.Transform(new Vector2(vec.X * n.Destination.Width, vec.Y * n.Destination.Height), n.Transform);
                    spritebatch.Draw(
                        this.circleTex.Texture, new Vector2(point.X, point.Y), null, Color.White,
                        n.GlobalRotation, this.circleTex.Origin, 0.025f, SpriteEffects.None, 0f);
                }

                spritebatch.End();
            }
        }