Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
AndroidGameTestActivity.cs
Go to the documentation of this file.
1 // Copyright (c) 2014 Silicon Studio Corp. (http://siliconstudio.co.jp)
2 // This file is distributed under GPL v3. See LICENSE.md for details.
3 #if SILICONSTUDIO_PLATFORM_ANDROID
4 using System;
5 using Android.App;
6 using Android.OS;
7 using SiliconStudio.Paradox.Games;
8 using SiliconStudio.Paradox.Starter;
9 
10 namespace SiliconStudio.Paradox.Graphics.Regression
11 {
12  [Activity]
13  public class AndroidGameTestActivity : AndroidParadoxActivity
14  {
15  public static GameBase Game;
16 
17  public static event EventHandler<EventArgs> Destroyed;
18 
19  protected override void OnCreate(Bundle bundle)
20  {
21  base.OnCreate(bundle);
22 
23  Game.Exiting += Game_Exiting;
24  Game.Run(GameContext);
25  }
26 
27  public override void OnBackPressed()
28  {
29  Game.Exit();
30  base.OnBackPressed();
31  }
32 
33  void Game_Exiting(object sender, EventArgs e)
34  {
35  Finish();
36  }
37 
38  protected override void OnDestroy()
39  {
40  if (Game != null)
41  Game.Dispose();
42 
43  base.OnDestroy();
44 
45  var handler = Destroyed;
46  if (handler != null)
47  handler(this, EventArgs.Empty);
48  }
49  }
50 }
51 #endif
Resource has been destroyed due to graphics device being destroyed. It will need to be recreated or r...