Fixed building errors

This commit is contained in:
KarimAkra
2025-04-17 14:51:33 +03:00
parent 5dd26101f2
commit b6e31e581a
9 changed files with 66 additions and 35 deletions
+23 -13
View File
@@ -291,6 +291,13 @@ class Project extends HXProject {
*/
static final FEATURE_GHOST_TAPPING:FeatureFlag = "FEATURE_GHOST_TAPPING";
/**
* `-DFEATURE_HAPTIC_FEEDBACK`
* If this flag is enabled, The game provide rich haptic feedback vibrations.
* Works for mobile targets (Android and iOS).
*/
static final FEATURE_HAPTIC_FEEDBACK:FeatureFlag = "FEATURE_HAPTIC_FEEDBACK";
/**
* `-DTOUCH_CONTROLS`
* If this flag is enabled, the touch controls for the game is also enabled.
@@ -353,10 +360,10 @@ class Project extends HXProject {
{
if (envConfig != null)
{
keystore = new Keystore();
keystore.path = Std.string(envConfig.get('ANDROID_KEYSTORE_PATH'));
keystore.alias = Std.string(envConfig.get('ANDROID_KEYSTORE_ALIAS'));
keystore.password = Std.string(envConfig.get('ANDROID_KEYSTORE_PASSWORD'));
keystore = new Keystore();
keystore.path = Std.string(envConfig.get('ANDROID_KEYSTORE_PATH'));
keystore.alias = Std.string(envConfig.get('ANDROID_KEYSTORE_ALIAS'));
keystore.password = Std.string(envConfig.get('ANDROID_KEYSTORE_PASSWORD'));
}
Reflect.setField(config.get('android.manifest'), 'xmlns:tools', 'http://schemas.android.com/tools');
@@ -638,6 +645,9 @@ class Project extends HXProject {
// Screenshots doesn't work there.
FEATURE_SCREENSHOTS.apply(this, !(isWeb() || isMobile()));
// Should be true only on mobile builds.
FEATURE_HAPTIC_FEEDBACK.apply(this, isMobile());
// Should be true only on mobile builds.
TOUCH_CONTROLS.apply(this, isMobile());
@@ -825,21 +835,21 @@ class Project extends HXProject {
addHaxelib('grig.audio'); // Audio data utilities
}
addHaxelib('funkin.haptic'); // Haptic feedback
addHaxelib('extension-haptics'); // Haptic feedback
if (FEATURE_PARTIAL_SOUNDS.isEnabled(this))
{
if (FEATURE_PARTIAL_SOUNDS.isEnabled(this)) {
addHaxelib('FlxPartialSound'); // Partial sound
}
if (FEATURE_ADMOB_ADS.isEnabled(this))
{
if (FEATURE_ADMOB_ADS.isEnabled(this)) {
addHaxelib('extension-admob'); // Ads Extension
}
addHaxelib('extension-iap'); // In-app purchases Extension
if (FEATURE_HAPTIC_FEEDBACK.isEnabled(this)) {
addHaxelib('extension-haptics'); // Haptic feedback
}
if (isMobile()) {
addHaxelib('extension-iap'); // In-app purchases Extension
}
}
function configureAssets() {
+2 -5
View File
@@ -122,10 +122,6 @@ class Main extends Sprite
// George recommends binding the save before FlxGame is created.
Save.load();
#if mobile
FlxG.signals.gameResized.add(resizeGame);
#end
var game:FlxGame = new FlxGame(gameWidth, gameHeight, initialState, Preferences.framerate, Preferences.framerate, skipSplash, startFullscreen);
// FlxG.game._customSoundTray wants just the class, it calls new from
@@ -220,4 +216,5 @@ class Main extends Sprite
}
}
}
}
#end
}
+1 -1
View File
@@ -327,7 +327,7 @@ class FunkinMemory
trace('Queued $key to clean up');
new Future<String>(function() {
new FlxTimer().start(1 / 24, function(_) {
new flixel.util.FlxTimer().start(1 / 24, function(_) {
FlxG.bitmap.removeKey(key);
if (currentCachedTextures.exists(key)) currentCachedTextures.remove(key);
obj.destroy();
+4 -4
View File
@@ -1,10 +1,10 @@
package funkin.mobile.util;
#if FEATURE_ADMOB_ADS
import admob.Admob;
import admob.AdmobBannerAlign;
import admob.AdmobBannerSize;
import admob.AdmobEvent;
import extension.admob.Admob;
import extension.admob.AdmobBannerAlign;
import extension.admob.AdmobBannerSize;
import extension.admob.AdmobEvent;
import funkin.util.macro.EnvironmentConfigMacro;
/**
+26 -5
View File
@@ -505,6 +505,14 @@ class GameOverSubState extends MusicBeatSubState
// PlayState.seenCutscene = false; // old thing...
if (gameOverMusic != null) gameOverMusic.stop();
// Stop death quotes immediately.
hasPlayedDeathQuote = true;
if (deathQuoteSound != null)
{
deathQuoteSound.stop();
deathQuoteSound = null;
}
if (isChartingMode)
{
this.close();
@@ -512,13 +520,26 @@ class GameOverSubState extends MusicBeatSubState
PlayState.instance.close(); // This only works because PlayState is a substate!
return;
}
else if (PlayStatePlaylist.isStoryMode)
{
openSubState(new funkin.ui.transition.StickerSubState(null, (sticker) -> new StoryMenuState(sticker)));
}
else
{
openSubState(new funkin.ui.transition.StickerSubState(null, (sticker) -> FreeplayState.build(sticker)));
var targetState:funkin.ui.transition.StickerSubState->FlxState = (PlayStatePlaylist.isStoryMode) ? (sticker) ->
new StoryMenuState(sticker) : (sticker) -> FreeplayState.build(sticker);
if (PlayStatePlaylist.isStoryMode)
{
PlayStatePlaylist.reset();
}
var playerCharacterId = PlayerRegistry.instance.getCharacterOwnerId(PlayState.instance.currentChart.characters.player);
var stickerSet = (playerCharacterId == "pico") ? "stickers-set-2" : "stickers-set-1";
var stickerPack = switch (PlayState.instance.currentChart.song.id)
{
case "tutorial": "tutorial";
case "darnell" | "lit-up" | "2hot": "weekend";
default: "all";
};
openSubState(new funkin.ui.transition.StickerSubState({targetState: targetState, stickerSet: stickerSet, stickerPack: stickerPack}));
}
}
+1
View File
@@ -11,6 +11,7 @@ import funkin.ui.debug.charting.ChartEditorState.ChartEditorTheme;
import funkin.ui.debug.stageeditor.StageEditorState.StageEditorTheme;
import funkin.util.FileUtil;
import funkin.util.SerializerUtil;
import funkin.mobile.ui.FunkinHitbox;
import thx.semver.Version;
#if FEATURE_NEWGROUNDS
import funkin.api.newgrounds.Medals;
+2 -3
View File
@@ -53,7 +53,6 @@ import funkin.api.discord.DiscordClient;
#end
import funkin.util.TouchUtil;
import funkin.util.SwipeUtil;
import flixel.system.scaleModes.FullScreenScaleMode;
/**
* The state for the freeplay menu, allowing the player to select any song to play.
@@ -448,7 +447,7 @@ class FreeplayState extends MusicBeatSubState
if (fromCharSelect)
{
blackOverlayBullshitLOLXD.x = bgDad.x;
blackOverlayBullshitLOLXD.x = backingImage.x;
overhangStuff.y = -100;
backingCard?.skipIntroTween();
}
@@ -456,7 +455,7 @@ class FreeplayState extends MusicBeatSubState
{
albumRoll.applyExitMovers(exitMovers, exitMoversCharSel);
FlxTween.tween(overhangStuff, {y: -100}, 0.3, {ease: FlxEase.quartOut});
FlxTween.tween(blackOverlayBullshitLOLXD, {x: bgDad.x}, 0.7, {ease: FlxEase.quintOut});
FlxTween.tween(blackOverlayBullshitLOLXD, {x: backingImage.x}, 0.7, {ease: FlxEase.quintOut});
}
fnfFreeplay = new FlxText(FullScreenScaleMode.gameNotchSize.x + 8, 8, 0, 'FREEPLAY', 48);
+1
View File
@@ -115,6 +115,7 @@ class WindowUtil
windowExit.dispatch(exitCode);
});
#if desktop
openfl.Lib.current.stage.addEventListener(openfl.events.KeyboardEvent.KEY_DOWN, (e:openfl.events.KeyboardEvent) -> {
for (key in PlayerSettings.player1.controls.getKeysForAction(WINDOW_FULLSCREEN))
{
@@ -1,6 +1,5 @@
package funkin.util.macro;
import haxe.ds.Map;
#if sys
import sys.io.File;
import sys.FileSystem;
@@ -9,11 +8,14 @@ import sys.FileSystem;
import haxe.macro.Context;
import haxe.macro.Expr;
#end
import haxe.ds.Map;
using StringTools;
/**
* A macro that reads an environment file during the build process for you to access in runtime without exposing the value.
*/
#if (!macro)
#if !macro
@:build(funkin.util.macro.EnvironmentConfigMacro.setupEnvConfig(".env"))
#end
class EnvironmentConfigMacro
@@ -34,7 +36,7 @@ class EnvironmentConfigMacro
var fields = Context.getBuildFields();
var pos = Context.currentPos();
var envFile = File.getConsent(file);
var envFile:String = File.getContent(file);
if (envFile == null)
{
@@ -64,7 +66,7 @@ class EnvironmentConfigMacro
var typePath:TypePath =
{
name: 'EnvironmentConfigMacro',
pack: ['funkin', 'utl', 'macro'],
pack: ['funkin', 'util', 'macro'],
sub: 'EnvironmentConfig'
};