protected override void TimerEvent(QTimerEvent e) { if (car.IsValid()) ui.label.Text = "connected"; else ui.label.Text = "disconnected"; }
protected override void TimerEvent(QTimerEvent e) { interceptor.Invoke("timerEvent#", "timerEvent(QTimerEvent*)", typeof(void), typeof(QTimerEvent), e); }
protected override void TimerEvent(QTimerEvent arg1) { interceptor.Invoke("timerEvent#", "timerEvent(QTimerEvent*)", typeof(void), typeof(QTimerEvent), arg1); }
/// <remarks> /// Reimplemented from QObject /// </remarks> <short> Reimplemented from QObject </short> protected virtual void TimerEvent(QTimerEvent arg1) { }
public void TimerEvent(QTimerEvent e) { double axelDistance = 54; double wheelsAngleRads = (wheelsAngle * Pi) / 180; double turnDistance = Math.Cos(wheelsAngleRads) * axelDistance * 2; double turnRateRads = wheelsAngleRads / turnDistance; // rough estimate double turnRate = (turnRateRads * 180) / Pi; double rotation = speed * turnRate; Rotate(rotation); Translate(0, -speed); Update(); }
protected override void TimerEvent(QTimerEvent e) { mouse.TimerEvent(e); }
public void TimerEvent(QTimerEvent e) { // Don't move too far away QLineF lineToCenter = new QLineF(new QPointF(0, 0), MapFromScene(0, 0)); if (lineToCenter.Length() > 150) { double angleToCenter = Math.Acos(lineToCenter.Dx() / lineToCenter.Length()); if (lineToCenter.Dy() < 0) angleToCenter = TwoPi - angleToCenter; angleToCenter = NormalizeAngle((Pi - angleToCenter) + Pi / 2); if (angleToCenter < Pi && angleToCenter > Pi / 4) { // Rotate left angle += (angle < -Pi / 2) ? 0.25 : -0.25; } else if (angleToCenter >= Pi && angleToCenter < (Pi + Pi / 2 + Pi / 4)) { // Rotate right angle += (angle < Pi / 2) ? 0.25 : -0.25; } } else if (Math.Sin(angle) < 0) { angle += 0.25; } else if (Math.Sin(angle) > 0) { angle -= 0.25; } // Try not to crash with any other mice List<QPointF> list = new List<QPointF>(); list.Add(MapToScene(0, 0)); list.Add(MapToScene(-30, -50)); list.Add(MapToScene(30, -50)); List<IQGraphicsItem> dangerMice = Scene().Items(new QPolygonF(list)); foreach (QGraphicsItem item in dangerMice) { if (item == this) continue; QLineF lineToMouse = new QLineF(new QPointF(0, 0), MapFromItem(item, 0, 0)); double angleToMouse = Math.Acos(lineToMouse.Dx() / lineToMouse.Length()); if (lineToMouse.Length() == 0) { angleToMouse = 0; } if (lineToMouse.Dy() < 0) angleToMouse = TwoPi - angleToMouse; angleToMouse = NormalizeAngle((Pi - angleToMouse) + Pi / 2); if (angleToMouse >= 0 && angleToMouse < Pi / 2) { // Rotate right angle += 0.5; } else if (angleToMouse <= TwoPi && angleToMouse > (TwoPi - Pi / 2)) { // Rotate left angle -= 0.5; } } // Add some random movement if (dangerMice.Count > 1 && (random.Next(10)) == 0) { if (random.Next(1) == 1) angle += (random.Next(100)) / 500.0; else angle -= (random.Next(100)) / 500.0; } speed += (-50 + random.Next(100)) / 100.0; double dx = Math.Sin(angle) * 10; mouseEyeDirection = (Math.Abs(dx / 5) < 1) ? 0 : dx / 5; Rotate(dx); SetPos(MapToParent(0, -(3 + Math.Sin(speed) * 3))); }
protected override void TimerEvent(QTimerEvent e) { car.TimerEvent(e); }
protected virtual void TimerEvent(QTimerEvent arg1) { interceptor.Invoke("timerEvent#", "timerEvent(QTimerEvent*)", typeof(void), typeof(QTimerEvent), arg1); }