Skip to content
This repository has been archived by the owner on Jan 26, 2025. It is now read-only.

Commit

Permalink
cum
Browse files Browse the repository at this point in the history
  • Loading branch information
MaybeMaru committed Dec 29, 2023
1 parent c697471 commit 696b1b8
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<assets path="assets/preload" rename="assets" exclude="*.mp3" unless="web"/>

<define name="PRELOAD_ALL" unless="web" />
<define name="NO_PRELOAD_ALL" unless="PRELOAD_ALL"/>
<define name="NO_PRELOAD_ALL" if="web"/>

<section if="PRELOAD_ALL">
<library name="songs" preload="true" />
Expand Down
5 changes: 5 additions & 0 deletions source/FPS_Mem.hx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,12 @@ class FPS_Mem extends TextField
times.shift();

final fps:Int = times.length;
#if web
final mem:Float = FlxMath.roundDecimal(Math.round(System.totalMemory * memDiv) * 0.01, 2);
#else
final mem:Float = Math.round(System.totalMemory * memDiv) * 0.01;
#end

if (mem > memPeak) memPeak = mem;

final result:UTF8String =
Expand Down
13 changes: 11 additions & 2 deletions source/Main.hx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package;

import openfl.display.BitmapData;
import flixel.system.FlxAssets;
import lime.app.Application;
import openfl.events.UncaughtErrorEvent;
import openfl.Lib;
Expand Down Expand Up @@ -107,18 +109,21 @@ class Main extends Sprite

private function init(?E:Event):Void
{
#if mac throw("no."); #end
#if (mac || web) throw("no."); #end
if (hasEventListener(Event.ADDED_TO_STAGE))
removeEventListener(Event.ADDED_TO_STAGE, init);

setupGame();
}

public static final DEFAULT_GRAPHIC:FlxGraphic = FlxGraphic.fromAssetKey("flixel/images/logo/default.png", true, "::default_graphic::", false);
public static var DEFAULT_GRAPHIC(default, null):GlobalGraphic = null;

private function setupGame():Void {
final stageWidth:Int = Lib.current.stage.stageWidth;
final stageHeight:Int = Lib.current.stage.stageHeight;

@:privateAccess
DEFAULT_GRAPHIC = new GlobalGraphic(null, FlxAssets.getBitmapData("flixel/images/logo/default.png"));

if (settings.zoom == -1.0) {
final ratioX:Float = stageWidth / settings.width;
Expand All @@ -130,4 +135,8 @@ class Main extends Sprite

addChild(game = new FlxFunkGame(settings.width, settings.height, settings.initialState, settings.framerate, settings.framerate, settings.skipSplash, settings.startFullscreen));
}
}

class GlobalGraphic extends FlxGraphic {
override function destroy() {} // Lol
}
11 changes: 8 additions & 3 deletions source/funkin/graphics/FlxSpriteExt.hx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package funkin.graphics;

import flixel.graphics.frames.FlxFrame;
import flixel.addons.effects.FlxSkewedSprite;
import flixel.util.FlxDestroyUtil;
import flixel.math.FlxMatrix;
Expand Down Expand Up @@ -114,14 +115,18 @@ class FlxSpriteExt extends FlxSkewedSprite {
}

override function checkEmptyFrame() {
if (_frame == null)
loadGraphic(Main.DEFAULT_GRAPHIC);
if (_frame == null) {
//trace(Main.DEFAULT_GRAPHIC);
frames = Main.DEFAULT_GRAPHIC.imageFrame;
}

//loadGraphic(Main.DEFAULT_GRAPHIC);
}

@:noCompletion
private inline function __superDraw() {
inline checkEmptyFrame();
if (alpha == 0 || _frame.type == EMPTY) return;
if (alpha == 0 || #if web _frame == null #elseif desktop _frame.type == FlxFrameType.EMPTY #end) return;
if (dirty) calcFrame(useFramePixels); // rarely

for (i in 0...cameras.length) {
Expand Down
8 changes: 5 additions & 3 deletions source/funkin/states/menus/TitleState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,11 @@ class TitleState extends MusicBeatState {
titleGroup.add(gfDance);

final colorSwap = Shader.initShader('colorSwap');
colorSwap.updateTime = false;
Shader.setSpriteShader(logoBump, 'colorSwap');
Shader.setSpriteShader(gfDance, 'colorSwap');
if (colorSwap != null) {
colorSwap.updateTime = false;
Shader.setSpriteShader(logoBump, 'colorSwap');
Shader.setSpriteShader(gfDance, 'colorSwap');
}

titleText = new FunkinSprite('title/titleEnter', [100,FlxG.height*0.8]);
titleText.addAnim('idle', 'Press Enter to Begin');
Expand Down
7 changes: 7 additions & 0 deletions source/funkin/states/options/OptionsState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,13 @@ class OptionsState extends MusicBeatState {
var selectedSomethin:Bool = false;

override function create():Void {
#if web
if (fromPlayState && FlxG.sound.music == null) FlxG.sound.playMusic(Paths.music('freakyMenu'));
#else
if (!fromPlayState) optionItems.push('Mod Folders');
else if (FlxG.sound.music == null) FlxG.sound.playMusic(Paths.music('freakyMenu'));
#end

optionItems.push('Exit');

var bg:FunkinSprite = new FunkinSprite('menuBGMagenta');
Expand Down Expand Up @@ -104,7 +109,9 @@ class OptionsState extends MusicBeatState {
case 'Preferences': switchState(new funkin.states.options.PreferencesState());
case 'Controls': switchState(new funkin.states.options.ControlsState());
case 'Latency': switchState(new funkin.states.options.LatencyState());
#if desktop
case 'Mod Folders': switchState(new funkin.states.options.ModFoldersState());
#end
default: exitOptions();
}
}
Expand Down

0 comments on commit 696b1b8

Please sign in to comment.