Skip to content

Instantly share code, notes, and snippets.

@ruby0x1
Created January 14, 2015 06:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ruby0x1/614658cfa2439a4f22d1 to your computer and use it in GitHub Desktop.
Save ruby0x1/614658cfa2439a4f22d1 to your computer and use it in GitHub Desktop.
mint wip quick example code
//create the list view
list = new mint.List({
parent: window,
name: 'list1',
bounds: new Rect(4,28,248,400-28-4)
});
//populate it with children
for(i in 0 ... 5) {
list.add_item( create_block(i) );
} //for
//create a single block panel
function create_block(idx:Int) {
var titles = ['Sword of Extraction', 'Fortitude', 'Wisdom stone', 'Cursed Blade', 'Risen Staff' ];
var desc = ['Steals 30% life of every hit from the target',
'3 second Invulnerability', 'Passive: intelligence +5',
'Each attack deals 1 damage to the weilder', 'Undead staff deals 3x damage to human enemies' ];
var _panel = new mint.Panel({
parent: list,
name: 'panel_${idx}',
bounds: new Rect(2,4,236,96),
});
new mint.Image({
name: 'icon_${idx}',
parent: _panel,
mouse_enabled:true,
bounds: new Rect(8,8,80,80),
path: 'assets/transparency.png'
});
new mint.Label({
name: 'label_${idx}',
parent: _panel,
mouse_enabled:true,
bounds: new Rect(96,8,148,18),
point_size: 16,
align: TextAlign.left,
align_vertical: TextAlign.top,
text: titles[idx]
});
new mint.Label({
name: 'desc_${idx}',
parent: _panel,
mouse_enabled:true,
bounds_wrap: true,
bounds: new Rect(96,30,132,18),
point_size: 12,
align: TextAlign.left,
align_vertical: TextAlign.top,
text: desc[idx]
});
return _panel;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment