-
Notifications
You must be signed in to change notification settings - Fork 3
/
ActionLayer.php
48 lines (40 loc) · 1.08 KB
/
ActionLayer.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
namespace Trojal\PhpRo;
class ActionLayer
{
public function __construct($header, $sprite)
{
$this->header = & $header;
$this->sprite = & $sprite;
}
public function getDimensions()
{
if (!isset($this->header['xSize'], $this->header['ySize'])) {
$this->header['xSize'] = imagesx(
$this->sprite->getImage(
$this->getSpriteFrame(),
PHPRO_IMG_RAW
)
);
$this->header['ySize'] = imagesy(
$this->sprite->getImage(
$this->getSpriteFrame(), PHPRO_IMG_RAW
)
);
}
$width = intval($this->header['xSize'] * $this->header['xScale']);
$height = intval($this->header['ySize'] * $this->header['yScale']);
return array(
'width' => $width,
'height' => $height
);
}
public function getSpriteFrame()
{
return $this->header['sprFrame'];
}
public function getHeader()
{
return $this->header;
}
}