All posts by kpark

XNA4Model (updated)

XNA4Model (updated)
– ModelNode (with ToonShading & BoundingSphere)
– GameComponent & GameService (InputHandler & FpsCounter)
– Event & EventHandler
8636798633.zip
XNA4ModelListPicking (updated)
– Mouse Left Button Pressed to Pick Object3684863626.zip
XNA4SkinnedModel (updated)
-animation clip name
6840418209.zip




  // draw text
        InputHandler input;
        bool drawFPS = false;
        SpriteFont font;

       public FpsCounter(Game game)
            : base(game)
        {
            Enabled = true;
            this.game = game;
            input = (InputHandler)game.Services.GetService(typeof(InputHandler));
        }


        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);
            if (input.IsKeyPressed(Keys.F))
                drawFPS = !drawFPS;


// 중간생략..
        }

        public sealed override void Draw(GameTime gameTime)
        {
            Game.Window.Title = “FPS: ” + fps.ToString();
            if (drawFPS)
            {
                // draw the text for fpsCounter
                spriteBatch.Begin();
                spriteBatch.DrawString(font, fps.ToString(), Vector2.One, Color.White);
                spriteBatch.End();
            }
        }



 


// GAME1.cs
        protected override void Initialize()
        {
            inputs = new InputHandler(this);
            Components.Add(inputs);
            Services.AddService(typeof(InputHandler), inputs);
// 중간생략..
        }