diff --git a/Project.xml b/Project.xml
index bf48e37..c475cab 100644
--- a/Project.xml
+++ b/Project.xml
@@ -106,7 +106,7 @@
-
+
@@ -116,13 +116,15 @@
+
+
-
+
diff --git a/assets/week_assets/the_outsiders_takingit_toofar.png b/assets/week_assets/the_outsiders_takingit_toofar.png
new file mode 100644
index 0000000..9fcd86a
Binary files /dev/null and b/assets/week_assets/the_outsiders_takingit_toofar.png differ
diff --git a/hmm.json b/hmm.json
index 0f92249..3bb03b4 100644
--- a/hmm.json
+++ b/hmm.json
@@ -7,6 +7,11 @@
"ref": "develop",
"url": "https://github.com/VsFoxaDevs/lime"
},
+ {
+ "name": "flixel-screenshot-plugin",
+ "type": "haxelib",
+ "version": null
+ },
{
"name": "haxeui-core",
"type": "haxelib",
diff --git a/source/Main.hx b/source/Main.hx
index 69bad5e..aeee3f5 100644
--- a/source/Main.hx
+++ b/source/Main.hx
@@ -8,8 +8,8 @@ import flixel.FlxGame;
import haxe.io.Path;
import openfl.Assets;
import openfl.Lib;
-import openfl.display.FPS;
import openfl.display.Sprite;
+import openfl.display.Bitmap;
import openfl.events.Event;
import openfl.display.StageScaleMode;
import lime.app.Application;
@@ -94,12 +94,6 @@ class Main extends Sprite
removeEventListener(Event.ADDED_TO_STAGE, init);
setupGame();
-
- var timer = new haxe.Timer(1);
- timer.run = () -> {
- coloring();
- if (fpsVar.textColor == 0) fpsVar.textColor = -4775566;
- } // needs to be done because textcolor beco
}
private function setupGame():Void {
@@ -114,6 +108,8 @@ class Main extends Sprite
game.width = Math.ceil(stageWidth / game.zoom);
game.height = Math.ceil(stageHeight / game.zoom);
}
+
+ flixel.FlxG.plugins.add(new flixel.addons.plugin.ScreenShotPlugin());
#if LUA_ALLOWED Lua.set_callbacks_function(cpp.Callable.fromStaticFunction(psychlua.CallbackHandler.call)); #end
Controls.instance = new Controls();
@@ -190,6 +186,8 @@ class Main extends Sprite
"I did but error oof - Vencerist",
"Ah bueno adios master - ShadowMario",
"Skibidy bah mmm dada *explodes* - ShadowMario",
+ "Wow, you're struggling! - CharlesCatYT",
+ "WHY - CharlesCatYT",
"What have you done, you killed it! - crowplexus",
"Have you checked if the variable exists? - crowplexus",
"Have you even read the wiki before trying that? - crowplexus"
diff --git a/source/backend/ArrayUtil.hx b/source/backend/ArrayUtil.hx
index d593673..0de9bf8 100644
--- a/source/backend/ArrayUtil.hx
+++ b/source/backend/ArrayUtil.hx
@@ -1,6 +1,39 @@
package backend;
+using StringTools;
+
class ArrayUtil {
+ /**
+ Checks a provided value to see if it is in the provided blacklist
+
+ @param value The value you would like to be checked
+ @param blacklist The provided blacklist you would like to use to check
+ **/
+ public static function checkBlacklist(value:String, blacklist:Array):Bool {
+ for (phrase in blacklist) {
+ if (value == phrase) {trace(phrase + ' is in the blacklist'); return true; break;}
+ }
+ trace(value + ' is not in blacklist');
+ return false;
+ }
+ /**
+ Essentially takes a double array and only returns the first parts of it.
+
+ Ex. [['A', "b"], ['c', "d"]] will only return as ['A', 'c']
+
+ @param bigArray Just an Array with more arrays in it.
+ @return An array that only has the first value of array within an array.
+ **/
+ public static function grabFirstVal(bigArray:Array>):Array {
+ var tempArray:Array = [];
+ for (item in bigArray) {
+ if (Std.isOfType(item, Array)) {
+ tempArray.push(item[0]);
+ }
+ }
+ return tempArray;
+ }
+
/**
* Gets the index of a possible new element of an Array of T using an efficient algorithm.
* @param array Array of T to check in
diff --git a/source/backend/CoolUtil.hx b/source/backend/CoolUtil.hx
index 8e09fdd..29d413b 100644
--- a/source/backend/CoolUtil.hx
+++ b/source/backend/CoolUtil.hx
@@ -2,12 +2,16 @@ package backend;
import flixel.FlxBasic;
import flixel.FlxObject;
+import flixel.tweens.FlxEase;
+import flixel.FlxG;
+import flixel.input.keyboard.FlxKey;
//import flixel.util.FlxSave;
//import flixel.math.FlxPoint;
import openfl.utils.Assets;
import lime.utils.Assets as LimeAssets;
+import lime.system.System;
#if sys
import sys.io.File;
@@ -24,6 +28,34 @@ enum SlideCalcMethod
class CoolUtil
{
+ /**
+ Returns the midpoint between 2 numbers. Can be useful for X or Y positions.
+
+ @param val1 The initial number
+ @param val2 The second number
+ **/
+ inline public static function midpoint(val1:Float, val2:Float) {
+ return (val1 + val2) / 2;
+ }
+
+ // sleep function that blocks the main thread
+ public static inline function blockExecution(time:Float):Void {
+ var start:Float = Sys.time();
+ while (Sys.time() - start < time) {"do nothing";}
+ }
+
+ /**
+ Returns a decimal where the `baseValue` is divided by the `denominator`, in a sense splitting it like a fraction.
+ Optionally, you can add the `numerator` value to increate the fraction you get back, ex 2/3 instead of 1/3.
+
+ @param baseValue The value you want divided
+ @param denominator The amount to divide by
+ @param numerator How many pieces of the fraction you want
+ **/
+ inline public static function fractionAmount(baseValue:Float, denominator:Float, ?numerator:Float = 1) {
+ return (baseValue / denominator) * numerator;
+ }
+
public static function makeOutlinedGraphic(Width:Int, Height:Int, Color:Int, LineThickness:Int, OutlineColor:Int){
var rectangle = flixel.graphics.FlxGraphic.fromRectangle(Width, Height, OutlineColor, true);
rectangle.bitmap.fillRect(new openfl.geom.Rectangle(LineThickness, LineThickness, Width - LineThickness * 2, Height - LineThickness * 2), Color);
@@ -38,7 +70,6 @@ class CoolUtil
if(n < l) n = l;
return n;
}
-
inline public static function quantize(f:Float, snap:Float){
// changed so this actually works lol
@@ -47,21 +78,54 @@ class CoolUtil
return (m / snap);
}
- public static function rotate(x:Float, y:Float, angle:Float, ?point:FlxPoint):FlxPoint
- {
+ /**
+ * Just a simple function to determine which key was pressed. Good for sequential keypresses. An example of how to use this is by simply adding the value to a string in the update function.
+ *
+ * Ex:
+ * ```
+ * public var value:String = '';
+ * override function update(elapsed:Float) {
+ * value += keypressToString(); // This will add a key to the string everytime a key is pressed
+ * }
+ * ```
+ * @return Key that was pressed as a String
+ */
+ public static function keypressToString():String {
+ var characterToAdd:String = "";
+ if (FlxG.keys.justPressed.ANY) {
+ final key = cast(FlxG.keys.firstJustPressed(), FlxKey);
+ if (key != FlxKey.NONE){
+ final upperKeyLol = key.toString().toUpperCase();
+ characterToAdd += FlxKey.fromStringMap.get(upperKeyLol);
+ }
+ }
+ return characterToAdd;
+ }
+
+ public static function rotate(x:Float, y:Float, angle:Float, ?point:FlxPoint):FlxPoint {
var p = point == null ? FlxPoint.weak() : point;
return p.set((x * Math.cos(angle)) - (y * Math.sin(angle)), (x * Math.sin(angle)) + (y * Math.cos(angle)));
}
-
+
+ /**
+ Just insert an ease name, like linear or quadOut for example, and it'll return it as an actual FlxEase value instead of a string. Useful if you have something customizable instead of perma set to a ease.
+
+ @param easeName The ease you want the function to return
+
+ @return FlxEase
+
+ @author LunarCleint
+ **/
+ inline public static function stringToEase(easeName:String, ?suffix:String = "")
+ return Reflect.field(FlxEase, easeName + (easeName == "linear" ? "" : suffix));
+
inline public static function quantizeAlpha(f:Float, interval:Float)
- return Std.int((f+interval/2)/interval)*interval;
+ return Std.int((f + interval / 2) / interval) * interval;
inline public static function capitalize(text:String)
return text.charAt(0).toUpperCase() + text.substr(1).toLowerCase();
- inline public static function boundTo(value:Float, min:Float, max:Float):Float {
- return Math.max(min, Math.min(max, value));
- }
+ inline public static function boundTo(value:Float, min:Float, max:Float):Float {return Math.max(min, Math.min(max, value));}
inline public static function coolTextFile(path:String):Array
{
@@ -92,8 +156,7 @@ class CoolUtil
return FlxColor.fromRGB(colors[0], colors[1], colors[2], colors[3]);
}
- inline public static function listFromString(string:String):Array
- {
+ inline public static function listFromString(string:String):Array {
var daList:Array = string.trim().split('\n');
for (i in 0...daList.length) daList[i] = daList[i].trim();
return daList;
@@ -103,6 +166,7 @@ class CoolUtil
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;
@@ -113,19 +177,43 @@ class CoolUtil
return formatSize + " " + dataTexts[data];
}
- inline public static function removeFromString(remove:String = "", string:String = "")
- return string.replace(remove, "");
+ public static function formatAccuracy(value:Float) {
+ var conversion:Map = [
+ '0' => '0.00',
+ '0.0' => '0.00',
+ '0.00' => '0.00',
+ '00' => '00.00',
+ '00.0' => '00.00',
+ '00.00' => '00.00',
+ '000' => '000.00'
+ ];
+
+ var stringVal:String = Std.string(value);
+ var converVal:String = '';
+ for (whyTho in 0...stringVal.length) {
+ if (stringVal.charAt(whyTho) == '.') converVal += '.';
+ else converVal += '0';
+ }
+
+ var wantedConversion:String = conversion.get(converVal);
+ var convertedValue:String = '';
+ for (ohThingy in 0...wantedConversion.length) {
+ if (stringVal.charAt(ohThingy) == '') convertedValue += wantedConversion.charAt(ohThingy);
+ else convertedValue += stringVal.charAt(ohThingy);
+ }
+
+ if (convertedValue.length == 0) return '$value';
+ return convertedValue;
+ }
+
+ inline public static function removeFromString(remove:String = "", string:String = "") return string.replace(remove, "");
public static function removeDuplicates(string:Array):Array {
var tempArray:Array = new Array();
var lastSeen:String = null;
- string.sort(function(str1:String, str2:String) {
- return (str1 == str2) ? 0 : (str1 > str2) ? 1 : -1;
- });
+ string.sort(function(str1:String, str2:String) {return (str1 == str2) ? 0 : (str1 > str2) ? 1 : -1;});
for (str in string) {
- if (str != lastSeen) {
- tempArray.push(str);
- }
+ if (str != lastSeen) tempArray.push(str);
lastSeen = str;
}
return tempArray;
@@ -162,7 +250,6 @@ class CoolUtil
{
if (slowness < 0) slowness = 1;
var slider:Float = (FlxG.sound.music.time / 1000) * (Conductor.bpm / 60);
-
var slideValue:Float;
switch (calcMethod) {
@@ -177,12 +264,11 @@ class CoolUtil
return b == 0 ? FlxMath.absInt(a) : GCD(b, a % b);
inline public static function closest2Multiple(num:Float)
- return Math.floor(num/2)*2;
+ return Math.floor(num / 2) * 2;
public static function addZeros(v:String, length:Int, end:Bool = false) {
var r = v;
- while(r.length < length)
- r = end ? r + '0': '0$r';
+ while(r.length < length) r = end ? r + '0': '0$r';
return r;
}
diff --git a/source/backend/FlxSpriteTools.hx b/source/backend/FlxSpriteTools.hx
new file mode 100644
index 0000000..67293a3
--- /dev/null
+++ b/source/backend/FlxSpriteTools.hx
@@ -0,0 +1,19 @@
+package backend;
+
+import flixel.FlxSprite;
+import flixel.util.FlxAxes;
+
+enum abstract SpriteAlignment(String) {
+ var LEFT = "LEFT";
+ var RIGHT = "RIGHT";
+ var CENTER = "CENTER";
+ var TOP = "TOP";
+ var BOTTOM = "BOTTOM";
+}
+
+class FlxSpriteTools {
+ public static function centerOnSprite(s:FlxSprite, t:FlxSprite, ?axes:FlxAxes = FlxAxes.XY):Void {
+ if (axes == FlxAxes.XY || axes == FlxAxes.X) s.x = t.x + (t.width / 2) - (s.width / 2);
+ if (axes == FlxAxes.XY || axes == FlxAxes.Y) s.y = t.y + (t.height / 2) - (s.height / 2);
+ }
+}
\ No newline at end of file
diff --git a/source/cppthing/CppApi.hx b/source/cppthing/CppApi.hx
index 1426bff..b3af5d9 100644
--- a/source/cppthing/CppApi.hx
+++ b/source/cppthing/CppApi.hx
@@ -23,6 +23,9 @@ class CppAPI
public static function enableVisualStyles()
WindowsData.enableVisualStyles();
+ public static function _enableCloseButton(why:Bool)
+ WindowsData.setCloseButtonEnabled(why);
+
public static function _setWindowLayered()
WindowsData._setWindowLayered();
#end
diff --git a/source/cppthing/WindowsData.hx b/source/cppthing/WindowsData.hx
index 877ca0f..e4ce0f4 100644
--- a/source/cppthing/WindowsData.hx
+++ b/source/cppthing/WindowsData.hx
@@ -60,6 +60,22 @@ class WindowsData
return 0;
}
+ // kudos to bing chatgpt thing i hate C++
+ #if windows
+ @:functionCode('
+ HWND hwnd = GetActiveWindow();
+ HMENU hmenu = GetSystemMenu(hwnd, FALSE);
+ if (enable) {
+ EnableMenuItem(hmenu, SC_CLOSE, MF_BYCOMMAND | MF_ENABLED);
+ } else {
+ EnableMenuItem(hmenu, SC_CLOSE, MF_BYCOMMAND | MF_GRAYED);
+ }
+ ')
+ #end
+ public static function setCloseButtonEnabled(enable:Bool) {
+ return enable;
+ }
+
#if windows
@:functionCode('
int darkMode = mode;
diff --git a/source/debug/FPSCounter.hx b/source/debug/FPSCounter.hx
index 8984c02..7ef15d0 100644
--- a/source/debug/FPSCounter.hx
+++ b/source/debug/FPSCounter.hx
@@ -20,7 +20,7 @@ enum GLInfo {
RENDERER;
SHADING_LANGUAGE_VERSION;
}
-class FPS extends TextField {
+class FPSCounter extends TextField {
/**
The current frame rate, expressed using frames-per-second
**/