Exemple #1
0
        public Visualiser(SimSession _Sim, PictureBox _RenderTarget, double xMeters = 40)
        {
            Enabled = _RenderTarget != null;
            if (!Enabled)
            {
                return;
            }

            Sim          = _Sim;
            RenderTarget = _RenderTarget;
            PxPerMeter   = RenderTarget.ClientSize.Width / xMeters;
            if (RenderTarget.Image == null)
            {
                RenderTarget.Image = new Bitmap(RenderTarget.ClientSize.Width, RenderTarget.ClientSize.Height);
            }
            g = Graphics.FromImage(RenderTarget.Image);

            stringFormat               = new StringFormat();
            stringFormat.Alignment     = StringAlignment.Center;
            stringFormat.LineAlignment = StringAlignment.Center;

            Pics = new Dictionary <string, Image>();

            try {
                foreach (var f in Directory.GetFiles("img"))
                {
                    Pics[Path.GetFileNameWithoutExtension(f).ToLower()] = Image.FromFile(f);
                }
            } catch { }

            if (Pics.Count == 0)
            {
                UsePics = false;
            }

            FrameTimer = new Stopwatch();
            FrameTimer.Start();
        }
Exemple #2
0
 public Form1()
 {
     InitializeComponent();
     Sim = new SimSession(RenderBox, txtLog, "ouput.txt", 2);
 }