Commits

Sepehr Taghdisian committed 020ad28

some minor fixes in EngineLayer

  • Participants
  • Parent commits f14df91

Comments (0)

Files changed (2)

DarkMotion/EngineLayer.cs

             Engine.Init("DarkMotion", cfg);
             App.ShowWindow();
 
-            App.Update += EngineUpdate;
-            
             Engine.ActiveScene = Engine.CreateScene("Main");
 
             GameObject cam = Engine.ActiveScene.CreateObject("Camera", GameObjectType.Camera);
             var w = control.ClientSize.Width;
             var h = control.ClientSize.Height;
             Resize(w, h);
-            App.Run();
         }
 
-        static void EngineUpdate()
+        public static void EngineUpdate()
         {
             if (Update != null)
                 Update();
+            App.SwapBuffers();
         }
 
         public static void ResetScene(AnimController controller)
         public static void ReleaseEngine()
         {
             Engine.Release();
+            App.Release();
             Core.Release();
         }
 
         public static void Resize(int w, int h)
         {
-            if (Engine.Initialized)
+            if (Engine.Initialized)    {
                 App.ResizeView((uint)w, (uint)h);
+                Engine.ResizeView((uint)w, (uint)h);
+            }
         }
 
         public static void SetFloat(string name, float value)

DarkMotion/Forms/MainForm.cs

             };
 
             engView.Resize += (s, e) => EngineLayer.Resize(engView.ClientSize.Width, engView.ClientSize.Height);
+            engView.Paint += (s, e) => EngineLayer.EngineUpdate();
             btnSync.Click += (s, e) => EngineLayer.Sync(_animController);
         }
 
         protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
         {
             base.OnClosing(e);
-            //hmrView.ReleaseEngine();
             EngineLayer.ReleaseEngine();
         }
 
         {
             EngineLayer.InitEngine("../../data", engView);
 
-            //hmrView.InitEngine("../../data");
-
             showWelcomeScreen();
             grdParamsInit();
             lstLayersInit();