1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-18 10:38:31 +02:00
VVVVVV/mobile_version/src/starling/utils/Padding.as
Terry Cavanagh 72d018ea04 Update mobile version to mobile v2.2.1
The android version just got a much needed update to fix some resolution issues on devices with cutouts.

It turns out the mobile source was actually pretty out of date, like 3 versions out of date! This commit brings it up to date.

All the changes have just been about keeping the game running on modern devices, though. The biggest change was adding the Starling library to the project, which made the game GPU powered and sped the whole thing up.
2022-12-02 18:19:58 +01:00

106 lines
3.4 KiB
ActionScript

// =================================================================================================
//
// Starling Framework
// Copyright Gamua GmbH. All Rights Reserved.
//
// This program is free software. You can redistribute and/or modify it
// in accordance with the terms of the accompanying license agreement.
//
// =================================================================================================
package starling.utils
{
import starling.events.Event;
import starling.events.EventDispatcher;
/** Dispatched when any property of the instance changes. */
[Event(name="change", type="starling.events.Event")]
/** The padding class stores one number for each of four directions,
* thus describing the padding around a 2D object. */
public class Padding extends EventDispatcher
{
private var _left:Number;
private var _right:Number;
private var _top:Number;
private var _bottom:Number;
/** Creates a new instance with the given properties. */
public function Padding(left:Number=0, right:Number=0, top:Number=0, bottom:Number=0)
{
setTo(left, right, top, bottom);
}
/** Sets all four values at once. */
public function setTo(left:Number=0, right:Number=0, top:Number=0, bottom:Number=0):void
{
var changed:Boolean = _left != left || _right != right || _top != top || _bottom != bottom;
_left = left;
_right = right;
_top = top;
_bottom = bottom;
if (changed) dispatchEventWith(Event.CHANGE);
}
/** Copies all properties from another Padding instance.
* Pass <code>null</code> to reset all values to zero. */
public function copyFrom(padding:Padding):void
{
if (padding == null) setTo(0, 0, 0, 0);
else setTo(padding._left, padding._right, padding._top, padding._bottom);
}
/** Creates a new instance with the exact same values. */
public function clone():Padding
{
return new Padding(_left, _right, _top, _bottom);
}
/** The padding on the left side. */
public function get left():Number { return _left; }
public function set left(value:Number):void
{
if (_left != value)
{
_left = value;
dispatchEventWith(Event.CHANGE);
}
}
/** The padding on the right side. */
public function get right():Number { return _right; }
public function set right(value:Number):void
{
if (_right != value)
{
_right = value;
dispatchEventWith(Event.CHANGE);
}
}
/** The padding towards the top. */
public function get top():Number { return _top; }
public function set top(value:Number):void
{
if (_top != value)
{
_top = value;
dispatchEventWith(Event.CHANGE);
}
}
/** The padding towards the bottom. */
public function get bottom():Number { return _bottom; }
public function set bottom(value:Number):void
{
if (_bottom != value)
{
_bottom = value;
dispatchEventWith(Event.CHANGE);
}
}
}
}