Skip to content

Commit

Permalink
UI update
Browse files Browse the repository at this point in the history
  • Loading branch information
Hackx2 committed Mar 17, 2024
1 parent 6c8e73e commit f694c02
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 16 deletions.
7 changes: 7 additions & 0 deletions source/backend/utils/ClientPrefs.hx
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,13 @@ class ClientPrefs {
Reflect.setField(data, key, Reflect.field(FlxG.save.data, key));


#if (!html5 && !switch)
if(FlxG.save.data.framerate == null) {
final refreshRate:Int = FlxG.stage.application.window.displayMode.refreshRate;
data.framerate = Std.int(FlxMath.bound(refreshRate, 60, 240));
}
#end

if(data.framerate > FlxG.drawFramerate)
{
FlxG.updateFramerate = data.framerate;
Expand Down
2 changes: 1 addition & 1 deletion source/game/Main.hx
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class Main extends Sprite
dateNow = dateNow.replace(" ", "_");
dateNow = dateNow.replace(":", "'");

path = "./crash/" + "PsychEngine_" + dateNow + ".txt";
path = "./crash/" + "AstroEngine_" + dateNow + ".txt";

for (stackItem in callStack)
{
Expand Down
51 changes: 36 additions & 15 deletions source/game/states/PlayState.hx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package game.states;

import flixel.util.FlxSpriteUtil;
import backend.funkinLua.LuaUtils;
import backend.data.EngineData;
import backend.data.WeekData;
Expand Down Expand Up @@ -113,7 +114,8 @@ using StringTools;

class PlayState extends MusicBeatState
{
var sexyUhmTxt:FlxTypedGroup<flixel.FlxSprite>;
var sexyUhmTxt:FlxTypedGroup<FlxSprite>;
var statBGGroup:FlxTypedGroup<FlxSprite>;

public static var STRUM_X = 42;
public static var STRUM_X_MIDDLESCROLL = -278;
Expand Down Expand Up @@ -304,7 +306,6 @@ class PlayState extends MusicBeatState
public var songHits:Int = 0;
public var songMisses:Int = 0;
public var scoreTxt:FlxText;
public var scoreTxtBG:FlxSprite;
var timeTxt:FlxText;
var versionTxtSmth:FlxText;
var scoreTxtTween:FlxTween;
Expand Down Expand Up @@ -1099,7 +1100,7 @@ class PlayState extends MusicBeatState
timeBarBG.yAdd = -5;
add(timeBarBG);

versionTxtSmth = new FlxText(FlxG.width - 300, 10, 400, "Astro Engine: v"+EngineData.mainCoreShit.coreVersion, 32);
versionTxtSmth = new FlxText(FlxG.width - 320, 10, 400, "Astro Engine: v"+EngineData.mainCoreShit.coreVersion, 32);
versionTxtSmth.setFormat(backend.utils.Paths.font("PhantomMuff.ttf"), 20, FlxColor.WHITE, CENTER, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
versionTxtSmth.scrollFactor.set();
versionTxtSmth.alpha = 0;
Expand Down Expand Up @@ -1214,8 +1215,11 @@ class PlayState extends MusicBeatState
var main_y:Int = 264;
var x:Int = 120;
var y:Int = 40;

sexyUhmTxt = new FlxTypedGroup<FlxSprite>();
add(sexyUhmTxt);
statBGGroup = new FlxTypedGroup<FlxSprite>();
add(statBGGroup);

var MAIN_SIZE:Int = 24;

Expand Down Expand Up @@ -1278,16 +1282,23 @@ class PlayState extends MusicBeatState
scoreTxt.borderSize = 1.25;
scoreTxt.visible = !ClientPrefs.data.hideFullHUD;

scoreTxtBG = new FlxSprite(0,scoreTxt.y).makeGraphic(FlxG.width, 50, FlxColor.BLACK);
scoreTxtBG.alpha = 0;
scoreTxtBG.visible = false;

if(!ClientPrefs.data.downScroll)
scoreTxtBG.visible = true;
if(ClientPrefs.data.hideFullHUD)
scoreTxtBG.visible = false;
// scoreTxtBG = new FlxSprite(0,scoreTxt.y).makeGraphic(FlxG.width, 50, FlxColor.BLACK);
// scoreTxtBG.alpha = 0;
// scoreTxtBG.visible = false;
//15//250

var curve:Int = 35;
// WaterMark
addCurveBG(scoreTxt.x+20, scoreTxt.y + 4.5, 225, 35, curve, curve, statBGGroup, 0);
// ScoreBar
addCurveBG(healthBarBG.x, scoreTxt.y + 4.5, 600, 35, curve, curve, statBGGroup, 0);
// TimeBar (Alt)
addCurveBG(songLeft.x - 12.5, scoreTxt.y + 4.5, 125, 35, curve, curve, statBGGroup, 0);
if (!ClientPrefs.data.downScroll)
statBGGroup.visible = true;
if (ClientPrefs.data.hideFullHUD)
statBGGroup.visible = false;

add(scoreTxtBG);
add(versionTxtSmth);
scoreTxt.y += 10;
add(psyWatermark);
Expand Down Expand Up @@ -1319,7 +1330,7 @@ class PlayState extends MusicBeatState
scoreTxt.cameras = [camHUD];
psyWatermark.cameras = [camHUD];
songLeft.cameras = [camHUD];
scoreTxtBG.cameras = [camHUD];
statBGGroup.cameras = [camHUD];
botplayTxt.cameras = [camHUD];
timeBar.cameras = [camHUD];
timeBarBG.cameras = [camHUD];
Expand Down Expand Up @@ -1582,6 +1593,13 @@ class PlayState extends MusicBeatState
}
#end

function addCurveBG(x:Float = 0, y:Float = 0, width:Int = 0, height:Int = 0, ellipseWidth:Int = 0, ellipseHeight:Int = 0, ?group:FlxTypedGroup<Dynamic>, startAlpha:Int = 0) {
var shit = new FlxSprite(x,y).makeGraphic(width, height, FlxColor.TRANSPARENT, true);
FlxSpriteUtil.drawRoundRect(shit, 0, 0, width, height, ellipseWidth, ellipseHeight, FlxColor.BLACK);
shit.alpha = startAlpha;
group.add(shit);
}

function set_songSpeed(value:Float):Float
{
if(generatedMusic)
Expand Down Expand Up @@ -2595,8 +2613,11 @@ class PlayState extends MusicBeatState
FlxTween.tween(songLeft, {alpha: 1}, 0.5, {ease: FlxEase.circOut});
FlxTween.tween(psyWatermark, {alpha: 1}, 0.5, {ease: FlxEase.circOut});
FlxTween.tween(scoreTxt, {alpha: 1}, 0.5, {ease: FlxEase.circOut});
FlxTween.tween(scoreTxtBG, {alpha: 0.6}, 0.5, {ease: FlxEase.circOut});


statBGGroup.forEach(function(spr:FlxSprite)
{
FlxTween.tween(spr, {alpha: 0.6}, 0.5, {ease: FlxEase.circOut});
});
/*
sickTxt.text = 'Sick: ${sicks}';
goodsTxt.text = 'Good: ${goods}';
Expand Down

0 comments on commit f694c02

Please sign in to comment.