コード例 #1
0
 private void Ske_Loaded(object sender, RoutedEventArgs e)
 {
     try
     {
         animator = new Animator(Ske.CanvasSize.Width, Ske.CanvasSize.Height);
         var Scene = animator.Scene;
         ImgHelper.LoadImg(Scene.TextureManager, System.IO.Path.Combine(Environment.CurrentDirectory, "snoke.png"), "snoke");
         var l = new SnokeLayout("snoke");
         Scene.Layouts.Add(l);
         Scene.RenderContext.LoadContent();
         animator.NeedToFrame += ani => Ske.InvalidateVisual();
         animator.Start();
     }
     catch (Exception ex)
     {
         Debug.Fail(ex.Message);
     }
 }
コード例 #2
0
ファイル: MainWindow.xaml.cs プロジェクト: Cricle/Jing
        private void Ske_Loaded(object sender, RoutedEventArgs e)
        {
            Scene = new Scene();
            var l = new SnokeLayout();

            Scene.Layouts.Add(l);
            using (var g = Graphics.FromHwnd(IntPtr.Zero))
            {
                Scene.Dpix = g.DpiX;
                Scene.Dpiy = g.DpiY;
            }
            var snke = File.Open(System.IO.Path.Combine(Environment.CurrentDirectory, "snoke.png"), FileMode.Open);
            var bit  = SKBitmap.Decode(snke);

            Scene.TextureManager.Add(new TextureInfo("snoke", bit));
            snke.Dispose();
            Scene.SetSize(Ske.CanvasSize.Width, Ske.CanvasSize.Height);
            Scene.RenderContext.LoadContent();
            new Task(Frame).RunSynchronously();
        }