2013-10-03 00:21:08 +00:00
<!DOCTYPE html>
< html lang = "en" >
< head >
< meta charset = "utf-8" >
2014-03-14 06:36:05 +00:00
< title > Phaser Source: core/ScaleManager.js< / title >
2013-10-03 00:21:08 +00:00
<!-- [if lt IE 9]>
< script src = "//html5shiv.googlecode.com/svn/trunk/html5.js" > < / script >
<![endif]-->
< link type = "text/css" rel = "stylesheet" href = "styles/sunlight.default.css" >
< link type = "text/css" rel = "stylesheet" href = "styles/site.cerulean.css" >
< / head >
< body >
< div class = "container-fluid" >
< div class = "navbar navbar-fixed-top navbar-inverse" >
< div class = "navbar-inner" >
< a class = "brand" href = "index.html" > Phaser< / a >
< ul class = "nav" >
< li class = "dropdown" >
2013-10-03 01:38:35 +00:00
< a href = "namespaces.list.html" class = "dropdown-toggle" data-toggle = "dropdown" > Namespaces< b
2013-10-03 00:21:08 +00:00
class="caret">< / b > < / a >
< ul class = "dropdown-menu " >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-0" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.html" > Phaser< / a >
2013-10-03 00:21:08 +00:00
< / li >
< / ul >
< / li >
< li class = "dropdown" >
< a href = "classes.list.html" class = "dropdown-toggle" data-toggle = "dropdown" > Classes< b
class="caret">< / b > < / a >
< ul class = "dropdown-menu " >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 00:21:08 +00:00
< a href = "Phaser.Animation.html" > Animation< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.AnimationManager.html" > AnimationManager< / a >
2013-10-03 00:21:08 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.AnimationParser.html" > AnimationParser< / a >
2013-10-03 00:21:08 +00:00
< / li >
2014-04-29 14:39:02 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.ArrayList.html" > ArrayList< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.BitmapData.html" > BitmapData< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.BitmapText.html" > BitmapText< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.Button.html" > Button< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.Cache.html" > Cache< / a >
2013-10-03 00:21:08 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.Camera.html" > Camera< / a >
2013-10-03 00:21:08 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.Canvas.html" > Canvas< / a >
2013-10-03 00:21:08 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.Circle.html" > Circle< / a >
2013-10-03 00:21:08 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.Color.html" > Color< / a >
2013-10-03 00:21:08 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.Device.html" > Device< / a >
2013-10-03 00:21:08 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.Easing.html" > Easing< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-2" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.Easing.Back.html" > Back< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-2" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.Easing.Bounce.html" > Bounce< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-2" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.Easing.Circular.html" > Circular< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-2" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.Easing.Cubic.html" > Cubic< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-2" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.Easing.Elastic.html" > Elastic< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-2" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.Easing.Exponential.html" > Exponential< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-2" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.Easing.Linear.html" > Linear< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-2" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.Easing.Quadratic.html" > Quadratic< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-2" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.Easing.Quartic.html" > Quartic< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-2" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.Easing.Quintic.html" > Quintic< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-2" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.Easing.Sinusoidal.html" > Sinusoidal< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2014-02-18 03:01:51 +00:00
< a href = "Phaser.Ellipse.html" > Ellipse< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.Events.html" > Events< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Filter.html" > Filter< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.Frame.html" > Frame< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.FrameData.html" > FrameData< / a >
2013-10-03 00:21:08 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 00:21:08 +00:00
< a href = "Phaser.Game.html" > Game< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2014-02-21 15:37:26 +00:00
< a href = "Phaser.GameObjectCreator.html" > GameObjectCreator< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.GameObjectFactory.html" > GameObjectFactory< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2014-02-05 06:29:17 +00:00
< a href = "Phaser.Gamepad.html" > Gamepad< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2014-02-05 06:29:17 +00:00
< a href = "Phaser.GamepadButton.html" > GamepadButton< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.Graphics.html" > Graphics< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 00:21:08 +00:00
< a href = "Phaser.Group.html" > Group< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2014-02-08 07:24:22 +00:00
< a href = "Phaser.Image.html" > Image< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 00:21:08 +00:00
< a href = "Phaser.Input.html" > Input< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 00:21:08 +00:00
< a href = "Phaser.InputHandler.html" > InputHandler< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 00:21:08 +00:00
< a href = "Phaser.Key.html" > Key< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 00:21:08 +00:00
< a href = "Phaser.Keyboard.html" > Keyboard< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2014-02-05 06:29:17 +00:00
< a href = "Phaser.Line.html" > Line< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 00:21:08 +00:00
< a href = "Phaser.LinkedList.html" > LinkedList< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 00:21:08 +00:00
< a href = "Phaser.Loader.html" > Loader< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.LoaderParser.html" > LoaderParser< / a >
2013-10-03 00:21:08 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 00:21:08 +00:00
< a href = "Phaser.Math.html" > Math< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 00:21:08 +00:00
< a href = "Phaser.Mouse.html" > Mouse< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 00:21:08 +00:00
< a href = "Phaser.MSPointer.html" > MSPointer< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 00:21:08 +00:00
< a href = "Phaser.Net.html" > Net< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.Particle.html" > Particle< / a >
< / li >
< li class = "class-depth-1" >
2013-10-03 00:21:08 +00:00
< a href = "Phaser.Particles.html" > Particles< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2013-10-03 00:21:08 +00:00
< a href = "Phaser.Particles.Arcade.Emitter.html" > Emitter< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.Physics.html" > Physics< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-2" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.Physics.Arcade.html" > Arcade< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.Arcade.Body.html" > Body< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-2" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.Ninja.html" > Ninja< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.Ninja.AABB.html" > AABB< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.Ninja.Body.html" > Body< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.Ninja.Circle.html" > Circle< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.Ninja.Tile.html" > Tile< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-2" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.html" > P2< / a >
2014-02-21 15:37:26 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.Body.html" > Body< / a >
2014-02-21 15:37:26 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.BodyDebug.html" > BodyDebug< / a >
2014-02-21 15:37:26 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.CollisionGroup.html" > CollisionGroup< / a >
2014-02-21 15:37:26 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.ContactMaterial.html" > ContactMaterial< / a >
2014-02-21 15:37:26 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.DistanceConstraint.html" > DistanceConstraint< / a >
2014-02-21 15:37:26 +00:00
< / li >
2014-04-11 12:09:28 +00:00
< li class = "class-depth-3" >
< a href = "Phaser.Physics.P2.FixtureList.html" > FixtureList< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.GearConstraint.html" > GearConstraint< / a >
2014-02-21 15:37:26 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.InversePointProxy.html" > InversePointProxy< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.LockConstraint.html" > LockConstraint< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.Material.html" > Material< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.PointProxy.html" > PointProxy< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.PrismaticConstraint.html" > PrismaticConstraint< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.RevoluteConstraint.html" > RevoluteConstraint< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.Spring.html" > Spring< / a >
2014-02-21 15:37:26 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 00:21:08 +00:00
< a href = "Phaser.Plugin.html" > Plugin< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 00:21:08 +00:00
< a href = "Phaser.PluginManager.html" > PluginManager< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 00:21:08 +00:00
< a href = "Phaser.Point.html" > Point< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 00:21:08 +00:00
< a href = "Phaser.Pointer.html" > Pointer< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-07 06:10:15 +00:00
< a href = "Phaser.Polygon.html" > Polygon< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.QuadTree.html" > QuadTree< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 00:21:08 +00:00
< a href = "Phaser.RandomDataGenerator.html" > RandomDataGenerator< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 00:21:08 +00:00
< a href = "Phaser.Rectangle.html" > Rectangle< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.RenderTexture.html" > RenderTexture< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 00:21:08 +00:00
< a href = "Phaser.RequestAnimationFrame.html" > RequestAnimationFrame< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.RetroFont.html" > RetroFont< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.ScaleManager.html" > ScaleManager< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 00:21:08 +00:00
< a href = "Phaser.Signal.html" > Signal< / a >
< / li >
2014-04-11 12:09:28 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.SignalBinding.html" > SignalBinding< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2014-02-05 06:29:17 +00:00
< a href = "Phaser.SinglePad.html" > SinglePad< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 00:21:08 +00:00
< a href = "Phaser.Sound.html" > Sound< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 00:21:08 +00:00
< a href = "Phaser.SoundManager.html" > SoundManager< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.Sprite.html" > Sprite< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2014-02-18 03:01:51 +00:00
< a href = "Phaser.SpriteBatch.html" > SpriteBatch< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 00:21:08 +00:00
< a href = "Phaser.Stage.html" > Stage< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 00:21:08 +00:00
< a href = "Phaser.State.html" > State< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 00:21:08 +00:00
< a href = "Phaser.StateManager.html" > StateManager< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.Text.html" > Text< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Tile.html" > Tile< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Tilemap.html" > Tilemap< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.TilemapLayer.html" > TilemapLayer< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.TilemapParser.html" > TilemapParser< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Tileset.html" > Tileset< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.TileSprite.html" > TileSprite< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.Time.html" > Time< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Timer.html" > Timer< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2014-02-05 06:29:17 +00:00
< a href = "Phaser.TimerEvent.html" > TimerEvent< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 00:21:08 +00:00
< a href = "Phaser.Touch.html" > Touch< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.Tween.html" > Tween< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.TweenManager.html" > TweenManager< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.Utils.html" > Utils< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-2" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.Utils.Debug.html" > Debug< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 00:21:08 +00:00
< a href = "Phaser.World.html" > World< / a >
< / li >
< / ul >
< / li >
< / ul >
< / div >
< / div >
< div class = "row-fluid" >
< div class = "span12" >
< div id = "main" >
2014-03-14 06:36:05 +00:00
< h1 class = "page-title" > Source: core/ScaleManager.js< / h1 >
2013-10-03 00:21:08 +00:00
< section >
< article >
< pre class = "sunlight-highlight-javascript linenums" > /**
* @author Richard Davey < rich@photonstorm.com>
2014-02-05 06:29:17 +00:00
* @copyright 2014 Photon Storm Ltd.
2013-10-03 00:21:08 +00:00
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
/**
2014-03-14 06:36:05 +00:00
* The ScaleManager object is responsible for helping you manage the scaling, resizing and alignment of your game within the browser.
2013-10-03 00:21:08 +00:00
*
2014-03-28 01:42:49 +00:00
* @class Phaser.ScaleManager
2013-10-03 00:21:08 +00:00
* @constructor
* @param {Phaser.Game} game - A reference to the currently running game.
2013-11-28 15:57:09 +00:00
* @param {number} width - The native width of the game.
* @param {number} height - The native height of the game.
2013-10-03 00:21:08 +00:00
*/
2014-03-14 06:36:05 +00:00
Phaser.ScaleManager = function (game, width, height) {
2013-10-03 00:21:08 +00:00
/**
2013-11-07 06:10:15 +00:00
* @property {Phaser.Game} game - A reference to the currently running game.
2013-10-03 00:21:08 +00:00
*/
2013-11-07 06:10:15 +00:00
this.game = game;
2013-10-03 00:21:08 +00:00
/**
2013-11-07 06:10:15 +00:00
* @property {number} width - Width of the stage after calculation.
2013-10-03 00:21:08 +00:00
*/
2013-11-07 06:10:15 +00:00
this.width = width;
2013-10-03 00:21:08 +00:00
/**
2013-11-07 06:10:15 +00:00
* @property {number} height - Height of the stage after calculation.
*/
this.height = height;
/**
* @property {number} minWidth - Minimum width the canvas should be scaled to (in pixels).
2013-10-03 00:21:08 +00:00
*/
2013-11-07 06:10:15 +00:00
this.minWidth = null;
2013-10-03 00:21:08 +00:00
/**
2014-02-18 03:01:51 +00:00
* @property {number} maxWidth - Maximum width the canvas should be scaled to (in pixels). If null it will scale to whatever width the browser can handle.
2013-10-03 00:21:08 +00:00
*/
2013-11-07 06:10:15 +00:00
this.maxWidth = null;
2013-10-03 00:21:08 +00:00
/**
2013-11-07 06:10:15 +00:00
* @property {number} minHeight - Minimum height the canvas should be scaled to (in pixels).
2013-10-03 00:21:08 +00:00
*/
2013-11-07 06:10:15 +00:00
this.minHeight = null;
2013-10-03 00:21:08 +00:00
/**
2014-02-18 03:01:51 +00:00
* @property {number} maxHeight - Maximum height the canvas should be scaled to (in pixels). If null it will scale to whatever height the browser can handle.
2013-10-03 00:21:08 +00:00
*/
2013-11-07 06:10:15 +00:00
this.maxHeight = null;
2013-10-03 00:21:08 +00:00
/**
2013-11-07 06:10:15 +00:00
* @property {boolean} forceLandscape - If the game should be forced to use Landscape mode, this is set to true by Game.Stage
2013-10-03 00:21:08 +00:00
* @default
*/
2013-11-07 06:10:15 +00:00
this.forceLandscape = false;
2013-10-03 00:21:08 +00:00
/**
2013-11-07 06:10:15 +00:00
* @property {boolean} forcePortrait - If the game should be forced to use Portrait mode, this is set to true by Game.Stage
2013-10-03 00:21:08 +00:00
* @default
*/
2013-11-28 15:57:09 +00:00
this.forcePortrait = false;
2013-10-03 00:21:08 +00:00
/**
2013-11-07 06:10:15 +00:00
* @property {boolean} incorrectOrientation - If the game should be forced to use a specific orientation and the device currently isn't in that orientation this is set to true.
2013-10-03 00:21:08 +00:00
* @default
*/
2013-11-07 06:10:15 +00:00
this.incorrectOrientation = false;
2013-10-03 00:21:08 +00:00
/**
2013-11-07 06:10:15 +00:00
* @property {boolean} pageAlignHorizontally - If you wish to align your game in the middle of the page then you can set this value to true.
* It will place a re-calculated margin-left pixel value onto the canvas element which is updated on orientation/resizing.
* It doesn't care about any other DOM element that may be on the page, it literally just sets the margin.
* @default
2013-10-03 00:21:08 +00:00
*/
2013-11-07 06:10:15 +00:00
this.pageAlignHorizontally = false;
2013-10-03 00:21:08 +00:00
/**
2013-11-07 06:10:15 +00:00
* @property {boolean} pageAlignVertically - If you wish to align your game in the middle of the page then you can set this value to true.
* It will place a re-calculated margin-left pixel value onto the canvas element which is updated on orientation/resizing.
* It doesn't care about any other DOM element that may be on the page, it literally just sets the margin.
* @default
2013-11-01 18:16:52 +00:00
*/
2013-11-07 06:10:15 +00:00
this.pageAlignVertically = false;
2013-11-01 18:16:52 +00:00
2013-10-03 00:21:08 +00:00
/**
* @property {number} maxIterations - The maximum number of times it will try to resize the canvas to fill the browser.
* @default
*/
this.maxIterations = 5;
2013-11-07 06:10:15 +00:00
2013-10-03 00:21:08 +00:00
/**
2013-11-07 06:10:15 +00:00
* @property {PIXI.Sprite} orientationSprite - The Sprite that is optionally displayed if the browser enters an unsupported orientation.
2013-10-03 00:21:08 +00:00
*/
2013-11-07 06:10:15 +00:00
this.orientationSprite = null;
2013-10-03 00:21:08 +00:00
/**
2013-11-07 06:10:15 +00:00
* @property {Phaser.Signal} enterLandscape - The event that is dispatched when the browser enters landscape orientation.
2013-10-03 00:21:08 +00:00
*/
this.enterLandscape = new Phaser.Signal();
/**
2013-11-07 06:10:15 +00:00
* @property {Phaser.Signal} enterPortrait - The event that is dispatched when the browser enters horizontal orientation.
2013-10-03 00:21:08 +00:00
*/
this.enterPortrait = new Phaser.Signal();
2013-11-28 15:57:09 +00:00
/**
* @property {Phaser.Signal} enterIncorrectOrientation - The event that is dispatched when the browser enters an incorrect orientation, as defined by forceOrientation.
*/
this.enterIncorrectOrientation = new Phaser.Signal();
/**
* @property {Phaser.Signal} leaveIncorrectOrientation - The event that is dispatched when the browser leaves an incorrect orientation, as defined by forceOrientation.
*/
this.leaveIncorrectOrientation = new Phaser.Signal();
/**
* @property {Phaser.Signal} hasResized - The event that is dispatched when the game scale changes.
*/
this.hasResized = new Phaser.Signal();
2014-03-14 06:36:05 +00:00
/**
* This is the DOM element that will have the Full Screen mode called on it. It defaults to the game canvas, but can be retargetted to any valid DOM element.
* If you adjust this property it's up to you to see it has the correct CSS applied, and that you have contained the game canvas correctly.
* Note that if you use a scale property of EXACT_FIT then fullScreenTarget will have its width and height style set to 100%.
* @property {any} fullScreenTarget
*/
this.fullScreenTarget = this.game.canvas;
/**
* @property {Phaser.Signal} enterFullScreen - The event that is dispatched when the browser enters full screen mode (if it supports the FullScreen API).
*/
this.enterFullScreen = new Phaser.Signal();
/**
* @property {Phaser.Signal} leaveFullScreen - The event that is dispatched when the browser leaves full screen mode (if it supports the FullScreen API).
*/
this.leaveFullScreen = new Phaser.Signal();
2014-02-18 03:01:51 +00:00
/**
* @property {number} orientation - The orientation value of the game (as defined by window.orientation if set). 90 = landscape. 0 = portrait.
*/
this.orientation = 0;
2013-10-03 00:21:08 +00:00
if (window['orientation'])
{
this.orientation = window['orientation'];
}
else
{
if (window.outerWidth > window.outerHeight)
{
this.orientation = 90;
}
}
/**
2013-11-07 06:10:15 +00:00
* @property {Phaser.Point} scaleFactor - The scale factor based on the game dimensions vs. the scaled dimensions.
2013-11-28 15:57:09 +00:00
* @readonly
2013-10-03 00:21:08 +00:00
*/
this.scaleFactor = new Phaser.Point(1, 1);
2013-11-28 15:57:09 +00:00
/**
* @property {Phaser.Point} scaleFactorInversed - The inversed scale factor. The displayed dimensions divided by the game dimensions.
* @readonly
*/
this.scaleFactorInversed = new Phaser.Point(1, 1);
/**
2014-04-29 14:39:02 +00:00
* @property {Phaser.Point} margin - If the game canvas is set to align by adjusting the margin, the margin calculation values are stored in this Point.
2013-11-28 15:57:09 +00:00
* @readonly
*/
this.margin = new Phaser.Point(0, 0);
2013-10-03 00:21:08 +00:00
/**
2014-02-18 03:01:51 +00:00
* @property {number} aspectRatio - The aspect ratio of the scaled game.
* @readonly
2013-10-03 00:21:08 +00:00
*/
this.aspectRatio = 0;
2014-02-18 03:01:51 +00:00
/**
* @property {number} sourceAspectRatio - The aspect ratio (width / height) of the original game dimensions.
* @readonly
*/
this.sourceAspectRatio = width / height;
2013-11-28 15:57:09 +00:00
/**
* @property {any} event- The native browser events from full screen API changes.
*/
this.event = null;
2014-02-18 03:01:51 +00:00
/**
* @property {number} scaleMode - The current scaleMode.
*/
2014-03-14 06:36:05 +00:00
this.scaleMode = Phaser.ScaleManager.NO_SCALE;
2014-02-18 03:01:51 +00:00
/*
* @property {number} fullScreenScaleMode - Scale mode to be used in fullScreen
*/
2014-03-14 06:36:05 +00:00
this.fullScreenScaleMode = Phaser.ScaleManager.NO_SCALE;
2014-02-18 03:01:51 +00:00
/**
* @property {number} _startHeight - Internal cache var. Stage height when starting the game.
* @private
*/
this._startHeight = 0;
/**
* @property {number} _width - Cached stage width for full screen mode.
* @private
*/
this._width = 0;
/**
* @property {number} _height - Cached stage height for full screen mode.
* @private
*/
this._height = 0;
2013-10-03 00:21:08 +00:00
var _this = this;
window.addEventListener('orientationchange', function (event) {
return _this.checkOrientation(event);
}, false);
window.addEventListener('resize', function (event) {
return _this.checkResize(event);
}, false);
2013-11-01 18:16:52 +00:00
document.addEventListener('webkitfullscreenchange', function (event) {
return _this.fullScreenChange(event);
}, false);
document.addEventListener('mozfullscreenchange', function (event) {
return _this.fullScreenChange(event);
}, false);
document.addEventListener('fullscreenchange', function (event) {
return _this.fullScreenChange(event);
}, false);
2014-03-28 01:42:49 +00:00
2013-10-03 00:21:08 +00:00
};
/**
* @constant
* @type {number}
*/
2014-03-14 06:36:05 +00:00
Phaser.ScaleManager.EXACT_FIT = 0;
2013-10-03 00:21:08 +00:00
/**
* @constant
* @type {number}
*/
2014-03-14 06:36:05 +00:00
Phaser.ScaleManager.NO_SCALE = 1;
2013-10-03 00:21:08 +00:00
/**
* @constant
* @type {number}
*/
2014-03-14 06:36:05 +00:00
Phaser.ScaleManager.SHOW_ALL = 2;
2013-10-03 00:21:08 +00:00
2014-03-14 06:36:05 +00:00
Phaser.ScaleManager.prototype = {
2013-10-03 00:21:08 +00:00
/**
* Tries to enter the browser into full screen mode.
* Please note that this needs to be supported by the web browser and isn't the same thing as setting your game to fill the browser.
2014-03-14 06:36:05 +00:00
* @method Phaser.ScaleManager#startFullScreen
2013-11-01 18:16:52 +00:00
* @param {boolean} antialias - You can toggle the anti-alias feature of the canvas before jumping in to full screen (false = retain pixel art, true = smooth art)
2013-10-03 00:21:08 +00:00
*/
2013-11-01 18:16:52 +00:00
startFullScreen: function (antialias) {
2013-10-03 00:21:08 +00:00
2014-03-14 06:36:05 +00:00
if (this.isFullScreen || !this.game.device.fullscreen)
2013-10-03 00:21:08 +00:00
{
return;
}
2014-04-11 12:09:28 +00:00
if (typeof antialias !== 'undefined' & & this.game.renderType === Phaser.CANVAS)
2013-11-01 18:16:52 +00:00
{
2014-03-14 06:36:05 +00:00
this.game.stage.smoothed = antialias;
2013-11-01 18:16:52 +00:00
}
this._width = this.width;
this._height = this.height;
2014-03-14 06:36:05 +00:00
if (this.game.device.fullscreenKeyboard)
2013-10-03 00:21:08 +00:00
{
2014-03-14 06:36:05 +00:00
this.fullScreenTarget[this.game.device.requestFullscreen](Element.ALLOW_KEYBOARD_INPUT);
2013-10-03 00:21:08 +00:00
}
2014-03-14 06:36:05 +00:00
else
2013-10-03 00:21:08 +00:00
{
2014-03-14 06:36:05 +00:00
this.fullScreenTarget[this.game.device.requestFullscreen]();
2013-10-03 00:21:08 +00:00
}
},
/**
* Stops full screen mode if the browser is in it.
2014-03-14 06:36:05 +00:00
* @method Phaser.ScaleManager#stopFullScreen
2013-10-03 00:21:08 +00:00
*/
stopFullScreen: function () {
2014-03-14 06:36:05 +00:00
this.fullScreenTarget[this.game.device.cancelFullscreen]();
2013-10-03 00:21:08 +00:00
},
2013-11-01 18:16:52 +00:00
/**
* Called automatically when the browser enters of leaves full screen mode.
2014-03-14 06:36:05 +00:00
* @method Phaser.ScaleManager#fullScreenChange
2013-11-01 18:16:52 +00:00
* @param {Event} event - The fullscreenchange event
* @protected
*/
fullScreenChange: function (event) {
2013-11-28 15:57:09 +00:00
this.event = event;
2013-11-01 18:16:52 +00:00
if (this.isFullScreen)
{
2014-03-14 06:36:05 +00:00
if (this.fullScreenScaleMode === Phaser.ScaleManager.EXACT_FIT)
2014-02-05 06:29:17 +00:00
{
2014-03-14 06:36:05 +00:00
this.fullScreenTarget.style['width'] = '100%';
this.fullScreenTarget.style['height'] = '100%';
2013-11-01 18:16:52 +00:00
2014-03-14 06:36:05 +00:00
this.width = window.outerWidth;
this.height = window.outerHeight;
2013-11-01 18:16:52 +00:00
2014-02-05 06:29:17 +00:00
this.game.input.scale.setTo(this.game.width / this.width, this.game.height / this.height);
2013-11-01 18:16:52 +00:00
2014-02-05 06:29:17 +00:00
this.aspectRatio = this.width / this.height;
this.scaleFactor.x = this.game.width / this.width;
this.scaleFactor.y = this.game.height / this.height;
2014-03-14 06:36:05 +00:00
this.checkResize();
2014-02-05 06:29:17 +00:00
}
2014-03-14 06:36:05 +00:00
else if (this.fullScreenScaleMode === Phaser.ScaleManager.SHOW_ALL)
2014-02-05 06:29:17 +00:00
{
2014-02-18 03:01:51 +00:00
this.setShowAll();
this.refresh();
2014-02-05 06:29:17 +00:00
}
2014-03-14 06:36:05 +00:00
this.enterFullScreen.dispatch(this.width, this.height);
2013-11-01 18:16:52 +00:00
}
else
{
2014-03-14 06:36:05 +00:00
this.fullScreenTarget.style['width'] = this.game.width + 'px';
this.fullScreenTarget.style['height'] = this.game.height + 'px';
2013-11-01 18:16:52 +00:00
this.width = this._width;
this.height = this._height;
this.game.input.scale.setTo(this.game.width / this.width, this.game.height / this.height);
this.aspectRatio = this.width / this.height;
this.scaleFactor.x = this.game.width / this.width;
this.scaleFactor.y = this.game.height / this.height;
2014-03-14 06:36:05 +00:00
this.leaveFullScreen.dispatch(this.width, this.height);
2013-11-01 18:16:52 +00:00
}
},
2013-11-07 06:10:15 +00:00
/**
* If you need your game to run in only one orientation you can force that to happen.
* The optional orientationImage is displayed when the game is in the incorrect orientation.
2014-03-14 06:36:05 +00:00
* @method Phaser.ScaleManager#forceOrientation
2013-11-07 06:10:15 +00:00
* @param {boolean} forceLandscape - true if the game should run in landscape mode only.
2013-11-28 15:57:09 +00:00
* @param {boolean} [forcePortrait=false] - true if the game should run in portrait mode only.
* @param {string} [orientationImage=''] - The string of an image in the Phaser.Cache to display when this game is in the incorrect orientation.
2013-11-07 06:10:15 +00:00
*/
forceOrientation: function (forceLandscape, forcePortrait, orientationImage) {
2013-11-28 15:57:09 +00:00
if (typeof forcePortrait === 'undefined') { forcePortrait = false; }
2013-11-07 06:10:15 +00:00
2013-11-28 15:57:09 +00:00
this.forceLandscape = forceLandscape;
this.forcePortrait = forcePortrait;
2013-11-07 06:10:15 +00:00
if (typeof orientationImage !== 'undefined')
{
2014-04-29 14:39:02 +00:00
if (orientationImage === null || this.game.cache.checkImageKey(orientationImage) === false)
2013-11-07 06:10:15 +00:00
{
orientationImage = '__default';
}
2014-03-14 06:36:05 +00:00
this.orientationSprite = new Phaser.Image(this.game, this.game.width / 2, this.game.height / 2, PIXI.TextureCache[orientationImage]);
this.orientationSprite.anchor.set(0.5);
2013-11-07 06:10:15 +00:00
this.checkOrientationState();
if (this.incorrectOrientation)
{
this.orientationSprite.visible = true;
this.game.world.visible = false;
}
else
{
this.orientationSprite.visible = false;
this.game.world.visible = true;
}
2014-02-18 03:01:51 +00:00
this.game.stage.addChild(this.orientationSprite);
2013-11-07 06:10:15 +00:00
}
},
2013-10-03 00:21:08 +00:00
/**
* Checks if the browser is in the correct orientation for your game (if forceLandscape or forcePortrait have been set)
2014-03-14 06:36:05 +00:00
* @method Phaser.ScaleManager#checkOrientationState
2013-10-03 00:21:08 +00:00
*/
checkOrientationState: function () {
// They are in the wrong orientation
if (this.incorrectOrientation)
{
2014-04-11 12:09:28 +00:00
if ((this.forceLandscape & & window.innerWidth > window.innerHeight) || (this.forcePortrait & & window.innerHeight > window.innerWidth))
2013-10-03 00:21:08 +00:00
{
// Back to normal
this.incorrectOrientation = false;
2013-11-28 15:57:09 +00:00
this.leaveIncorrectOrientation.dispatch();
2013-11-07 06:10:15 +00:00
if (this.orientationSprite)
{
this.orientationSprite.visible = false;
this.game.world.visible = true;
}
2014-03-14 06:36:05 +00:00
if (this.scaleMode !== Phaser.ScaleManager.NO_SCALE)
{
this.refresh();
}
2013-10-03 00:21:08 +00:00
}
}
else
{
2014-04-11 12:09:28 +00:00
if ((this.forceLandscape & & window.innerWidth < window.innerHeight) || (this.forcePortrait & & window.innerHeight < window.innerWidth))
2013-10-03 00:21:08 +00:00
{
// Show orientation screen
this.incorrectOrientation = true;
2013-11-28 15:57:09 +00:00
this.enterIncorrectOrientation.dispatch();
2013-11-07 06:10:15 +00:00
2014-04-11 12:09:28 +00:00
if (this.orientationSprite & & this.orientationSprite.visible === false)
2013-11-07 06:10:15 +00:00
{
this.orientationSprite.visible = true;
this.game.world.visible = false;
}
2014-03-14 06:36:05 +00:00
if (this.scaleMode !== Phaser.ScaleManager.NO_SCALE)
{
this.refresh();
}
2013-10-03 00:21:08 +00:00
}
}
},
/**
* Handle window.orientationchange events
2014-03-14 06:36:05 +00:00
* @method Phaser.ScaleManager#checkOrientation
2013-10-03 00:21:08 +00:00
* @param {Event} event - The orientationchange event data.
*/
checkOrientation: function (event) {
2013-11-28 15:57:09 +00:00
this.event = event;
2013-10-03 00:21:08 +00:00
this.orientation = window['orientation'];
if (this.isLandscape)
{
this.enterLandscape.dispatch(this.orientation, true, false);
}
else
{
this.enterPortrait.dispatch(this.orientation, false, true);
}
2014-03-14 06:36:05 +00:00
if (this.scaleMode !== Phaser.ScaleManager.NO_SCALE)
2013-10-03 00:21:08 +00:00
{
this.refresh();
}
},
/**
* Handle window.resize events
2014-03-14 06:36:05 +00:00
* @method Phaser.ScaleManager#checkResize
2013-10-03 00:21:08 +00:00
* @param {Event} event - The resize event data.
*/
checkResize: function (event) {
2013-11-28 15:57:09 +00:00
this.event = event;
2013-10-03 00:21:08 +00:00
if (window.outerWidth > window.outerHeight)
{
this.orientation = 90;
}
else
{
this.orientation = 0;
}
if (this.isLandscape)
{
this.enterLandscape.dispatch(this.orientation, true, false);
}
else
{
this.enterPortrait.dispatch(this.orientation, false, true);
}
2014-03-14 06:36:05 +00:00
if (this.scaleMode !== Phaser.ScaleManager.NO_SCALE)
2013-10-03 00:21:08 +00:00
{
this.refresh();
}
2013-11-07 06:10:15 +00:00
this.checkOrientationState();
2013-10-03 00:21:08 +00:00
},
/**
* Re-calculate scale mode and update screen size.
2014-03-14 06:36:05 +00:00
* @method Phaser.ScaleManager#refresh
2013-10-03 00:21:08 +00:00
*/
refresh: function () {
// We can't do anything about the status bars in iPads, web apps or desktops
2014-04-29 14:39:02 +00:00
if (!this.game.device.iPad & & !this.game.device.webApp & & !this.game.device.desktop)
2013-10-03 00:21:08 +00:00
{
2014-04-29 14:39:02 +00:00
// TODO - Test this
// this._startHeight = window.innerHeight;
if (this.game.device.android & & !this.game.device.chrome)
2013-10-03 00:21:08 +00:00
{
window.scrollTo(0, 1);
}
else
{
window.scrollTo(0, 0);
}
}
2014-04-29 14:39:02 +00:00
if (this._check === null & & this.maxIterations > 0)
2013-10-03 00:21:08 +00:00
{
this._iterations = this.maxIterations;
2013-11-28 15:57:09 +00:00
var _this = this;
2013-10-03 00:21:08 +00:00
this._check = window.setInterval(function () {
return _this.setScreenSize();
}, 10);
2013-11-28 15:57:09 +00:00
2013-10-03 00:21:08 +00:00
this.setScreenSize();
}
},
/**
* Set screen size automatically based on the scaleMode.
2013-11-07 06:10:15 +00:00
* @param {boolean} force - If force is true it will try to resize the game regardless of the document dimensions.
2013-10-03 00:21:08 +00:00
*/
setScreenSize: function (force) {
2014-04-29 14:39:02 +00:00
if (typeof force === 'undefined')
2013-10-03 00:21:08 +00:00
{
force = false;
}
2014-03-28 01:42:49 +00:00
2014-04-29 14:39:02 +00:00
if (!this.game.device.iPad & & !this.game.device.webApp & & !this.game.device.desktop)
2013-10-03 00:21:08 +00:00
{
2014-04-29 14:39:02 +00:00
if (this.game.device.android & & !this.game.device.chrome)
2013-10-03 00:21:08 +00:00
{
window.scrollTo(0, 1);
}
else
{
window.scrollTo(0, 0);
}
}
this._iterations--;
if (force || window.innerHeight > this._startHeight || this._iterations < 0)
{
// Set minimum height of content to new window height
document.documentElement['style'].minHeight = window.innerHeight + 'px';
2014-03-28 01:42:49 +00:00
2014-04-29 14:39:02 +00:00
if (this.incorrectOrientation)
2013-10-03 00:21:08 +00:00
{
this.setMaximum();
}
2014-02-05 06:29:17 +00:00
else if (!this.isFullScreen)
2013-10-03 00:21:08 +00:00
{
2014-04-29 14:39:02 +00:00
if (this.scaleMode === Phaser.ScaleManager.EXACT_FIT)
2014-02-05 06:29:17 +00:00
{
this.setExactFit();
}
2014-04-29 14:39:02 +00:00
else if (this.scaleMode === Phaser.ScaleManager.SHOW_ALL)
2014-02-05 06:29:17 +00:00
{
this.setShowAll();
}
2013-10-03 00:21:08 +00:00
}
2014-02-05 06:29:17 +00:00
else
2013-10-03 00:21:08 +00:00
{
2014-04-29 14:39:02 +00:00
if (this.fullScreenScaleMode === Phaser.ScaleManager.EXACT_FIT)
2014-02-05 06:29:17 +00:00
{
this.setExactFit();
}
2014-04-29 14:39:02 +00:00
else if (this.fullScreenScaleMode === Phaser.ScaleManager.SHOW_ALL)
2014-02-05 06:29:17 +00:00
{
this.setShowAll();
}
2013-10-03 00:21:08 +00:00
}
this.setSize();
clearInterval(this._check);
this._check = null;
}
},
/**
* Sets the canvas style width and height values based on minWidth/Height and maxWidth/Height.
2014-03-14 06:36:05 +00:00
* @method Phaser.ScaleManager#setSize
2013-10-03 00:21:08 +00:00
*/
setSize: function () {
2014-04-29 14:39:02 +00:00
if (!this.incorrectOrientation)
2013-10-03 00:21:08 +00:00
{
2014-04-11 12:09:28 +00:00
if (this.maxWidth & & this.width > this.maxWidth)
2013-10-03 00:21:08 +00:00
{
this.width = this.maxWidth;
}
2014-04-11 12:09:28 +00:00
if (this.maxHeight & & this.height > this.maxHeight)
2013-10-03 00:21:08 +00:00
{
this.height = this.maxHeight;
}
2014-04-11 12:09:28 +00:00
if (this.minWidth & & this.width < this.minWidth)
2013-10-03 00:21:08 +00:00
{
this.width = this.minWidth;
}
2014-04-11 12:09:28 +00:00
if (this.minHeight & & this.height < this.minHeight)
2013-10-03 00:21:08 +00:00
{
this.height = this.minHeight;
}
}
this.game.canvas.style.width = this.width + 'px';
this.game.canvas.style.height = this.height + 'px';
2014-03-28 01:42:49 +00:00
2013-10-03 00:21:08 +00:00
this.game.input.scale.setTo(this.game.width / this.width, this.game.height / this.height);
if (this.pageAlignHorizontally)
{
2014-04-29 14:39:02 +00:00
if (this.width < window.innerWidth & & !this.incorrectOrientation)
2013-10-03 00:21:08 +00:00
{
2013-11-28 15:57:09 +00:00
this.margin.x = Math.round((window.innerWidth - this.width) / 2);
this.game.canvas.style.marginLeft = this.margin.x + 'px';
2013-10-03 00:21:08 +00:00
}
else
{
2013-11-28 15:57:09 +00:00
this.margin.x = 0;
2013-10-03 00:21:08 +00:00
this.game.canvas.style.marginLeft = '0px';
}
}
2013-10-23 13:00:28 +00:00
if (this.pageAlignVertically)
2013-10-03 00:21:08 +00:00
{
2014-04-29 14:39:02 +00:00
if (this.height < window.innerHeight & & !this.incorrectOrientation)
2013-10-03 00:21:08 +00:00
{
2013-11-28 15:57:09 +00:00
this.margin.y = Math.round((window.innerHeight - this.height) / 2);
this.game.canvas.style.marginTop = this.margin.y + 'px';
2013-10-03 00:21:08 +00:00
}
else
{
2013-11-28 15:57:09 +00:00
this.margin.y = 0;
2013-10-03 00:21:08 +00:00
this.game.canvas.style.marginTop = '0px';
}
}
Phaser.Canvas.getOffset(this.game.canvas, this.game.stage.offset);
2014-03-28 01:42:49 +00:00
2013-10-03 00:21:08 +00:00
this.aspectRatio = this.width / this.height;
2014-03-28 01:42:49 +00:00
2013-10-03 00:21:08 +00:00
this.scaleFactor.x = this.game.width / this.width;
this.scaleFactor.y = this.game.height / this.height;
2013-11-28 15:57:09 +00:00
this.scaleFactorInversed.x = this.width / this.game.width;
this.scaleFactorInversed.y = this.height / this.game.height;
this.hasResized.dispatch(this.width, this.height);
2013-11-07 06:10:15 +00:00
this.checkOrientationState();
2013-10-03 00:21:08 +00:00
},
/**
* Sets this.width equal to window.innerWidth and this.height equal to window.innerHeight
2014-03-14 06:36:05 +00:00
* @method Phaser.ScaleManager#setMaximum
2013-10-03 00:21:08 +00:00
*/
setMaximum: function () {
this.width = window.innerWidth;
this.height = window.innerHeight;
},
/**
* Calculates the multiplier needed to scale the game proportionally.
2014-03-14 06:36:05 +00:00
* @method Phaser.ScaleManager#setShowAll
2013-10-03 00:21:08 +00:00
*/
setShowAll: function () {
var multiplier = Math.min((window.innerHeight / this.game.height), (window.innerWidth / this.game.width));
this.width = Math.round(this.game.width * multiplier);
this.height = Math.round(this.game.height * multiplier);
},
/**
* Sets the width and height values of the canvas, no larger than the maxWidth/Height.
2014-03-14 06:36:05 +00:00
* @method Phaser.ScaleManager#setExactFit
2013-10-03 00:21:08 +00:00
*/
setExactFit: function () {
2013-11-01 18:16:52 +00:00
var availableWidth = window.innerWidth;
var availableHeight = window.innerHeight;
2013-10-03 00:21:08 +00:00
2014-04-11 12:09:28 +00:00
if (this.maxWidth & & availableWidth > this.maxWidth)
2013-10-03 00:21:08 +00:00
{
this.width = this.maxWidth;
}
else
{
this.width = availableWidth;
}
2014-04-11 12:09:28 +00:00
if (this.maxHeight & & availableHeight > this.maxHeight)
2013-10-03 00:21:08 +00:00
{
this.height = this.maxHeight;
}
else
{
this.height = availableHeight;
}
}
};
2014-03-14 06:36:05 +00:00
Phaser.ScaleManager.prototype.constructor = Phaser.ScaleManager;
2014-02-05 06:29:17 +00:00
2013-10-03 00:21:08 +00:00
/**
2014-03-14 06:36:05 +00:00
* @name Phaser.ScaleManager#isFullScreen
2013-10-03 00:21:08 +00:00
* @property {boolean} isFullScreen - Returns true if the browser is in full screen mode, otherwise false.
* @readonly
*/
2014-03-14 06:36:05 +00:00
Object.defineProperty(Phaser.ScaleManager.prototype, "isFullScreen", {
2013-10-03 00:21:08 +00:00
get: function () {
2014-03-28 01:42:49 +00:00
return (document['fullscreenElement'] || document['mozFullScreenElement'] || document['webkitFullscreenElement']);
2013-10-03 00:21:08 +00:00
}
});
/**
2014-03-14 06:36:05 +00:00
* @name Phaser.ScaleManager#isPortrait
2013-10-03 00:21:08 +00:00
* @property {boolean} isPortrait - Returns true if the browser dimensions match a portrait display.
* @readonly
*/
2014-03-14 06:36:05 +00:00
Object.defineProperty(Phaser.ScaleManager.prototype, "isPortrait", {
2013-10-03 00:21:08 +00:00
get: function () {
2014-04-29 14:39:02 +00:00
return (this.orientation === 0 || this.orientation === 180);
2013-10-03 00:21:08 +00:00
}
});
/**
2014-03-14 06:36:05 +00:00
* @name Phaser.ScaleManager#isLandscape
2013-10-03 00:21:08 +00:00
* @property {boolean} isLandscape - Returns true if the browser dimensions match a landscape display.
* @readonly
*/
2014-03-14 06:36:05 +00:00
Object.defineProperty(Phaser.ScaleManager.prototype, "isLandscape", {
2013-10-03 00:21:08 +00:00
get: function () {
2014-04-29 14:39:02 +00:00
return (this.orientation === 90 || this.orientation === -90);
2013-10-03 00:21:08 +00:00
}
});
< / pre >
< / article >
< / section >
< / div >
< div class = "clearfix" > < / div >
< footer >
< span class = "copyright" >
2014-02-05 06:29:17 +00:00
Phaser Copyright © 2012-2014 Photon Storm Ltd.
2013-10-03 00:21:08 +00:00
< / span >
< br / >
< span class = "jsdoc-message" >
2014-04-11 12:09:28 +00:00
Documentation generated by < a href = "https://github.com/jsdoc3/jsdoc" > JSDoc 3.3.0-dev< / a >
2014-04-29 14:39:02 +00:00
on Tue Apr 29 2014 14:51:17 GMT+0100 (BST) using the < a href = "https://github.com/terryweiss/docstrap" > DocStrap template< / a > .
2013-10-03 00:21:08 +00:00
< / span >
< / footer >
< / div >
< br clear = "both" >
< / div >
< / div >
< script src = "scripts/sunlight.js" > < / script >
< script src = "scripts/sunlight.javascript.js" > < / script >
< script src = "scripts/sunlight-plugin.doclinks.js" > < / script >
< script src = "scripts/sunlight-plugin.linenumbers.js" > < / script >
< script src = "scripts/sunlight-plugin.menu.js" > < / script >
< script src = "scripts/jquery.min.js" > < / script >
< script src = "scripts/jquery.scrollTo.js" > < / script >
< script src = "scripts/jquery.localScroll.js" > < / script >
< script src = "scripts/bootstrap-dropdown.js" > < / script >
< script src = "scripts/toc.js" > < / script >
< script > Sunlight . highlightAll ( { lineNumbers : true , showMenu : true , enableDoclinks : true } ) ; < / script >
< script >
$( function () {
$( "#toc" ).toc( {
2014-04-10 22:13:43 +00:00
anchorName : function(i, heading, prefix) {
2014-03-14 06:36:05 +00:00
return $(heading).attr("id") || ( prefix + i );
},
2013-10-03 00:21:08 +00:00
selectors : "h1,h2,h3,h4",
showAndHide : false,
scrollTo : 60
} );
$( "#toc>ul" ).addClass( "nav nav-pills nav-stacked" );
$( "#main span[id^='toc']" ).addClass( "toc-shim" );
} );
< / script >
< / body >
< / html >