File tree Expand file tree Collapse file tree 3 files changed +26
-48
lines changed
Expand file tree Collapse file tree 3 files changed +26
-48
lines changed Original file line number Diff line number Diff line change 1- const Struct = require ( 'awestruct' )
21const createImageData = require ( './createImageData' )
3-
4- const t = Struct . types
2+ const headerStruct = require ( './header' )
53
64module . exports = SLP
75
@@ -32,27 +30,6 @@ const RENDER_OUTLINE = 0x05
3230const RENDER_FILL = 0x06
3331const RENDER_PLAYER_FILL = 0x07
3432
35- // SLP Header
36- let headerStruct = Struct ( {
37- version : t . string ( 4 ) ,
38- numFrames : t . int32 ,
39- comment : t . string ( 24 ) ,
40-
41- frames : t . array ( 'numFrames' , Struct ( {
42- cmdTableOffset : t . uint32 ,
43- outlineTableOffset : t . uint32 ,
44- paletteOffset : t . uint32 ,
45- properties : t . uint32 ,
46-
47- width : t . int32 ,
48- height : t . int32 ,
49- hotspot : Struct ( {
50- x : t . int32 ,
51- y : t . int32
52- } )
53- } ) )
54- } )
55-
5633const getPlayerColor = ( pal , idx , player ) => pal [ idx + 16 * player ]
5734
5835/**
Original file line number Diff line number Diff line change 1- const Struct = require ( 'awestruct' )
2-
3- const t = Struct . types
1+ const headerStruct = require ( './header' )
42
53module . exports = SLPEncoder
64
@@ -31,27 +29,6 @@ const RENDER_OUTLINE = 0x05
3129const RENDER_FILL = 0x06
3230const RENDER_PLAYER_FILL = 0x07
3331
34- // SLP Header
35- const headerStruct = Struct ( {
36- version : t . string ( 4 ) ,
37- numFrames : t . int32 ,
38- comment : t . string ( 24 ) ,
39-
40- frames : t . array ( 'numFrames' , Struct ( {
41- cmdTableOffset : t . uint32 ,
42- outlineTableOffset : t . uint32 ,
43- paletteOffset : t . uint32 ,
44- properties : t . uint32 ,
45-
46- width : t . int32 ,
47- height : t . int32 ,
48- hotspot : Struct ( {
49- x : t . int32 ,
50- y : t . int32
51- } )
52- } ) )
53- } )
54-
5532function last ( arr ) {
5633 return arr [ arr . length - 1 ]
5734}
Original file line number Diff line number Diff line change 1+ const Struct = require ( 'awestruct' )
2+
3+ const t = Struct . types
4+
5+ // SLP Header
6+ module . exports = Struct ( {
7+ version : t . string ( 4 ) ,
8+ numFrames : t . int32 ,
9+ comment : t . string ( 24 ) ,
10+
11+ frames : t . array ( 'numFrames' , Struct ( {
12+ cmdTableOffset : t . uint32 ,
13+ outlineTableOffset : t . uint32 ,
14+ paletteOffset : t . uint32 ,
15+ properties : t . uint32 ,
16+
17+ width : t . int32 ,
18+ height : t . int32 ,
19+ hotspot : Struct ( {
20+ x : t . int32 ,
21+ y : t . int32
22+ } )
23+ } ) )
24+ } )
You can’t perform that action at this time.
0 commit comments