protected override void UnloadContent()
        {
            // TODO: Unload any non ContentManager content here
            skeletonRenderer.End();

            graphicsDeviceMgr.EndDraw();
            graphicsDeviceMgr.Dispose();
            graphicsDeviceMgr = null;
        }
 public void Draw(Camera Cam)
 {
     skeleton.Pos = Cam.WorldToWindow(pos).ToVector2();
     skeletonRenderer.Begin();
     skeletonRenderer.Draw(skeleton);
     skeletonRenderer.End();
 }
Esempio n. 3
0
        private void Draw()
        {
            if (App.GV.SpineVersion != "3.4.02" || 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();
        }
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            spineboy.AnimationState.Apply(spineboy.Skeleton);
            spineboy.Skeleton.UpdateWorldTransform();

            skeletonRenderer.Begin();
            skeletonRenderer.Draw(spineboy.Skeleton);
            skeletonRenderer.End();

            spriteBatch.Begin();

            for (var x = 0; x < spineboy.SkeletonData.Animations.Count; x++)
            {
                var color = animationIndex == x ? Color.Yellow : Color.WhiteSmoke;

                spriteBatch.DrawString(basicFont, spineboy.SkeletonData.Animations.Items[x].Name,
                                       new Vector2(20, 26 * x), color);
            }

            spriteBatch.End();

            base.Draw(gameTime);
        }
Esempio n. 5
0
        protected override void UnloadContent()
        {
            if (audio != null)
            {
                //audio.Pause();
                audio.Dispose();
            }

            skeletonMeshRenderer.End();

            _DxDeviceManager.EndDraw();
            _DxDeviceManager.Dispose();


            mapObjects_NPCs.Clear();
            mapObjects_Mobs.Clear();
            mapObjects_Reactors.Clear();
            mapObjects_Portal.Clear();

            backgrounds_front.Clear();
            backgrounds_back.Clear();

            texturePool.Dispose();

            // clear prior mirror bottom boundary
            rect_mirrorBottom      = new Rectangle();
            mirrorBottomReflection = null;
        }
Esempio n. 6
0
 public void Draw(Camera Cam)
 {
     skeleton.Pos = Cam.WorldToWindow(pos).ToVector2() + offset;
     Scale        = Cam.Scale.X;
     //skeleton.scale = Cam.Scale.X / 551f;
     skeletonRenderer.Begin();
     skeletonRenderer.Draw(skeleton);
     skeletonRenderer.End();
 }
Esempio n. 7
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 != "2.1.08" || 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);
        if (json != null)
        {
            if (App.globalValues.Scale != json.Scale)
            {
                json.Scale   = App.globalValues.Scale;
                skeletonData = json.ReadSkeletonData(App.globalValues.SelectSpineFile);
                skeleton     = new Skeleton(skeletonData);
            }
        }

        skeleton.X     = App.globalValues.PosX;
        skeleton.Y     = App.globalValues.PosY;
        skeleton.FlipX = App.globalValues.FilpX;
        skeleton.FlipY = App.globalValues.FilpY;


        skeleton.RootBone.Rotation = App.globalValues.Rotation;
        skeleton.UpdateWorldTransform();
        skeletonRenderer.PremultipliedAlpha = App.globalValues.Alpha;
        skeletonRenderer.Begin();
        skeletonRenderer.Draw(skeleton);
        skeletonRenderer.End();
    }
Esempio n. 8
0
        protected override void UnloadContent()
        {
            if (audio != null)
            {
                //audio.Pause();
                audio.Dispose();
            }

            skeletonMeshRenderer.End();

            _DxDeviceManager.EndDraw();
            _DxDeviceManager.Dispose();
        }
Esempio n. 9
0
        public void DrawObject(SpriteBatch sprite, SkeletonMeshRenderer skeletonMeshRenderer, GameTime gameTime,
                               int mapShiftX, int mapShiftY, bool flip)
        {
            spineObject.state.Update(gameTime.ElapsedGameTime.Milliseconds / 1000f);
            spineObject.state.Apply(spineObject.skeleton);

            spineObject.skeleton.FlipX = flip;
            spineObject.skeleton.X     = X - mapShiftX;
            spineObject.skeleton.Y     = Y - mapShiftY;
            spineObject.skeleton.UpdateWorldTransform();

            skeletonMeshRenderer.PremultipliedAlpha = spineObject.spineAnimationItem.PremultipliedAlpha;

            skeletonMeshRenderer.Begin();
            skeletonMeshRenderer.Draw(spineObject.skeleton);
            skeletonMeshRenderer.End();
        }
Esempio n. 10
0
        public void DrawBackground(SpriteBatch sprite, SkeletonMeshRenderer skeletonMeshRenderer, GameTime gameTime,
                                   int x, int y, Color color, bool flip)
        {
            spineObject.state.Update(gameTime.ElapsedGameTime.Milliseconds / 1000f);
            spineObject.state.Apply(spineObject.skeleton);

            if (spineObject.skeleton.FlipX != flip || spineObject.skeleton.X != x || spineObject.skeleton.Y != y) // reduce the number of updates
            {
                spineObject.skeleton.FlipX = flip;
                spineObject.skeleton.X     = x; //x + (Width);
                spineObject.skeleton.Y     = y; //y + (Height / 2);
                spineObject.skeleton.UpdateWorldTransform();
            }

            skeletonMeshRenderer.PremultipliedAlpha = spineObject.spineAnimationItem.PremultipliedAlpha;

            skeletonMeshRenderer.Begin();
            skeletonMeshRenderer.Draw(spineObject.skeleton);
            skeletonMeshRenderer.End();
        }
Esempio n. 11
0
        public void DrawBackground(SpriteBatch sprite, SkeletonMeshRenderer skeletonMeshRenderer, GameTime gameTime,
                                   int x, int y, Color color, bool flip, ReflectionDrawableBoundary drawReflectionInfo)
        {
            spineObject.state.Update(gameTime.ElapsedGameTime.Milliseconds / 1000f);
            spineObject.state.Apply(spineObject.skeleton);

            //if (spineObject.skeleton.FlipX != flip || spineObject.skeleton.X != x || spineObject.skeleton.Y != y) // reduce the number of updates [removed, recent spine object includes the ones that does not move]
            //{
            spineObject.skeleton.FlipX = flip;
            spineObject.skeleton.X     = x; //x + (Width);
            spineObject.skeleton.Y     = y; //y + (Height / 2);
            spineObject.skeleton.UpdateWorldTransform();
            //}

            skeletonMeshRenderer.PremultipliedAlpha = spineObject.spineAnimationItem.PremultipliedAlpha;

            skeletonMeshRenderer.Begin();
            skeletonMeshRenderer.Draw(spineObject.skeleton);
            skeletonMeshRenderer.End();
        }
        protected override void UnloadContent()
        {
            if (audio != null)
            {
                //audio.Pause();
                audio.Dispose();
            }

            skeletonMeshRenderer.End();

            _DxDeviceManager.EndDraw();
            _DxDeviceManager.Dispose();


            mapObjects_NPCs.Clear();
            mapObjects_Mobs.Clear();
            mapObjects_Reactors.Clear();
            mapObjects_Portal.Clear();

            backgrounds_front.Clear();
            backgrounds_back.Clear();

            texturePool.Dispose();
        }
Esempio n. 13
0
    public void Draw()
    {
        if (App.GV.SpineVersion != "3.4.02" || 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;
        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.LastTime < entry.EndTime)
                {
                    if (App.GV.GifList.Count == 0)
                    {
                        TrackEntry te = state.GetCurrent(0);
                        te.Time          = 0;
                        App.GV.TimeScale = 1;
                        App.GV.Lock      = 0;
                    }

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

                if (App.GV.IsRecoding && entry.LastTime >= entry.EndTime)
                {
                    state.TimeScale   = 0;
                    App.GV.IsRecoding = false;
                    Common.RecodingEnd(entry.EndTime);

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

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