Skip to content

Commit

Permalink
tiny fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Joalor64GH authored Dec 5, 2024
1 parent 7bb87ba commit c69ed38
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 35 deletions.
8 changes: 0 additions & 8 deletions source/Main.hx
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ class Main extends openfl.display.Sprite {
};

public static var fpsDisplay:FPS;
public static var fpsOnRight(default, set):Bool = false;

public static var toast:ToastCore;

public function new() {
Expand Down Expand Up @@ -184,12 +182,6 @@ class Main extends openfl.display.Sprite {
}
}

public static function set_fpsOnRight(value:Bool):Bool {
fpsOnRight = value;
fpsDisplay.onRight = value;
return value;
}

public static function updateFramerate(newFramerate:Int) {
if (newFramerate > FlxG.updateFramerate) {
FlxG.updateFramerate = newFramerate;
Expand Down
4 changes: 2 additions & 2 deletions source/backend/Paths.hx
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,10 @@ class Paths {
}

inline public static function getTextArray(path:String):Array<String>
return Assets.exists(path) ? [for (i in Assets.getText(path).trim().split('\n')) i.trim()] : [];
return exists(path) ? [for (i in getText(path).trim().split('\n')) i.trim()] : [];

static public function getTextFromFile(key:String):String
return (exists(file(key))) ? getText(file(key)) : null;
return exists(file(key)) ? getText(file(key)) : null;

inline static public function txt(key:String)
return file('$key.txt');
Expand Down
22 changes: 1 addition & 21 deletions source/debug/FPS.hx
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,11 @@ import openfl.text.*;
import openfl.events.Event;

class FPS extends TextField {
public var onRight(default, set):Bool = false;
public var borderSize:Int = 1;

private final borders:Array<TextField> = new Array<TextField>();
private var times:Array<Float> = [];

var xStart:Float = 10.0;

public function set_onRight(value:Bool):Bool {
var align:TextFormat = new TextFormat();
align.align = (value ? "right" : "left");
setTextFormat(align);
return onRight = value;
}

public function new(x:Float, y:Float, color:Int, ?font:String) {
super();

Expand All @@ -35,7 +25,6 @@ class FPS extends TextField {

text = "";
this.x = x;
xStart = x;
this.y = y;
width = 1280;
height = 720;
Expand All @@ -53,16 +42,7 @@ class FPS extends TextField {
if (mem > memPeak)
memPeak = mem;

if (visible) {
if (onRight) {
x = Application.current.window.width - width - xStart;
for (border in borders)
border.x = Application.current.window.width - width - xStart;
} else
x = xStart;

text = 'FPS: ${times.length}\nMEM: ${FlxStringUtil.formatBytes(mem)} / ${FlxStringUtil.formatBytes(memPeak)}';
}
text = (visible) ? 'FPS: ${times.length}\nMEM: ${FlxStringUtil.formatBytes(mem)} / ${FlxStringUtil.formatBytes(memPeak)}' : '';

textColor = (times.length < FlxG.drawFramerate * 0.5) ? 0xFFFF0000 : 0xFFFFFFFF;
});
Expand Down
2 changes: 0 additions & 2 deletions source/states/ChartingState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ class ChartingState extends ExtendableState {
override function create() {
super.create();

Main.fpsOnRight = true;

Paths.clearStoredMemory();
Paths.clearUnusedMemory();

Expand Down
2 changes: 0 additions & 2 deletions source/states/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,6 @@ class PlayState extends ExtendableState {
override function create() {
super.create();

Main.fpsOnRight = false;

Paths.clearStoredMemory();

if (FlxG.sound.music != null)
Expand Down

0 comments on commit c69ed38

Please sign in to comment.