Skip to content

Commit

Permalink
fixed some issues related with package & sounds
Browse files Browse the repository at this point in the history
  • Loading branch information
MrMadera committed Aug 30, 2024
1 parent df8b8b0 commit d313fb0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
3 changes: 1 addition & 2 deletions haxelib.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"tags": ["haxe"],
"description": "No",
"version": "0.0.1",
"classPath": "me/",
"releasenote": "Initial release, everything is working correctly.",
"releasenote": "Initial release",
"contributors": ["MrMadera"]
}
13 changes: 7 additions & 6 deletions me/customs/ui/CustomButton.hx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package customs.ui;
package me.customs.ui;

import flixel.FlxG;
import flixel.FlxSprite;
import flixel.text.FlxText;
import flixel.util.FlxColor;
import flixel.group.FlxSpriteGroup;

Expand All @@ -18,8 +20,8 @@ class CustomButton extends FlxSpriteGroup

// Optional stuff
public var usingSounds:Bool = false;
public var selectButtonSound:String = '';
public var pressButtonSound:String = '';
public var selectButtonSoundPath:String = '';
public var pressButtonSoundPath:String = '';

public function new(x:Float, y:Float, width:Int, height:Int, _bgColor:FlxColor, text:String, size:Int, _txtColor:FlxColor, _onPress:Void -> Void)
{
Expand All @@ -37,7 +39,6 @@ class CustomButton extends FlxSpriteGroup
txt = new FlxText(0, 0, bg.width, text, size);
txt.setFormat("VCR OSD Mono", size, txtColor, CENTER);
txt.y = (bg.height / 2) - (txt.height / 2);
txt.antialiasing = ClientPrefs.data.antialiasing;
add(txt);
}

Expand All @@ -49,15 +50,15 @@ class CustomButton extends FlxSpriteGroup
{
if(!soundPlayed && usingSounds)
{
if(selectButtonSound != '') FlxG.sound.play(Paths.sound(selectButtonSound));
if(selectButtonSoundPath != '') try { FlxG.sound.play(selectButtonSoundPath); }
soundPlayed = true;
}
bg.makeGraphic(bgWidth, bgHeight, bgSelectedColor);
txt.color = txtSelectedColor;
if(FlxG.mouse.justPressed)
{
onPress();
if(pressButtonSound != '' && usingSounds) FlxG.sound.play(Paths.sound(pressButtonSound));
if(pressButtonSoundPath != '' && usingSounds) try { FlxG.sound.play(pressButtonSoundPath); }
}
}
else
Expand Down

0 comments on commit d313fb0

Please sign in to comment.