forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Rotating an image?

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development
View previous topic :: View next topic  
Author Message
JorDy



Joined: 11 Dec 2005
Posts: 121

PostPosted: Sun Mar 26, 2006 9:04 pm    Post subject: Rotating an image? Reply with quote

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
View user's profile Send private message
DiabloTerrorGF



Joined: 15 Jul 2005
Posts: 64

PostPosted: Mon Mar 27, 2006 12:26 pm    Post subject: Reply with quote

try settings:
screen:blit(-100, -100,theImage)

or more till the pic is off screen.
Back to top
View user's profile Send private message
JorDy



Joined: 11 Dec 2005
Posts: 121

PostPosted: Tue Mar 28, 2006 12:52 am    Post subject: Reply with quote

ive tried that it just moves my image aswell
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
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