Пример #1
0
        public static void paint(Playground _actPlayground)
        {
            Font       drawFont  = new Font("Arial", 13);
            SolidBrush drawBrush = new SolidBrush(Color.Red);

            try
            {
                myBuffer = currentContext.Allocate(_actPlayground.CreateGraphics(), _actPlayground.DisplayRectangle);
                foreach (Feld field in Engine.FieldMap_2D)
                {
                    myBuffer.Graphics.DrawImage(field.getBMap(), field.getStartPoint());
                }

                foreach (Kiste obj in Engine.holder)
                {
                    myBuffer.Graphics.DrawImage(obj.getBMap(), obj.getStartPoint());
                }

                myBuffer.Graphics.DrawImage(_actPlayground._spieler.getBMap(), _actPlayground._spieler.getActPoint());

                //moves and shifts
                myBuffer.Graphics.DrawString("Moves " + Engine.moves, drawFont, drawBrush, new PointF(5, 30));
                myBuffer.Graphics.DrawString("Shifts " + Engine.shifts, drawFont, drawBrush, new PointF(150, 30));

                myBuffer.Render();
            }
            catch (NullReferenceException ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
                _actPlayground.timer1.Stop();
            }
        }
Пример #2
0
        public static void Start()
        {
            String Text;

            moves  = 0;
            shifts = 0;
            Playground.RegisterKeyType();
            Dateileser datain = new Dateileser();

            GraphicEngine.currentContext = BufferedGraphicsManager.Current;
            GraphicEngine.myBuffer       = GraphicEngine.currentContext.Allocate(Playground.CreateGraphics(), Playground.DisplayRectangle);

            Text = datain.leseein();
            //GraphicEngine.initiateMap(Text, ref Playground._spieler);
            GraphicEngine.initiateMap(Text, ref Spieler);

            Engine.threadTargetStarter();
            Playground.timer1.Start();
        }