Skip to content

Instantly share code, notes, and snippets.

@triplefox
Created January 16, 2015 11:53
Show Gist options
  • Save triplefox/b64eb859b4152dc5ae5c to your computer and use it in GitHub Desktop.
Save triplefox/b64eb859b4152dc5ae5c to your computer and use it in GitHub Desktop.
Data types for 2d sprite packing tool
type
DataEntry* = object
k:string # key
v:int # value
Rect* = object
x:int
y:int
w:int # width
h:int # height
d:seq[DataEntry] # metadata
AssetGroup* = ref object
rect:Rect # describes surface that assets are packed on
name:string
counter:int # start point for auto-incrementing ids
Asset* = ref object
p:Asset # previous version of asset
i:int # asset id
g:AssetGroup # group association
r:seq[Rect] # rectangles: 1st is boundary.
# additional are metadata, relative to top-left.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment