-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTKTexturePack.lua
41 lines (34 loc) · 889 Bytes
/
TKTexturePack.lua
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
module(..., package.seeall)
TKTexturePack = {}
function TKTexturePack:new ( o )
o = o or {}
setmetatable ( o, self )
self.__index = self
return o
end
function TKTexturePack:init ()
self.textureTables = {}
return self
end
function TKTexturePack:addTextureTable ( tbl )
table.insert ( self.textureTables, tbl )
end
function TKTexturePack:getFrameInfo ( frameName )
for i, tbl in ipairs ( self.textureTables ) do
if tbl.spriteNames [ frameName ] then
local frameInfo = {}
frameInfo.frameName = frameName
frameInfo.deck = tbl.deck
frameInfo.resourceScaleFactor = tbl.resourceScaleFactor
frameInfo.index = tbl.spriteNames [ frameName ]
return frameInfo
end
end
end
function TKTexturePack:release ()
for i, tbl in ipairs ( self.textureTables ) do
tbl.texture:release ()
end
self.textureTables = {}
end
return TKTexturePack