Skip to content
This repository has been archived by the owner on Aug 28, 2022. It is now read-only.

Commit

Permalink
Mouse wheel supprot lol
Browse files Browse the repository at this point in the history
  • Loading branch information
justxale committed Jul 2, 2022
1 parent 01bab50 commit fa6dab3
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 14 deletions.
25 changes: 15 additions & 10 deletions source/FreeplayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class FreeplayState extends MusicBeatState

bg = new FlxSprite().loadGraphic(Paths.image('menuDesat'));
bg.antialiasing = ClientPrefs.globalAntialiasing;
bg.setGraphicSize(Std.int(bg.width * 1.1));
bg.setGraphicSize(Std.int(bg.width * 1.1));
bg.updateHitbox();
bg.screenCenter();
add(bg);
Expand Down Expand Up @@ -247,14 +247,12 @@ class FreeplayState extends MusicBeatState
{
if (FlxG.sound.music != null)
Conductor.songPosition = FlxG.sound.music.time;

if(FlxG.keys.justPressed.F11)
{
FlxG.fullscreen = !FlxG.fullscreen;
}
if (FlxG.sound.music.volume < 0.7)
{
FlxG.fullscreen = !FlxG.fullscreen;

if (FlxG.sound.music.volume < 0.7)
FlxG.sound.music.volume += 0.5 * FlxG.elapsed;
}

lerpScore = Math.floor(FlxMath.lerp(lerpScore, intendedScore, CoolUtil.boundTo(elapsed * 24, 0, 1)));
lerpRating = FlxMath.lerp(lerpRating, intendedRating, CoolUtil.boundTo(elapsed * 12, 0, 1));
Expand Down Expand Up @@ -314,6 +312,13 @@ class FreeplayState extends MusicBeatState
}
}

if(FlxG.mouse.wheel != 0)
{
FlxG.sound.play(Paths.sound('scrollMenu'), 0.2);
changeSelection(-shiftMult * FlxG.mouse.wheel, false);
changeDiff();
}

if (controls.UI_LEFT_P)
changeDiff(-1);
else if (controls.UI_RIGHT_P)
Expand Down Expand Up @@ -347,7 +352,7 @@ class FreeplayState extends MusicBeatState
vocals = new FlxSound().loadEmbedded(Paths.voices(PlayState.SONG.song));
else
vocals = new FlxSound();
FlxG.sound.list.add(vocals);
FlxG.sound.list.add(vocals);
FlxG.sound.playMusic(Paths.inst(PlayState.SONG.song), 0.7);
vocals.play();
vocals.persist = true;
Expand All @@ -359,7 +364,7 @@ class FreeplayState extends MusicBeatState
}
}

else if (accepted)
else if (accepted || FlxG.mouse.justPressed)
{
persistentUpdate = false;
var songLowercase:String = Paths.formatToSongPath(songs[curSelected].songName);
Expand Down Expand Up @@ -411,7 +416,7 @@ class FreeplayState extends MusicBeatState
if (FlxG.camera.zoom < 1.35 && ClientPrefs.camZooms && curBeat % 2 == 0)
FlxG.camera.zoom += 0.015;
}
public static function destroyFreeplayVocals() {
public static function destroyFreeplayVocals() {
if(vocals != null) {
vocals.stop();
vocals.destroy();
Expand Down
12 changes: 9 additions & 3 deletions source/MainMenuState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class MainMenuState extends MusicBeatState
}

FlxG.mouse.visible = false;
FlxG.mouse.useSystemCursor = true;
//FlxG.mouse.useSystemCursor = true;

Application.current.window.title = Main.appTitle + ' - Main Menu';

Expand Down Expand Up @@ -166,7 +166,7 @@ class MainMenuState extends MusicBeatState
else
menuItem.x= 50;
}
firstStart = false;
firstStart = false;

FlxG.camera.follow(camFollowPos, null, 1);

Expand Down Expand Up @@ -211,6 +211,12 @@ class MainMenuState extends MusicBeatState

if (!selectedSomethin)
{
if(FlxG.mouse.wheel != 0)
{
FlxG.sound.play(Paths.sound('scrollMenu'), 0.4);
changeItem(-FlxG.mouse.wheel);
}

if (controls.UI_UP_P)
{
FlxG.sound.play(Paths.sound('scrollMenu'));
Expand All @@ -231,7 +237,7 @@ class MainMenuState extends MusicBeatState
TitleState.fromMainMenu = true;
}

if (controls.ACCEPT)
if (controls.ACCEPT || FlxG.mouse.justPressed)
{
select();
}
Expand Down
9 changes: 8 additions & 1 deletion source/StoryMenuState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,13 @@ class StoryMenuState extends MusicBeatState
else if (upP || downP)
changeDifficulty();

if(FlxG.mouse.wheel != 0)
{
FlxG.sound.play(Paths.sound('scrollMenu'), 0.4);
changeWeek(-FlxG.mouse.wheel);
changeDifficulty();
}

if(FlxG.keys.justPressed.CONTROL)
{
persistentUpdate = false;
Expand All @@ -260,7 +267,7 @@ class StoryMenuState extends MusicBeatState
openSubState(new ResetScoreSubState('', curDifficulty, '', curWeek));
//FlxG.sound.play(Paths.sound('scrollMenu'));
}
else if (controls.ACCEPT)
else if (controls.ACCEPT || FlxG.mouse.justPressed)
{
selectWeek();
}
Expand Down

0 comments on commit fa6dab3

Please sign in to comment.