Skip to content

Commit

Permalink
Hai
Browse files Browse the repository at this point in the history
  • Loading branch information
Hackx2 committed Nov 2, 2024
1 parent 8e4907b commit b998faa
Show file tree
Hide file tree
Showing 7 changed files with 175 additions and 104 deletions.
20 changes: 7 additions & 13 deletions Project.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<!-- _________________________ Application Settings _________________________ -->
<app
title="Friday Night Funkin' Astro Engine"
file="Astro Engine"
version="0.2.8"
packageName="com.astro"
main="funkin.game.Main"
company="Hackx2"
/>
<app title="Friday Night Funkin' Astro Engine" file="Astro Engine" version="0.2.8" packageName="com.astro" main="funkin.game.Main" company="YourFriendOrbl" />
<!-- for your mod do like com.astro.MODNAMEHERE -->

<!--Switch Export with Unique ApplicationID and Icon-->
<set name="APP_ID" value="0x0100f6c013bbc000" />
Expand Down Expand Up @@ -41,7 +35,7 @@
<define name="FLXANIMATE_ALLOWED" />

<!-- Enables Support For Discord Client Integration -->
<define name="DISCORD_ALLOWED" if="desktop"/>
<define name="DISCORD_ALLOWED" if="desktop"/>

<!-- Enables Achievements -->
<define name="ACHIEVEMENTS_ALLOWED" />
Expand Down Expand Up @@ -72,7 +66,7 @@
<icon path="art/icons/icon32.png" size='32'/>
<icon path="art/icons/icon64.png" size='64'/>
<icon path="art/icons/iconOG.png"/>

<!-- ____________________________ Window Settings ___________________________ -->

<!--These window settings apply to all targets-->
Expand Down Expand Up @@ -106,8 +100,8 @@
<assets path='mods' embed='false'/>
<assets path="assets/embed" exclude="*.ogg" if="web" embed="true"/>
<assets path="assets/embed" exclude="*.mp3" unless="web" embed="true"/>
<assets path="assets/week_assets" rename="assets" exclude="*.ogg" if="web"/>
<assets path="assets/week_assets" rename="assets" exclude="*.mp3" unless="web"/>
<assets path="assets/week_assets" rename="assets" exclude="*.ogg" if="web"/>
<assets path="assets/week_assets" rename="assets" exclude="*.mp3" unless="web"/>
<assets path='art/icons/iconOG.png' rename='icon.png' if="linux" />

<section if="BASE_GAME_FILES">
Expand Down Expand Up @@ -148,7 +142,7 @@
<haxelib name="hxcpp-debug-server" if="DEBUG_SERVER_ALLOWED"/>

<!-- ______________________________ Haxedefines _____________________________ -->

<!-- A Script That Runs Before Complie -->
<prebuild haxe="source/Prebuild.hx"/>

Expand Down
18 changes: 18 additions & 0 deletions source/funkin/backend/CoolUtil.hx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,24 @@ class CoolUtil
return newValue / tempMult;
}


static var _mousePoint:FlxPoint = new FlxPoint();
static var _objPoint:FlxPoint = new FlxPoint();
public static function mouseOverlapping<T:flixel.FlxObject>(obj:T, ?mousePoint:FlxPoint, ?camera:flixel.FlxCamera)
{
if (camera == null)
camera = obj.camera;
if (mousePoint == null)
{
mousePoint = _mousePoint;
FlxG.mouse.getScreenPosition(camera, mousePoint);
}
{
obj.getScreenPosition(_objPoint, camera);
return FlxMath.pointInCoordinates(mousePoint.x, mousePoint.y, _objPoint.x, _objPoint.y, obj.width, obj.height);
}
}

public static function coolLerp(base:Float, target:Float, ratio:Float):Float
return base + cameraLerp(ratio) * (target - base);

Expand Down
64 changes: 0 additions & 64 deletions source/funkin/backend/macro/CommitMacro.hx

This file was deleted.

89 changes: 89 additions & 0 deletions source/funkin/backend/macro/GitMacro.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
package funkin.backend.macro;

#if macro
import sys.io.Process;
#end

class GitMacro
{
/**
Current git commit number.
**/
public static var commitNumber(get, never):Int;

/**
Current git commit hash.
**/
public static var commitHash(get, never):String;

/**
Current git branch.
**/
public static var branch(get, never):String;

@:noCompletion private static function get_branch()
return _currentBranch();

@:noCompletion private static function get_commitNumber()
return _commitNumber();

@:noCompletion private static function get_commitHash()
return _commitHash();

@:noCompletion private static macro function _commitNumber()
{
#if display
return macro $v{0};
#else
try
{
final process = new Process('git', ['rev-list', 'HEAD', '--count'], false);
process.exitCode(true);

return macro $v{Std.parseInt(process.stdout.readLine())};
}
catch (e)
{
trace("Error Gettings Hash from Git" + e);
}
return macro $v{0} #end
}

@:noCompletion private static macro function _commitHash()
{
#if display
return macro $v{"~"};
#else
try
{
final process = new Process('git', ['rev-parse', '--short', 'HEAD'], false);
process.exitCode(true);

return macro $v{process.stdout.readLine()};
}
catch (e)
{
trace("Error Gettings Hash from Git" + e);
}
return macro $v{"~"} #end
}

@:noCompletion private static macro function _currentBranch()
{
#if display
return macro $v{""};
#else
try
{
final process = new Process("git", ["rev-parse", "--abbrev-ref", "HEAD"], false);
process.exitCode(true);

return macro $v{process.stdout.readLine()};
}
catch (e)
{
trace("Error Gettings Hash from Git" + e);
}
return macro $v{""} #end
}
}
2 changes: 1 addition & 1 deletion source/funkin/game/FPS.hx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class FPS extends TextField
text += '\nAstro Engine: ' + EngineData.engineData.coreVersion;
*/
#if debug
text += '\nCommit: ${CommitMacro.commitNumber} [${CommitMacro.commitHash}]';
text += '\nCommit: ${GitMacro.commitNumber} [${GitMacro.commitHash}] ${GitMacro.branch}';
#end

textColor = 0xFFFFFFFF;
Expand Down
83 changes: 59 additions & 24 deletions source/funkin/game/states/MainMenuState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -61,28 +61,25 @@ class MainMenuState extends MusicBeatState
{
name: 'freeplay',
state: new FreeplayState()
},
},
#if MODS_ALLOWED
{
name: 'mods',
state: new ModsMenuState()
},
#end
#if ACHIEVEMENTS_ALLOWED
{
#if ACHIEVEMENTS_ALLOWED {
name: 'awards',
state: new AchievementsMenuState()
}
#end,
} #end,
{
name: 'credits',
state: new CreditsState()
},
#if !switch
{
#if !switch {
name: 'donate',
link: 'https://ninja-muffin24.itch.io/funkin'
}#end,
} #end,
{
name: 'options',
state: new OptionsState()
Expand Down Expand Up @@ -184,19 +181,6 @@ class MainMenuState extends MusicBeatState
menuItem.scrollFactor.set(0, scr);
menuItem.antialiasing = ClientPrefs.data.globalAntialiasing;
menuItem.updateHitbox();
MouseUtil.MOUSESUPPORT(menuItem, {
onClick: (_) -> onStateChange(),
selectedSomethin: selectedSomethin,
selectedSomethinMouse: selectedSomethinMouse,
onHover: () ->
{
if(curSelected == i) return;

FlxG.sound.play(Paths.sound('scrollMenu'));
curSelected = i;
changeItem();
}
});
}

// Version Loop
Expand Down Expand Up @@ -227,6 +211,8 @@ class MainMenuState extends MusicBeatState

var selectedSomethin:Bool = false;
var selectedSomethinMouse:Bool = true;
var overlap:Bool = false;
var curSpr:FlxSprite = null;

override function update(elapsed:Float)
{
Expand All @@ -237,6 +223,23 @@ class MainMenuState extends MusicBeatState
funkin.game.states.FreeplayState.vocals.volume += 0.5 * elapsed;
}

/*
MouseUtil.MOUSESUPPORT(menuItem, {
onClick: (_) -> onStateChange(),
selectedSomethin: selectedSomethin,
selectedSomethinMouse: selectedSomethinMouse,
onHover: () ->
{
if(curSelected == i) return;
FlxG.sound.play(Paths.sound('scrollMenu'));
curSelected = i;
changeItem();
}
});*/

//mouseFunc();

if (!selectedSomethin)
{
if (controls.UI_UP_P)
Expand Down Expand Up @@ -278,6 +281,38 @@ class MainMenuState extends MusicBeatState
menuItems.forEach(function(spr:FlxSprite) spr.screenCenter(X));
}

function mouseFunc() {
overlap = false;
for (spr in menuItems.members)
{
final mousePoint = FlxG.mouse.getScreenPosition(FlxG.camera);

if (spr == null && curSpr == spr)
continue;

if (CoolUtil.mouseOverlapping(spr, mousePoint))
{
curSelected = spr.ID;
overlap = true;
curSpr = spr;
changeItem();
break;
}
else
{
curSpr = null;
overlap = false;
}
mousePoint.put();
}

if (overlap && FlxG.mouse.justPressed)
{
onStateChange();
return;
}
}

function onStateChange():Void
{
if (menuButtons[curSelected].link != null)
Expand Down Expand Up @@ -306,11 +341,11 @@ class MainMenuState extends MusicBeatState
{
FlxFlicker.flicker(spr, 1, 0.06, false, false, function(flick:FlxFlicker)
{
var daChoice:EitherType<FlxState,FlxSubState> = menuButtons[curSelected].state;
var daChoice:EitherType<FlxState, FlxSubState> = menuButtons[curSelected].state;

if(Std.is(daChoice, FlxState))
if (Std.is(daChoice, FlxState))
MusicBeatState.switchState(daChoice);
else
else
openSubState(daChoice);
});
}
Expand Down
3 changes: 1 addition & 2 deletions source/funkin/import.hx
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,7 @@ import flixel.addons.display.FlxBackdrop;
import flixel.FlxBasic;
#end
using StringTools;

#if !macro
using funkin.backend.utils.StringUtils;
#if !macro
using funkin.backend.utils.ObjectUtils;
#end

0 comments on commit b998faa

Please sign in to comment.