Skip to content

rogersanctus/df-loader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

##Sprites and Animations loader for Haxe and OpenFL.##

This library was developed to load and use sprites and animations generated by DarkFunction Editor easily. It depends on OpenFL library: openfl.

To install the dependencies:

haxelib install openfl

To configure OpenFL for Native/Flash/Html5:

openfl setup

Installing

Just download and extract this library into your project folder and use it. Or install it via haxelib:

Last changes on from this repository:

haxelib git df-loader https://github.com/rogersanctus/df-loader.git

Last release from lib.haxe.org:

haxelib install df-loader

A simple Spritesheet test:

var sprs: DfSpritesheet = new DfSpritesheet( Assets.getText("teste.sprites"), "path_to_images" );

var renderer = new DfRenderer( new DfContentDef(sprs) );

// Create sprites with the sprites names on the generated xml file
var spr1 = new DfSprite("/sprite/0");
var spr2 = new DfSprite("/sprite/1");

spr1.x = 64;
spr2.x = 128;

// Add sprites to the renderer
renderer.addChild(spr1);
renderer.addChild(spr2);

// Add the renderer view to the sprite
addChild( renderer.view );

// Render the renderer
renderer.render();

The teste.sprites file:

<?xml version="1.0"?>
<!-- Generated by darkFunction Editor (www.darkfunction.com) -->
<img name="teste.png" w="64" h="32">
  <definitions>
    <dir name="/">
      <dir name="sprite">
        <spr name="0" x="0" y="0" w="32" h="32"/>
        <spr name="1" x="32" y="0" w="32" h="32"/>
      </dir>
    </dir>
  </definitions>
</img>

More samples at examples directory.

Known issues

  • Rotations on animations will not work as expected when each cell (frame) have more than one sprite with position different from the animation center point.

About

DarkFunction Sprites and Animations Loader for Haxe, OpenFL.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages