//------------------------------------------------------------------------------------------------------------------------ // initializeFromTexture() //------------------------------------------------------------------------------------------------------------------------ protected void initializeFromTexture(Texture2D texture) { _texture = texture; _bounds = new Rectangle(0, 0, _texture.width, _texture.height); setUVs(); }
//------------------------------------------------------------------------------------------------------------------------ // initializeAnimFrames() //------------------------------------------------------------------------------------------------------------------------ private void initializeAnimFrames(int cols, int rows, int frames=-1) { if (frames < 0) frames = rows * cols; if (frames > rows * cols) frames = rows * cols; if (frames < 1) return; _cols = cols; _frames = frames; _frameWidth = 1.0f / (float)cols; _frameHeight = 1.0f / (float)rows; _bounds = new Rectangle(0, 0, _texture.width * _frameWidth, _texture.height * _frameHeight); _currentFrame = -1; SetFrame(0); }