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

Mac changes #14

Merged
merged 7 commits into from
May 22, 2024
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
6 changes: 5 additions & 1 deletion assets/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,8 @@ You can safely delete the "assets/base_game/" folder after that if you want to,

Q: What's the "translations" folder for?
A: This is where I've put the Portuguese translation in, you can also set up other languages inside it easily,
You can turn off languages by deleting the line with "TRANSLATIONS_ALLOWED" inside Project.xml
You can turn off languages by deleting the line with "TRANSLATIONS_ALLOWED" inside Project.xml

NOTE:

In "translations" there are two phrases that get replaced, being "MODIFIER1" and "MODIFIER2", replaced by "Control" & "Alt" if you use Mac OS, "Command" & "Option".
2 changes: 1 addition & 1 deletion assets/translations/shared/data/pt-BR.lang
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ storyname_week6: "simulador de confronto ft. moawling"

// Freeplay
personal_best: "MELHOR PONTUAÇÃO: {1} ({2}%)"
freeplay_tip: "Aperte SPACE para ouvir a Música / Aperte CTRL para abrir o Menu de Modificadores / Aperte RESET para limpar sua pontuação."
freeplay_tip: "Aperte SPACE para ouvir a Música / Aperte MODIFIER1 para abrir o Menu de Modificadores / Aperte RESET para limpar sua pontuação."

musicplayer_playing: "MÚSICA: {1}"
musicplayer_paused: "MÚSICA: {1} (PAUSADO)"
Expand Down
3 changes: 3 additions & 0 deletions source/Main.hx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ class Main extends Sprite
startFullscreen: false // if the game should start at fullscreen mode
};

// changes how modifier keys are shown in UI.
// small heads-up Command is mapped to WINDOWS in Haxeflixel, Option is curiously mapped to ALT still though.
public static var modifier_keys:Array<String> = #if !mac ['Control', 'Alt']; #else['Command', 'Option']; #end
public static var fpsVar:FPSCounter;

// You can pretty much ignore everything from here on - your code should go in your states.
Expand Down
6 changes: 5 additions & 1 deletion source/backend/InputFormatter.hx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class InputFormatter {
case CONTROL:
return "Ctrl";
case ALT:
return "Alt";
return Main.modifier_keys[1];
case CAPSLOCK:
return "Caps";
case PAGEUP:
Expand Down Expand Up @@ -88,6 +88,10 @@ class InputFormatter {
return "'";
case PRINTSCREEN:
return "PrtScrn";
#if mac
case WINDOWS:
return 'Command';
#end
case NONE:
return '---';
default:
Expand Down
5 changes: 5 additions & 0 deletions source/backend/Language.hx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ class Language
for (num => value in values)
str = str.replace('{${num+1}}', value);


// Multiplatform keys
str = str.replace('MODIFIER1', Main.modifier_keys[0]);
str = str.replace('MODIFIER2', Main.modifier_keys[1]);

return str;
}

Expand Down
3 changes: 3 additions & 0 deletions source/psychlua/FunkinLua.hx
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ class FunkinLua {
set('startedCountdown', false);
set('curStage', PlayState.SONG.stage);

set('primaryModifier', Main.modifier_keys[0]); // Control or Command
set('secondaryModifier', Main.modifier_keys[1]); // Alt or Option

set('isStoryMode', PlayState.isStoryMode);
set('difficulty', PlayState.storyDifficulty);

Expand Down
4 changes: 2 additions & 2 deletions source/states/FreeplayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ class FreeplayState extends MusicBeatState
bottomBG.alpha = 0.6;
add(bottomBG);

var leText:String = Language.getPhrase("freeplay_tip", "Press SPACE to listen to the Song / Press CTRL to open the Gameplay Changers Menu / Press RESET to Reset your Score and Accuracy.");
var leText:String = Language.getPhrase("freeplay_tip", "Press SPACE to listen to the Song / Press "+Main.modifier_keys[0]+" to open the Gameplay Changers Menu / Press RESET to Reset your Score and Accuracy.");
bottomString = leText;
var size:Int = 16;
bottomText = new FlxText(bottomBG.x, bottomBG.y + 4, FlxG.width, leText, size);
Expand Down Expand Up @@ -307,7 +307,7 @@ class FreeplayState extends MusicBeatState
}
}

if(FlxG.keys.justPressed.CONTROL && !player.playingMusic)
if(#if !mac FlxG.keys.justPressed.CONTROL #else FlxG.keys.justPressed.WINDOWS #end && !player.playingMusic)
{
persistentUpdate = false;
openSubState(new GameplayChangersSubstate());
Expand Down
2 changes: 1 addition & 1 deletion source/states/StoryMenuState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ class StoryMenuState extends MusicBeatState
else if (changeDiff)
changeDifficulty();

if(FlxG.keys.justPressed.CONTROL)
if(#if !mac FlxG.keys.pressed.CONTROL #else FlxG.keys.pressed.WINDOWS #end)
{
persistentUpdate = false;
openSubState(new GameplayChangersSubstate());
Expand Down
16 changes: 8 additions & 8 deletions source/states/editors/CharacterEditorState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,10 @@ class CharacterEditorState extends MusicBeatState
\nR - Reset Camera Zoom
\n
\nCHARACTER
\nCtrl + R - Reset Current Offset
\nCtrl + C - Copy Current Offset
\nCtrl + V - Paste Copied Offset on Current Animation
\nCtrl + Z - Undo Last Paste or Reset
\n"+Main.modifier_keys[0]+" + R - Reset Current Offset
\n"+Main.modifier_keys[0]+" + C - Copy Current Offset
\n"+Main.modifier_keys[0]+" + V - Paste Copied Offset on Current Animation
\n"+Main.modifier_keys[0]+" + Z - Undo Last Paste or Reset
\nW/S - Previous/Next Animation
\nSpace - Replay Animation
\nArrow Keys/Mouse & Right Click - Move Offset
Expand All @@ -180,7 +180,7 @@ class CharacterEditorState extends MusicBeatState
\nOTHER
\nF12 - Toggle Silhouettes
\nHold Shift - Move Offsets 10x faster and Camera 4x faster
\nHold Control - Move camera 4x slower";
\nHold "+Main.modifier_keys[0]+" - Move camera 4x slower";

helpBg = new FlxSprite().makeGraphic(1, 1, FlxColor.BLACK);
helpBg.scale.set(FlxG.width, FlxG.height);
Expand Down Expand Up @@ -860,7 +860,7 @@ class CharacterEditorState extends MusicBeatState
shiftMult = 4;
shiftMultBig = 10;
}
if(FlxG.keys.pressed.CONTROL) ctrlMult = 0.25;
if(#if !mac FlxG.keys.pressed.CONTROL #else FlxG.keys.pressed.WINDOWS #end) ctrlMult = 0.25;

// CAMERA CONTROLS
if (FlxG.keys.pressed.J) FlxG.camera.scroll.x -= elapsed * 500 * shiftMult * ctrlMult;
Expand All @@ -869,7 +869,7 @@ class CharacterEditorState extends MusicBeatState
if (FlxG.keys.pressed.I) FlxG.camera.scroll.y -= elapsed * 500 * shiftMult * ctrlMult;

var lastZoom = FlxG.camera.zoom;
if(FlxG.keys.justPressed.R && !FlxG.keys.pressed.CONTROL) FlxG.camera.zoom = 1;
if(FlxG.keys.justPressed.R && !#if !mac FlxG.keys.pressed.CONTROL #else FlxG.keys.pressed.WINDOWS #end) FlxG.camera.zoom = 1;
else if (FlxG.keys.pressed.E && FlxG.camera.zoom < 3) {
FlxG.camera.zoom += elapsed * FlxG.camera.zoom * shiftMult * ctrlMult;
if(FlxG.camera.zoom > 3) FlxG.camera.zoom = 3;
Expand Down Expand Up @@ -931,7 +931,7 @@ class CharacterEditorState extends MusicBeatState
changedOffset = true;
}

if(FlxG.keys.pressed.CONTROL)
if(#if !mac FlxG.keys.pressed.CONTROL #else FlxG.keys.pressed.WINDOWS #end)
{
if(FlxG.keys.justPressed.C)
{
Expand Down
14 changes: 7 additions & 7 deletions source/states/editors/ChartingState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -329,10 +329,10 @@ class ChartingState extends MusicBeatState
\nUp/Down - Change Conductor's Strum Time with Snapping" +
#if FLX_PITCH
"\nLeft Bracket / Right Bracket - Change Song Playback Rate (SHIFT to go Faster)
\nALT + Left Bracket / Right Bracket - Reset Song Playback Rate" +
\n" + Main.modifier_keys[1] + " + Left Bracket / Right Bracket - Reset Song Playback Rate" +
#end
"\nHold Shift to move 4x faster
\nHold Control and click on an arrow to select it
\nHold "+Main.modifier_keys[0]+" and click on an arrow to select it
\nZ/X - Zoom in/out
\n
\nEsc - Test your chart inside Chart Editor
Expand Down Expand Up @@ -1757,7 +1757,7 @@ class ChartingState extends MusicBeatState
{
if (FlxG.mouse.overlaps(note))
{
if (FlxG.keys.pressed.CONTROL)
if (#if !mac FlxG.keys.pressed.CONTROL #else FlxG.keys.pressed.WINDOWS #end) // WINDOWS is the command key in Mac OS
{
selectNote(note);
}
Expand Down Expand Up @@ -1879,11 +1879,11 @@ class ChartingState extends MusicBeatState
return;
}

if(FlxG.keys.justPressed.Z && FlxG.keys.pressed.CONTROL) {
if(FlxG.keys.justPressed.Z && #if !mac FlxG.keys.pressed.CONTROL #else FlxG.keys.pressed.WINDOWS #end) {
undo();
}

if(FlxG.keys.justPressed.Z && curZoom > 0 && !FlxG.keys.pressed.CONTROL) {
if(FlxG.keys.justPressed.Z && curZoom > 0 && #if !mac !FlxG.keys.pressed.CONTROL #else !FlxG.keys.pressed.WINDOWS #end) {
--curZoom;
updateZoom();
}
Expand Down Expand Up @@ -1960,7 +1960,7 @@ class ChartingState extends MusicBeatState
FlxG.sound.music.pause();

var holdingShift:Float = 1;
if (FlxG.keys.pressed.CONTROL) holdingShift = 0.25;
if (#if !mac FlxG.keys.pressed.CONTROL #else FlxG.keys.pressed.WINDOWS #end) holdingShift = 0.25;
else if (FlxG.keys.pressed.SHIFT) holdingShift = 4;

var daTime:Float = 700 * FlxG.elapsed * holdingShift;
Expand Down Expand Up @@ -3034,7 +3034,7 @@ class ChartingState extends MusicBeatState
}
changeEventSelected();

if (FlxG.keys.pressed.CONTROL && noteData > -1)
if (#if !mac FlxG.keys.pressed.CONTROL #else FlxG.keys.pressed.WINDOWS #end && noteData > -1)
{
_song.notes[curSec].sectionNotes.push([noteStrum, (noteData + 4) % 8, noteSus, curNoteTypes[daType]]);
}
Expand Down
2 changes: 1 addition & 1 deletion source/states/editors/NoteSplashDebugState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ class NoteSplashDebugState extends MusicBeatState
}

// Copy & Paste
if(FlxG.keys.pressed.CONTROL)
if(#if !mac FlxG.keys.pressed.CONTROL #else FlxG.keys.pressed.WINDOWS #end)
{
if(FlxG.keys.justPressed.C)
{
Expand Down
Loading