diff --git a/data/ui/xbox/helpWindow.png b/data/ui/xbox/helpWindow.png new file mode 100644 index 00000000..4f25d02e Binary files /dev/null and b/data/ui/xbox/helpWindow.png differ diff --git a/src/gui/AboutMenuOptionsGui.hx b/src/gui/AboutMenuOptionsGui.hx new file mode 100644 index 00000000..cc1f2cf0 --- /dev/null +++ b/src/gui/AboutMenuOptionsGui.hx @@ -0,0 +1,88 @@ +package gui; + +import src.MarbleGame; +import hxd.res.BitmapFont; +import h3d.Vector; +import src.ResourceLoader; +import src.Settings; + +class AboutMenuOptionsGui 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 = "HOW TO PLAY"; + rootTitle.text.alpha = 0.5; + innerCtrl.addChild(rootTitle); + + var btnList = new GuiXboxList(); + btnList.position = new Vector(70 - offsetX, 165); + btnList.horizSizing = Left; + 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)); + }); + + 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("Back", 160); + backButton.position = new Vector(400, 0); + backButton.vertSizing = Bottom; + backButton.horizSizing = Right; + backButton.gamepadAccelerator = ["B"]; + backButton.pressedAction = (e) -> MarbleGame.canvas.setContent(new OptionsListGui()); + bottomBar.addChild(backButton); + } +} diff --git a/src/gui/HelpCreditsGui.hx b/src/gui/HelpCreditsGui.hx index 309a83a9..09bc0607 100644 --- a/src/gui/HelpCreditsGui.hx +++ b/src/gui/HelpCreditsGui.hx @@ -1,5 +1,6 @@ package gui; +import gui.GuiControl.MouseState; import h2d.Scene; import h3d.shader.AlphaChannel; import src.DtsObject; @@ -12,129 +13,151 @@ import src.Settings; import src.Util; class HelpCreditsGui extends GuiImage { - var manualPageList:GuiTextListCtrl; + var wndTxt:GuiMLText; + var wndTxtBg:GuiMLText; + var curScroll:Float = -50; + var doScroll = false; + + public function new(index:Int) { + 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); - public function new() { - function chooseBg() { - var rand = Math.random(); - if (rand >= 0 && rand <= 0.244) - return ResourceLoader.getImage('data/ui/backgrounds/gold/${cast (Math.floor(Util.lerp(1, 12, Math.random())), Int)}.jpg'); - if (rand > 0.244 && rand <= 0.816) - return ResourceLoader.getImage('data/ui/backgrounds/platinum/${cast (Math.floor(Util.lerp(1, 28, Math.random())), Int)}.jpg'); - return ResourceLoader.getImage('data/ui/backgrounds/ultra/${cast (Math.floor(Util.lerp(1, 9, Math.random())), Int)}.jpg'); - } - var img = chooseBg(); - super(img.resource.toTile()); - this.position = new Vector(0, 0); - this.extent = new Vector(640, 480); this.horizSizing = Width; this.vertSizing = Height; + this.position = new Vector(); + this.extent = new Vector(640, 480); - var wnd = new GuiImage(ResourceLoader.getResource("data/ui/manual/window.png", ResourceLoader.getImage, this.imageResources).toTile()); - wnd.position = new Vector(0, 0); - wnd.extent = new Vector(640, 480); - wnd.horizSizing = Center; - wnd.vertSizing = Center; - this.addChild(wnd); + var scene2d = MarbleGame.canvas.scene2d; - 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(); - return [normal, hover, pressed]; - } + var offsetX = (scene2d.width - 1280) / 2; + var offsetY = (scene2d.height - 720) / 2; - var homeButton = new GuiButton(loadButtonImages("data/ui/manual/home")); - homeButton.position = new Vector(274, 385); - homeButton.extent = new Vector(94, 46); - homeButton.accelerator = hxd.Key.ESCAPE; - homeButton.gamepadAccelerator = ["B"]; - homeButton.pressedAction = (sender) -> { - MarbleGame.canvas.setContent(new MainMenuGui()); - } - wnd.addChild(homeButton); + var subX = 640 - (scene2d.width - offsetX) * 640 / scene2d.width; + var subY = 480 - (scene2d.height - offsetY) * 480 / scene2d.height; - var arial14fontdata = ResourceLoader.getFileEntry("data/font/arial.fnt"); + 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 titles = [ + "POWERUPS", + "BLAST METER", + "SINGLE PLAYER MODE", + "MULTIPLAYER MODE", + "MARBLE CONTROLS", + "CREDITS" + ]; + + var rootTitle = new GuiText(coliseum); + rootTitle.position = new Vector(100, 30); + rootTitle.extent = new Vector(1120, 80); + rootTitle.text.textColor = 0xFFFFFF; + rootTitle.text.text = titles[index]; + rootTitle.text.alpha = 0.5; + innerCtrl.addChild(rootTitle); + + var wnd = new GuiImage(ResourceLoader.getResource("data/ui/xbox/helpWindow.png", ResourceLoader.getImage, this.imageResources).toTile()); + wnd.position = new Vector(260, 107); + wnd.extent = new Vector(736, 460); + wnd.horizSizing = Right; + wnd.vertSizing = Bottom; + innerCtrl.addChild(wnd); + + 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 11.7 * Settings.uiScale, MultiChannel); - - var pagefiles = []; - for (i in 1...23) { - var pg = ResourceLoader.load('ui/manual/pages/${i}.txt').entry; - pagefiles.push(pg); - } - var pagetxt = pagefiles.map(x -> x.getText()); - var pageheadings = pagetxt.map(x -> x.substr(0, x.indexOf("\n"))); - - var scrollCtrl1 = new GuiControl(); - scrollCtrl1.position = new Vector(29, 24); - scrollCtrl1.extent = new Vector(176, 352); - wnd.addChild(scrollCtrl1); - - manualPageList = new GuiTextListCtrl(arial14, pageheadings); - manualPageList.position = new Vector(0, 0); - manualPageList.extent = new Vector(176, 352); - manualPageList.scrollable = true; - scrollCtrl1.addChild(manualPageList); - - var scrollCtrl2 = new GuiScrollCtrl(ResourceLoader.getResource("data/ui/common/philscroll.png", ResourceLoader.getImage, this.imageResources) - .toTile()); - scrollCtrl2.position = new Vector(219, 28); - scrollCtrl2.extent = new Vector(386, 342); - scrollCtrl2.childrenHandleScroll = true; - wnd.addChild(scrollCtrl2); - - var arial14fontdata = ResourceLoader.getFileEntry("data/font/arial.fnt"); - var arial14b = new BitmapFont(arial14fontdata.entry); - @:privateAccess arial14b.loader = ResourceLoader.loader; - var arial14 = arial14b.toSdfFont(cast 14 * Settings.uiScale, MultiChannel); - - var markerFelt32fontdata = ResourceLoader.getFileEntry("data/font/MarkerFelt.fnt"); - var markerFelt32b = new BitmapFont(markerFelt32fontdata.entry); - @:privateAccess markerFelt32b.loader = ResourceLoader.loader; - var markerFelt32 = markerFelt32b.toSdfFont(cast 26 * Settings.uiScale, MultiChannel); - var markerFelt24 = markerFelt32b.toSdfFont(cast 18 * Settings.uiScale, MultiChannel); - var markerFelt18 = markerFelt32b.toSdfFont(cast 14 * Settings.uiScale, MultiChannel); - + var arial14 = arial14b.toSdfFont(cast 21 * Settings.uiScale, h2d.Font.SDFChannel.MultiChannel); + var arial14big = arial14b.toSdfFont(cast 30 * Settings.uiScale, h2d.Font.SDFChannel.MultiChannel); + var arial14med = arial14b.toSdfFont(cast 26 * Settings.uiScale, h2d.Font.SDFChannel.MultiChannel); function mlFontLoader(text:String) { switch (text) { - case "MarkerFelt32": - return markerFelt32; - case "MarkerFelt24": - return markerFelt24; - case "MarkerFelt18": - return markerFelt18; - case "Arial16": - return arial14; + case "ArialBig": + return arial14big; + case "ArialMed": + return arial14med; default: - return null; + return arial14; } } - var manualContent = new GuiMLText(arial14, mlFontLoader); - manualContent.position = new Vector(0, 20); - manualContent.extent = new Vector(376, 322); - manualContent.text.textColor = 0; - manualContent.scrollable = true; - scrollCtrl2.addChild(manualContent); + var credits1 = '


GarageGames Team


Development
Tim Aste
Jane Chase
Timothy Clarke
Adam deGrandis
Clark Fagot
Matt Fairfax
Mark Frohnmayer
Ben Garney
Tim Gift
Davey Jackson
Justin Kovac
Joe Maruschak
Mark McCoy
Jay Moore
Rick Overman
John Quigley
Brian Ramage
Kevin Ryan
Liam Ryan
Alex Swanson
Jeff Tunnell
Pat Wilson

Special Thanks
Cafe Aroma
Cafe Yumm!
Mezza Luna Pizzeria
Pizza Research Institute
The GarageGames Community

'; + var credits2 = '

Xbox Live Arcade Team

Program Management
Katie Stone
Jon David

Test Manager
Tony Harlich

Test
Michael Jones
Chad Dylan Long (VMC)
Eric Snyder (VMC)
Noriko Fritschle (VMC)
Kevin Hathaway (VMC)
Ty Roberts (VMC)

Release Manager
Julie Pitt (VOLT)

Development
Brian Ostergren
Eric Heutchy
Eric Fleegal

Group Manager
Greg Canessa

Product Planning
Ross Erickson
Cherie Lutz

Content Creation
Michelle Lomba

Usability
Tom Fuller
Chuck Harrison

Special Thanks
J Allard
Shane Kim
Don Ryan
Chris Early
Oliver Miyashita
Mike Minahan
VMC Consulting
Ami Blaire
Darryl Saunders
Aaron Greenberg
Michael Wolf
David Hufford
Darren Trencher

'; + var credits3 = '

Localization

Japan Localization Team
Shinya Muto
Junya Chiba
Go Komatsu
Mayumi Koike
Takehiro Kuga
Masao Okamoto
Yutaka Hasegawa
Munetaka Fuse
Takashi Sasaki
Shinji Komiyama

Korea Localization Team
Eun Hee Lee
In Goo Kwon
Whi Young Yoon
Ji Young Kim

Taiwan Localization Team
Robert Lin
Carole Lin
Lilia Lee
Jason Cheng

'; - manualPageList.onSelectedFunc = (idx) -> { - if (idx != -1) { - var txt = pagetxt[idx]; - var txtlines = txt.split('\n'); - txtlines[0] = '

${txtlines[0]}

'; - var finaltxt = txtlines.join('
') + '
'; - manualContent.text.text = finaltxt; - scrollCtrl2.setScrollMax(manualContent.text.textHeight); - scrollCtrl2.updateScrollVisual(); - } - }; + var texts = [ + "There are many powerups that will help you along. To collect a powerup, roll over it. It will appear in the powerup window.

On an Xbox 360 Controller, Pull the right trigger or press B to activate the powerup; Otherwise use left click or the Q key.", + "The Marble has a blast ability which gives you a slight upward boost. Use it wisely!

The Blast meter shows the current level of blast that you have available. It regenerates slowly over time.

On an Xbox 360 Controller, Press X or the right bumper to use your current blast power; Otherwise, use Right Click or the E key.

Collect the Ultra Blast powerup to instantly fill your blast meter - and then some!", + "Get to the End Pad of each level as fast as possible.

Start Pad - You start the level here.

End Pad - Roll your marble here to end the level.

Gems - Some levels have gems. You must pick up all of them before you can end the level.

Time Travel - Roll through these to temporarily pause the clock.", + "Race to the gems and pick them up to earn points. Get as many gems as you can, but be ready to go when the next group appears!

Some gems are worth more points than others. More valuable gems are usually harder to reach.

View the leaderboards to compare your ranking with other players around the world.", + "Xbox 360 Controller:
Use the left stick to move the marble.

Press A or pull the left trigger to make the marble jump.

Use the right stick to look around with the camera.

Keyboard and Mouse:
Use the WASD keys to move.
Move the mouse to look around.
Press Space to Jump." + ]; + texts.push(credits1 + "
" + credits2 + "
" + credits3); + + if (index == 5) + doScroll = true; + + var textCtrl = new GuiControl(); + textCtrl.position = new Vector(30, 33); + textCtrl.extent = new Vector(683, 403); + wnd.addChild(textCtrl); + + wndTxtBg = new GuiMLText(arial14, mlFontLoader); + wndTxtBg.position = new Vector(2, 7); + wndTxtBg.extent = new Vector(683, 343); + wndTxtBg.text.textColor = 0x101010; + wndTxtBg.text.text = texts[index]; + wndTxtBg.scrollable = true; + textCtrl.addChild(wndTxtBg); + + wndTxt = new GuiMLText(arial14, mlFontLoader); + wndTxt.position = new Vector(0, 5); + wndTxt.extent = new Vector(683, 343); + wndTxt.text.textColor = 0xEBEBEB; + wndTxt.text.text = texts[index]; + wndTxt.scrollable = true; + textCtrl.addChild(wndTxt); + + 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 (index == 5) + backButton.pressedAction = (e) -> MarbleGame.canvas.setContent(new OptionsListGui()); + else + backButton.pressedAction = (e) -> MarbleGame.canvas.setContent(new AboutMenuOptionsGui()); + bottomBar.addChild(backButton); } - public override function render(scene2d:Scene, ?parent:h2d.Flow) { - super.render(scene2d, parent); + override function update(dt:Float, mouseState:MouseState) { + super.update(dt, mouseState); - manualPageList.onSelectedFunc(0); + if (doScroll) { + curScroll += dt * 20; + + var realScroll = Math.max(curScroll, 0); + + wndTxt.onScroll(0, realScroll); + wndTxtBg.onScroll(0, realScroll); + } } } diff --git a/src/gui/OptionsListGui.hx b/src/gui/OptionsListGui.hx index e39c978f..520ac771 100644 --- a/src/gui/OptionsListGui.hx +++ b/src/gui/OptionsListGui.hx @@ -54,14 +54,18 @@ class OptionsListGui extends GuiImage { btnList.extent = new Vector(502, 500); innerCtrl.addChild(btnList); - btnList.addButton(0, 'Marble Appearance', (e) -> { + btnList.addButton(3, 'Marble Appearance', (e) -> { MarbleGame.canvas.pushDialog(new MarbleSelectGui()); }); - btnList.addButton(0, 'Input and Sound Options', (e) -> {}); - btnList.addButton(0, 'Video Options', (e) -> {}); - btnList.addButton(0, 'Misc Options', (e) -> {}); - btnList.addButton(0, 'How to Play', (e) -> {}); - btnList.addButton(0, 'Credits', (e) -> {}); + btnList.addButton(3, 'Input and Sound Options', (e) -> {}); + btnList.addButton(3, 'Video Options', (e) -> {}); + btnList.addButton(3, 'Misc Options', (e) -> {}); + btnList.addButton(5, 'How to Play', (e) -> { + MarbleGame.canvas.setContent(new AboutMenuOptionsGui()); + }); + btnList.addButton(5, 'Credits', (e) -> { + MarbleGame.canvas.setContent(new HelpCreditsGui(5)); + }); var bottomBar = new GuiControl(); bottomBar.position = new Vector(0, 590);