<?php if (!extension_loaded('php_qt')) { dl('php_qt.' . PHP_SHLIB_SUFFIX); } echo "\nTesting qAbs:\n"; echo "qAbs(4) = " . qAbs(4) . "\n"; echo "qAbs(-4) = " . qAbs(-4) . "\n"; echo "qAbs(4.3) = " . qAbs(4.3) . "\n"; echo "qAbs(-4.3) = " . qAbs(-4.3) . "\n"; echo "\nTesting qRound:\n"; echo "qRound(1) = " . qRound(1) . "\n"; echo "qRound(4.5) = " . qRound(4.5) . "\n"; echo "qRound(-4.47837289) = " . qRound(-4.478327289) . "\n"; echo "\nTesting qRound64:\n"; echo "qRound64(1) = " . qRound64(1) . "\n"; echo "qRound64(4.5) = " . qRound64(4.5) . "\n"; echo "qRound64(-4.47837289) = " . qRound64(-4.478327289) . "\n"; echo "\nTesting qMin:\n"; echo "qMin(4,5) = " . qMin(4, 5) . "\n"; echo "qMin(7,-1.567) = " . qMin(7, -1.567) . "\n"; echo "\nTesting qMax:\n"; echo "qMax(4,5) = " . qMax(4, 5) . "\n"; echo "qMax(7,-1.567) = " . qMax(7, -1.567) . "\n"; echo "\nTesting qBound:\n"; echo "qBound(3,4,5) = " . qBound(3, 4, 5) . "\n"; echo "qBound(4,3,5) = " . qBound(4, 3, 5) . "\n"; echo "qBound(4,6,5) = " . qBound(4, 6, 5) . "\n"; echo "\nTesting qPrintable:\n"; echo "qPrintable(\"bob\") = " . qPrintable("bob") . "\n"; echo "qPrintable(new QString(\"fred\") = " . qPrintable(new QString("fred")) . "\n";
private function shotRect() { $gravity = 4.0; $time = $this->timerCount / 20.0; $velocity = $this->shootForce; $radians = $this->shootAngle * 3.14159265 / 180; $velx = $velocity * cos($radians); $vely = $velocity * sin($radians); $x0 = ($this->barrelRect->right() + 5) * cos($radians); $y0 = ($this->barrelRect->right() + 5) * sin($radians); $x = $x0 + $velx * $time; $y = $y0 + $vely * $time - 0.5 * $gravity * $time * $time; $result = new QRect(0, 0, 6, 6); $result->moveCenter(new QPoint(qRound($x), $this->height() - 1 - qRound($y))); return $result; }