Skip to content

Commit

Permalink
some changes lol
Browse files Browse the repository at this point in the history
Improved moonchart format detection
Optimized some unnnecesary array instances on script calls
Added song backup vocals
Removed haxeui cuz meh i dont think ill ever take the time to actually use it lol
  • Loading branch information
MaybeMaru committed Nov 23, 2024
1 parent f8d18e7 commit ae9023b
Show file tree
Hide file tree
Showing 18 changed files with 161 additions and 283 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ haxelib install flixel-addons
haxelib install flixel-ui
haxelib install hxvlc
haxelib git moonchart https://github.com/MaybeMaru/moonchart
haxelib git haxeui-openfl https://github.com/haxeui/haxeui-openfl
haxelib git haxeui-core https://github.com/haxeui/haxeui-core
haxelib git maru-hscript https://github.com/MaybeMaru/hscript-improved
haxelib git discord_rpc https://github.com/Aidan63/linc_discord-rpc
```
Expand Down
14 changes: 0 additions & 14 deletions actions/libraries.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,6 @@
"type": "install",
"version": null
},
{
"name": "haxeui-openfl",
"type": "git",
"dir": null,
"ref": "master",
"url": "https://github.com/haxeui/haxeui-openfl"
},
{
"name": "haxeui-core",
"type": "git",
"dir": null,
"ref": "master",
"url": "https://github.com/haxeui/haxeui-core"
},
{
"name": "hxcpp-debug-server",
"type": "install",
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
191 changes: 0 additions & 191 deletions assets/ui/chart-tabs.xml

This file was deleted.

2 changes: 0 additions & 2 deletions project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@
<haxelib name="flixel"/>
<haxelib name="flixel-ui"/>
<haxelib name="flixel-addons"/>
<haxelib name="haxeui-core" unless="mac"/>
<haxelib name="haxeui-openfl" unless="mac"/>
<haxelib name="maru-hscript"/>
<haxelib name="moonchart"/>

Expand Down
34 changes: 20 additions & 14 deletions source/FPS_Mem.hx
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ import memory.Memory;

class FPS_Mem extends TextField
{
private var times:Array<Float>;

public function new(X:Float = 10.0, Y:Float = 10.0, Color:Int = 0x000000)
{
super();
Expand All @@ -31,7 +29,6 @@ class FPS_Mem extends TextField
defaultTextFormat = new TextFormat("_sans", 12, Color);

text = "FPS: ";
times = [];

addEventListener(Event.ENTER_FRAME, onEnter);
addEventListener(Event.ADDED_TO_STAGE, create);
Expand All @@ -45,6 +42,7 @@ class FPS_Mem extends TextField
}

function onResize(_):Void {
lastTime = Timer.stamp();
final _scale = Math.min(FlxG.stage.stageWidth / FlxG.width, FlxG.stage.stageHeight / FlxG.height);
scaleX = _scale;
scaleY = _scale;
Expand All @@ -60,28 +58,36 @@ class FPS_Mem extends TextField
}

var memPeak:Float = 0;
var lastTime:Float = 0;

var timeFrame:Float = 0;
var frames:Int = 0;

private function onEnter(_):Void
{
if (!visible)
return;

final now = Timer.stamp();
times.push(now);
timeFrame += (now - lastTime);
frames++;

while (times[0] < now - 1)
times.shift();
if (timeFrame >= (1 / 6))
{
final fps = Std.int(frames / timeFrame);
final bytes = #if (cpp && !mobile) Memory.getCurrentUsage(); #else System.totalMemory; #end
final memCur = formatBytes(bytes);

final fps:Int = times.length;
if (memCur > memPeak)
memPeak = memCur;

final bytes = #if (cpp && !mobile) Memory.getCurrentUsage(); #else System.totalMemory; #end
final memCur = formatBytes(bytes);
text = 'FPS: ${Math.min(fps, FlxG.updateFramerate)}\nRAM: $memCur mb/$memPeak mb';

if (memCur > memPeak)
memPeak = memCur;
frames = 0;
while (timeFrame > 0)
timeFrame = timeFrame - (1 / 6);
}

text =
'FPS: ${fps > FlxG.updateFramerate ? FlxG.updateFramerate : fps}\n' +
'RAM: $memCur mb/$memPeak mb';
lastTime = now;
}
}
15 changes: 3 additions & 12 deletions source/Main.hx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ import openfl.events.UncaughtErrorEvent;
import openfl.Lib;
import openfl.display.Sprite;
import openfl.events.Event;
#if !mac
import haxe.ui.Toolkit;
import haxe.ui.locale.LocaleManager;
#end

class InitState extends FlxState
{
Expand Down Expand Up @@ -89,14 +85,9 @@ class Main extends Sprite
if (hasEventListener(Event.ADDED_TO_STAGE))
removeEventListener(Event.ADDED_TO_STAGE, init);

#if !mac
// Init haxeui
Toolkit.theme = "dark";
Toolkit.init();
#end

// TODO: Only spanish and portuguese exist
//LocaleManager.instance.language;
moonchart.backend.FormatDetector.defaultFileFormatter = (title, diff) -> {
return [diff.trim().toLowerCase()];
}

setupGame();
}
Expand Down
16 changes: 12 additions & 4 deletions source/funkin/objects/Character.hx
Original file line number Diff line number Diff line change
Expand Up @@ -230,15 +230,23 @@ class Character extends FlxSpriteExt
__superUpdate(elapsed);
}

public function prepareCamPoint(?point:Null<FlxPoint>, ?bounds:Array<Float>)
public function getCamPoint(?point:Null<FlxPoint>):FlxPoint
{
point = getMidpoint(point);

point ??= FlxPoint.get();
point.set(width * 0.5, height * 0.5);
point.subtract(camOffsets.x * (flippedOffsets ? -1 : 1), camOffsets.y);
point.subtract(stageCamOffsets.x, stageCamOffsets.y);

if (flippedOffsets)
point.add((width * (isPlayerJson ? 0.25 : -(0.25 / 2))), 0);

return point;
}

public function prepareCamPoint(?point:Null<FlxPoint>, ?bounds:Array<Float>)
{
point = getCamPoint(point);
point.add(x, y);

if (bounds != null) {
point.x = FlxMath.bound(point.x, bounds[0], bounds[2]);
Expand Down
Loading

0 comments on commit ae9023b

Please sign in to comment.