Exemple #1
0
 /// <summary>
 /// Create a new event loop hooked to a Windows.Forms object and (optionally) a map
 /// </summary>
 /// <param name="opener">The Form to which Redraw events are passed</param>
 /// <param name="currentMap">(optional) map to use</param>
 public EventLoop(Dispatcher opener = null, Backend.Map currentMap = null)
 {
     _opener = opener;
     _currentMap = currentMap;
     _timer = new System.Timers.Timer(10);
     _timer.Elapsed += _timer_Elapsed;
     _timer.Start();
 }
Exemple #2
0
 public MainWindow()
 {
     InitializeComponent();
     WindowState = FormWindowState.Maximized;
     FormBorderStyle = FormBorderStyle.None;
     SetStyle(ControlStyles.ResizeRedraw, true);
     DoubleBuffered = true;
     Show(); // Necessary to recalc window size
     _dispatcher = new Dispatcher(this);
 }
Exemple #3
0
 /// <summary>
 /// Constructor for an empty map
 /// </summary>
 /// <param name="width">Number of horizontal tiles</param>
 /// <param name="height">Number of vertical tiles</param>
 /// <param name="generate">Place random walls</param>
 public Map(Dispatcher opener, int width = 0, int height = 0, bool generate = false)
 {
     _opener = opener;
     _valid = false;
     Setup(width, height);
     if (generate)
     {
         PlaceWalls();
         _valid = true;
     }
 }
Exemple #4
0
 /// <summary>
 /// Constructor for a map loaded from a file
 /// </summary>
 /// <param name="fileName">An XML-file containing map-data (XML-extension automatically appended)</param>
 public Map(Dispatcher opener, string fileName)
 {
     _opener = opener;
     if (Load(fileName))
     {
         _valid = true;
         _filename = fileName;
     }
     else
     {
         _width = 0;
         _height = 0;
         _valid = false;
     }
 }
Exemple #5
0
 /// <summary>
 /// Create a new draw hooked to a Windows.Forms object and (optionally) a map
 /// </summary>
 /// <param name="opener">The Form to which Redraw events are passed</param>
 /// <param name="currentMap">(optional) map to use</param>
 public Input(Server.Dispatcher opener)
 {
     _opener = opener;
 }