Skip to content

Commit 780408d

Browse files
Mobile Menus
1 parent cd8334b commit 780408d

File tree

11 files changed

+108
-134
lines changed

11 files changed

+108
-134
lines changed

.github/workflows/builds.yaml

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ jobs:
1515
include:
1616
- platform: Windows
1717
os: windows-latest
18-
haxe_setup:
1918
build_cmd: haxelib run lime build windows
2019
setup_libs: ./install-haxelibs.bat
2120
extra_libs:
@@ -25,7 +24,6 @@ jobs:
2524

2625
- platform: Windows x32
2726
os: windows-latest
28-
haxe_setup:
2927
build_cmd: haxelib run lime build windows -32 -D 32bits -D HXCPP_M32
3028
setup_libs: ./install-haxelibs.bat
3129
extra_libs:
@@ -35,7 +33,6 @@ jobs:
3533

3634
- platform: Linux
3735
os: ubuntu-22.04
38-
haxe_setup:
3936
build_cmd: haxelib run lime build linux
4037
setup_libs: sh ./install-haxelibs.sh
4138
extra_libs: |
@@ -45,26 +42,8 @@ jobs:
4542
post_build_commands:
4643
artifact_path: export/release/linux/bin
4744

48-
- platform: Linux ARM64
49-
os: ubuntu-22.04-arm
50-
haxe_setup: |
51-
sudo add-apt-repository ppa:haxe/releases -y
52-
sudo apt-get update
53-
sudo apt-get install -y haxe
54-
mkdir $HOME/haxelib
55-
haxelib setup $HOME/haxelib
56-
build_cmd: haxelib run lime build linux
57-
setup_libs: sh ./install-haxelibs.sh
58-
extra_libs: |
59-
sudo apt-get update
60-
sudo apt-get install -y libvlc-dev libvlccore-dev dpkg-dev file desktop-file-utils gtk-update-icon-cache
61-
pre_build_commands:
62-
post_build_commands:
63-
artifact_path: export/release/linux/bin
64-
6545
- platform: Android
6646
os: ubuntu-latest
67-
haxe_setup:
6847
build_cmd: haxelib run lime build android
6948
setup_libs: sh ./install-haxelibs.sh
7049
extra_libs:
@@ -78,7 +57,6 @@ jobs:
7857

7958
- platform: MacOS
8059
os: macos-15
81-
haxe_setup:
8260
build_cmd: haxelib run lime build macos --app-version="4.0.0-${{ github.run_id}}"
8361
setup_libs: sh ./install-haxelibs.sh
8462
pre_build_commands:
@@ -87,7 +65,6 @@ jobs:
8765

8866
- platform: MacOS x64
8967
os: macos-15-intel
90-
haxe_setup:
9168
build_cmd: haxelib run lime build macos --app-version="4.0.0-${{ github.run_id}}"
9269
setup_libs: sh ./install-haxelibs.sh
9370
pre_build_commands:
@@ -99,15 +76,10 @@ jobs:
9976
uses: actions/checkout@v4.1.7
10077

10178
- name: Setup Haxe
102-
if: ${{ !matrix.haxe_setup }}
10379
uses: krdlab/setup-haxe@master
10480
with:
10581
haxe-version: 4.3.7
10682

107-
- name: Custom Haxe Setup
108-
if: ${{ matrix.haxe_setup }}
109-
run: ${{ matrix.haxe_setup }}
110-
11183
- name: Install Extra Libraries
11284
if: ${{ matrix.extra_libs }}
11385
run: ${{ matrix.extra_libs }}

assets/scripts/states/CreditsState.hx

Lines changed: 11 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -169,37 +169,18 @@ function changeShit()
169169
descBG.y = description.y - 20;
170170
}
171171

172-
var mobileCamera:FlxCamera;
173-
174-
function postCreate()
175-
{
176-
if (CoolVars.mobileControls)
177-
{
178-
mobileCamera = new ALECamera();
179-
180-
FlxG.cameras.add(mobileCamera, false);
181-
182-
var buttonMap:Array<Dynamic> = [
183-
[50, 395, ClientPrefs.controls.ui.up, '< normal', 90],
184-
[50, 550, ClientPrefs.controls.ui.down, '> normal', 90],
185-
[1105, 485, ClientPrefs.controls.ui.back, 'b uppercase'],
186-
];
187-
188-
for (button in buttonMap)
189-
{
190-
var obj:MobileButton = new MobileButton(button[0], button[1], button[2], button[3]);
191-
add(obj);
192-
obj.label.angle = button[4] ?? 0;
193-
obj.cameras = [mobileCamera];
194-
}
195-
}
196-
}
197-
198172
function onDestroy()
199173
{
200-
if (CoolVars.mobileControls)
201-
FlxG.cameras.remove(mobileCamera);
202-
203174
CoolUtil.save.custom.data.credits = selInt;
204175
CoolUtil.save.custom.flush();
205-
}
176+
}
177+
178+
MobileAPI.createButtons(FlxG.width - 300, FlxG.height - 200, [
179+
{label: 'A', keys: ClientPrefs.controls.ui.accept},
180+
{label: 'B', keys: ClientPrefs.controls.ui.back},
181+
]);
182+
183+
MobileAPI.createButtons(100, FlxG.height - 200, [
184+
{label: 'D', keys: ClientPrefs.controls.ui.down},
185+
{label: 'U', keys: ClientPrefs.controls.ui.up},
186+
]);

assets/scripts/states/FreeplayState.hx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,4 +216,16 @@ function onDestroy()
216216
{
217217
CoolUtil.save.custom.data.freeplaySelection = selInt;
218218
CoolUtil.save.custom.data.freeplayDifficultySelection = diffSelInt;
219-
}
219+
}
220+
221+
MobileAPI.createButtons(FlxG.width - 300, FlxG.height - 200, [
222+
{label: 'A', keys: ClientPrefs.controls.ui.accept},
223+
{label: 'B', keys: ClientPrefs.controls.ui.back},
224+
]);
225+
226+
MobileAPI.createButtons(100, FlxG.height - 300, [
227+
{label: 'R', keys: ClientPrefs.controls.ui.right},
228+
{label: 'D', keys: ClientPrefs.controls.ui.down},
229+
{label: 'L', keys: ClientPrefs.controls.ui.left},
230+
{label: 'U', keys: ClientPrefs.controls.ui.up},
231+
]);

assets/scripts/states/MainMenuState.hx

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ if (CoolUtil.onlineVersion != null && CoolUtil.onlineVersion != CoolVars.engineV
127127

128128
changeSelection();
129129

130-
function onUpdate(elapsed:Float)
130+
function postUpdate(elapsed:Float)
131131
{
132132
game.camGame.scroll.y = CoolUtil.fpsLerp(game.camGame.scroll.y, selInt * OPTION_SPACE - FlxG.height * (0.25 + 0.5 * selInt / options.length), CAMERA_SPEED);
133133

@@ -165,17 +165,20 @@ function onUpdate(elapsed:Float)
165165
if (!data.overrideDefaultBehavior)
166166
selectMenu(data);
167167
}
168-
169-
if (Controls.ENGINE_CHART)
170-
{
171-
canSelect = false;
172-
173-
CoolUtil.switchState(new CustomState('MasterEditorState'));
174-
}
175168
}
176169
}
177170

178171
function onDestroy()
179172
{
180173
CoolUtil.save.custom.data.mainMenuSelection = selInt;
181-
}
174+
}
175+
176+
MobileAPI.createButtons(FlxG.width - 300, FlxG.height - 200, [
177+
{label: 'A', keys: ClientPrefs.controls.ui.accept},
178+
{label: 'B', keys: ClientPrefs.controls.ui.back},
179+
]);
180+
181+
MobileAPI.createButtons(100, FlxG.height - 200, [
182+
{label: 'D', keys: ClientPrefs.controls.ui.down},
183+
{label: 'U', keys: ClientPrefs.controls.ui.up},
184+
]);

assets/scripts/states/OptionsState.hx

Lines changed: 14 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ for (index => category in categories)
5858
var obj:BaseOption;
5959

6060
for (option in category.options)
61-
if ((option.platform == 'desktop' && !CoolVars.mobileControls) || (option.platform == 'mobile' && CoolVars.mobileControls) || option.platform == null)
61+
if ((option.platform == 'desktop' && !CoolVars.mobile) || (option.platform == 'mobile' && CoolVars.mobile) || option.platform == null)
6262
createOption(index,
6363
switch (option.type.toUpperCase())
6464
{
@@ -154,42 +154,22 @@ function onUpdate(elapsed:Float)
154154
}
155155
}
156156

157-
var mobileCamera:FlxCamera;
158-
159-
function postCreate()
160-
{
161-
if (CoolVars.mobileControls)
162-
{
163-
mobileCamera = new ALECamera();
164-
165-
FlxG.cameras.add(mobileCamera, false);
166-
167-
var buttonMap:Array<Dynamic> = [
168-
[50, 485, ClientPrefs.controls.ui.left, '< normal'],
169-
[360, 485, ClientPrefs.controls.ui.right, '> normal'],
170-
[205, 395, ClientPrefs.controls.ui.up, '< normal', 90],
171-
[205, 550, ClientPrefs.controls.ui.down, '> normal', 90],
172-
[1105, 485, ClientPrefs.controls.ui.accept, 'a uppercase'],
173-
[950, 485, ClientPrefs.controls.ui.back, 'b uppercase']
174-
];
175-
176-
for (button in buttonMap)
177-
{
178-
var obj:MobileButton = new MobileButton(button[0], button[1], button[2], button[3]);
179-
add(obj);
180-
obj.label.angle = button[4] ?? 0;
181-
obj.cameras = [mobileCamera];
182-
}
183-
}
184-
}
185-
186157
function onDestroy()
187158
{
188-
if (CoolVars.mobileControls)
189-
FlxG.cameras.remove(mobileCamera);
190-
191159
CoolUtil.save.custom.data.optionsMenu = selInt;
192160

193161
CoolUtil.save.save();
194162
CoolUtil.save.load();
195-
}
163+
}
164+
165+
MobileAPI.createButtons(FlxG.width - 300, FlxG.height - 200, [
166+
{label: 'A', keys: ClientPrefs.controls.ui.accept},
167+
{label: 'B', keys: ClientPrefs.controls.ui.back},
168+
]);
169+
170+
MobileAPI.createButtons(100, FlxG.height - 300, [
171+
{label: 'R', keys: ClientPrefs.controls.ui.right},
172+
{label: 'D', keys: ClientPrefs.controls.ui.down},
173+
{label: 'L', keys: ClientPrefs.controls.ui.left},
174+
{label: 'U', keys: ClientPrefs.controls.ui.up},
175+
]);

assets/scripts/states/StoryMenuState.hx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,4 +279,16 @@ function onDestroy()
279279
{
280280
CoolUtil.save.custom.data.storyMenu = selInt;
281281
CoolUtil.save.custom.data.storyMenuDifficulty = diffSelInt;
282-
}
282+
}
283+
284+
MobileAPI.createButtons(FlxG.width - 300, FlxG.height - 200, [
285+
{label: 'A', keys: ClientPrefs.controls.ui.accept},
286+
{label: 'B', keys: ClientPrefs.controls.ui.back},
287+
]);
288+
289+
MobileAPI.createButtons(100, FlxG.height - 300, [
290+
{label: 'R', keys: ClientPrefs.controls.ui.right},
291+
{label: 'D', keys: ClientPrefs.controls.ui.down},
292+
{label: 'L', keys: ClientPrefs.controls.ui.left},
293+
{label: 'U', keys: ClientPrefs.controls.ui.up},
294+
]);

assets/scripts/states/TitleState.hx

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -157,32 +157,4 @@ function onUpdate(elapsed:Float)
157157
}
158158
}
159159

160-
var mobileCamera:FlxCamera;
161-
162-
function postCreate()
163-
{
164-
if (CoolVars.mobileControls)
165-
{
166-
mobileCamera = new ALECamera();
167-
168-
FlxG.cameras.add(mobileCamera, false);
169-
170-
var buttonMap:Array<Dynamic> = [
171-
[1105, 485, ClientPrefs.controls.ui.accept, 'a uppercase']
172-
];
173-
174-
for (button in buttonMap)
175-
{
176-
var obj:MobileButton = new MobileButton(button[0], button[1], button[2], button[3]);
177-
add(obj);
178-
obj.label.angle = button[4] ?? 0;
179-
obj.cameras = [mobileCamera];
180-
}
181-
}
182-
}
183-
184-
function onDestroy()
185-
{
186-
if (CoolVars.mobileControls)
187-
FlxG.cameras.remove(mobileCamera);
188-
}
160+
MobileAPI.createButtons(FlxG.width - 100, FlxG.height - 100, [{label: 'A', keys: ClientPrefs.controls.ui.accept}]);

assets/scripts/substates/FadeTransition.hx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ function onUpdate(elapsed:Float)
4141

4242
if (transIn)
4343
finishCallback();
44-
4544
}
4645
}
4746

assets/scripts/substates/GameOverSubState.hx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,4 +109,15 @@ function onDestroy()
109109

110110
sfx.stop();
111111
music.stop();
112+
}
113+
114+
MobileAPI.toggleButtons(false, false);
115+
116+
MobileAPI.createButtons(FlxG.width - 100, FlxG.height - 100, [{label: 'A', keys: ClientPrefs.controls.ui.accept}], null, true);
117+
118+
function onDestroy()
119+
{
120+
MobileAPI.destroyButtons(true);
121+
122+
MobileAPI.toggleButtons(false, true);
112123
}

assets/scripts/substates/PauseSubState.hx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,4 +90,20 @@ function onUpdate(elapsed:Float)
9090
default:
9191
}
9292
}
93+
}
94+
95+
MobileAPI.toggleButtons(false, false);
96+
97+
MobileAPI.createButtons(FlxG.width - 100, FlxG.height - 100, [{label: 'A', keys: ClientPrefs.controls.ui.accept}], null, true);
98+
99+
MobileAPI.createButtons(100, FlxG.height - 200, [
100+
{label: 'D', keys: ClientPrefs.controls.ui.down},
101+
{label: 'U', keys: ClientPrefs.controls.ui.up},
102+
], null, true);
103+
104+
function onDestroy()
105+
{
106+
MobileAPI.destroyButtons(true);
107+
108+
MobileAPI.toggleButtons(false, true);
93109
}

0 commit comments

Comments
 (0)