Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualHeadkaze

Posted 12 February 2013 - 05:55 PM

By frame I mean a frame of animation in a texture kinda like a sprite sheet.

 

I need to write a method (in C#) that takes a texture size and the number of frames required and returns the maximum size of a frame (let's assume for now the frame is a square).

 

 

ie.

 

public static Size GetMaxFrameSize(Size textureSize, int frameCount)
{
    ...
}

 

So say I have a texture size of 1024 x 1024 and I have 64 frames of animation the routine would return 128 x 128.

 

Another routine that I need is one that does the same thing but also takes into account the frame size. So it returns the maximum frame size based on the frame size but maintains the aspect ratio of the frame.

 

ie.

 

 

public static Size GetMaxFrameSize(Size textureSize, Size frameSize, int frameCount)
{
    ...
}

 

So in other words I need to be able to fit the required number of animation frames into a given texture size but if the frames wont fit I need to calculate the maximum size so they will fit.


#1Headkaze

Posted 12 February 2013 - 05:55 PM

By frame I mean a frame of animation in a texture kinda like a sprite sheet.

 

I need to write a method (in C#) that takes a texture size and the number of frames required and returns the maximum size of a frame (let's assume for now the frame is a square).

 

 

ie.

public static Size GetMaxFrameSize(Size textureSize, int frameCount)
{
    ...
}

 

So say I have a texture size of 1024 x 1024 and I have 64 frames of animation the routine would return 128 x 128.

 

Another routine that I need is one that does the same thing but also takes into account the frame size. So it returns the maximum frame size based on the frame size but maintains the aspect ratio of the frame.

 

ie.

 

public static Size GetMaxFrameSize(Size textureSize, Size frameSize, int frameCount)
{
    ...
}

 

So in other words I need to be able to fit the required number of animation frames into a given texture size but if the frames wont fit I need to calculate the maximum size so they will fit.


PARTNERS