Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualCrusable

Posted 12 July 2013 - 12:14 AM

I am using Gimp to make the images and they are all PNG files. This image is part of a sheet. I am using SFML and C++. The object using the image is a sf::VertexArray of type sf::Quads with 4 elements. The Image itself is a sf::Texture. This specific texture is part of an animated object and the first image works properly as well as all the others on the sheet. 

 

here is the code for mapping the texture choords:

	m_sfObjBox[0].texCoords = sf::Vector2f(m_fCurrentFrame * m_sfSize.x, m_fCurrentFrame * m_sfSize.y);
	m_sfObjBox[1].texCoords = sf::Vector2f((m_fCurrentFrame * m_sfSize.x) + m_sfSize.x, m_fCurrentFrame * m_sfSize.y);
	m_sfObjBox[2].texCoords = sf::Vector2f((m_fCurrentFrame * m_sfSize.x) + m_sfSize.x, (m_fCurrentFrame * m_sfSize.y) + m_sfSize.y);
	m_sfObjBox[3].texCoords = sf::Vector2f(m_fCurrentFrame * m_sfSize.x, (m_fCurrentFrame * m_sfSize.y) + m_sfSize.y);

m_fCurrentFrame is either 0 or 1 because there is only two frames in this animation. m_sfSize is a sf::Vector2f with both x and y being 32. m_sfObjBox is the sf::VertexArray.

 

Edit: I did not see sik_the_hedghog's post and I just looked at it. I see my error.


#3Crusable

Posted 12 July 2013 - 12:14 AM

I am using Gimp to make the images and they are all PNG files. This image is part of a sheet. I am using SFML and C++. The object using the image is a sf::VertexArray of type sf::Quads with 4 elements. The Image itself is a sf::Texture. This specific texture is part of an animated object and the first image works properly as well as all the others on the sheet. 

 

here is the code for mapping the texture choords:

	m_sfObjBox[0].texCoords = sf::Vector2f(m_fCurrentFrame * m_sfSize.x, m_fCurrentFrame * m_sfSize.y);
	m_sfObjBox[1].texCoords = sf::Vector2f((m_fCurrentFrame * m_sfSize.x) + m_sfSize.x, m_fCurrentFrame * m_sfSize.y);
	m_sfObjBox[2].texCoords = sf::Vector2f((m_fCurrentFrame * m_sfSize.x) + m_sfSize.x, (m_fCurrentFrame * m_sfSize.y) + m_sfSize.y);
	m_sfObjBox[3].texCoords = sf::Vector2f(m_fCurrentFrame * m_sfSize.x, (m_fCurrentFrame * m_sfSize.y) + m_sfSize.y);

m_fCurrentFrame is either 0 or 1 because there is only two frames in this animation. m_sfSize is a sf::Vector2f with both x and y being 32. m_sfObjBox is the sf::VertexArray.

 

Edit: I did not see sik_the_hedghog's post and I just looked at it. I see my error.


#2Crusable

Posted 12 July 2013 - 12:12 AM

I am using Gimp to make the images and they are all PNG files. This image is part of a sheet. I am using SFML and C++. The object using the image is a sf::VertexArray of type sf::Quads with 4 elements. The Image itself is a sf::Texture. This specific texture is part of an animated object and the first image works properly as well as all the others on the sheet. 

 

here is the code for mapping the texture choords:

	m_sfObjBox[0].texCoords = sf::Vector2f(m_fCurrentFrame * m_sfSize.x, m_fCurrentFrame * m_sfSize.y);
	m_sfObjBox[1].texCoords = sf::Vector2f((m_fCurrentFrame * m_sfSize.x) + m_sfSize.x, m_fCurrentFrame * m_sfSize.y);
	m_sfObjBox[2].texCoords = sf::Vector2f((m_fCurrentFrame * m_sfSize.x) + m_sfSize.x, (m_fCurrentFrame * m_sfSize.y) + m_sfSize.y);
	m_sfObjBox[3].texCoords = sf::Vector2f(m_fCurrentFrame * m_sfSize.x, (m_fCurrentFrame * m_sfSize.y) + m_sfSize.y);

m_fCurrentFrame is either 0 or 1 because there is only two frames in this animation. m_sfSize is a sf::Vector2f with both x and y being 32. m_sfObjBox is the sf::VertexArray.


#1Crusable

Posted 12 July 2013 - 12:07 AM

I am using Gimp to make the images and they are all PNG files. This image is part of a sheet. I am using SFML and C++. The object using the image is a sf::VertexArray of type sf::Quads with 4 elements. The Image itself is a sf::Texture. This specific texture is part of an animated object and the first image works properly as well as all the others on the sheet.


PARTNERS