mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2025-03-22 18:09:33 +00:00
use new offsets
This commit is contained in:
parent
3b3b9d97ba
commit
f3e04114eb
source/funkin/ui/options
|
@ -84,22 +84,23 @@ class PreferencesMenu extends Page
|
||||||
// TODO: Only do this on menu change?
|
// TODO: Only do this on menu change?
|
||||||
items.forEach(function(daItem:TextMenuItem) {
|
items.forEach(function(daItem:TextMenuItem) {
|
||||||
var thyOffset:Int = 0;
|
var thyOffset:Int = 0;
|
||||||
if (Std.isOfType(daItem, NumberPreferenceItem)) thyOffset = cast(daItem, NumberPreferenceItem).lefthandText.getWidth();
|
// Initializing thy text width (if thou text present)
|
||||||
|
var thyTextWidth:Int = 0;
|
||||||
|
if (Std.isOfType(daItem, NumberPreferenceItem)) thyTextWidth = cast(daItem, NumberPreferenceItem).lefthandText.getWidth();
|
||||||
|
|
||||||
// Very messy but it works
|
if (thyTextWidth != 0)
|
||||||
if (thyOffset == 0)
|
|
||||||
{
|
{
|
||||||
if (items.selectedItem == daItem) thyOffset += 150;
|
// Magic number because of the weird offset thats being added by default
|
||||||
else
|
thyOffset += thyTextWidth - 75;
|
||||||
thyOffset += 120;
|
|
||||||
}
|
}
|
||||||
else if (items.selectedItem == daItem)
|
|
||||||
|
if (items.selectedItem == daItem)
|
||||||
{
|
{
|
||||||
thyOffset += 70;
|
thyOffset += 150;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
thyOffset += 25;
|
thyOffset += 120;
|
||||||
}
|
}
|
||||||
|
|
||||||
daItem.x = thyOffset;
|
daItem.x = thyOffset;
|
||||||
|
@ -110,7 +111,7 @@ class PreferencesMenu extends Page
|
||||||
{
|
{
|
||||||
var checkbox:CheckboxPreferenceItem = new CheckboxPreferenceItem(0, 120 * (items.length - 1 + 1), defaultValue);
|
var checkbox:CheckboxPreferenceItem = new CheckboxPreferenceItem(0, 120 * (items.length - 1 + 1), defaultValue);
|
||||||
|
|
||||||
items.createItem(120, (120 * items.length) + 30, prefName, AtlasFont.BOLD, function() {
|
items.createItem(0, (120 * items.length) + 30, prefName, AtlasFont.BOLD, function() {
|
||||||
var value = !checkbox.currentValue;
|
var value = !checkbox.currentValue;
|
||||||
onChange(value);
|
onChange(value);
|
||||||
checkbox.currentValue = value;
|
checkbox.currentValue = value;
|
||||||
|
@ -122,7 +123,7 @@ class PreferencesMenu extends Page
|
||||||
function createPrefItemNumber(prefName:String, prefDesc:String, onChange:Float->Void, defaultValue:Float, min:Float, max:Float, step:Float,
|
function createPrefItemNumber(prefName:String, prefDesc:String, onChange:Float->Void, defaultValue:Float, min:Float, max:Float, step:Float,
|
||||||
precision:Int):Void
|
precision:Int):Void
|
||||||
{
|
{
|
||||||
var item = new NumberPreferenceItem(145, (120 * items.length) + 30, prefName, defaultValue, min, max, step, precision, onChange);
|
var item = new NumberPreferenceItem(0, (120 * items.length) + 30, prefName, defaultValue, min, max, step, precision, onChange);
|
||||||
items.addItem(prefName, item);
|
items.addItem(prefName, item);
|
||||||
preferenceItems.add(item.lefthandText);
|
preferenceItems.add(item.lefthandText);
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ class NumberPreferenceItem extends TextMenuItem
|
||||||
super(x, y, name, function() {
|
super(x, y, name, function() {
|
||||||
callback(this.currentValue);
|
callback(this.currentValue);
|
||||||
});
|
});
|
||||||
lefthandText = new AtlasText(20, y, formatted(defaultValue), AtlasFont.DEFAULT);
|
lefthandText = new AtlasText(15, y, formatted(defaultValue), AtlasFont.DEFAULT);
|
||||||
|
|
||||||
updateHitbox();
|
updateHitbox();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue