예제 #1
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            skeleton.UpdateWorldTransform();

            spriteBatch.End();

            skeletonRenderer.Begin();
            skeletonRenderer.Draw(skeleton);
            skeletonRenderer.End();

            spriteBatch.Begin(SpriteSortMode.Immediate,
                              BlendState.AlphaBlend,
                              null,
                              null,
                              null,
                              null,
                              MediaManager.cam.get_transformation(graphics));

            bounds.Update(skeleton, true);

            /* MouseState mouse = Mouse.GetState();
             * headSlot.G = 1;
             * headSlot.B = 1;
             * if (bounds.AabbContainsPoint(mouse.X, mouse.Y))
             * {
             *   BoundingBoxAttachment hit = bounds.ContainsPoint(mouse.X, mouse.Y);
             *   if (hit != null)
             *   {
             *       headSlot.G = 0;
             *       headSlot.B = 0;
             *   }
             * } */
        }
예제 #2
0
        public static void renderSpineEntities(Matrix camera, List <Entity> entList, Entity cameraEntity, TileMap map, ParticleSet set, List <MutantAcidSpitter> spitters)
        {
            skeletonRenderer.setCameraMatrix(camera);
            skeletonRenderer.Begin();

            skeletonRenderer.DrawSpriteToSpineVertexArray(Game1.whitePixel, new Rectangle(0, 0, 1, 1), new Vector2(cameraEntity.CenterPoint.X - GlobalGameConstants.GameResolutionWidth / 2, cameraEntity.CenterPoint.Y - GlobalGameConstants.GameResolutionHeight / 2), Color.Black, 0.0f, new Vector2(GlobalGameConstants.GameResolutionWidth, GlobalGameConstants.GameResolutionHeight));

            map.renderSPINEBATCHTEST(skeletonRenderer, 0.5f, spitters);

            for (int i = 0; i < entList.Count; i++)
            {
                if (Vector2.Distance(cameraEntity.Position, entList[i].Position) > (GlobalGameConstants.GameResolutionWidth * 0.75f))
                {
                    continue;
                }

                entList[i].draw(skeletonRenderer);

                if (entList[i] is SpineEntity)
                {
                    ((SpineEntity)entList[i]).spinerender(skeletonRenderer);
                }
            }

            set.drawSpineSet(skeletonRenderer, cameraEntity.Position, 0.5f);

            skeletonRenderer.End();
        }
예제 #3
0
파일: Robot.cs 프로젝트: GarethIW/RoboFight
        public void Draw(GraphicsDevice graphicsDevice, SpriteBatch spriteBatch, Camera gameCamera)
        {
            skeletonRenderer.Begin(graphicsDevice, gameCamera.CameraMatrix);
            skeletonRenderer.Draw(skeleton);
            skeletonRenderer.End();

            // Draw collision box

            //spriteBatch.Draw(blankTex, collisionRect, Color.White * 0.3f);
            //spriteBatch.End();

            spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, gameCamera.CameraMatrix);

            if (!IsPlayer)
            {
                Vector2 pos = Position + new Vector2(-25, -150);
                int     i   = 0;

                for (i = 0; i < (int)(Health / 10f); i++)
                {
                    spriteBatch.Draw(EnemyManager.Instance.hudTex, pos, new Rectangle(11, 0, 15, 8), Color.Red, 0f, new Vector2(7, 4), 0.5f, i % 2 == 0 ? SpriteEffects.None : SpriteEffects.FlipVertically, 1);
                    pos.X += 5;
                }

                spriteBatch.Draw(EnemyManager.Instance.hudTex, pos, new Rectangle(11, 0, 15, 8), Color.Red * ((Health / 10f) - (int)(Health / 10f)), 0f, new Vector2(7, 4), 0.5f, i % 2 == 0 ? SpriteEffects.None : SpriteEffects.FlipVertically, 1);
            }

            spriteBatch.End();
        }
        private void Draw()
        {
            if (App.GV.SpineVersion != "3.6.39" || App.GV.FileHash != skeleton.Data.Hash)
            {
                state = null;

                skeletonRenderer = null;
                return;
            }
            _graphicsDevice.Clear(Color.Transparent);
            state.Update(App.GV.Speed / 1000f);
            state.Apply(skeleton);
            state.TimeScale = App.GV.TimeScale;
            skeleton.X      = App.GV.PosX;
            skeleton.Y      = App.GV.PosY;
            if (App.GV.SelectSkin != "" && App.GV.SetSkin)
            {
                skeleton.SetSkin(App.GV.SelectSkin);
                App.GV.SetSkin = false;
            }
            if (App.GV.SelectAnimeName != "" && App.GV.SetAnime)
            {
                state.ClearTracks();
                state.SetAnimation(0, App.GV.SelectAnimeName, App.GV.IsLoop);
                App.GV.SetAnime = false;
            }
            skeleton.UpdateWorldTransform();
            skeletonRenderer.PremultipliedAlpha = App.GV.Alpha;
            skeletonRenderer.Begin();
            skeletonRenderer.Draw(skeleton);
            skeletonRenderer.End();
        }
예제 #5
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            base.Draw(spriteBatch);
            if (skeleton.X > 640 || skeleton.X < 0)
            {
                speed          = -1 * speed;
                skeleton.FlipX = !skeleton.FlipX;
            }

            skeleton.X += speed;

            skeleton.UpdateWorldTransform();
            skeletonRenderer.Begin();
            skeletonRenderer.Draw(skeleton);
            skeletonRenderer.End();

            bounds.Update(skeleton, true);
            MouseState mouse = Mouse.GetState();

            headSlot.G = 1;
            headSlot.B = 1;
            if (bounds.AabbContainsPoint(mouse.X, mouse.Y))
            {
                BoundingBoxAttachment hit = bounds.ContainsPoint(mouse.X, mouse.Y);
                if (hit != null)
                {
                    headSlot.G = 0;
                    headSlot.B = 0;
                }
            }
        }
예제 #6
0
    public void Update(GameTime gameTime)
    {
        if (App.globalValues.SelectAnimeName != "" && App.globalValues.SetAnime)
        {
            state.ClearTracks();
            skeleton.SetToSetupPose();
            state.SetAnimation(0, App.globalValues.SelectAnimeName, App.globalValues.IsLoop);
            App.globalValues.SetAnime = false;
        }

        if (App.globalValues.SelectSkin != "" && App.globalValues.SetSkin)
        {
            skeleton.SetSkin(App.globalValues.SelectSkin);
            skeleton.SetSlotsToSetupPose();
            App.globalValues.SetSkin = false;
        }


        if (App.globalValues.SelectSpineVersion != "3.7.83" || App.globalValues.FileHash != skeleton.Data.Hash)
        {
            state            = null;
            skeletonRenderer = null;
            return;
        }
        App.graphicsDevice.Clear(Color.Transparent);

        Player.DrawBG(ref App.spriteBatch);
        App.globalValues.TimeScale = (float)App.globalValues.Speed / 30f;

        state.Update((float)gameTime.ElapsedGameTime.TotalMilliseconds / 1000f);
        state.Apply(skeleton);

        skeleton.X      = App.globalValues.PosX;
        skeleton.Y      = App.globalValues.PosY;
        skeleton.ScaleX = (App.globalValues.FilpX ? -1 : 1) * App.globalValues.Scale;
        skeleton.ScaleY = (App.globalValues.FilpY ? 1 : -1) * App.globalValues.Scale;


        skeleton.RootBone.Rotation = App.globalValues.Rotation;
        skeleton.UpdateWorldTransform();
        skeletonRenderer.PremultipliedAlpha = App.globalValues.Alpha;
        if (skeletonRenderer.Effect is BasicEffect)
        {
            ((BasicEffect)skeletonRenderer.Effect).Projection = Matrix.CreateOrthographicOffCenter(0, App.graphicsDevice.Viewport.Width, App.graphicsDevice.Viewport.Height, 0, 1, 0);
        }
        else
        {
            skeletonRenderer.Effect.Parameters["Projection"].SetValue(Matrix.CreateOrthographicOffCenter(0, App.graphicsDevice.Viewport.Width, App.graphicsDevice.Viewport.Height, 0, 1, 0));
        }
        skeletonRenderer.Begin();
        skeletonRenderer.Draw(skeleton);
        skeletonRenderer.End();
    }
예제 #7
0
 private void beginSkeletonRenderer()
 {
     if (state != RendererState.SkeletonRendererBegan)
     {
         if (state == RendererState.SpriteBatchBegan)
         {
             spriteBatch.End();
         }
         skeletonRenderer.Begin(CurrentShader);
         state = RendererState.SkeletonRendererBegan;
     }
 }
예제 #8
0
        public void Draw(GraphicsDevice graphicsDevice, SpriteBatch spriteBatch, Camera gameCamera)
        {
            if (teleportScale < 0.02f)
            {
                return;
            }

            skeletonRenderer.Begin(graphicsDevice, gameCamera.CameraMatrix);
            skeletonRenderer.Draw(skeleton);
            skeletonRenderer.End();

            // Draw collision box
            //spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, gameCamera.CameraMatrix);
            //spriteBatch.Draw(blankTex, collisionRect, Color.White * 0.3f);
            //spriteBatch.End();
        }
예제 #9
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.MediumVioletRed);

            ((BasicEffect)skeletonRenderer.Effect).Projection = camera.Transform * Matrix.CreateOrthographicOffCenter(0, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, 0, 1, 0);

            // Draw all objects requiring the skeletonRenderer
            skeletonRenderer.Begin();
            level.CurrentRoom.DrawCharacters(skeletonRenderer, gameTime);
            skeletonRenderer.End();

            // Draw all objects requiring the spriteBatch
            spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, null, null, null, camera.Transform);
            level.CurrentRoom.DrawObjects(spriteBatch);
            base.Draw(gameTime);
            spriteBatch.End();
        }
        public override void Draw(GameTime gameTime, Camera2D cam)
        {
            if (!IsLoaded)
            {
                return;
            }
            _state.Update((float)(gameTime.ElapsedGameTime.TotalMilliseconds * Props.PlaySpeed / 1000));
            _state.Apply(_skeleton);
            _skeleton.UpdateWorldTransform();

            _effect.View       = cam.View;
            _effect.Projection = cam.Projection;

            _skeletonRenderer.Begin();
            _skeletonRenderer.Draw(_skeleton);
            _skeletonRenderer.End();
        }
예제 #11
0
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.Black);

            state.Update(gameTime.ElapsedGameTime.Milliseconds / 1000f);
            state.Apply(skeleton);
            skeleton.UpdateWorldTransform();
            if (skeletonRenderer.Effect is BasicEffect)
            {
                ((BasicEffect)skeletonRenderer.Effect).Projection = Matrix.CreateOrthographicOffCenter(0, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, 0, 1, 0);
            }
            else
            {
                skeletonRenderer.Effect.Parameters["Projection"].SetValue(Matrix.CreateOrthographicOffCenter(0, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, 0, 1, 0));
            }
            skeletonRenderer.Begin();
            skeletonRenderer.Draw(skeleton);
            skeletonRenderer.End();

            bounds.Update(skeleton, true);
            MouseState mouse = Mouse.GetState();

            if (headSlot != null)
            {
                headSlot.G = 1;
                headSlot.B = 1;
                if (bounds.AabbContainsPoint(mouse.X, mouse.Y))
                {
                    BoundingBoxAttachment hit = bounds.ContainsPoint(mouse.X, mouse.Y);
                    if (hit != null)
                    {
                        headSlot.G = 0;
                        headSlot.B = 0;
                    }
                }
            }

            base.Draw(gameTime);
        }
예제 #12
0
    public void Draw()
    {
        if (App.GV.SpineVersion != "3.6.53" || App.GV.FileHash != skeleton.Data.Hash)
        {
            state            = null;
            skeletonRenderer = null;
            return;
        }
        App.graphicsDevice.Clear(Color.Transparent);

        Player.DrawBG(ref App.spriteBatch);


        state.Update(App.GV.Speed / 1000f);

        if (binary != null)
        {
            if (App.GV.Scale != binary.Scale)
            {
                binary.Scale = App.GV.Scale;
                skeletonData = binary.ReadSkeletonData(Common.GetSkelPath(App.GV.SelectFile));
                skeleton     = new Skeleton(skeletonData);
            }
        }
        else if (json != null)
        {
            if (App.GV.Scale != json.Scale)
            {
                json.Scale   = App.GV.Scale;
                skeletonData = json.ReadSkeletonData(Common.GetJsonPath(App.GV.SelectFile));
                skeleton     = new Skeleton(skeletonData);
            }
        }

        skeleton.X                 = App.GV.PosX;
        skeleton.Y                 = App.GV.PosY;
        skeleton.FlipX             = App.GV.FilpX;
        skeleton.FlipY             = App.GV.FilpY;
        skeleton.RootBone.Rotation = App.GV.Rotation;
        skeleton.UpdateWorldTransform();
        state.TimeScale = App.GV.TimeScale;
        state.Apply(skeleton);
        skeletonRenderer.PremultipliedAlpha = App.GV.Alpha;
        if (skeletonRenderer.Effect is BasicEffect)
        {
            ((BasicEffect)skeletonRenderer.Effect).Projection = Matrix.CreateOrthographicOffCenter(0, App.graphicsDevice.Viewport.Width, App.graphicsDevice.Viewport.Height, 0, 1, 0);
        }
        else
        {
            skeletonRenderer.Effect.Parameters["Projection"].SetValue(Matrix.CreateOrthographicOffCenter(0, App.graphicsDevice.Viewport.Width, App.graphicsDevice.Viewport.Height, 0, 1, 0));
        }
        skeletonRenderer.Begin();
        skeletonRenderer.Draw(skeleton);
        skeletonRenderer.End();

        if (state != null)
        {
            TrackEntry entry = state.GetCurrent(0);
            if (entry != null)
            {
                if (App.GV.IsRecoding && App.GV.GifList != null && !entry.IsComplete)
                {
                    if (App.GV.GifList.Count == 0)
                    {
                        TrackEntry te = state.GetCurrent(0);
                        te.trackTime     = 0;
                        App.GV.TimeScale = 1;
                        App.GV.Lock      = 0;
                    }

                    App.GV.GifList.Add(Common.TakeRecodeScreenshot(App.graphicsDevice));
                }

                if (App.GV.IsRecoding && entry.IsComplete)
                {
                    state.TimeScale   = 0;
                    App.GV.IsRecoding = false;
                    Common.RecodingEnd(entry.AnimationEnd);

                    state.TimeScale  = 1;
                    App.GV.TimeScale = 1;
                }

                if (App.GV.TimeScale == 0)
                {
                    entry.TrackTime = entry.AnimationEnd * App.GV.Lock;
                    entry.TimeScale = 0;
                }
                else
                {
                    App.GV.Lock     = entry.AnimationTime / entry.AnimationEnd;
                    entry.TimeScale = 1;
                }
                App.GV.LoadingProcess = $"{ Math.Round(entry.AnimationTime / entry.AnimationEnd * 100, 2)}%";
            }
        }
    }