예제 #1
0
        public static void Init(PictureBox _pb)
        {
            IDrawer stdDrawer        = new DrawerStandart(_pb);
            IDrawer testDrawer       = new DrawerDebug(_pb);
            IDrawer interstingDrawer = new DrawerInteresting(_pb);

            m_pBox = _pb;


            m_factory2 = new ParticleFactoryStandart(_pb.Width, _pb.Height, stdDrawer);

            m_tstFactory = new ParticleFactoryInteresting(_pb.Width, _pb.Height, interstingDrawer);


            var borderOfArea = new BorderBounce(new List <PairDouble>
            {
                new PairDouble(0, 0),
                new PairDouble(0, _pb.Height),
                new PairDouble(_pb.Width, _pb.Height),
                new PairDouble(_pb.Width, 0)
            });

            m_box = new ParticleBox(m_factory2, Miscelaneous.ParticleCount, stdDrawer, borderOfArea);

            Run(m_box);
        }
예제 #2
0
        public static void Init(PictureBox _pb)
        {
            IDrawer stdDrawer = new DrawerStandart(_pb);
            IDrawer testDrawer = new DrawerDebug(_pb);
            IDrawer interstingDrawer = new DrawerInteresting(_pb);
            m_pBox = _pb;


            m_factory2 = new ParticleFactoryStandart(_pb.Width, _pb.Height, stdDrawer);

            m_tstFactory = new ParticleFactoryInteresting(_pb.Width, _pb.Height, interstingDrawer);


            var borderOfArea = new BorderBounce(new List<PairDouble>
                                            {
                                                new PairDouble(0, 0),
                                                new PairDouble(0, _pb.Height),
                                                new PairDouble(_pb.Width, _pb.Height),
                                                new PairDouble(_pb.Width, 0)
                                            });

            m_box = new ParticleBox(m_factory2, Miscelaneous.ParticleCount, stdDrawer, borderOfArea);

            Run(m_box);
        }
예제 #3
0
 private static async void Run(IParticleBox _box)
 {
     _box.Draw();
     while (true)
     {
         await Task.Run(() => Live(_box));
     }
 }
예제 #4
0
 private static async void Run(IParticleBox _box)
 {
     _box.Draw();
     while(true)
     {
         await Task.Run(() => Live(_box));
     }
 }
예제 #5
0
 public static void Live(IParticleBox _box)
 {
     lock (_box)
     {
         _box.NextStep();
         _box.Draw();
         _box.Particles.Last().Draw(m_pBox);
     }
 }
예제 #6
0
 public static void Live(IParticleBox _box)
 {
     lock (_box)
     {
         _box.NextStep();
         _box.Draw();
         _box.Particles.Last().Draw(m_pBox);
     }
 }
예제 #7
0
        public virtual void Draw(IParticleBox _box)
        {
            var bmp = new Bitmap(SizeX, SizeY, Graph);

            tempGraph = Graphics.FromImage(bmp);
            tempGraph.Clear(Color.White);

            foreach (var particle in _box.Particles)
            {
                particle.Draw();
            }
            
            Graph.DrawImage(bmp, 0, 0);
        }
예제 #8
0
        public virtual void Draw(IParticleBox _box)
        {
            var bmp = new Bitmap(SizeX, SizeY, Graph);

            tempGraph = Graphics.FromImage(bmp);
            tempGraph.Clear(Color.White);

            foreach (var particle in _box.Particles)
            {
                particle.Draw();
            }

            Graph.DrawImage(bmp, 0, 0);
        }