Added ChangeSize function to TexturePacker.
This commit is contained in:
parent
a19c45e895
commit
e5278cf454
1 changed files with 21 additions and 1 deletions
|
@ -76,7 +76,10 @@ namespace OpenTK
|
|||
{
|
||||
Node node;
|
||||
bool found = items.TryGetValue(item, out node);
|
||||
rect = node.Rect;
|
||||
if (found)
|
||||
rect = node.Rect;
|
||||
else
|
||||
rect = new Rectangle();
|
||||
return found;
|
||||
}
|
||||
|
||||
|
@ -95,6 +98,23 @@ namespace OpenTK
|
|||
|
||||
#endregion
|
||||
|
||||
#region public void ChangeSize(int new_width, int new_height)
|
||||
|
||||
/// <summary>
|
||||
/// Changes the dimensions of the TexturePacker surface.
|
||||
/// </summary>
|
||||
/// <param name="new_width">The new width of the TexturePacker surface.</param>
|
||||
/// <param name="new_height">The new height of the TexturePacker surface.</param>
|
||||
/// <remarks>Changing the size of the TexturePacker surface will implicitly call TexturePacker.Clear().</remarks>
|
||||
/// <seealso cref="Clear"/>
|
||||
public void ChangeSize(int new_width, int new_height)
|
||||
{
|
||||
Clear();
|
||||
root.Rect = new Rectangle(0, 0, new_width, new_height);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Node
|
||||
|
||||
class Node
|
||||
|
|
Loading…
Reference in a new issue