Skip to content

Commit

Permalink
Performance changes, note folder changed, memory monitor, new boyfrie…
Browse files Browse the repository at this point in the history
…nd, etc.

Performance changes, note folder changed, memory monitor, new boyfriend, etc.
  • Loading branch information
TheGaloXx committed Dec 11, 2022
1 parent 96be893 commit 266921c
Show file tree
Hide file tree
Showing 39 changed files with 641 additions and 869 deletions.
Binary file modified assets/shared/images/characters/bf-dead.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
248 changes: 122 additions & 126 deletions assets/shared/images/characters/bf-dead.xml

Large diffs are not rendered by default.

Binary file modified assets/shared/images/characters/bf.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
437 changes: 172 additions & 265 deletions assets/shared/images/characters/bf.xml

Large diffs are not rendered by default.

File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
Binary file modified extra/art/Flash files/Custom Boyfriend.fla
Binary file not shown.
38 changes: 21 additions & 17 deletions source/Character.hx
Original file line number Diff line number Diff line change
Expand Up @@ -205,32 +205,34 @@ class Character extends FlxSprite

animation.addByPrefix('hey', 'BF HEY', 24, false);
animation.addByPrefix('hurt', 'BF hit', 24, false);
animation.addByPrefix('attack', 'boyfriend attack', 24, false);
//animation.addByPrefix('attack', 'boyfriend attack', 24, false);
animation.addByPrefix('dodge', 'boyfriend dodge', 24, false);
animation.addByPrefix('scared', 'BF idle shaking', 24);
//animation.addByPrefix('scared', 'BF idle shaking', 24);

addOffset('idle', -5);

addOffset("singUP", -47, 33);
addOffset("singRIGHT", -48, -7);
addOffset("singLEFT", 7, -6);
addOffset("singDOWN", -16, -50);
addOffset("singUP", -53, 19);
addOffset("singRIGHT", -88, 7);
addOffset("singLEFT", 11, 8);
addOffset("singDOWN", -40);

addOffset("singUPmiss", -39, 19);
addOffset("singRIGHTmiss", -47, 21);
addOffset("singLEFTmiss", -9, 20);
addOffset("singDOWNmiss", -12, -22);
addOffset("singUPmiss", -40);
addOffset("singRIGHTmiss", -74, 4);
addOffset("singLEFTmiss", -25, 7);
addOffset("singDOWNmiss", -25, -1);

addOffset("hey", -2, 4);
addOffset("hurt", 8, 20);
addOffset("attack", 291, 273);
addOffset("dodge", -7, -15);
addOffset('scared', -4);
addOffset("hey", -32, 4);
addOffset("hurt", -53, 9);
//addOffset("attack", 291, 273);
addOffset("dodge", -21, 4);
//addOffset('scared', -4);

flipX = true;

curColor = FlxColor.fromRGB(49, 176, 209);

setGraphicSize(Std.int(width * 0.9), Std.int(height * 0.9)); //head is big af

case 'bf-pixel':
var tex = Paths.getSparrowAtlas('characters/bf-pixel', 'shared');
frames = tex;
Expand Down Expand Up @@ -273,14 +275,16 @@ class Character extends FlxSprite
animation.addByPrefix('deathConfirm', "BF Dead confirm", 24, false);

addOffset('firstDeath', 37, 11);
addOffset('deathLoop', 37, 5);
addOffset('deathConfirm', 37, 69);
addOffset('deathLoop', 36, 8);
addOffset('deathConfirm', 36, 8);
playAnim('firstDeath');

flipX = true;

curColor = FlxColor.fromRGB(49, 176, 209);

setGraphicSize(Std.int(width * 0.9), Std.int(height * 0.9)); //head is big af

case 'bf-pixel-dead':
frames = Paths.getSparrowAtlas('characters/bf-pixel-dead', 'shared');
animation.addByPrefix('firstDeath', "BF dies", 24, false);
Expand Down
1 change: 1 addition & 0 deletions source/KadeEngineData.hx
Original file line number Diff line number Diff line change
Expand Up @@ -97,5 +97,6 @@ class KadeEngineData
KeyBinds.keyCheck();

(cast (Lib.current.getChildAt(0), Main)).setFPSCap(FlxG.save.data.fpsCap);
(cast (Lib.current.getChildAt(0), Main)).toggleMemCounter(FlxG.save.data.fps);
}
}
19 changes: 18 additions & 1 deletion source/Main.hx
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package;

import openfl.system.System;
import flixel.graphics.FlxGraphic;
import openfl.Assets;
import openfl.display.Application;
import flixel.util.FlxColor;
import flixel.FlxG;
Expand All @@ -22,7 +25,7 @@ class Main extends Sprite

// You can pretty much ignore everything from here on - your code should go in your states.

public static var appTitle:String = "Friday Night Funkin': Funkergarten";
public static var appTitle:String = "Funkergarten";

public static function main():Void
{
Expand Down Expand Up @@ -74,6 +77,10 @@ class Main extends Sprite
#end
addChild(game);

#if cpp
addChild(memoryMonitor);
#end

#if !mobile
fpsCounter = new FPS(10, 3, 0xFFFFFF);
addChild(fpsCounter);
Expand All @@ -84,12 +91,22 @@ class Main extends Sprite

var game:FlxGame;

#if cpp
var memoryMonitor:MemoryMonitor = new MemoryMonitor(10, 3, 0xffffff);
#end
var fpsCounter:FPS;

public function toggleFPS(fpsEnabled:Bool):Void {
fpsCounter.visible = fpsEnabled;
}

public function toggleMemCounter(enabled:Bool):Void
{
#if cpp
memoryMonitor.visible = enabled;
#end
}

public function changeFPSColor(color:FlxColor)
{
fpsCounter.textColor = color;
Expand Down
74 changes: 74 additions & 0 deletions source/MemoryMonitor.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
package;

import cpp.vm.Gc;
import openfl.events.Event;
import openfl.text.TextField;
import openfl.text.TextFormat;

//Code from Indie Cross
// https://imgur.com/a/LVkQmqe
#if windows
@:headerCode("
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <psapi.h>
// are you serious??
// do i have to include this after windows.h to not get outrageous compilation errors??????
// one side of my brains loves c++ and the other one hates it
")
#end
class MemoryMonitor extends TextField
{
private var times:Array<Float>;
private var memPeak:Float = 0;

public function new(inX:Float = 10.0, inY:Float = 10.0, inCol:Int = 0x000000)
{
super();

x = inX;
y = inY;
selectable = false;
defaultTextFormat = new TextFormat("_sans", 12, inCol);

addEventListener(Event.ENTER_FRAME, onEnter);
width = 150;
height = 70;
}

private function onEnter(_)
{
#if windows
// now be an ACTUAL real man and get the memory from plain & straight c++
var actualMem:Float = obtainMemory();
#else
// be a real man and calculate memory from hxcpp
var actualMem:Float = Gc.memInfo64(3); // update: this sucks
#end
var mem:Float = Math.round(actualMem / 1024 / 1024 * 100) / 100;
if (mem > memPeak)
memPeak = mem;

if (visible)
{
text = "\nMEM: " + mem + " MB\nMEM peak: " + memPeak + " MB";
}
}

#if windows // planning to do the same for linux but im lazy af so rn it'll use the hxcpp gc
@:functionCode("
// ily windows api <3
auto memhandle = GetCurrentProcess();
PROCESS_MEMORY_COUNTERS pmc;
if (GetProcessMemoryInfo(memhandle, &pmc, sizeof(pmc)))
return(pmc.WorkingSetSize);
else
return 0;
")
function obtainMemory():Dynamic
{
return 0;
}
#end
}
2 changes: 1 addition & 1 deletion source/MusicBeatState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -149,4 +149,4 @@ class MusicBeatState extends FlxUIState
FlxTween.tween(screenFade, {alpha: 1}, 0.5);
new FlxTimer().start(0.5, function(_) video.playVideo(Paths.video(videoName + '.mp4')));
}
}
}
3 changes: 2 additions & 1 deletion source/Note.hx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class Note extends FlxSprite
if (!PlayState.isPixel) //if not pixel
{
//normal notes
frames = Paths.getSparrowAtlas('gameplay/' + daPath);
frames = Paths.getSparrowAtlas('gameplay/notes/' + daPath);

animation.addByPrefix('greenScroll', 'green0');
animation.addByPrefix('redScroll', 'red0');
Expand Down Expand Up @@ -202,6 +202,7 @@ class Note extends FlxSprite

x += width / 2;

y -= 15;
switch (noteData)
{
case 2:
Expand Down
6 changes: 3 additions & 3 deletions source/NoteSplash.hx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class NoteSplash extends FlxSprite
switch(type)
{
case 'gum':
var tex = Paths.getSparrowAtlas('gameplay/gumSplash', 'shared');
var tex = Paths.getSparrowAtlas('gameplay/notes/gumSplash', 'shared');
frames = tex;
animation.addByPrefix('splash', 'Gum Splash', 24, false);

Expand All @@ -23,7 +23,7 @@ class NoteSplash extends FlxSprite
//perfect offsets x += 80, y += 70

default:
var tex = Paths.getSparrowAtlas('gameplay/' + (PlayState.isPixel ? 'pixel/' : '') + 'noteSplashes', 'shared');
var tex = Paths.getSparrowAtlas('gameplay/' + (PlayState.isPixel ? 'pixel/' : 'notes/') + 'noteSplashes', 'shared');
frames = tex;
animation.addByPrefix('splash 0 0', 'note impact 1 purple', 24, false);
animation.addByPrefix('splash 0 1', 'note impact 1 blue', 24, false);
Expand Down Expand Up @@ -73,7 +73,7 @@ class GumTrap extends FlxSprite
{
super(x, y);

var tex = Paths.getSparrowAtlas('gameplay/Gum_trap', 'shared');
var tex = Paths.getSparrowAtlas('gameplay/notes/Gum_trap', 'shared');
frames = tex;
animation.addByIndices('idle', 'Sticky Note', [0, 1, 2, 3], "", 24, true);
animation.addByIndices('pre-struggle', 'Sticky Note', [4, 5, 6, 7], "", 24, false);
Expand Down
20 changes: 2 additions & 18 deletions source/Objects.hx
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,6 @@ class KinderButton extends FlxSpriteGroup

class Try extends FlxSprite
{
//aaaaaaaaaaaaa
//i really like creating a new .hx for every fucking thing that i make

public function new(x:Float = 0, y:Float = 0, animated:Bool)
{
super(x, y);
Expand All @@ -147,20 +144,7 @@ class Try extends FlxSprite
var tex = Paths.getSparrowAtlas('tries');
frames = tex;

/*
animation.addByPrefix('0', '0', 0);
animation.addByPrefix('1', '1', 0);
animation.addByPrefix('2', '2', 0);
animation.addByPrefix('3', '3', 0);
animation.addByPrefix('4', '4', 0);
animation.addByPrefix('5', '5', 0);
animation.addByPrefix('6', '6', 0);
animation.addByPrefix('7', '7', 0);
animation.addByPrefix('8', '8', 0);
animation.addByPrefix('9', '9', 0);
*/

for (i in 0...9)
for (i in 0...10)
{
animation.addByPrefix(Std.string(i), Std.string(i), 0);
}
Expand All @@ -173,7 +157,7 @@ class Try extends FlxSprite
}

antialiasing = FlxG.save.data.antialiasing;
setGraphicSize(Std.int(this.width * 1.5));
setGraphicSize(Std.int(this.width * 1.4));
updateHitbox();
screenCenter(Y);
}
Expand Down
Loading

0 comments on commit 266921c

Please sign in to comment.