mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2025-10-30 08:11:25 +00:00
video options and fix shaders lol
This commit is contained in:
parent
05bfd35bc1
commit
5a6454a12d
7 changed files with 136 additions and 14 deletions
|
|
@ -114,9 +114,12 @@ class GuiXboxListButton extends GuiControl {
|
|||
}
|
||||
|
||||
public override function onMouseRelease(mouseState:MouseState) {
|
||||
if (mouseState.handled)
|
||||
var renderRect = getHitTestRect();
|
||||
renderRect.position = renderRect.position.add(new Vector(24, 20)); // Offset
|
||||
renderRect.extent.set(439, 53);
|
||||
if (!renderRect.inRect(mouseState.position))
|
||||
return;
|
||||
mouseState.handled = true;
|
||||
|
||||
super.onMouseRelease(mouseState);
|
||||
if (this.pressedAction != null && !disabled) {
|
||||
this.pressedAction(new GuiEvent(this));
|
||||
|
|
@ -124,9 +127,12 @@ class GuiXboxListButton extends GuiControl {
|
|||
}
|
||||
|
||||
public override function onMouseEnter(mouseState:MouseState) {
|
||||
if (mouseState.handled)
|
||||
var renderRect = getHitTestRect();
|
||||
renderRect.position = renderRect.position.add(new Vector(24, 20)); // Offset
|
||||
renderRect.extent.set(439, 53);
|
||||
if (!renderRect.inRect(mouseState.position))
|
||||
return;
|
||||
mouseState.handled = true;
|
||||
|
||||
super.onMouseEnter(mouseState);
|
||||
|
||||
if (buttonSounds && !disabled) {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ class GuiXboxOptionsList extends GuiControl {
|
|||
|
||||
var onChangeFunc:Int->Bool = null;
|
||||
|
||||
public function new(icon:Int, name:String, values:Array<String>) {
|
||||
public function new(icon:Int, name:String, values:Array<String>, midcolumn:Float = 0.3) {
|
||||
super();
|
||||
|
||||
this.options = values;
|
||||
|
|
@ -58,7 +58,7 @@ class GuiXboxOptionsList extends GuiControl {
|
|||
rightShadeFilter.enable = false;
|
||||
|
||||
leftButton = new GuiAnim([arrowButtonImage, arrowButtonImagePressed]);
|
||||
leftButton.position = new Vector(815 * 0.3, 0);
|
||||
leftButton.position = new Vector(815 * midcolumn, 0);
|
||||
leftButton.extent = new Vector(114, 94);
|
||||
leftButton.anim.filter = leftShadeFilter;
|
||||
this.addChild(leftButton);
|
||||
|
|
@ -82,19 +82,20 @@ class GuiXboxOptionsList extends GuiControl {
|
|||
var arial14fontdata = ResourceLoader.getFileEntry("data/font/Arial Bold.fnt");
|
||||
var arial14b = new BitmapFont(arial14fontdata.entry);
|
||||
@:privateAccess arial14b.loader = ResourceLoader.loader;
|
||||
var arial14 = arial14b.toSdfFont(cast 26 * Settings.uiScale, h2d.Font.SDFChannel.MultiChannel);
|
||||
var arial14 = arial14b.toSdfFont(cast 25 * Settings.uiScale, h2d.Font.SDFChannel.MultiChannel);
|
||||
|
||||
labelText = new GuiText(arial14);
|
||||
labelText.position = new Vector(155, 36);
|
||||
labelText.position = new Vector(815 * midcolumn - 125, 36);
|
||||
labelText.extent = new Vector(100, 35);
|
||||
labelText.vertSizing = Top;
|
||||
labelText.justify = Right;
|
||||
labelText.text.text = name;
|
||||
labelText.text.textColor = 0x787878;
|
||||
this.addChild(labelText);
|
||||
|
||||
optionText = new GuiText(arial14);
|
||||
optionText.position = new Vector(400, 36);
|
||||
optionText.extent = new Vector(200, 35);
|
||||
optionText.position = new Vector(815 * midcolumn + 155.5, 36);
|
||||
optionText.extent = new Vector(815 * (0.8 - midcolumn) / 2, 35);
|
||||
optionText.vertSizing = Top;
|
||||
optionText.text.text = values[0];
|
||||
optionText.text.textColor = 0x787878;
|
||||
|
|
@ -108,6 +109,21 @@ class GuiXboxOptionsList extends GuiControl {
|
|||
optIcon.anim.currentFrame = 1;
|
||||
labelText.text.textColor = 0x101010;
|
||||
optionText.text.textColor = 0x101010;
|
||||
} else {
|
||||
var htr = this.getHitTestRect();
|
||||
htr.position = htr.position.add(new Vector(24, 20));
|
||||
htr.extent.set(776, 53);
|
||||
if (htr.inRect(mouseState.position)) {
|
||||
bgFill.anim.currentFrame = 1;
|
||||
optIcon.anim.currentFrame = 1;
|
||||
labelText.text.textColor = 0x101010;
|
||||
optionText.text.textColor = 0x101010;
|
||||
} else {
|
||||
bgFill.anim.currentFrame = 0;
|
||||
optIcon.anim.currentFrame = 0;
|
||||
labelText.text.textColor = 0x787878;
|
||||
optionText.text.textColor = 0x787878;
|
||||
}
|
||||
}
|
||||
var leftBtnRect = leftButton.getHitTestRect();
|
||||
var rightBtnRect = rightButton.getHitTestRect();
|
||||
|
|
|
|||
|
|
@ -58,7 +58,9 @@ class OptionsListGui extends GuiImage {
|
|||
MarbleGame.canvas.pushDialog(new MarbleSelectGui());
|
||||
});
|
||||
btnList.addButton(3, 'Input and Sound Options', (e) -> {});
|
||||
btnList.addButton(3, 'Video Options', (e) -> {});
|
||||
btnList.addButton(3, 'Video Options', (e) -> {
|
||||
MarbleGame.canvas.setContent(new VideoOptionsGui());
|
||||
});
|
||||
btnList.addButton(3, 'Misc Options', (e) -> {});
|
||||
btnList.addButton(5, 'How to Play', (e) -> {
|
||||
MarbleGame.canvas.setContent(new AboutMenuOptionsGui());
|
||||
|
|
|
|||
101
src/gui/VideoOptionsGui.hx
Normal file
101
src/gui/VideoOptionsGui.hx
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
package gui;
|
||||
|
||||
import src.MarbleGame;
|
||||
import hxd.res.BitmapFont;
|
||||
import h3d.Vector;
|
||||
import src.ResourceLoader;
|
||||
import src.Settings;
|
||||
|
||||
class VideoOptionsGui extends GuiImage {
|
||||
public function new() {
|
||||
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 = "VIDEO OPTIONS";
|
||||
rootTitle.text.alpha = 0.5;
|
||||
innerCtrl.addChild(rootTitle);
|
||||
|
||||
var yPos = 160;
|
||||
|
||||
var resolutionOpt = new GuiXboxOptionsList(1, "Fullscreen Res", [
|
||||
"1024 x 800",
|
||||
"1280 x 720",
|
||||
"1366 x 768",
|
||||
"1440 x 900",
|
||||
"1600 x 900",
|
||||
"1920 x 1080"
|
||||
], 0.35);
|
||||
|
||||
resolutionOpt.vertSizing = Bottom;
|
||||
resolutionOpt.horizSizing = Right;
|
||||
resolutionOpt.position = new Vector(380, yPos);
|
||||
resolutionOpt.extent = new Vector(815, 94);
|
||||
innerCtrl.addChild(resolutionOpt);
|
||||
|
||||
yPos += 60;
|
||||
|
||||
var displayOpt = new GuiXboxOptionsList(1, "Resolution", ["Fullscreen", "Windowed"], 0.35);
|
||||
displayOpt.vertSizing = Bottom;
|
||||
displayOpt.horizSizing = Right;
|
||||
displayOpt.position = new Vector(380, yPos);
|
||||
displayOpt.extent = new Vector(815, 94);
|
||||
innerCtrl.addChild(displayOpt);
|
||||
|
||||
yPos += 60;
|
||||
|
||||
var vsyncOpt = new GuiXboxOptionsList(1, "VSync", ["Disabled", "Enabled"], 0.35);
|
||||
vsyncOpt.vertSizing = Bottom;
|
||||
vsyncOpt.horizSizing = Right;
|
||||
vsyncOpt.position = new Vector(380, yPos);
|
||||
vsyncOpt.extent = new Vector(815, 94);
|
||||
innerCtrl.addChild(vsyncOpt);
|
||||
|
||||
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"];
|
||||
backButton.pressedAction = (e) -> MarbleGame.canvas.setContent(new OptionsListGui());
|
||||
bottomBar.addChild(backButton);
|
||||
}
|
||||
}
|
||||
|
|
@ -78,7 +78,6 @@ class DefaultCubemapMaterial extends hxsl.Shader {
|
|||
var diffuse = diffuseMap.get(calculatedUV);
|
||||
var outCol = diffuse;
|
||||
var bumpNormal = normalMap.get(calculatedUV * secondaryMapUvFactor).xyz * 2 - 1;
|
||||
bumpNormal.y *= -1;
|
||||
|
||||
var incidentRay = normalize(pixelTransformedPosition - camera.position);
|
||||
var reflectionRay = reflect(incidentRay, transformedNormal);
|
||||
|
|
|
|||
|
|
@ -58,7 +58,6 @@ class NoiseTileMaterial extends hxsl.Shader {
|
|||
}
|
||||
function fragment() {
|
||||
var bumpNormal = normalMap.get(calculatedUV * secondaryMapUvFactor).xyz * 2 - 1;
|
||||
bumpNormal.y *= -1;
|
||||
var bumpDot = saturate(dot(bumpNormal, outLightVec.xyz));
|
||||
// Diffuse part
|
||||
var diffuse = diffuseMap.get(calculatedUV);
|
||||
|
|
|
|||
|
|
@ -60,7 +60,6 @@ class RefractMaterial extends hxsl.Shader {
|
|||
}
|
||||
function fragment() {
|
||||
var bumpNormal = normalMap.get(calculatedUV * secondaryMapUvFactor).xyz * 2 - 1;
|
||||
bumpNormal.y *= -1;
|
||||
// Refract
|
||||
var distortion = 0.3;
|
||||
var off = projectedPosition;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue