diff --git a/source/menus/BaseOptionItem.hx b/source/menus/BaseOptionItem.hx index b330d10..392b0a4 100644 --- a/source/menus/BaseOptionItem.hx +++ b/source/menus/BaseOptionItem.hx @@ -72,8 +72,6 @@ class BaseOptionItem extends FlxSpriteGroup background.antialiasing = true; - background.color = background.color.getDarkened(0.25); - background.frames = FlxAtlasFrames.fromSparrow(AssetMan.graphic(Paths.png("assets/images/menus/BaseOptionItem/background")), Paths.xml("assets/images/menus/BaseOptionItem/background")); background.animation.addByPrefix("background", "background", 12.0); diff --git a/source/menus/BoolOptionItem.hx b/source/menus/BoolOptionItem.hx index fd6f4a6..83cf057 100644 --- a/source/menus/BoolOptionItem.hx +++ b/source/menus/BoolOptionItem.hx @@ -25,8 +25,6 @@ class BoolOptionItem extends BaseOptionItem checkbox.antialiasing = true; - checkbox.color = checkbox.color.getDarkened(0.25); - checkbox.frames = FlxAtlasFrames.fromSparrow(AssetMan.graphic(Paths.png("assets/images/menus/BoolOptionItem/checkbox")), Paths.xml("assets/images/menus/BoolOptionItem/checkbox")); checkbox.animation.addByIndices("check", "checkbox", [0, 1, 2, 3, 4, 5, 6], "", 24.0, false); diff --git a/source/menus/OptionsMenu.hx b/source/menus/OptionsMenu.hx index 3e3ed76..80001b2 100644 --- a/source/menus/OptionsMenu.hx +++ b/source/menus/OptionsMenu.hx @@ -8,6 +8,8 @@ import flixel.graphics.frames.FlxAtlasFrames; import flixel.group.FlxSpriteGroup.FlxTypedSpriteGroup; +import flixel.math.FlxMath; + import flixel.sound.FlxSound; import flixel.text.FlxText; @@ -23,8 +25,6 @@ import core.Paths; import game.levels.Level1; -import util.MathUtil; - class OptionsMenu extends FlxState { public var background:FlxSprite; @@ -182,8 +182,6 @@ class OptionsMenu extends FlxState descriptor.antialiasing = true; - descriptor.color = descriptor.color.getDarkened(0.25); - descriptor.frames = FlxAtlasFrames.fromSparrow(AssetMan.graphic(Paths.png("assets/images/menus/OptionsMenu/descriptor")), Paths.xml("assets/images/menus/OptionsMenu/descriptor")); descriptor.animation.addByPrefix("descriptor", "descriptor", 12.0); @@ -204,9 +202,9 @@ class OptionsMenu extends FlxState descText.font = Paths.ttf("assets/fonts/Ubuntu Regular"); - descText.alignment = LEFT; + descText.alignment = CENTER; - descText.setPosition(descriptor.x + 300.0, descriptor.getMidpoint().y - descText.height * 0.5 - 35.0); + descText.setPosition(descriptor.getMidpoint().x - descText.width * 0.5, descriptor.getMidpoint().y - descText.height * 0.5 - 25.0); add(descText); @@ -221,29 +219,20 @@ class OptionsMenu extends FlxState { super.update(elapsed); - if (FlxG.keys.justPressed.DOWN) + if (FlxG.keys.justPressed.DOWN || FlxG.mouse.wheel == -1.0) { - var _option:Int = option; + FlxG.sound.play(AssetMan.sound(Paths.ogg("assets/sounds/menus/OptionsMenu/scroll"), false), 0.35); - option = MathUtil.boundInt(option + 1, 0, options.members.length - 1); - - if (_option != options.members.length - 1.0) - FlxG.sound.play(AssetMan.sound(Paths.ogg("assets/sounds/menus/OptionsMenu/scroll"), false), 0.35); + option = FlxMath.wrap(option + 1, 0, options.members.length - 1); } - if (FlxG.keys.justPressed.UP) + if (FlxG.keys.justPressed.UP || FlxG.mouse.wheel == 1.0) { - var _option:Int = option; - - option = MathUtil.boundInt(option - 1, 0, options.members.length - 1); + FlxG.sound.play(AssetMan.sound(Paths.ogg("assets/sounds/menus/OptionsMenu/scroll"), false), 0.35); - if (_option != 0) - FlxG.sound.play(AssetMan.sound(Paths.ogg("assets/sounds/menus/OptionsMenu/scroll"), false), 0.35); + option = FlxMath.wrap(option - 1, 0, options.members.length - 1); } - if (FlxG.mouse.wheel != 0.0) - option = MathUtil.boundInt(option - FlxG.mouse.wheel, 0, options.members.length - 1); - if (FlxG.keys.justPressed.DOWN || FlxG.keys.justPressed.UP || FlxG.mouse.wheel != 0.0) descText.text = options.members[option].description; diff --git a/source/util/MathUtil.hx b/source/util/MathUtil.hx index 5c232a7..eb65224 100644 --- a/source/util/MathUtil.hx +++ b/source/util/MathUtil.hx @@ -63,9 +63,4 @@ class MathUtil return output; } - - public static function boundInt(int:Int, min:Null = null, max:Null = null):Int - { - return Std.int(FlxMath.bound(int, min, max)); - } } \ No newline at end of file