Less copy-pasta-y doc for viewport.

This commit is contained in:
Florian Nücke 2016-01-15 21:09:54 +01:00
parent e7f0384666
commit 0ba31b7be0

View File

@ -217,11 +217,11 @@ class GraphicsCard(val tier: Int) extends prefab.ManagedEnvironment {
result(math.min(gmw, smw), math.min(gmh, smh)) result(math.min(gmw, smw), math.min(gmh, smh))
}) })
@Callback(direct = true, doc = """function():number, number -- Get the current screen resolution.""") @Callback(direct = true, doc = """function():number, number -- Get the current viewport resolution.""")
def getViewport(context: Context, args: Arguments): Array[AnyRef] = def getViewport(context: Context, args: Arguments): Array[AnyRef] =
screen(s => result(s.getViewportWidth, s.getViewportHeight)) screen(s => result(s.getViewportWidth, s.getViewportHeight))
@Callback(doc = """function(width:number, height:number):boolean -- Set the screen resolution. Returns true if the resolution changed.""") @Callback(doc = """function(width:number, height:number):boolean -- Set the viewport resolution. Cannot exceed the screen resolution. Returns true if the resolution changed.""")
def setViewport(context: Context, args: Arguments): Array[AnyRef] = { def setViewport(context: Context, args: Arguments): Array[AnyRef] = {
val w = args.checkInteger(0) val w = args.checkInteger(0)
val h = args.checkInteger(1) val h = args.checkInteger(1)