Esempio n. 1
0
 void BubbleLayer_Resize(object sender, EventArgs e)
 {
     border = new RectangleBorder(this);
     lock (lockBubble)
     {
         this.graphics = this.CreateGraphics();
     }
 }
        public BubbleLayerTimer()
        {
            InitializeComponent();

            this.MouseUp   += BubbleLayer_MouseUp;
            this.MouseDown += BubbleLayer_MouseDown;
            this.Resize    += BubbleLayer_Resize;

            graphics = this.CreateGraphics();

            circles        = new List <Circle>();
            border         = new RectangleBorder(this);
            timer          = new Timer();
            timer.Interval = 10;
            timer.Tick    += timer_Tick;
            timer.Start();
        }
Esempio n. 3
0
 public void CheckForBorderCollision(RectangleBorder border)
 {
     if (CollisionDetection.IsCollisionCircleLine(this, border.LeftStart, border.LeftEnd))
     {
         this.Direction = GetReflection(Direction, NormalizeVector(new Vector2(1, 0)));
     }
     else if (CollisionDetection.IsCollisionCircleLine(this, border.RightStart, border.RightEnd))
     {
         this.Direction = GetReflection(Direction, NormalizeVector(new Vector2(-1, 0)));
     }
     else if (CollisionDetection.IsCollisionCircleLine(this, border.TopStart, border.TopEnd))
     {
         this.Direction = GetReflection(Direction, NormalizeVector(new Vector2(0, -1)));
     }
     else if (CollisionDetection.IsCollisionCircleLine(this, border.BottomStart, border.BottomEnd))
     {
         this.Direction = GetReflection(Direction, NormalizeVector(new Vector2(0, 1)));
     }
 }