Hi
I have a texture lets name it texutre one.
So texture one's resolution is 500x250
I also have a RectangleShape
I want to:
set the texture to Rectangle shape, then rotate it by 90 degrees
for example
XXXXXXXXX
XXXXXXXXX
XXXXXXXXX
to:
XXXX
XXXX
XXXX
XXXX
XXXX
thats kinda easy to do, i have a problem later
i want to set the width of already rotated Rectangleshape to 30% of the overall screen width which i something managed to do.
now the hardest part i dont know how to do (i tried every possilbe way i can think of)
i want to set the lenght (or actually the height of already rotated element) so it keeps the proportion;
for example if texture is 500x250 the proportion is 2
so i want the lenght (height) of the shape to be 2 times longer than its width, of course these values change some texture can be 500x100, some can be 500x200
i have tried something like this
shape.setsize(texture.getsize().x/texture.getsize.()y*screenwidth*0.3, screenwidth*0.3);
but it doesnt work, im not sure why (the textures indeed show, but they are flattened)
can anyone explain why it is not working and give me a better idea?
The exact order of things being done is:
loadfile to texture
set texture to rectangleshape
set size of rectangleshape
set its origin (it has to be changed by its height because it will be rotated 90 degree and i want upper left corner be 0,0 not 0, -height)
set its position on screen (not mportant here i guess)
rotate it