mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2025-10-30 08:11:25 +00:00
finish up options gui
This commit is contained in:
parent
5a6454a12d
commit
3476380823
14 changed files with 519 additions and 251 deletions
|
|
@ -224,33 +224,37 @@ class MarbleGame {
|
|||
}
|
||||
}
|
||||
|
||||
public function showPauseUI() {
|
||||
exitGameDlg = new ExitGameDlg((sender) -> {
|
||||
canvas.popDialog(exitGameDlg);
|
||||
if (world.isRecording) {
|
||||
MarbleGame.canvas.pushDialog(new ReplayNameDlg(() -> {
|
||||
quitMission();
|
||||
}));
|
||||
} else {
|
||||
quitMission();
|
||||
}
|
||||
}, (sender) -> {
|
||||
@:privateAccess world.playGui.setGuiVisibility(true);
|
||||
canvas.popDialog(exitGameDlg);
|
||||
paused = !paused;
|
||||
world.setCursorLock(true);
|
||||
}, (sender) -> {
|
||||
@:privateAccess world.playGui.setGuiVisibility(true);
|
||||
canvas.popDialog(exitGameDlg);
|
||||
world.restart(true);
|
||||
// world.setCursorLock(true);
|
||||
paused = !paused;
|
||||
});
|
||||
canvas.pushDialog(exitGameDlg);
|
||||
}
|
||||
|
||||
public function handlePauseGame() {
|
||||
if (paused && world._ready) {
|
||||
Console.log("Game paused");
|
||||
world.setCursorLock(false);
|
||||
@:privateAccess world.playGui.setGuiVisibility(false);
|
||||
exitGameDlg = new ExitGameDlg((sender) -> {
|
||||
canvas.popDialog(exitGameDlg);
|
||||
if (world.isRecording) {
|
||||
MarbleGame.canvas.pushDialog(new ReplayNameDlg(() -> {
|
||||
quitMission();
|
||||
}));
|
||||
} else {
|
||||
quitMission();
|
||||
}
|
||||
}, (sender) -> {
|
||||
@:privateAccess world.playGui.setGuiVisibility(true);
|
||||
canvas.popDialog(exitGameDlg);
|
||||
paused = !paused;
|
||||
world.setCursorLock(true);
|
||||
}, (sender) -> {
|
||||
@:privateAccess world.playGui.setGuiVisibility(true);
|
||||
canvas.popDialog(exitGameDlg);
|
||||
world.restart(true);
|
||||
// world.setCursorLock(true);
|
||||
paused = !paused;
|
||||
});
|
||||
canvas.pushDialog(exitGameDlg);
|
||||
showPauseUI();
|
||||
} else {
|
||||
if (world._ready) {
|
||||
Console.log("Game unpaused");
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ import collision.Collision;
|
|||
import shapes.MegaMarble;
|
||||
import shapes.Blast;
|
||||
import shapes.Glass;
|
||||
import gui.OOBInsultGui;
|
||||
import shapes.Checkpoint;
|
||||
import triggers.CheckpointTrigger;
|
||||
import shapes.EasterEgg;
|
||||
|
|
@ -1574,8 +1573,6 @@ class MarbleWorld extends Scheduler {
|
|||
} else {
|
||||
Settings.levelStatistics[mission.path].oobs++;
|
||||
}
|
||||
if (Settings.optionsSettings.oobInsults)
|
||||
OOBInsultGui.OOBCheck();
|
||||
}
|
||||
// sky.follow = null;
|
||||
// this.oobCameraPosition = camera.position.clone();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package src;
|
||||
|
||||
import src.ResourceLoader;
|
||||
import shaders.GammaRamp;
|
||||
import h3d.mat.Texture;
|
||||
import h3d.Vector;
|
||||
import shaders.Blur;
|
||||
|
|
@ -87,18 +89,24 @@ class Renderer extends h3d.scene.Renderer {
|
|||
renderPass(defaultPass, get("glowPre"));
|
||||
|
||||
// Glow pass
|
||||
ctx.engine.pushTarget(glowBuffer);
|
||||
ctx.engine.clear(0);
|
||||
renderPass(defaultPass, get("glow"));
|
||||
bloomPass(ctx);
|
||||
ctx.engine.popTarget();
|
||||
copyPass.shader.texture = growBufferTemps[0];
|
||||
copyPass.pass.blend(One, One);
|
||||
copyPass.pass.depth(false, Always);
|
||||
copyPass.render();
|
||||
var glowObjects = get("glow");
|
||||
if (!glowObjects.isEmpty()) {
|
||||
ctx.engine.pushTarget(glowBuffer);
|
||||
ctx.engine.clear(0);
|
||||
renderPass(defaultPass, glowObjects);
|
||||
bloomPass(ctx);
|
||||
ctx.engine.popTarget();
|
||||
copyPass.shader.texture = growBufferTemps[0];
|
||||
copyPass.pass.blend(One, One);
|
||||
copyPass.pass.depth(false, Always);
|
||||
copyPass.render();
|
||||
}
|
||||
// Refraction pass
|
||||
h3d.pass.Copy.run(backBuffer, sfxBuffer);
|
||||
renderPass(defaultPass, get("refract"));
|
||||
var refractObjects = get("refract");
|
||||
if (!refractObjects.isEmpty()) {
|
||||
h3d.pass.Copy.run(backBuffer, sfxBuffer);
|
||||
renderPass(defaultPass, refractObjects);
|
||||
}
|
||||
|
||||
renderPass(defaultPass, get("alpha"), backToFront);
|
||||
renderPass(defaultPass, get("additive"));
|
||||
|
|
|
|||
|
|
@ -47,6 +47,8 @@ class ResourceLoader {
|
|||
static var audioCache:Map<String, Resource<Sound>> = new Map();
|
||||
static var zipFilesystem:Map<String, BytesFileEntry> = new Map();
|
||||
|
||||
public static var initialized = false;
|
||||
|
||||
// static var threadPool:FixedThreadPool = new FixedThreadPool(4);
|
||||
|
||||
public static function init(scene2d:h2d.Scene, onLoadedFunc:Void->Void) {
|
||||
|
|
@ -64,6 +66,7 @@ class ResourceLoader {
|
|||
var preloader = new ManifestProgress(mloader, () -> {
|
||||
loader = mloader;
|
||||
fileSystem = mfileSystem;
|
||||
initialized = true;
|
||||
onLoadedFunc();
|
||||
}, scene2d);
|
||||
#if js
|
||||
|
|
@ -110,6 +113,7 @@ class ResourceLoader {
|
|||
worker.addTask(fwd -> preloadShapes(fwd));
|
||||
worker.addTask(fwd -> {
|
||||
scene2d.removeChild(loadg);
|
||||
initialized = true;
|
||||
fwd();
|
||||
});
|
||||
worker.run();
|
||||
|
|
@ -119,6 +123,7 @@ class ResourceLoader {
|
|||
#end
|
||||
#end
|
||||
#if (hl && !android)
|
||||
initialized = true;
|
||||
onLoadedFunc();
|
||||
#end
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import src.ResourceLoader;
|
|||
import src.Settings;
|
||||
|
||||
class AboutMenuOptionsGui extends GuiImage {
|
||||
public function new() {
|
||||
public function new(pauseGui:Bool = false) {
|
||||
var res = ResourceLoader.getImage("data/ui/xbox/BG_fadeOutSoftEdge.png").resource.toTile();
|
||||
super(res);
|
||||
var domcasual32fontdata = ResourceLoader.getFileEntry("data/font/DomCasualD.fnt");
|
||||
|
|
@ -54,21 +54,44 @@ class AboutMenuOptionsGui extends GuiImage {
|
|||
btnList.extent = new Vector(502, 500);
|
||||
innerCtrl.addChild(btnList);
|
||||
|
||||
btnList.addButton(5, 'Marble Controls', (e) -> {
|
||||
MarbleGame.canvas.setContent(new HelpCreditsGui(4));
|
||||
});
|
||||
btnList.addButton(5, 'Powerups', (e) -> {
|
||||
MarbleGame.canvas.setContent(new HelpCreditsGui(0));
|
||||
});
|
||||
btnList.addButton(5, 'Blast Meter', (e) -> {
|
||||
MarbleGame.canvas.setContent(new HelpCreditsGui(1));
|
||||
});
|
||||
btnList.addButton(5, 'Single Player Mode', (e) -> {
|
||||
MarbleGame.canvas.setContent(new HelpCreditsGui(2));
|
||||
});
|
||||
btnList.addButton(5, 'Multiplayer Mode', (e) -> {
|
||||
MarbleGame.canvas.setContent(new HelpCreditsGui(3));
|
||||
});
|
||||
if (pauseGui) {
|
||||
btnList.addButton(5, 'Marble Controls', (e) -> {
|
||||
MarbleGame.canvas.popDialog(this);
|
||||
MarbleGame.canvas.pushDialog(new HelpCreditsGui(4, true));
|
||||
});
|
||||
btnList.addButton(5, 'Powerups', (e) -> {
|
||||
MarbleGame.canvas.popDialog(this);
|
||||
MarbleGame.canvas.pushDialog(new HelpCreditsGui(0, true));
|
||||
});
|
||||
btnList.addButton(5, 'Blast Meter', (e) -> {
|
||||
MarbleGame.canvas.popDialog(this);
|
||||
MarbleGame.canvas.pushDialog(new HelpCreditsGui(1, true));
|
||||
});
|
||||
btnList.addButton(5, 'Single Player Mode', (e) -> {
|
||||
MarbleGame.canvas.popDialog(this);
|
||||
MarbleGame.canvas.pushDialog(new HelpCreditsGui(2, true));
|
||||
});
|
||||
btnList.addButton(5, 'Multiplayer Mode', (e) -> {
|
||||
MarbleGame.canvas.popDialog(this);
|
||||
MarbleGame.canvas.pushDialog(new HelpCreditsGui(3, true));
|
||||
});
|
||||
} else {
|
||||
btnList.addButton(5, 'Marble Controls', (e) -> {
|
||||
MarbleGame.canvas.setContent(new HelpCreditsGui(4));
|
||||
});
|
||||
btnList.addButton(5, 'Powerups', (e) -> {
|
||||
MarbleGame.canvas.setContent(new HelpCreditsGui(0));
|
||||
});
|
||||
btnList.addButton(5, 'Blast Meter', (e) -> {
|
||||
MarbleGame.canvas.setContent(new HelpCreditsGui(1));
|
||||
});
|
||||
btnList.addButton(5, 'Single Player Mode', (e) -> {
|
||||
MarbleGame.canvas.setContent(new HelpCreditsGui(2));
|
||||
});
|
||||
btnList.addButton(5, 'Multiplayer Mode', (e) -> {
|
||||
MarbleGame.canvas.setContent(new HelpCreditsGui(3));
|
||||
});
|
||||
}
|
||||
|
||||
var bottomBar = new GuiControl();
|
||||
bottomBar.position = new Vector(0, 590);
|
||||
|
|
@ -82,7 +105,13 @@ class AboutMenuOptionsGui extends GuiImage {
|
|||
backButton.vertSizing = Bottom;
|
||||
backButton.horizSizing = Right;
|
||||
backButton.gamepadAccelerator = ["B"];
|
||||
backButton.pressedAction = (e) -> MarbleGame.canvas.setContent(new OptionsListGui());
|
||||
if (pauseGui)
|
||||
backButton.pressedAction = (e) -> {
|
||||
MarbleGame.canvas.popDialog(this);
|
||||
MarbleGame.canvas.pushDialog(new OptionsListGui(true));
|
||||
}
|
||||
else
|
||||
backButton.pressedAction = (e) -> MarbleGame.canvas.setContent(new OptionsListGui());
|
||||
bottomBar.addChild(backButton);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,7 +73,10 @@ class ExitGameDlg extends GuiImage {
|
|||
btnList.addButton(0, "Resume", (evt) -> noFunc(btnList));
|
||||
btnList.addButton(0, "Restart", (evt) -> restartFunc(btnList));
|
||||
btnList.addButton(4, "Exit Level", (evt) -> yesFunc(btnList));
|
||||
btnList.addButton(3, "Help & Options", (evt) -> {}, 20);
|
||||
btnList.addButton(3, "Help & Options", (evt) -> {
|
||||
MarbleGame.canvas.popDialog(this);
|
||||
MarbleGame.canvas.pushDialog(new OptionsListGui(true));
|
||||
}, 20);
|
||||
btnList.addButton(2, "Leaderboards", (evt) -> {});
|
||||
btnList.addButton(2, "Achievements", (evt) -> {});
|
||||
btnList.addButton(4, "Main Menu", (evt) -> {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ class GuiXboxOptionsList extends GuiControl {
|
|||
|
||||
var onChangeFunc:Int->Bool = null;
|
||||
|
||||
public function new(icon:Int, name:String, values:Array<String>, midcolumn:Float = 0.3) {
|
||||
public function new(icon:Int, name:String, values:Array<String>, midcolumn:Float = 0.3, textOff = 155.5) {
|
||||
super();
|
||||
|
||||
this.options = values;
|
||||
|
|
@ -94,7 +94,7 @@ class GuiXboxOptionsList extends GuiControl {
|
|||
this.addChild(labelText);
|
||||
|
||||
optionText = new GuiText(arial14);
|
||||
optionText.position = new Vector(815 * midcolumn + 155.5, 36);
|
||||
optionText.position = new Vector(815 * midcolumn + textOff, 36);
|
||||
optionText.extent = new Vector(815 * (0.8 - midcolumn) / 2, 35);
|
||||
optionText.vertSizing = Top;
|
||||
optionText.text.text = values[0];
|
||||
|
|
@ -126,7 +126,11 @@ class GuiXboxOptionsList extends GuiControl {
|
|||
}
|
||||
}
|
||||
var leftBtnRect = leftButton.getHitTestRect();
|
||||
leftBtnRect.position = leftBtnRect.position.add(new Vector(15, 21));
|
||||
leftBtnRect.extent.set(83, 53);
|
||||
var rightBtnRect = rightButton.getHitTestRect();
|
||||
rightBtnRect.position = rightBtnRect.position.add(new Vector(15, 21));
|
||||
rightBtnRect.extent.set(83, 53);
|
||||
if (leftBtnRect.inRect(mouseState.position) || rightBtnRect.inRect(mouseState.position)) {
|
||||
if (Key.isPressed(Key.MOUSE_LEFT)) {
|
||||
AudioManager.playSound(ResourceLoader.getResource("data/sound/buttonpress.wav", ResourceLoader.getAudio, this.soundResources));
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ class HelpCreditsGui extends GuiImage {
|
|||
var curScroll:Float = -50;
|
||||
var doScroll = false;
|
||||
|
||||
public function new(index:Int) {
|
||||
public function new(index:Int, pauseGui:Bool = false) {
|
||||
var res = ResourceLoader.getImage("data/ui/xbox/BG_fadeOutSoftEdge.png").resource.toTile();
|
||||
super(res);
|
||||
var domcasual32fontdata = ResourceLoader.getFileEntry("data/font/DomCasualD.fnt");
|
||||
|
|
@ -141,10 +141,23 @@ class HelpCreditsGui extends GuiImage {
|
|||
backButton.vertSizing = Bottom;
|
||||
backButton.horizSizing = Right;
|
||||
backButton.gamepadAccelerator = ["OK"];
|
||||
if (index == 5)
|
||||
backButton.pressedAction = (e) -> MarbleGame.canvas.setContent(new OptionsListGui());
|
||||
else
|
||||
backButton.pressedAction = (e) -> MarbleGame.canvas.setContent(new AboutMenuOptionsGui());
|
||||
if (pauseGui)
|
||||
if (index == 5)
|
||||
backButton.pressedAction = (e) -> {
|
||||
MarbleGame.canvas.popDialog(this);
|
||||
MarbleGame.canvas.pushDialog(new OptionsListGui(true));
|
||||
}
|
||||
else
|
||||
backButton.pressedAction = (e) -> {
|
||||
MarbleGame.canvas.popDialog(this);
|
||||
MarbleGame.canvas.pushDialog(new AboutMenuOptionsGui(true));
|
||||
}
|
||||
else {
|
||||
if (index == 5)
|
||||
backButton.pressedAction = (e) -> MarbleGame.canvas.setContent(new OptionsListGui());
|
||||
else
|
||||
backButton.pressedAction = (e) -> MarbleGame.canvas.setContent(new AboutMenuOptionsGui());
|
||||
}
|
||||
bottomBar.addChild(backButton);
|
||||
}
|
||||
|
||||
|
|
|
|||
158
src/gui/InputOptionsGui.hx
Normal file
158
src/gui/InputOptionsGui.hx
Normal file
|
|
@ -0,0 +1,158 @@
|
|||
package gui;
|
||||
|
||||
import src.MarbleGame;
|
||||
import hxd.res.BitmapFont;
|
||||
import h3d.Vector;
|
||||
import src.ResourceLoader;
|
||||
import src.Settings;
|
||||
import src.Util;
|
||||
|
||||
class InputOptionsGui extends GuiImage {
|
||||
public function new(pauseGui:Bool = false) {
|
||||
var res = ResourceLoader.getImage("data/ui/xbox/BG_fadeOutSoftEdge.png").resource.toTile();
|
||||
super(res);
|
||||
var domcasual32fontdata = ResourceLoader.getFileEntry("data/font/DomCasualD.fnt");
|
||||
var domcasual32b = new BitmapFont(domcasual32fontdata.entry);
|
||||
@:privateAccess domcasual32b.loader = ResourceLoader.loader;
|
||||
var domcasual32 = domcasual32b.toSdfFont(cast 42 * Settings.uiScale, MultiChannel);
|
||||
|
||||
this.horizSizing = Width;
|
||||
this.vertSizing = Height;
|
||||
this.position = new Vector();
|
||||
this.extent = new Vector(640, 480);
|
||||
|
||||
var scene2d = MarbleGame.canvas.scene2d;
|
||||
|
||||
var offsetX = (scene2d.width - 1280) / 2;
|
||||
var offsetY = (scene2d.height - 720) / 2;
|
||||
|
||||
var subX = 640 - (scene2d.width - offsetX) * 640 / scene2d.width;
|
||||
var subY = 480 - (scene2d.height - offsetY) * 480 / scene2d.height;
|
||||
|
||||
var innerCtrl = new GuiControl();
|
||||
innerCtrl.position = new Vector(offsetX, offsetY);
|
||||
innerCtrl.extent = new Vector(640 - subX, 480 - subY);
|
||||
innerCtrl.horizSizing = Width;
|
||||
innerCtrl.vertSizing = Height;
|
||||
this.addChild(innerCtrl);
|
||||
|
||||
var coliseumfontdata = ResourceLoader.getFileEntry("data/font/ColiseumRR.fnt");
|
||||
var coliseumb = new BitmapFont(coliseumfontdata.entry);
|
||||
@:privateAccess coliseumb.loader = ResourceLoader.loader;
|
||||
var coliseum = coliseumb.toSdfFont(cast 44 * Settings.uiScale, MultiChannel);
|
||||
|
||||
var rootTitle = new GuiText(coliseum);
|
||||
rootTitle.position = new Vector(100, 30);
|
||||
rootTitle.extent = new Vector(1120, 80);
|
||||
rootTitle.text.textColor = 0xFFFFFF;
|
||||
rootTitle.text.text = "INPUT & SOUND OPTIONS";
|
||||
rootTitle.text.alpha = 0.5;
|
||||
innerCtrl.addChild(rootTitle);
|
||||
|
||||
function numberRange(start:Int, stop:Int, step:Int) {
|
||||
var range = [];
|
||||
while (start <= stop) {
|
||||
range.push('${start}');
|
||||
start += step;
|
||||
}
|
||||
return range;
|
||||
}
|
||||
|
||||
var yPos = 160;
|
||||
|
||||
var iyOpt = new GuiXboxOptionsList(1, "Camera Y-Axis", ["Normal", "Inverted"], 0.5, 118);
|
||||
iyOpt.vertSizing = Bottom;
|
||||
iyOpt.horizSizing = Right;
|
||||
iyOpt.position = new Vector(380, yPos);
|
||||
iyOpt.extent = new Vector(815, 94);
|
||||
iyOpt.setCurrentOption(Settings.controlsSettings.invertYAxis ? 1 : 0);
|
||||
iyOpt.onChangeFunc = (idx) -> {
|
||||
Settings.controlsSettings.invertYAxis = (idx == 1);
|
||||
return true;
|
||||
}
|
||||
innerCtrl.addChild(iyOpt);
|
||||
|
||||
yPos += 60;
|
||||
|
||||
var musicOpt = new GuiXboxOptionsList(1, "Music Volume", numberRange(0, 100, 5), 0.5, 118);
|
||||
|
||||
musicOpt.vertSizing = Bottom;
|
||||
musicOpt.horizSizing = Right;
|
||||
musicOpt.position = new Vector(380, yPos);
|
||||
musicOpt.extent = new Vector(815, 94);
|
||||
musicOpt.setCurrentOption(Std.int(Util.clamp(Math.floor(Settings.optionsSettings.musicVolume * 20), 0, 20)));
|
||||
musicOpt.onChangeFunc = (idx) -> {
|
||||
Settings.optionsSettings.musicVolume = (idx / 20.0);
|
||||
return true;
|
||||
}
|
||||
innerCtrl.addChild(musicOpt);
|
||||
|
||||
yPos += 60;
|
||||
|
||||
var soundOpt = new GuiXboxOptionsList(1, "Effects Volume", numberRange(0, 100, 5), 0.5, 118);
|
||||
|
||||
soundOpt.vertSizing = Bottom;
|
||||
soundOpt.horizSizing = Right;
|
||||
soundOpt.position = new Vector(380, yPos);
|
||||
soundOpt.extent = new Vector(815, 94);
|
||||
soundOpt.setCurrentOption(Std.int(Util.clamp(Math.floor(Settings.optionsSettings.soundVolume * 20), 0, 20)));
|
||||
soundOpt.onChangeFunc = (idx) -> {
|
||||
Settings.optionsSettings.soundVolume = (idx / 20.0);
|
||||
return true;
|
||||
}
|
||||
innerCtrl.addChild(soundOpt);
|
||||
|
||||
yPos += 60;
|
||||
|
||||
var flOpt = new GuiXboxOptionsList(1, "Free-Look", ["Disabled", "Enabled"], 0.5, 118);
|
||||
flOpt.vertSizing = Bottom;
|
||||
flOpt.horizSizing = Right;
|
||||
flOpt.position = new Vector(380, yPos);
|
||||
flOpt.extent = new Vector(815, 94);
|
||||
flOpt.setCurrentOption(Settings.optionsSettings.vsync ? 1 : 0);
|
||||
flOpt.onChangeFunc = (idx) -> {
|
||||
Settings.controlsSettings.alwaysFreeLook = (idx == 1);
|
||||
return true;
|
||||
}
|
||||
innerCtrl.addChild(flOpt);
|
||||
|
||||
yPos += 60;
|
||||
|
||||
var msOpt = new GuiXboxOptionsList(1, "Mouse Sensitivity", numberRange(10, 100, 5), 0.5, 118);
|
||||
msOpt.vertSizing = Bottom;
|
||||
msOpt.horizSizing = Right;
|
||||
msOpt.position = new Vector(380, yPos);
|
||||
msOpt.extent = new Vector(815, 94);
|
||||
msOpt.setCurrentOption(Std.int(Util.clamp(Math.floor(((Settings.controlsSettings.cameraSensitivity - 0.2) / (3 - 0.2)) * 18), 0, 18)));
|
||||
msOpt.onChangeFunc = (idx) -> {
|
||||
Settings.controlsSettings.cameraSensitivity = cast(0.2 + (idx / 18.0) * (3 - 0.2));
|
||||
return true;
|
||||
}
|
||||
innerCtrl.addChild(msOpt);
|
||||
|
||||
var bottomBar = new GuiControl();
|
||||
bottomBar.position = new Vector(0, 590);
|
||||
bottomBar.extent = new Vector(640, 200);
|
||||
bottomBar.horizSizing = Width;
|
||||
bottomBar.vertSizing = Bottom;
|
||||
innerCtrl.addChild(bottomBar);
|
||||
|
||||
var backButton = new GuiXboxButton("Ok", 160);
|
||||
backButton.position = new Vector(960, 0);
|
||||
backButton.vertSizing = Bottom;
|
||||
backButton.horizSizing = Right;
|
||||
backButton.gamepadAccelerator = ["OK"];
|
||||
if (pauseGui)
|
||||
backButton.pressedAction = (e) -> {
|
||||
Settings.applySettings();
|
||||
MarbleGame.canvas.popDialog(this);
|
||||
MarbleGame.canvas.pushDialog(new OptionsListGui(true));
|
||||
}
|
||||
else
|
||||
backButton.pressedAction = (e) -> {
|
||||
Settings.applySettings();
|
||||
MarbleGame.canvas.setContent(new OptionsListGui());
|
||||
};
|
||||
bottomBar.addChild(backButton);
|
||||
}
|
||||
}
|
||||
117
src/gui/MiscOptionsGui.hx
Normal file
117
src/gui/MiscOptionsGui.hx
Normal file
|
|
@ -0,0 +1,117 @@
|
|||
package gui;
|
||||
|
||||
import src.MarbleGame;
|
||||
import hxd.res.BitmapFont;
|
||||
import h3d.Vector;
|
||||
import src.ResourceLoader;
|
||||
import src.Settings;
|
||||
import src.Util;
|
||||
|
||||
class MiscOptionsGui extends GuiImage {
|
||||
public function new(pauseGui:Bool = false) {
|
||||
var res = ResourceLoader.getImage("data/ui/xbox/BG_fadeOutSoftEdge.png").resource.toTile();
|
||||
super(res);
|
||||
var domcasual32fontdata = ResourceLoader.getFileEntry("data/font/DomCasualD.fnt");
|
||||
var domcasual32b = new BitmapFont(domcasual32fontdata.entry);
|
||||
@:privateAccess domcasual32b.loader = ResourceLoader.loader;
|
||||
var domcasual32 = domcasual32b.toSdfFont(cast 42 * Settings.uiScale, MultiChannel);
|
||||
|
||||
this.horizSizing = Width;
|
||||
this.vertSizing = Height;
|
||||
this.position = new Vector();
|
||||
this.extent = new Vector(640, 480);
|
||||
|
||||
var scene2d = MarbleGame.canvas.scene2d;
|
||||
|
||||
var offsetX = (scene2d.width - 1280) / 2;
|
||||
var offsetY = (scene2d.height - 720) / 2;
|
||||
|
||||
var subX = 640 - (scene2d.width - offsetX) * 640 / scene2d.width;
|
||||
var subY = 480 - (scene2d.height - offsetY) * 480 / scene2d.height;
|
||||
|
||||
var innerCtrl = new GuiControl();
|
||||
innerCtrl.position = new Vector(offsetX, offsetY);
|
||||
innerCtrl.extent = new Vector(640 - subX, 480 - subY);
|
||||
innerCtrl.horizSizing = Width;
|
||||
innerCtrl.vertSizing = Height;
|
||||
this.addChild(innerCtrl);
|
||||
|
||||
var coliseumfontdata = ResourceLoader.getFileEntry("data/font/ColiseumRR.fnt");
|
||||
var coliseumb = new BitmapFont(coliseumfontdata.entry);
|
||||
@:privateAccess coliseumb.loader = ResourceLoader.loader;
|
||||
var coliseum = coliseumb.toSdfFont(cast 44 * Settings.uiScale, MultiChannel);
|
||||
|
||||
var rootTitle = new GuiText(coliseum);
|
||||
rootTitle.position = new Vector(100, 30);
|
||||
rootTitle.extent = new Vector(1120, 80);
|
||||
rootTitle.text.textColor = 0xFFFFFF;
|
||||
rootTitle.text.text = "MISC OPTIONS";
|
||||
rootTitle.text.alpha = 0.5;
|
||||
innerCtrl.addChild(rootTitle);
|
||||
|
||||
function numberRange(start:Int, stop:Int, step:Int) {
|
||||
var range = [];
|
||||
while (start <= stop) {
|
||||
range.push('${start}');
|
||||
start += step;
|
||||
}
|
||||
return range;
|
||||
}
|
||||
|
||||
var yPos = 160;
|
||||
|
||||
var rwOpt = new GuiXboxOptionsList(1, "Rewind", ["Disabled", "Enabled"], 0.5, 118);
|
||||
rwOpt.vertSizing = Bottom;
|
||||
rwOpt.horizSizing = Right;
|
||||
rwOpt.position = new Vector(380, yPos);
|
||||
rwOpt.extent = new Vector(815, 94);
|
||||
rwOpt.setCurrentOption(Settings.optionsSettings.rewindEnabled ? 1 : 0);
|
||||
rwOpt.onChangeFunc = (idx) -> {
|
||||
Settings.optionsSettings.rewindEnabled = (idx == 1);
|
||||
return true;
|
||||
}
|
||||
innerCtrl.addChild(rwOpt);
|
||||
|
||||
yPos += 60;
|
||||
|
||||
var rsOpt = new GuiXboxOptionsList(1, "Rewind Speed", numberRange(10, 100, 5), 0.5, 118);
|
||||
|
||||
rsOpt.vertSizing = Bottom;
|
||||
rsOpt.horizSizing = Right;
|
||||
rsOpt.position = new Vector(380, yPos);
|
||||
rsOpt.extent = new Vector(815, 94);
|
||||
rsOpt.setCurrentOption(Std.int(Util.clamp(Math.floor(((Settings.optionsSettings.rewindTimescale - 0.1) / (1 - 0.1)) * 18), 0, 18)));
|
||||
rsOpt.onChangeFunc = (idx) -> {
|
||||
Settings.optionsSettings.rewindTimescale = cast(0.1 + (idx / 18.0) * (1 - 0.1));
|
||||
return true;
|
||||
}
|
||||
innerCtrl.addChild(rsOpt);
|
||||
|
||||
yPos += 60;
|
||||
|
||||
var bottomBar = new GuiControl();
|
||||
bottomBar.position = new Vector(0, 590);
|
||||
bottomBar.extent = new Vector(640, 200);
|
||||
bottomBar.horizSizing = Width;
|
||||
bottomBar.vertSizing = Bottom;
|
||||
innerCtrl.addChild(bottomBar);
|
||||
|
||||
var backButton = new GuiXboxButton("Ok", 160);
|
||||
backButton.position = new Vector(960, 0);
|
||||
backButton.vertSizing = Bottom;
|
||||
backButton.horizSizing = Right;
|
||||
backButton.gamepadAccelerator = ["OK"];
|
||||
if (pauseGui)
|
||||
backButton.pressedAction = (e) -> {
|
||||
Settings.applySettings();
|
||||
MarbleGame.canvas.popDialog(this);
|
||||
MarbleGame.canvas.pushDialog(new OptionsListGui(true));
|
||||
}
|
||||
else
|
||||
backButton.pressedAction = (e) -> {
|
||||
Settings.applySettings();
|
||||
MarbleGame.canvas.setContent(new OptionsListGui());
|
||||
};
|
||||
bottomBar.addChild(backButton);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,180 +0,0 @@
|
|||
package gui;
|
||||
|
||||
import hxd.res.BitmapFont;
|
||||
import h3d.Vector;
|
||||
import src.ResourceLoader;
|
||||
import src.Settings;
|
||||
import src.MarbleGame;
|
||||
|
||||
class OOBInsultGui extends GuiImage {
|
||||
public function new(title:String, text:String) {
|
||||
var img = ResourceLoader.getImage("data/ui/marbleSelect/marbleSelect.png");
|
||||
super(img.resource.toTile());
|
||||
|
||||
MarbleGame.instance.world.setCursorLock(false);
|
||||
MarbleGame.instance.paused = true;
|
||||
|
||||
this.horizSizing = Center;
|
||||
this.vertSizing = Center;
|
||||
this.position = new Vector(98, 69);
|
||||
this.extent = new Vector(444, 341);
|
||||
|
||||
var domcasual32fontdata = ResourceLoader.getFileEntry("data/font/DomCasualD.fnt");
|
||||
var domcasual32b = new BitmapFont(domcasual32fontdata.entry);
|
||||
@:privateAccess domcasual32b.loader = ResourceLoader.loader;
|
||||
var domcasual32 = domcasual32b.toSdfFont(cast 26 * Settings.uiScale, MultiChannel);
|
||||
var domcasual64 = domcasual32b.toSdfFont(cast 58 * Settings.uiScale, MultiChannel);
|
||||
var domcasual24 = domcasual32b.toSdfFont(cast 20 * Settings.uiScale, MultiChannel);
|
||||
|
||||
var arial14fontdata = ResourceLoader.getFileEntry("data/font/arial.fnt");
|
||||
var arial14b = new BitmapFont(arial14fontdata.entry);
|
||||
@:privateAccess arial14b.loader = ResourceLoader.loader;
|
||||
var arial14 = arial14b.toSdfFont(cast 12 * Settings.uiScale, MultiChannel);
|
||||
|
||||
function loadButtonImages(path:String) {
|
||||
var normal = ResourceLoader.getResource('${path}_n.png', ResourceLoader.getImage, this.imageResources).toTile();
|
||||
var hover = ResourceLoader.getResource('${path}_h.png', ResourceLoader.getImage, this.imageResources).toTile();
|
||||
var pressed = ResourceLoader.getResource('${path}_d.png', ResourceLoader.getImage, this.imageResources).toTile();
|
||||
var disabled = ResourceLoader.getResource('${path}_i.png', ResourceLoader.getImage, this.imageResources).toTile();
|
||||
return [normal, hover, pressed, disabled];
|
||||
}
|
||||
|
||||
var titleText = new GuiMLText(domcasual24, null);
|
||||
titleText.horizSizing = Center;
|
||||
titleText.position = new Vector(35, 39);
|
||||
titleText.extent = new Vector(374, 25);
|
||||
titleText.text.textColor = 0;
|
||||
titleText.text.text = '<p align="center">${title}</p>';
|
||||
this.addChild(titleText);
|
||||
|
||||
var contentText = new GuiMLText(arial14, null);
|
||||
contentText.horizSizing = Center;
|
||||
contentText.position = new Vector(33, 66);
|
||||
contentText.extent = new Vector(377, 350);
|
||||
contentText.text.textColor = 0;
|
||||
contentText.text.text = text;
|
||||
this.addChild(contentText);
|
||||
|
||||
var okBtn = new GuiButton(loadButtonImages("data/ui/motd/ok"));
|
||||
okBtn.position = new Vector(179, 254);
|
||||
okBtn.extent = new Vector(88, 41);
|
||||
okBtn.vertSizing = Top;
|
||||
okBtn.pressedAction = (e) -> {
|
||||
MarbleGame.instance.paused = false;
|
||||
MarbleGame.canvas.popDialog(this);
|
||||
MarbleGame.instance.world.setCursorLock(true);
|
||||
}
|
||||
this.addChild(okBtn);
|
||||
}
|
||||
|
||||
public static function OOBCheck() {
|
||||
var oobMsgs = [
|
||||
"Let\'s be clear of the blatant truth: You suck!",
|
||||
"Honestly, do you have any control over the marble? It seems to have a life on its own...",
|
||||
"Are you sure you know how to play Marble Blast?",
|
||||
"I really hope you\'re seeing this message on Manic Bounce right now. If you\'re not, man do YOU have some practicing to do.",
|
||||
"Look at the bright side, it\'s part of the learning experience, but it doesn\'t change the fact that you still suck.",
|
||||
"If we ever had a \'You suck\' achievement, you\'d be having the honour to wear it today.",
|
||||
"200 more times to go Out of Bounds before you see this message again. For your sake, try and do better.",
|
||||
"\"I didn\'t play on the computer! It...it was.. my auntie!\" Yeah, right. Admit it, you suck.",
|
||||
"Are you having fun going Out of Bounds all the time? It seriously looks like it.",
|
||||
"Don\'t you just hate all these messages that make a mockery of your suckiness? It\'s a joke of course, but it\'s a nice easter egg.\nIf you don\'t want to see them anymore, then stop going Out of Bounds so many times!",
|
||||
"My grandmother is better than you!",
|
||||
"We\'ll see what happens first: You finishing the level, or the clock hitting the 100 minute mark.",
|
||||
"Can we put this on the video show? I mean, that was absolutely stupid of you to go Out of Bounds like that!",
|
||||
"While we\'re on the subject of you going Out of Bounds, you should try and find out all the possible ways to go Out of Bounds, including the stupid ways which you seem to excel in.",
|
||||
"This level isn\'t made out completely out of tiny thin tightropes! You have no excuse whatsoever on failing this badly. If you see this message on Tightropes, Under Construction, Catwalks, or Slopwropes, ignore it. Instead, change it to \"HAHAHA!\"",
|
||||
"Excuse of the Day: \"I was pushed Out of Bounds by an invisible Mega Marble!\"",
|
||||
"Congratulations, you win--- wait, no, no you don\'t. You went Out of Bounds. Sorry, you lose. Again.",
|
||||
"I found a way for you not to go Out of Bounds. We\'ll change the shape of the marble to a cube. Wait, never mind, you\'ll still find a way, because you can.",
|
||||
"You sure you played the beginner levels? You did? Doesn\'t look like it.",
|
||||
"You know what would be hilarious? This message popping up on \'Training Wheels\'. I hope you aren\'t playing that level right now... are you?",
|
||||
"Mind if we\'ll change your name to \'Mr. McFail?\'",
|
||||
"Excuse of the Day: \"But I was distracted by ________ and he/she/it wouldn\'t stop and forced me to go Out of Bounds.\"",
|
||||
"Which one are you: a bad player or a bad player? We willl go with option C: a really bad player.",
|
||||
"Excuse of the Day: WHO PUT THAT GRAVITY MODIFIER IN THERE??!?!",
|
||||
"Excuse of the Day: That In Bounds Trigger WAS NOT in the level last time I played it! Somebody hacked the level and put one in there!",
|
||||
"Excuse of the Day: My awesome marble was abducted by aliens and was replaced by a really crap one!",
|
||||
"Excuse of the Day: That Out of Bounds trigger was NOT there before! I swear!",
|
||||
"Excuse of the Day: I\'m not Xelna :(",
|
||||
"Excuse of the Day: I don\'t suck, I fell off because I wanted to get to the next 200 Out of Bounds multiplier so I can see the awesome messages that are written down.",
|
||||
"You know, you won\'t beat the level if you keep falling off. You will, however, see more of these messages. Try and stay on the level next time. Our guess is that you can\'t, because you\'re bad.",
|
||||
"Look at the statistics page! I bet you fell more times than the amount of levels you beat!",
|
||||
"Excuse of the Day: I\'m learning to play... the hard way.",
|
||||
"Apparently your marble isn\'t supermarble. It is suckmarble.",
|
||||
"Foo-Foo Marble laughs at how bad you are.",
|
||||
"A Rock Can Do Better!",
|
||||
"Please, Quit Embarrassing Yourself.",
|
||||
"Keep this up and you\'ll win the \'Award of LOL\', courtesy of Marble Blast Fubar creators!",
|
||||
"Marble Blast Fubar creators would like to give you the title of \'Official NOOB of the Year\'. Congratulations!",
|
||||
"Did you hear that \'Practice Makes Perfect\'? Apparently not.",
|
||||
"You should create a new level and title it \'Learn the In Bounds and Out of Bounds Triggers\' because you\'re so experienced with them.",
|
||||
"We\'ve seen the ways you fell while playing this game and we gotta admit, some of their are epic fails. We still can\'t stop laughing!",
|
||||
"SING WITH ME:\n\nOne hundred and ninety nine times Out of Bounds, one hundred and ninety nine times Out of Bounds, throw the marble off the level, two hundred times Out of Bounds!",
|
||||
"*sigh*, you just can\'t stop yourself from going Out of Bounds, can you?",
|
||||
"Excuse of the Day: I\'m playing one of those special levels from Technostick where you must fall off in order to beat them.",
|
||||
"Excuse of the Day: I\'m under bad karma today.",
|
||||
"Excuse of the Day: So THAT\'S what my astrologist referred to when he said I\'ll keep falling off today.",
|
||||
"What do you have against the marble that you keep making it fall off the level?!",
|
||||
"I bet having a Blast powerup would have really helped you there, no? Well, too bad! \nOh, and if you\'re playing an Ultra level, pretend this message says \"HAHAHA!\" instead.",
|
||||
"And how is it OUR fault that you\'re playing so badly?",
|
||||
"Do you ever think about the marble\'s safety when you\'re playing? Apparently not because you\'re really careless with it."
|
||||
];
|
||||
|
||||
var oobSpecial = [
|
||||
"You went Out of Bounds for 1,250 times. This program will now sit in the corner and cry about how bad you are and hope that when you open it again you won\'t repeat it. False hopes are still hopes.",
|
||||
"You went Out of Bounds for 2,500 times. If you aren\'t tired of going Out of Bounds all the time, we sure did. Stop it already!",
|
||||
"Another 1,250 marbles had fallen to the great sea below, and you\'ve reached the 3,750 Out of Bounds mark. You definitely suck. Ah yes, greenpeace would like to see you in court for your \"contribution\" to rising sea levels.",
|
||||
"If I had a nickel for every marble that fell Out of Bounds I\'d be rich right now and all thanks to you. However, I\'m not going to give you any money. Instead, I\'ll stick my tongue out at you and then laugh at you. Ah yes, congratulations on hitting the 5,000 Out of Bounds mark.",
|
||||
"6,750 times Out of Bounds. Let\'s assume, hypothetically, that you won\'t go Out of Bounds ever again. Actually, never mind that, you will still suck even if you don\'t go Out of Bounds again.",
|
||||
"I have an awesome gut feeling that you are going 7,500 times Out of Bounds on purpose if only to see these messages and to hear about how bad you are.\nWell then, I won\'t keep it away from you.\nYou suck!",
|
||||
"8,750 times Out of Bounds. For reaching this landmark, I\'m giving you a nice Australian Slang sentence to answer the question: Will you ever stop sucking in this game and go Out of Bounds? Answer:\nTill it rains in Marble Bar\n\n\nIn your language it means:\nNever.",
|
||||
"Wow, you truly are bad, probably one of the worst Marble Blast players to ever live on this planet. Or you just keep failing to good runs. Are you sure you aren\'t playing an easy level while this message pops up? Whatever, those messages will now repeat themselves (with a few exceptions), but for now, please remember this:\n\n\nYOU suck!",
|
||||
"SING WITH ME:\n\nForty nine thousand nine hundred and ninety nine times Out of Bounds, forty nine thousand nine hundred and ninety nine times Out of Bounds, knock a marble off the level, fifty thousand times Out of Bounds!",
|
||||
"What\'s that in the sky? Is it a plane? Is it a bird? No! It\'s the marble! And it\'s way off the level!!! Congratulations on hitting 300,000 Out of Bounds mark. You may now suck more.",
|
||||
"1,000,000 times Out of Bounds?!?! You seriously love this game, don\'t you? Well then, thanks for playing Marble Blast Platinum! Please keep this bad playing up and continue to go Out of Bounds. We\'ll just laugh at how bad you are. Also, this is the final message as from now on they\'re all repeats. Thank you for sucking at Marble Blast Platinum!",
|
||||
"You have no life. This is official."
|
||||
];
|
||||
|
||||
var oobMsg = "";
|
||||
var oobTitle = "Out of Bounds";
|
||||
|
||||
switch (Settings.playStatistics.oobs) {
|
||||
case 1250:
|
||||
oobMsg = oobSpecial[0];
|
||||
case 2500:
|
||||
oobMsg = oobSpecial[1];
|
||||
case 3750:
|
||||
oobMsg = oobSpecial[2];
|
||||
case 5000:
|
||||
oobMsg = oobSpecial[3];
|
||||
case 6250:
|
||||
oobMsg = oobSpecial[4];
|
||||
case 7500:
|
||||
oobMsg = oobSpecial[5];
|
||||
case 8750:
|
||||
oobMsg = oobSpecial[6];
|
||||
case 10000:
|
||||
oobMsg = oobSpecial[7];
|
||||
case 50000:
|
||||
oobMsg = oobSpecial[8];
|
||||
case 300000:
|
||||
oobMsg = oobSpecial[9];
|
||||
case 1000000:
|
||||
oobMsg = oobSpecial[10];
|
||||
case 30000000:
|
||||
oobMsg = oobSpecial[11];
|
||||
}
|
||||
|
||||
if (oobMsg == "") {
|
||||
if (Settings.playStatistics.oobs != 0 && Settings.playStatistics.oobs % 200 == 0) {
|
||||
oobTitle = 'Out of Bounds ${Settings.playStatistics.oobs} times';
|
||||
oobMsg = oobMsgs[Math.floor(Math.random() * oobMsgs.length)];
|
||||
}
|
||||
}
|
||||
|
||||
if (oobMsg != "") {
|
||||
MarbleGame.canvas.pushDialog(new OOBInsultGui(oobTitle, oobMsg));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -7,7 +7,7 @@ import src.ResourceLoader;
|
|||
import src.Settings;
|
||||
|
||||
class OptionsListGui extends GuiImage {
|
||||
public function new() {
|
||||
public function new(pauseGui:Bool = false) {
|
||||
var res = ResourceLoader.getImage("data/ui/xbox/BG_fadeOutSoftEdge.png").resource.toTile();
|
||||
super(res);
|
||||
var domcasual32fontdata = ResourceLoader.getFileEntry("data/font/DomCasualD.fnt");
|
||||
|
|
@ -57,16 +57,20 @@ class OptionsListGui extends GuiImage {
|
|||
btnList.addButton(3, 'Marble Appearance', (e) -> {
|
||||
MarbleGame.canvas.pushDialog(new MarbleSelectGui());
|
||||
});
|
||||
btnList.addButton(3, 'Input and Sound Options', (e) -> {});
|
||||
btnList.addButton(3, 'Video Options', (e) -> {
|
||||
MarbleGame.canvas.setContent(new VideoOptionsGui());
|
||||
btnList.addButton(3, 'Input and Sound Options', (e) -> {
|
||||
MarbleGame.canvas.setContent(new InputOptionsGui(pauseGui));
|
||||
});
|
||||
btnList.addButton(3, 'Video Options', (e) -> {
|
||||
MarbleGame.canvas.setContent(new VideoOptionsGui(pauseGui));
|
||||
});
|
||||
btnList.addButton(3, 'Misc Options', (e) -> {
|
||||
MarbleGame.canvas.setContent(new MiscOptionsGui(pauseGui));
|
||||
});
|
||||
btnList.addButton(3, 'Misc Options', (e) -> {});
|
||||
btnList.addButton(5, 'How to Play', (e) -> {
|
||||
MarbleGame.canvas.setContent(new AboutMenuOptionsGui());
|
||||
MarbleGame.canvas.setContent(new AboutMenuOptionsGui(pauseGui));
|
||||
});
|
||||
btnList.addButton(5, 'Credits', (e) -> {
|
||||
MarbleGame.canvas.setContent(new HelpCreditsGui(5));
|
||||
MarbleGame.canvas.setContent(new HelpCreditsGui(5, pauseGui));
|
||||
});
|
||||
|
||||
var bottomBar = new GuiControl();
|
||||
|
|
@ -81,7 +85,13 @@ class OptionsListGui extends GuiImage {
|
|||
backButton.vertSizing = Bottom;
|
||||
backButton.horizSizing = Right;
|
||||
backButton.gamepadAccelerator = ["B"];
|
||||
backButton.pressedAction = (e) -> MarbleGame.canvas.setContent(new MainMenuGui());
|
||||
if (pauseGui)
|
||||
backButton.pressedAction = (e) -> {
|
||||
MarbleGame.canvas.popDialog(this);
|
||||
MarbleGame.instance.showPauseUI();
|
||||
}
|
||||
else
|
||||
backButton.pressedAction = (e) -> MarbleGame.canvas.setContent(new MainMenuGui());
|
||||
bottomBar.addChild(backButton);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,9 +5,10 @@ import hxd.res.BitmapFont;
|
|||
import h3d.Vector;
|
||||
import src.ResourceLoader;
|
||||
import src.Settings;
|
||||
import src.Util;
|
||||
|
||||
class VideoOptionsGui extends GuiImage {
|
||||
public function new() {
|
||||
public function new(pauseGui:Bool = false) {
|
||||
var res = ResourceLoader.getImage("data/ui/xbox/BG_fadeOutSoftEdge.png").resource.toTile();
|
||||
super(res);
|
||||
var domcasual32fontdata = ResourceLoader.getFileEntry("data/font/DomCasualD.fnt");
|
||||
|
|
@ -58,6 +59,40 @@ class VideoOptionsGui extends GuiImage {
|
|||
"1600 x 900",
|
||||
"1920 x 1080"
|
||||
], 0.35);
|
||||
resolutionOpt.optionText.text.text = '${Settings.optionsSettings.screenWidth} x ${Settings.optionsSettings.screenHeight}';
|
||||
var curOpt = [
|
||||
"1024 x 800",
|
||||
"1280 x 720",
|
||||
"1366 x 768",
|
||||
"1440 x 900",
|
||||
"1600 x 900",
|
||||
"1920 x 1080"
|
||||
].indexOf(resolutionOpt.optionText.text.text);
|
||||
if (curOpt != -1)
|
||||
resolutionOpt.setCurrentOption(curOpt);
|
||||
resolutionOpt.onChangeFunc = (idx) -> {
|
||||
switch (idx) {
|
||||
case 0:
|
||||
Settings.optionsSettings.screenWidth = 1024;
|
||||
Settings.optionsSettings.screenHeight = 800;
|
||||
case 1:
|
||||
Settings.optionsSettings.screenWidth = 1280;
|
||||
Settings.optionsSettings.screenHeight = 720;
|
||||
case 2:
|
||||
Settings.optionsSettings.screenWidth = 1366;
|
||||
Settings.optionsSettings.screenHeight = 768;
|
||||
case 3:
|
||||
Settings.optionsSettings.screenWidth = 1440;
|
||||
Settings.optionsSettings.screenHeight = 900;
|
||||
case 4:
|
||||
Settings.optionsSettings.screenWidth = 1600;
|
||||
Settings.optionsSettings.screenHeight = 900;
|
||||
case 5:
|
||||
Settings.optionsSettings.screenWidth = 1920;
|
||||
Settings.optionsSettings.screenHeight = 1080;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
resolutionOpt.vertSizing = Bottom;
|
||||
resolutionOpt.horizSizing = Right;
|
||||
|
|
@ -72,6 +107,11 @@ class VideoOptionsGui extends GuiImage {
|
|||
displayOpt.horizSizing = Right;
|
||||
displayOpt.position = new Vector(380, yPos);
|
||||
displayOpt.extent = new Vector(815, 94);
|
||||
displayOpt.setCurrentOption(Settings.optionsSettings.isFullScreen ? 0 : 1);
|
||||
displayOpt.onChangeFunc = (idx) -> {
|
||||
Settings.optionsSettings.isFullScreen = (idx == 0);
|
||||
return true;
|
||||
}
|
||||
innerCtrl.addChild(displayOpt);
|
||||
|
||||
yPos += 60;
|
||||
|
|
@ -81,8 +121,36 @@ class VideoOptionsGui extends GuiImage {
|
|||
vsyncOpt.horizSizing = Right;
|
||||
vsyncOpt.position = new Vector(380, yPos);
|
||||
vsyncOpt.extent = new Vector(815, 94);
|
||||
vsyncOpt.setCurrentOption(Settings.optionsSettings.vsync ? 1 : 0);
|
||||
vsyncOpt.onChangeFunc = (idx) -> {
|
||||
Settings.optionsSettings.vsync = (idx == 1);
|
||||
return true;
|
||||
}
|
||||
innerCtrl.addChild(vsyncOpt);
|
||||
|
||||
yPos += 60;
|
||||
|
||||
function numberRange(start:Int, stop:Int, step:Int) {
|
||||
var range = [];
|
||||
while (start <= stop) {
|
||||
range.push('${start}');
|
||||
start += step;
|
||||
}
|
||||
return range;
|
||||
}
|
||||
|
||||
var fovOpt = new GuiXboxOptionsList(1, "Field of Vision", numberRange(60, 140, 5), 0.35);
|
||||
fovOpt.vertSizing = Bottom;
|
||||
fovOpt.horizSizing = Right;
|
||||
fovOpt.position = new Vector(380, yPos);
|
||||
fovOpt.extent = new Vector(815, 94);
|
||||
fovOpt.setCurrentOption(Std.int(Util.clamp(Math.floor(((Settings.optionsSettings.fovX - 60) / (140 - 60)) * 16), 0, 16)));
|
||||
fovOpt.onChangeFunc = (idx) -> {
|
||||
Settings.optionsSettings.fovX = cast(60 + (idx / 16.0) * (140 - 60));
|
||||
return true;
|
||||
}
|
||||
innerCtrl.addChild(fovOpt);
|
||||
|
||||
var bottomBar = new GuiControl();
|
||||
bottomBar.position = new Vector(0, 590);
|
||||
bottomBar.extent = new Vector(640, 200);
|
||||
|
|
@ -95,7 +163,17 @@ class VideoOptionsGui extends GuiImage {
|
|||
backButton.vertSizing = Bottom;
|
||||
backButton.horizSizing = Right;
|
||||
backButton.gamepadAccelerator = ["OK"];
|
||||
backButton.pressedAction = (e) -> MarbleGame.canvas.setContent(new OptionsListGui());
|
||||
if (pauseGui)
|
||||
backButton.pressedAction = (e) -> {
|
||||
Settings.applySettings();
|
||||
MarbleGame.canvas.popDialog(this);
|
||||
MarbleGame.canvas.pushDialog(new OptionsListGui(true));
|
||||
}
|
||||
else
|
||||
backButton.pressedAction = (e) -> {
|
||||
Settings.applySettings();
|
||||
MarbleGame.canvas.setContent(new OptionsListGui());
|
||||
};
|
||||
bottomBar.addChild(backButton);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
22
src/shaders/GammaRamp.hx
Normal file
22
src/shaders/GammaRamp.hx
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
package shaders;
|
||||
|
||||
import h3d.shader.ScreenShader;
|
||||
|
||||
class GammaRamp extends ScreenShader {
|
||||
static var SRC = {
|
||||
@param var texture:Sampler2D;
|
||||
@param var gammaRampInvSize:Float = 0.0009765625;
|
||||
function fragment() {
|
||||
var getColor = pixelColor * (1 - gammaRampInvSize) + (0.5 * gammaRampInvSize);
|
||||
pixelColor.r = texture.get(vec2(getColor.r, 0.5)).r;
|
||||
pixelColor.g = texture.get(vec2(getColor.g, 0.5)).g;
|
||||
pixelColor.b = texture.get(vec2(getColor.b, 0.5)).b;
|
||||
pixelColor.a = 1;
|
||||
}
|
||||
};
|
||||
|
||||
public function new(texture) {
|
||||
super();
|
||||
this.texture = texture;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue