Exemple #1
0
 public static void Main(string[] args)
 {
     try
     {
         Application app = new Application();
         app.Run();
     }
     catch(Exception ex)
     {
         Console.Error.WriteLine("Top-level catch:\n" + ex.Message + "\n" + ex.StackTrace);
     }
 }
Exemple #2
0
        public Game(Application app)
        {
            Application = app;
            _config = new Sim.Config();

            _hud = new UI.Hud (this);

            _pm = new Presentation.PresentationManager(Application.Renderer, this);

            LoadMap ("data/testmap6.tmx");
            _buildings = new List<Buildable> (Enumerable.Repeat ((Buildable)null, Map.Width * Map.Height));
            _blockers = new List<Point> ();

            Navigation = new Navigation (Map, Map.Base.BlockX, Map.Base.BlockY);

            _waveGenerator = new WaveGenerator (this);

            _waveGenerator.WaveCountdown += delegate(Wave current, Wave next, int extra) { _hud.ShowNextWaveWarning (next.Text, extra); };
            _waveGenerator.WaveStarted += delegate(Wave current, Wave next, int extra) { _hud.ShowNextWaveWarning ("", -1); };

            Cash = 1000;

            app.Input.KeyDown += delegate(OpenTK.Input.Key key)
            {
                if (key == OpenTK.Input.Key.F1)
                {
                    ShowNavigationMap = !ShowNavigationMap;
                }
                else if (key == OpenTK.Input.Key.F2)
                {
                    ShowVehicleProbes = !ShowVehicleProbes;
                }
            };

            app.Input.MouseWheelChanged += delegate(int delta) { app.Renderer.ZoomLevel = Util.Clamp (1.0f, 2.0f, app.Renderer.ZoomLevel + delta / 10.0f); };
        }
		static void Main()
		{
			Application.EnableVisualStyles();
			Application.SetCompatibleTextRenderingDefault(false);
			Application.Run(new frmMain());
		}