devnix /
chipmunkphp
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace Chipmunk; |
||
| 6 | |||
| 7 | class Vector extends AbstractFfi |
||
| 8 | { |
||
| 9 | public function __construct(float $x = 0.0, float $y = 0.0) |
||
| 10 | { |
||
| 11 | parent::__construct(); |
||
| 12 | |||
| 13 | $this->setCData($this->getFfi()->new('cpVect')); |
||
| 14 | |||
| 15 | $this->getCData()->x = $x; |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 16 | $this->getCData()->y = $y; |
||
|
0 ignored issues
–
show
|
|||
| 17 | } |
||
| 18 | |||
| 19 | public function getX(): float |
||
| 20 | { |
||
| 21 | return $this->getCData()->x; |
||
|
0 ignored issues
–
show
|
|||
| 22 | } |
||
| 23 | |||
| 24 | public function setX(float $x): self |
||
| 25 | { |
||
| 26 | $this->getCData()->x = $x; |
||
|
0 ignored issues
–
show
|
|||
| 27 | |||
| 28 | return $this; |
||
| 29 | } |
||
| 30 | |||
| 31 | public function getY(): float |
||
| 32 | { |
||
| 33 | return $this->getCData()->y; |
||
|
0 ignored issues
–
show
|
|||
| 34 | } |
||
| 35 | |||
| 36 | public function setY(float $y): self |
||
| 37 | { |
||
| 38 | $this->getCData()->y = $y; |
||
|
0 ignored issues
–
show
|
|||
| 39 | |||
| 40 | return $this; |
||
| 41 | } |
||
| 42 | } |
||
| 43 |