Obracanie bitmapy SDL

0

C++/biblioteka SDL/rotozoom.h

rotozoomSurface( student , -GetAlfa()-90, 1, 0);

Problem dość prosty.
Przy obracaniu główny bohater "skacze", ale nie o stopnie tylko na lewo i prawo. Nie obraca się dookoła swojej osi.
Problem polega na tym, że najprawdopodobniej obracam bitmapę wokół lewego górnego rogu zamiast środka ciężkości:
GetXpos()-GetSstudent()/2,GetYpos()-GetHstudent.bmp/2 (gdzie S - szerokosc, H - wysokosc)
Moje pytanie:
Czy da się w jakiś sposób ustawiać miejsce, o które ma obracać bitmapę lub w jaki sposób zaimplementować coś takiego?
Zaznacze, ze obracam sie o pojedyncze stopnie, wiec zalezy mi na precyzji.

0

http://stackoverflow.com/questions/1183900/best-way-to-rotate-an-image-using-sdl

Best way to rotate an image using SDL?
With SDL you have a few choices.

Rotate all your sprites in advance (pre-render all possible rotations) and render them like you would any other sprite. This approach is fast, but uses more memory and more sprites. As @Nick Wiggle pointed out, RotSprite is a great tool for generating sprite transoformations.

Use something like SDL_gfx to do real-time rotation/zooming. (Not recommended, very slow)

Use SDL in OpenGL mode and render your sprites to primitives, applying rotation to the primitives.

Wspomniany algorytm
http://en.wikipedia.org/wiki/Pixel_art_scaling_algorithms#RotSprite

1 użytkowników online, w tym zalogowanych: 0, gości: 1