Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

switch build works #1

Merged
merged 20 commits into from
Nov 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions Project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<project>
<!-- _________________________ Application Settings _________________________ -->

<app title="Friday Night Funkin" file="Funkin" main="Main" version="0.0.1" company="HaxeFlixel" />
<app title="Friday Night Funkin" file="Funkin" packageName="com.ninjamuffin99.fridaynightfunkin" main="Main" version="0.0.1" company="ninjamuffin99" />

<!--The flixel preloader is not accurate in Chrome. You can use it regularly if you embed the swf into a html file
or you can set the actual size of your file manually at "FlxPreloaderBase-onUpdate-bytesTotal"-->
Expand All @@ -25,6 +25,9 @@
<!--Mobile-specific-->
<window if="mobile" orientation="landscape" fullscreen="true" width="0" height="0" />

<!--Switch-specific-->
<window if="switch" orientation="landscape" fullscreen="true" width="0" height="0" resizable="true" />

<!-- _____________________________ Path Settings ____________________________ -->

<set name="BUILD_DIR" value="export/debug" if="debug" />
Expand Down Expand Up @@ -93,7 +96,10 @@
<!-- _________________________________ Custom _______________________________ -->

<!--Place custom nodes like icons here (higher priority to override the HaxeFlixel icon)-->
<icon path="art/icon.png"/>
<haxedef name="SKIP_TO_PLAYSTATE" if="debug" />
<!-- <haxedef name="NG_LOGIN" /> -->

<icon path="art/icon.png" />
<!-- <haxedef name="SKIP_TO_PLAYSTATE" if="debug" /> -->
<haxedef name="NG_LOGIN" />


</project>
Binary file added art/NintendoSDK_Application.bmp
Binary file not shown.
27 changes: 27 additions & 0 deletions art/build-lime-SWITCH.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
@echo off
cd ..
@echo on
echo REBUILDING LIME FOR EXPORT (VERBOSE)
@echo off
color 0b
@echo on
lime rebuild windows -clean -v
@echo off
color 0a
@echo on
lime rebuild switch -clean -v
@echo off
color 0e
@echo on
lime rebuild tools -clean -v
echo HOPE AND PRAY...
@echo off
color 0a
@echo on
echo BUILDING GAME
lime build switch -final -v
@echo off
color 0b
@echo on
echo NSP FILE CREATED
pause
Binary file added art/iconSwitch.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/data/south/south.json

Large diffs are not rendered by default.

16 changes: 14 additions & 2 deletions source/Alphabet.hx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class Alphabet extends FlxSpriteGroup
this.text = text;
isBold = bold;


if (text != "")
{
if (typed)
Expand Down Expand Up @@ -77,7 +78,8 @@ class Alphabet extends FlxSpriteGroup
lastWasSpace = true;
}

if (AlphaCharacter.alphabet.contains(character.toLowerCase()))
if (AlphaCharacter.alphabet.indexOf(character.toLowerCase()) != -1)
//if (AlphaCharacter.alphabet.contains(character.toLowerCase()))
{
if (lastSprite != null)
{
Expand Down Expand Up @@ -121,6 +123,7 @@ class Alphabet extends FlxSpriteGroup
_finalText = text;
doSplitWords();


// trace(arrayShit);

var loopNum:Int = 0;
Expand All @@ -137,16 +140,25 @@ class Alphabet extends FlxSpriteGroup
xPosResetted = true;
xPos = 0;
curRow += 1;

}

if (splitWords[loopNum] == " ")
{
lastWasSpace = true;
}

#if (haxe >= "4.0.0")
var isNumber:Bool = AlphaCharacter.numbers.contains(splitWords[loopNum]);
var isSymbol:Bool = AlphaCharacter.symbols.contains(splitWords[loopNum]);
if (AlphaCharacter.alphabet.contains(splitWords[loopNum].toLowerCase()) || isNumber || isSymbol)
#else
var isNumber:Bool = AlphaCharacter.numbers.indexOf(splitWords[loopNum]) != -1;
var isSymbol:Bool = AlphaCharacter.symbols.indexOf(splitWords[loopNum]) != -1;
#end

if (AlphaCharacter.alphabet.indexOf(splitWords[loopNum].toLowerCase()) != -1 || isNumber || isSymbol)
//if (AlphaCharacter.alphabet.contains(splitWords[loopNum].toLowerCase()) || isNumber || isSymbol)

{
if (lastSprite != null && !xPosResetted)
{
Expand Down
135 changes: 133 additions & 2 deletions source/Controls.hx
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,11 @@ class Controls extends FlxActionSet
var _pause = new FlxActionDigital(Action.PAUSE);
var _reset = new FlxActionDigital(Action.RESET);

#if (haxe >= "4.0.0")
var byName:Map<String, FlxActionDigital> = [];
#else
var byName:Map<String, FlxActionDigital> = new Map<String, FlxActionDigital>();
#end

public var gamepadsAdded:Array<Int> = [];
public var keyboardScheme = KeyboardScheme.None;
Expand Down Expand Up @@ -193,6 +197,7 @@ class Controls extends FlxActionSet
inline function get_RESET()
return _reset.check();

#if (haxe >= "4.0.0")
public function new(name, scheme = None)
{
super(name);
Expand All @@ -219,6 +224,36 @@ class Controls extends FlxActionSet

setKeyboardScheme(scheme, false);
}
#else
public function new(name, scheme:KeyboardScheme = null)
{
super(name);

add(_up);
add(_left);
add(_right);
add(_down);
add(_upP);
add(_leftP);
add(_rightP);
add(_downP);
add(_upR);
add(_leftR);
add(_rightR);
add(_downR);
add(_accept);
add(_back);
add(_pause);
add(_reset);

for (action in digitalActions)
byName[action.name] = action;

if (scheme == null)
scheme = None;
setKeyboardScheme(scheme, false);
}
#end

override function update()
{
Expand Down Expand Up @@ -278,7 +313,7 @@ class Controls extends FlxActionSet
* @param func
* @return ->Void)
*/
function forEachBound(control:Control, func:(FlxActionDigital, FlxInputState) -> Void)
function forEachBound(control:Control, func:FlxActionDigital->FlxInputState->Void)
{
switch (control)
{
Expand Down Expand Up @@ -332,6 +367,7 @@ class Controls extends FlxActionSet

public function copyFrom(controls:Controls, ?device:Device)
{
#if (haxe >= "4.0.0")
for (name => action in controls.byName)
{
for (input in action.inputs)
Expand All @@ -340,14 +376,31 @@ class Controls extends FlxActionSet
byName[name].add(cast input);
}
}
#else
for (name in controls.byName.keys())
{
var action = controls.byName[name];
for (input in action.inputs)
{
if (device == null || isDevice(input, device))
byName[name].add(cast input);
}
}
#end

switch (device)
{
case null:
// add all
#if (haxe >= "4.0.0")
for (gamepad in controls.gamepadsAdded)
if (!gamepadsAdded.contains(gamepad))
gamepadsAdded.push(gamepad);
#else
for (gamepad in controls.gamepadsAdded)
if (gamepadsAdded.indexOf(gamepad) == -1)
gamepadsAdded.push(gamepad);
#end

mergeKeyboardScheme(controls.keyboardScheme);

Expand Down Expand Up @@ -383,7 +436,11 @@ class Controls extends FlxActionSet
*/
public function bindKeys(control:Control, keys:Array<FlxKey>)
{
#if (haxe >= "4.0.0")
inline forEachBound(control, (action, state) -> addKeys(action, keys, state));
#else
forEachBound(control, function(action, state) addKeys(action, keys, state));
#end
}

/**
Expand All @@ -392,7 +449,11 @@ class Controls extends FlxActionSet
*/
public function unbindKeys(control:Control, keys:Array<FlxKey>)
{
#if (haxe >= "4.0.0")
inline forEachBound(control, (action, _) -> removeKeys(action, keys));
#else
forEachBound(control, function(action, _) removeKeys(action, keys));
#end
}

inline static function addKeys(action:FlxActionDigital, keys:Array<FlxKey>, state:FlxInputState)
Expand All @@ -418,6 +479,8 @@ class Controls extends FlxActionSet
removeKeyboard();

keyboardScheme = scheme;

#if (haxe >= "4.0.0")
switch (scheme)
{
case Solo:
Expand Down Expand Up @@ -450,6 +513,40 @@ class Controls extends FlxActionSet
case None: // nothing
case Custom: // nothing
}
#else
switch (scheme)
{
case Solo:
bindKeys(Control.UP, [W, FlxKey.UP]);
bindKeys(Control.DOWN, [S, FlxKey.DOWN]);
bindKeys(Control.LEFT, [A, FlxKey.LEFT]);
bindKeys(Control.RIGHT, [D, FlxKey.RIGHT]);
bindKeys(Control.ACCEPT, [Z, SPACE, ENTER]);
bindKeys(Control.BACK, [BACKSPACE, ESCAPE]);
bindKeys(Control.PAUSE, [P, ENTER, ESCAPE]);
bindKeys(Control.RESET, [R]);
case Duo(true):
bindKeys(Control.UP, [W]);
bindKeys(Control.DOWN, [S]);
bindKeys(Control.LEFT, [A]);
bindKeys(Control.RIGHT, [D]);
bindKeys(Control.ACCEPT, [G, Z]);
bindKeys(Control.BACK, [H, X]);
bindKeys(Control.PAUSE, [ONE]);
bindKeys(Control.RESET, [R]);
case Duo(false):
bindKeys(Control.UP, [FlxKey.UP]);
bindKeys(Control.DOWN, [FlxKey.DOWN]);
bindKeys(Control.LEFT, [FlxKey.LEFT]);
bindKeys(Control.RIGHT, [FlxKey.RIGHT]);
bindKeys(Control.ACCEPT, [O]);
bindKeys(Control.BACK, [P]);
bindKeys(Control.PAUSE, [ENTER]);
bindKeys(Control.RESET, [BACKSPACE]);
case None: // nothing
case Custom: // nothing
}
#end
}

function removeKeyboard()
Expand All @@ -469,15 +566,27 @@ class Controls extends FlxActionSet
public function addGamepad(id:Int, ?buttonMap:Map<Control, Array<FlxGamepadInputID>>):Void
{
gamepadsAdded.push(id);

#if (haxe >= "4.0.0")
for (control => buttons in buttonMap)
bindButtons(control, id, buttons);
inline bindButtons(control, id, buttons);
#else
for (control in buttonMap.keys())
bindButtons(control, id, buttonMap[control]);
#end
}

inline function addGamepadLiteral(id:Int, ?buttonMap:Map<Control, Array<FlxGamepadInputID>>):Void
{
gamepadsAdded.push(id);

#if (haxe >= "4.0.0")
for (control => buttons in buttonMap)
inline bindButtons(control, id, buttons);
#else
for (control in buttonMap.keys())
bindButtons(control, id, buttonMap[control]);
#end
}

public function removeGamepad(deviceID:Int = FlxInputDeviceID.ALL):Void
Expand All @@ -498,6 +607,7 @@ class Controls extends FlxActionSet

public function addDefaultGamepad(id):Void
{
#if !switch
addGamepadLiteral(id, [
Control.ACCEPT => [A],
Control.BACK => [B],
Expand All @@ -508,6 +618,19 @@ class Controls extends FlxActionSet
Control.PAUSE => [START],
Control.RESET => [Y]
]);
#else
addGamepadLiteral(id, [
//Swap A and B for switch
Control.ACCEPT => [B],
Control.BACK => [A],
Control.UP => [DPAD_UP, LEFT_STICK_DIGITAL_UP],
Control.DOWN => [DPAD_DOWN, LEFT_STICK_DIGITAL_DOWN],
Control.LEFT => [DPAD_LEFT, LEFT_STICK_DIGITAL_LEFT],
Control.RIGHT => [DPAD_RIGHT, LEFT_STICK_DIGITAL_RIGHT],
Control.PAUSE => [START],
Control.RESET => [Y]
]);
#end
}

/**
Expand All @@ -516,7 +639,11 @@ class Controls extends FlxActionSet
*/
public function bindButtons(control:Control, id, buttons)
{
#if (haxe >= "4.0.0")
inline forEachBound(control, (action, state) -> addButtons(action, buttons, state, id));
#else
forEachBound(control, function(action, state) addButtons(action, buttons, state, id));
#end
}

/**
Expand All @@ -525,7 +652,11 @@ class Controls extends FlxActionSet
*/
public function unbindButtons(control:Control, gamepadID:Int, buttons)
{
#if (haxe >= "4.0.0")
inline forEachBound(control, (action, _) -> removeButtons(action, gamepadID, buttons));
#else
forEachBound(control, function(action, _) removeButtons(action, gamepadID, buttons));
#end
}

inline static function addButtons(action:FlxActionDigital, buttons:Array<FlxGamepadInputID>, state, id)
Expand Down
7 changes: 7 additions & 0 deletions source/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,11 @@ class PlayState extends MusicBeatState
{
trace('SONG DONE' + isStoryMode);


#if !switch
NGio.postScore(songScore, SONG.song);
#end


if (isStoryMode)
{
Expand All @@ -834,7 +838,10 @@ class PlayState extends MusicBeatState

StoryMenuState.weekUnlocked[1] = true;

#if !switch
NGio.unlockMedal(60961);
#end


FlxG.save.data.weekUnlocked = StoryMenuState.weekUnlocked;
FlxG.save.flush();
Expand Down
Loading