Discuss using and improving Lua and the Lua Player specific to the PSP.
Moderators: Shine , Insert_witty_name
JorDy
Posts: 121 Joined: Sun Dec 11, 2005 8:45 am
Post
by JorDy » Sun Mar 26, 2006 9:04 pm
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: Select all
--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()
DiabloTerrorGF
Posts: 64 Joined: Fri Jul 15, 2005 11:44 pm
Post
by DiabloTerrorGF » Mon Mar 27, 2006 12:26 pm
try settings:
screen:blit(-100, -100,theImage)
or more till the pic is off screen.
JorDy
Posts: 121 Joined: Sun Dec 11, 2005 8:45 am
Post
by JorDy » Tue Mar 28, 2006 12:52 am
ive tried that it just moves my image aswell