Skip to content

Commit

Permalink
fart
Browse files Browse the repository at this point in the history
I've been holding these commits for awhile
  • Loading branch information
TheRealJake12 committed Jan 6, 2025
1 parent 5357da7 commit 50be27a
Show file tree
Hide file tree
Showing 25 changed files with 527 additions and 496 deletions.
1 change: 0 additions & 1 deletion Project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@
<assets path="assets/fonts" />
<assets path="alsoft.ini" />
<!-- _______________________________ Libraries ______________________________ -->
<haxedev set="webgl" />
<!-- Flixel -->
<haxelib name="flixel" />
<haxelib name="flixel-addons" />
Expand Down
File renamed without changes
2 changes: 1 addition & 1 deletion source/ClassMacro.hx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class ClassMacro
}
}

Compiler.include("kec", [#if !FEATURE_STEPMANIA "kec.backend.util.smTools" #end]);
Compiler.include("kec");
}
}
#end
8 changes: 2 additions & 6 deletions source/Init.hx
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,14 @@ class Init extends MusicBeatState
CPPInterface.darkMode();
#end

Paths.initialize();

FlxG.save.bind('kec' #if (flixel < "5.0.0"), 'therealjake12' #end);

kec.backend.PlayerSettings.init();

kec.backend.KadeEngineData.initSave();

kec.backend.KeyBinds.keyCheck();
FilterUtils.initializeFilters();
kec.backend.Discord.load();

FilterUtils.initializeFilters();
FilterUtils.setColorBlindess(FlxG.save.data.colorblind);

// Gotta run this before any assets get loaded.
Expand All @@ -48,7 +44,7 @@ class Init extends MusicBeatState

FlxG.worldBounds.set(0, 0);

FlxG.mouse.load('assets/shared/images/curser.png');
FlxG.mouse.load('assets/shared/images/mouseCursor.png');

kec.util.Highscore.load();

Expand Down
94 changes: 38 additions & 56 deletions source/Main.hx
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,19 @@ class Main extends Sprite
startFullscreen: false // if the game should start at fullscreen mode
};

public static var mainClassState:Class<FlxState> = Init; // yoshubs jumpscare (I am aware of *the incident*)
public static var focusMusicTween:FlxTween;
public static var focused:Bool = true;

public var hasWifi:Bool = true;
public static var focused:Bool = true;

var oldVol:Float = 1.0;
var newVol:Float = 0.3;
private var oldVol:Float = 1.0;
private var newVol:Float = 0.3;

// You can pretty much ignore everything from here on - your code should go in your states.
private var curGame:FlxGame;

public static var gameContainer:Main = null; // Main instance to access when needed.

public var frameCounter:FrameCounter = null;

public static var mainClassState:Class<FlxState> = Init; // yoshubs jumpscare (I am aware of *the incident*)
public static var focusMusicTween:FlxTween;

public function new()
{
super();
Expand All @@ -66,63 +63,41 @@ class Main extends Sprite
private function setupGame():Void
{
gameContainer = this;

initHaxeUI();

// Run this first so we can see logs.
kec.backend.Debug.onInitProgram();

frameCounter = new FrameCounter(10, 3, 0xFFFFFF);
game.framerate = 60;
curGame = new Game(game.width, game.height, game.initialState, game.framerate, game.skipSplash, game.startFullscreen);

@:privateAccess
curGame._customSoundTray = flixel.FunkinSoundTray;
curGame._customSoundTray = kec.objects.SoundTray;

addChild(curGame);

FlxG.fixedTimestep = false;

#if !mobile

addChild(frameCounter);
fpsVisible(FlxG.save.data.fps);
#end

#if html5
FlxG.autoPause = false;
FlxG.mouse.visible = false;
#end
FlxG.signals.preStateSwitch.add(function()
{
Paths.clearCache();
});

#if VIDEOS
Handle.initAsync();
#end

// Finish up loading debug tools.
Debug.onGameStart();
#if desktop

#if cpp
cpp.vm.Gc.enable(true);
#end

Lib.current.loaderInfo.uncaughtErrorEvents.addEventListener(UncaughtErrorEvent.UNCAUGHT_ERROR, onCrash);
Application.current.window.onFocusOut.add(onWindowFocusOut);
Application.current.window.onFocusIn.add(onWindowFocusIn);
#end
}

public function setFPSCap(cap:Int)
{
FlxG.updateFramerate = cap;
FlxG.drawFramerate = FlxG.updateFramerate;
}

public inline function fpsVisible(visible:Bool)
return gameContainer.frameCounter.visible = visible;

public inline function setFPSPos(x:Int, y:Int)
{
gameContainer.frameCounter.x = x;
gameContainer.frameCounter.y = y;
}

public inline function setFPSColor(col:Int)
return gameContainer.frameCounter.textColor = col;

public function checkInternetConnection()
{
Debug.logInfo('Checking Internet connection Through URL: "https://www.google.com".');
Expand All @@ -148,8 +123,7 @@ class Main extends Sprite

http.request();
}

#if desktop

function onCrash(e:UncaughtErrorEvent):Void
{
var errMsg:String = "";
Expand Down Expand Up @@ -186,6 +160,24 @@ class Main extends Sprite
Sys.exit(1);
}

public function setFPSCap(cap:Int)
{
FlxG.updateFramerate = cap;
FlxG.drawFramerate = FlxG.updateFramerate;
}

public inline function fpsVisible(visible:Bool)
return gameContainer.frameCounter.visible = visible;

public inline function setFPSPos(x:Int, y:Int)
{
gameContainer.frameCounter.x = x;
gameContainer.frameCounter.y = y;
}

public inline function setFPSColor(col:Int)
return gameContainer.frameCounter.textColor = col;

function onWindowFocusOut()
{
focused = false;
Expand All @@ -207,28 +199,18 @@ class Main extends Sprite
focusMusicTween = FlxTween.tween(FlxG.sound, {volume: newVol}, 0.5);

// Conserve power by lowering draw framerate when unfocuced
// was 30 but it might cause bugs
FlxG.drawFramerate = 60;
}

function onWindowFocusIn()
{
FlxTimer.wait(0.2, function()
{
focused = true;
});

// Lower global volume when unfocused
// Normal global volume when focused
focused = true;
if (focusMusicTween != null)
focusMusicTween.cancel();

focusMusicTween = FlxTween.tween(FlxG.sound, {volume: oldVol}, 0.5);

// Bring framerate back when focused
gameContainer.setFPSCap(FlxG.save.data.fpsCap);
}
#end

function initHaxeUI():Void
{
Expand Down
11 changes: 6 additions & 5 deletions source/haxe/ui/backend/TextInputImpl.hx
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package haxe.ui.backend;

typedef TextInputEvent = {type:String, stageX:Float, stageY:Float};
typedef TextInputEvent =
{
type:String,
stageX:Float,
stageY:Float
};

#if flixel_text_input

typedef TextInputImpl = haxe.ui.backend.flixel.textinputs.FlxTextInput;

#else

typedef TextInputImpl = haxe.ui.backend.flixel.textinputs.OpenFLTextInput;

#end
Loading

0 comments on commit 50be27a

Please sign in to comment.