Skip to content

A specialized FlxSprite that can render SVG content in flixel.

License

Notifications You must be signed in to change notification settings

UncertainProd/FlxSVGSprite

Repository files navigation

FlxSVGSprite

A specialized FlxSprite that can render SVG content in flixel.

Setup

This library depends on my fork of openfl/svg, which can be found here Be sure to install it using:

haxelib git svg https://github.com/UncertainProd/svg.git

and then install this library using:

haxelib git flxsvgsprite https://github.com/UncertainProd/FlxSVGSprite.git

And then add this entry to your Project.xml file:

<haxelib name="flxsvgsprite">

Usage

Import flixel.addons.display.FlxSVGSprite at the top of your file.

import flixel.addons.display.FlxSVGSprite;

And then instantiate it as follows:

// ...
//                               x,  y, width,height, svg file path
var svgSprite = new FlxSVGSprite(50, 100, 36, 36, 'path/to/svgfile.svg');
add(svgSprite); // add it to the state
// ...

You can change the sprite's width and height using it's displayWidth and displayHeight properties.

svgSprite.displayWidth = 60;
svgSprite.displayHeight = 30;

You can also change the svg that's being rendered on the sprite using the loadSVGGraphic method.

svgSprite.loadSVGSprite('new/svg/path.svg');

For a basic example, check out the samples/ folder

About

A specialized FlxSprite that can render SVG content in flixel.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages