 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
JorDy
Joined: 11 Dec 2005 Posts: 121
|
Posted: Sun Mar 26, 2006 9:04 pm Post subject: Rotating an image? |
|
|
i would like to be able to rotate an image to certain degrees with the pad. i have came across a function which will do that but it also blits an image in the top left which cant be gotten rid of other wise the rotated image is not shown
this is the code i found:
| Code: |
--Rotate image
function rotateImage(theImage, angle)
screen:blit(0, 0,theImage)
angle = angle*(6 + (1/3))/360
for x = 1, theImage:width() do
for y = 1, theImage:height() do
tX = math.cos(angle)*(x-theImage:width() / 2) - math.sin(angle) * (y-theImage:height() / 2)
tY = math.sin(angle)*(x-theImage:width() / 2) + math.cos(angle) * (y-theImage:height() / 2)
screen:fillRect(tX + 480, tY + 0, 2, 2, screen:pixel(x, y))
end
end
end
rotateImage(MyImage, angle)
screen.flip()
|
|
|
| Back to top |
|
 |
DiabloTerrorGF
Joined: 15 Jul 2005 Posts: 64
|
Posted: Mon Mar 27, 2006 12:26 pm Post subject: |
|
|
try settings:
screen:blit(-100, -100,theImage)
or more till the pic is off screen. |
|
| Back to top |
|
 |
JorDy
Joined: 11 Dec 2005 Posts: 121
|
Posted: Tue Mar 28, 2006 12:52 am Post subject: |
|
|
| ive tried that it just moves my image aswell |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|