Skip to content

Commit

Permalink
yeayea just a lot
Browse files Browse the repository at this point in the history
still no inst():Sound fix yet cuz thats for next weekend, but if you want it now, idk make a pr for it
  • Loading branch information
charlesisfeline committed Feb 29, 2024
1 parent fbdfb8e commit 7901ebf
Show file tree
Hide file tree
Showing 33 changed files with 623 additions and 202 deletions.
3 changes: 3 additions & 0 deletions Project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@
<assets path='art/readme.txt' rename='dont_look_at_this_folder/warned.txt' />
<assets path='art/the rel readme.txt' rename='readme.txt' />

<!-- This seems to be occuring only on linux, so I'm gonna do this -->
<template path="source/ManifestResources.hx" rename="../haxe/ManifestResources.hx" if="linux" />

<!-- _______________________________ Libraries ______________________________ -->

<haxelib name="flixel" />
Expand Down
Binary file added assets/shared/images/coolmic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/shared/images/foxaIcon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
65 changes: 24 additions & 41 deletions source/Main.hx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import flixel.util.FlxColor;
import lime.app.Application;
import haxe.EnumFlags;
import haxe.Exception;
import debug.FPSCounter;

#if linux
import lime.graphics.Image;
Expand Down Expand Up @@ -50,7 +51,8 @@ class Main extends Sprite
startFullscreen: false // if the game should start at fullscreen mode
};

public static var fpsVar:FPS;
public static var fpsVar:FPSCounter;
public static var watermark:Sprite;

public static var instance:Main;

Expand All @@ -72,6 +74,15 @@ class Main extends Sprite
Sys.setCwd(lime.system.System.applicationStorageDirectory);
#end

#if windows
@:functionCode("
#include <windows.h>
#include <winuser.h>
setProcessDPIAware() // allows for more crisp visuals
DisableProcessWindowsGhosting() // lets you move the window and such if it's not responding
")
#end

instance = this;

if (stage != null) init();
Expand Down Expand Up @@ -113,13 +124,22 @@ class Main extends Sprite

cppthing.CppAPI.darkMode();

#if !mobile
fpsVar = new FPS(10, 3, 0xFFFFFF);
#if !mobile fpsVar = new FPSCounter(10, 3);
addChild(fpsVar);
Lib.current.stage.align = "tl";
Lib.current.stage.scaleMode = StageScaleMode.NO_SCALE;
if (fpsVar != null) fpsVar.visible = ClientPrefs.data.showFPS;
#end
#end

// Mic'd Up SC code :D
var bitmapData = Assets.getBitmapData("assets/shared/images/foxaIcon.png");
watermark = new Sprite();
watermark.addChild(new Bitmap(bitmapData)); // Sets the graphic of the sprite to a Bitmap object, which uses our embedded BitmapData class.
watermark.alpha = 0.4;
watermark.x = Lib.application.window.width - 10 - watermark.width;
watermark.y = Lib.application.window.height - 10 - watermark.height;
addChild(watermark);
if (watermark != null) watermark.visible = ClientPrefs.data.watermarkIcon;

#if linux
var icon = Image.fromFile("icon.png");
Expand All @@ -146,43 +166,6 @@ class Main extends Sprite
});
}

// Chroma Effect (12 Colors)
var array:Array<FlxColor> = [
FlxColor.fromRGB(216, 34, 83),
FlxColor.fromRGB(255, 38, 0),
FlxColor.fromRGB(255, 80, 0),
FlxColor.fromRGB(255, 147, 0),
FlxColor.fromRGB(255, 199, 0),
FlxColor.fromRGB(255, 255, 0),
FlxColor.fromRGB(202, 255, 0),
FlxColor.fromRGB(0, 255, 0),
FlxColor.fromRGB(0, 146, 146),
FlxColor.fromRGB(0, 0, 255),
FlxColor.fromRGB(82, 40, 204),
FlxColor.fromRGB(150, 33, 146)
];
var skippedFrames = 0;
var currentColor = 0;

// Event Handlers
public function coloring():Void {
// Hippity, Hoppity, your code is now my property (from Kade Engine)
if (ClientPrefs.data.fpsRainbow) {
fpsVar.isRainbow = true;
if (currentColor >= array.length) currentColor = 0;
currentColor = Math.round(FlxMath.lerp(0, array.length, skippedFrames / ClientPrefs.data.framerate));
(cast(Lib.current.getChildAt(0), Main)).changeFPSColor(array[currentColor]);
currentColor++;
skippedFrames++;
if (skippedFrames > ClientPrefs.data.framerate) skippedFrames = 0;
} else {
fpsVar.isRainbow = false;
fpsVar.textColor = FlxColor.fromRGB(255, 255, 255);
}
}

public function changeFPSColor(color:FlxColor) fpsVar.textColor = color;

static function resetSpriteCache(sprite:Sprite):Void {
@:privateAccess {
sprite.__cacheBitmap = null;
Expand Down
128 changes: 128 additions & 0 deletions source/ManifestResources.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
package;

import haxe.io.Bytes;
import haxe.io.Path;
import lime.utils.AssetBundle;
import lime.utils.AssetLibrary;
import lime.utils.AssetManifest;
import lime.utils.Assets;

#if sys
import sys.FileSystem;
#end

#if disable_preloader_assets
@:dox(hide) class ManifestResources {
public static var preloadLibraries:Array<Dynamic>;
public static var preloadLibraryNames:Array<String>;
public static var rootPath:String;

public static function init (config:Dynamic):Void {
preloadLibraries = new Array ();
preloadLibraryNames = new Array ();
}
}
#else
@:access(lime.utils.Assets)


@:keep @:dox(hide) class ManifestResources {
public static var preloadLibraries:Array<AssetLibrary>;
public static var preloadLibraryNames:Array<String>;
public static var rootPath:String;


public static function init (config:Dynamic):Void {

preloadLibraries = new Array ();
preloadLibraryNames = new Array ();

rootPath = null;

if (config != null && Reflect.hasField (config, "rootPath")) {
rootPath = Reflect.field (config, "rootPath");
if(!StringTools.endsWith (rootPath, "/")) {
rootPath += "/";
}
}

if (rootPath == null) {
#if (ios || tvos || webassembly)
rootPath = "assets/";
#elseif android
rootPath = "";
#elseif (console || sys)
rootPath = lime.system.System.applicationDirectory;
rootPath = haxe.io.Path.normalize(Sys.getCwd() + '/');
#else
rootPath = "./";
#end
}

#if (openfl && !flash && !display)
::if (assets != null)::::foreach assets::::if (type == "font")::openfl.text.Font.registerFont (__ASSET__OPENFL__::flatName::);
::end::::end::::end::
#end

var data, manifest, library, bundle;

::if (assets != null)::::foreach assets::::if (type == "manifest")::::if (embed)::data = '::data::';
manifest = AssetManifest.parse (data, rootPath);
library = AssetLibrary.fromManifest (manifest);
Assets.registerLibrary ("::library::", library);
::else::Assets.libraryPaths["::library::"] = rootPath + "::resourceName::";
::end::::end::::if (type == "bundle")::::if (embed)::
bundle = AssetBundle.fromBytes (#if flash Bytes.ofData (new __ASSET__::flatName:: () #else new __ASSET__::flatName:: () #end));
library = AssetLibrary.fromBundle (bundle);
Assets.registerLibrary ("::library::", library);
::else::Assets.bundlePaths["::library::"] = rootPath + "::resourceName::";
::end::::end::::end::::end::

::foreach libraries::::if (preload)::library = Assets.getLibrary ("::name::");
if (library != null) preloadLibraries.push (library);
else preloadLibraryNames.push ("::name::");
::end::::end::

}


}

#if !display
#if flash

::foreach assets::::if (embed != false)::::if (type == "image")::@:keep @:bind @:noCompletion #if display private #end class __ASSET__::flatName:: extends flash.display.BitmapData { public function new () { super (0, 0, true, 0); } }::else::@:keep @:bind @:noCompletion #if display private #end class __ASSET__::flatName:: extends ::flashClass:: { }::end::
::end::::end::

#elseif (desktop || cpp)

::if (assets != null)::::foreach assets::::if (embed)::@:keep ::if (type == "image")::@:image("::sourcePath::") @:noCompletion #if display private #end class __ASSET__::flatName:: extends lime.graphics.Image {}
::elseif (type == "sound")::@:file("::sourcePath::") @:noCompletion #if display private #end class __ASSET__::flatName:: extends haxe.io.Bytes {}
::elseif (type == "music")::@:file("::sourcePath::") @:noCompletion #if display private #end class __ASSET__::flatName:: extends haxe.io.Bytes {}
::elseif (type == "font")::@:font("::sourcePath::") @:noCompletion #if display private #end class __ASSET__::flatName:: extends lime.text.Font {}
::else::@:file("::sourcePath::") @:noCompletion #if display private #end class __ASSET__::flatName:: extends haxe.io.Bytes {}
::end::::end::::end::::end::
::if (assets != null)::::foreach assets::::if (!embed)::::if (type == "font")::@:keep @:noCompletion #if display private #end class __ASSET__::flatName:: extends lime.text.Font { public function new () { ::if (targetPath != null)::__fontPath = ManifestResources.rootPath + "::targetPath::";::else::::if (library != null)::__fontID = "::library:::::id::";::else::__fontID = "::id::";::end::::end:: ::if (fontName)::name = "::fontName::";::end:: super (); }}
::end::::end::::end::::end::

#else

::if (assets != null)::::foreach assets::::if (type == "font")::@:keep @:expose('__ASSET__::flatName::') @:noCompletion #if display private #end class __ASSET__::flatName:: extends lime.text.Font { public function new () { #if !html5 __fontPath = "::targetPath::"; #else ascender = ::ascender::; descender = ::descender::; height = ::height::; numGlyphs = ::numGlyphs::; underlinePosition = ::underlinePosition::; underlineThickness = ::underlineThickness::; unitsPerEM = ::unitsPerEM::; #end::if (fontName):: name = "::fontName::";::end:: super (); }}
::end::::end::::end::

#end

#if (openfl && !flash)

#if html5
::if (assets != null)::::foreach assets::::if (type == "font")::@:keep @:expose('__ASSET__OPENFL__::flatName::') @:noCompletion #if display private #end class __ASSET__OPENFL__::flatName:: extends openfl.text.Font { public function new () {::if (embed):: __fromLimeFont (new __ASSET__::flatName:: ());::else::::if (fontName):: name = "::fontName::";::end::::end:: super (); }}
::end::::end::::end::
#else
::if (assets != null)::::foreach assets::::if (type == "font")::@:keep @:expose('__ASSET__OPENFL__::flatName::') @:noCompletion #if display private #end class __ASSET__OPENFL__::flatName:: extends openfl.text.Font { public function new () {::if (embed):: __fromLimeFont (new __ASSET__::flatName:: ());::else:: ::if (targetPath != null)::__fontPath = ManifestResources.rootPath + "::targetPath::";::else::::if (library != null)::__fontID = "::library:::::id::";::else::__fontID = "::id::";::end::::end::::if (fontName):: name = "::fontName::";::end::::end:: super (); }}
::end::::end::::end::
#end

#end
#end

#end
4 changes: 2 additions & 2 deletions source/animateatlas/Main.hx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package;
import animateatlas.JSONData.AtlasData;
import openfl.display.BitmapData;
import animateatlas.JSONData.AnimationData;
import openfl.display.FPS;
import openfl.Lib;
import openfl.events.MouseEvent;
import debug.FPSCounter;
import animateatlas.HelperEnums.LoopMode;
import openfl.events.Event;
import openfl.display.Tilemap;
Expand Down Expand Up @@ -48,7 +48,7 @@ class Main extends Sprite {
renderer.tileColorTransformEnabled = false;

addChild(renderer);
addChild(new FPS(10, 10, 0xFFFFFF));
addChild(new FPSCounter(10, 10, 0xFFFFFF));

tileSymbols = [];
spriteSymbols = [];
Expand Down
9 changes: 9 additions & 0 deletions source/backend/ClientPrefs.hx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ import states.StartingState;
public var middleScroll:Bool = false;
public var opponentStrums:Bool = true;
public var showFPS:Bool = true;
public var showTotalFPS:Bool = false;
public var memory:Bool = true;
public var totalMemory:Bool = false;
public var engineVersion:Bool = false;
public var debugInfo:Bool = false;
public var rainbowFPS:Bool = false;
public var redText:Bool = true;
public var watermarkIcon:Bool = true;
public var flashing:Bool = true;
public var autoPause:Bool = true;
public var fullscreen:Bool = false;
Expand All @@ -29,6 +37,7 @@ import states.StartingState;
public var splashAlpha:Float = 0.6;
public var fpsRainbow:Bool = false; //kadedev
public var laneUnderlay:Float = 0;
public var checkerBoard:Bool = true;
public var coloredHealthBar = true;
public var enableVignette:Bool = false;
public var botplaySine:Bool = true;
Expand Down
19 changes: 19 additions & 0 deletions source/backend/CoolUtil.hx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ import flixel.FlxObject;
import openfl.utils.Assets;
import lime.utils.Assets as LimeAssets;

#if sys
import sys.io.File;
import sys.FileSystem;
#end

using StringTools;

enum SlideCalcMethod
Expand Down Expand Up @@ -94,6 +99,20 @@ class CoolUtil
return daList;
}

public static function formatMemory(num:UInt):String {
var size:Float = num;
var data = 0;
var dataTexts = ["B", "KB", "MB", "GB", "TB"];
while (size > 1024 && data < dataTexts.length - 1) {
data++;
size = size / 1024;
}

size = Math.round(size * 100) / 100;
var formatSize:String = formatAccuracy(size);
return formatSize + " " + dataTexts[data];
}

inline public static function removeFromString(remove:String = "", string:String = "")
return string.replace(remove, "");

Expand Down
31 changes: 13 additions & 18 deletions source/backend/StageData.hx
Original file line number Diff line number Diff line change
Expand Up @@ -82,26 +82,21 @@ class StageData {
}

public static function getStageFile(stage:String):StageFile {
var rawJson:String = null;
var path:String = Paths.getSharedPath('stages/' + stage + '.json');
try {
var path:String = Paths.getSharedPath('stages/' + stage + '.json');
#if MODS_ALLOWED
var modPath:String = Paths.modFolders('stages/' + stage + '.json');
if(FileSystem.exists(modPath))
return cast tjson.TJSON.parse(File.getContent(modPath));
else if(FileSystem.exists(path))
return cast tjson.TJSON.parse(File.getContent(path));

#if MODS_ALLOWED
var modPath:String = Paths.modFolders('stages/' + stage + '.json');
if(FileSystem.exists(modPath)) {
rawJson = File.getContent(modPath);
} else if(FileSystem.exists(path)) {
rawJson = File.getContent(path);
#else
if(Assets.exists(path))
return cast tjson.TJSON.parse(Assets.getText(path));
#end
}
#else
if(Assets.exists(path)) {
rawJson = Assets.getText(path);
}
#end
else
{
return null;
}
return cast Json.parse(rawJson);
return dummy(); //Stage couldn't be found, create a dummy stage for preventing a crash
}

public static function vanillaSongStage(songName):String
Expand Down
Loading

0 comments on commit 7901ebf

Please sign in to comment.