I using SFML 2.4.2
My english is not the best sorry for mistakes.
I try to make a Pseudo3D Object(an Emerald or something like this) and have tried to Rotate the Picture.
The Variables of the Code are:
Defines:
#define DEFAULT_BIT_SCALE 4
#define DEFAULT_BIT_SIZE 8
Objects:
sf::Texture texture;
sf::Sprite sprite[DEFAULT_BIT_SIZE];
The Code in the Init look like this:
void bit8::Cube::init()
{
//Its an test Texture
this->texture.loadFromFile("gfx/8x8x8.png");
this->texture.setRepeated(false);
this->texture.setSmooth(false);
//This is the code for creation for test a cube
for (int i = 0; i < DEFAULT_BIT_SIZE; i++) {
this->sprite[i].setTexture(texture);
this->sprite[i].setTextureRect(sf::IntRect(i * DEFAULT_BIT_SIZE, 0, DEFAULT_BIT_SIZE, DEFAULT_BIT_SIZE));
this->sprite[i].setScale(DEFAULT_BIT_SCALE, DEFAULT_BIT_SCALE);
this->sprite[i].setPosition(200, 300 + i*DEFAULT_BIT_SCALE);
}
}
The Code for the Rotate look like this:
float degrees = 0
for (int i = 0; i < DEFAULT_BIT_SIZE; i++) {
if (degrees > 359.90) {
degrees = 0;
}
degrees += 0.1f;
this->sprite[i].setRotation(degrees);
}
I don't know if the Question is in the right place.
And I have the problem that I have to change the Rotation axis to the Center and dont know a way to do that.
So is the question how to do the axis in the center.
Thanks for any answers.