Skip to content

Instantly share code, notes, and snippets.

/ClassBar.hx Secret
Created Jan 25, 2017

Embed
What would you like to do?
package classes.utils;
import flixel.ui.FlxBar;
@:enum
abstract BarType(Int) from Int to Int {
var GAME_STATE_SCORE_BAR = 0;
var SETTINGS_VOLUME_BAR = 1;
}
class ClassBar extends FlxBar
{
@:isVar public var barID(get, set):BarType;
public function new(xpos:Float,ypos:Float,max:Int,barID:BarType)
{
super(xpos, ypos);
FlxBarFillDirection.LEFT_TO_RIGHT;
this.min = 0;
this.max = max;
this.barID = barID;
setRange(min, max);
switch(barID) {
case GAME_STATE_SCORE_BAR:
{
createImageBar(AssetPaths.emptyScoreStarBarBG__png, AssetPaths.fullScoreStarFG__png);
pxPerPercent = 4;
}
case SETTINGS_VOLUME_BAR:
{
createImageBar(AssetPaths.emptyBar300x50__png, AssetPaths.fullBar300x50__png);
}
}
percent = 100;
}
public function getMax():Int
{
return Math.floor(max);
}
public function setMax(Max:Int):Void
{
max = Max;
setRange(min,max);
}
public function get_barID():BarType
{
return barID;
}
public function set_barID(value:BarType):BarType
{
return barID = value;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.