A library to parse INI files.
haxelib git ini https://github.com/MrNiz/IniParser
- first obtain a INI with data
["keys"]
up="UP"
down="DOWN"
["volume"]
master=100
- Second parse it in haxe.
/**
["keys"]
up="UP"
down="DOWN"
["volume"]
master=100
*/
var myIni = sys.io.File.getContent("config.ini").trim();
/*
{keys=> {up= "UP", down="DOWN"},volume=>{master=>100}}
*/
var map:ini.Ini.INI = ini.Ini.parse(myIni);
- For last step use in you Game!
// Using Flixel example.
import flixel.FlxSprite;
import flixel.FlxState;
class MyState extends FlxState
{
override function create():Void
{
super.create();
var myIni = sys.io.File.getContent("character.ini").trim();
var map:ini.Ini.INI = ini.Ini.parse(myIni);
var damian = map.get("Damian")
var sprite = new FlxSprite().loadSprite(damian.get("file"));
}
}