Skip to content

Commit

Permalink
Port fullscreen
Browse files Browse the repository at this point in the history
  • Loading branch information
mirrorcult committed Aug 5, 2022
1 parent c812ee6 commit 2809afc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/game/Options.as
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ package game
public static var showTime:Boolean;

public static var particles:Boolean;


public static var fullscreen:Boolean;

public function Options()
{
Expand Down Expand Up @@ -52,6 +53,7 @@ package game
obj.data.options.volume = FP.volume;
obj.data.options.voices = voices;
obj.data.options.particles = particles;
obj.data.options.fullscreen = fullscreen;
}

public static function loadOptions() : void
Expand All @@ -65,6 +67,7 @@ package game
FP.volume = 1;
voices = true;
particles = true;
fullscreen = false;
}
else
{
Expand All @@ -74,6 +77,7 @@ package game
FP.volume = obj.data.options.volume;
voices = obj.data.options.voices;
particles = obj.data.options.particles;
fullscreen = obj.data.options.fullscreen;
}
}
}
Expand Down
8 changes: 8 additions & 0 deletions src/game/menus/MainMenu.as
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ package game.menus
import net.flashpunk.Sfx;
import net.flashpunk.utils.Input;
import net.flashpunk.utils.Key;
import flash.display.StageDisplayState;

public class MainMenu extends MattWorld
{
Expand Down Expand Up @@ -80,6 +81,13 @@ package game.menus
Options.particles = !Options.particles;
button.setText("Particles: " + this.getBoolName(Options.particles));
}

private function toggleFullscreen(button:MenuButton) : void
{
Options.fullscreen = !Options.fullscreen;
button.setText("Fullscreen: " + this.getBoolName(Options.fullscreen))
Main.instance.stage.displayState = Options.fullscreen ? StageDisplayState.FULL_SCREEN_INTERACTIVE : StageDisplayState.NORMAL;
}

override public function update() : void
{
Expand Down

0 comments on commit 2809afc

Please sign in to comment.