Results 1 to 10 of 10

Thread: rotating images

  
  1. #1
    soulkiller is offline -Hacks Smarty
    Join Date
    Jan 2006
    Location
    pffff I\'m not telling you
    Posts
    197
    Rep Power
    14

    Default

    how would i rotate images in lua

    GOOGLE IS YOUR FREIND, USE IT. IF GOOGLE FAILS THEN REFER TO THIS LINK MQ:BtG Programmer

  2. #2
    illfoundedmind is offline -Hacks Enthusiast
    Join Date
    Nov 2005
    Location
    WTF~~~~~~~~~~> Rank: %NULL
    Posts
    389
    Rep Power
    15

    Default

    Tell me when you find out
    july 19

  3. #3
    soulkiller is offline -Hacks Smarty
    Join Date
    Jan 2006
    Location
    pffff I\'m not telling you
    Posts
    197
    Rep Power
    14

    Default

    ok I think I found a leed. When you download luaplayer .16 for 1.5 it comes with a folder called samples in that folder theirs a script called "rotate". well I breifly looked at the code and I understood some but not all of it because of the fact I'm still kinda new to lua, anyways I ran the script and it rotated some text by 90 degrees. I spent almost an hour trying to figure out how to use it in my code but no dice :( so illfoundedmind I know your a good lua programmer, do you think you could look at the script I'm talking about and see if you can get an image to rotate instead of text?
    GOOGLE IS YOUR FREIND, USE IT. IF GOOGLE FAILS THEN REFER TO THIS LINK MQ:BtG Programmer

  4. #4
    illfoundedmind is offline -Hacks Enthusiast
    Join Date
    Nov 2005
    Location
    WTF~~~~~~~~~~> Rank: %NULL
    Posts
    389
    Rep Power
    15

    Default

    Quote Originally Posted by soulkiller
    so illfoundedmind I know your a good lua programmer
    say no more :cool:

    I look at the script, if you post it and figure out a way to get it to rotate images.
    july 19

  5. #5
    soulkiller is offline -Hacks Smarty
    Join Date
    Jan 2006
    Location
    pffff I\'m not telling you
    Posts
    197
    Rep Power
    14

    Default

    just go to luaplayer.org and download the one for 1.0 and its in the folder called samples
    GOOGLE IS YOUR FREIND, USE IT. IF GOOGLE FAILS THEN REFER TO THIS LINK MQ:BtG Programmer

  6. #6
    illfoundedmind is offline -Hacks Enthusiast
    Join Date
    Nov 2005
    Location
    WTF~~~~~~~~~~> Rank: %NULL
    Posts
    389
    Rep Power
    15

    Default

    Busy >__> if you want the help your going to need to do some work :cool:
    july 19

  7. #7
    soulkiller is offline -Hacks Smarty
    Join Date
    Jan 2006
    Location
    pffff I\'m not telling you
    Posts
    197
    Rep Power
    14

    Default

    ok hold up


    ok its uploaded
    www.badongo.com/file/274148
    GOOGLE IS YOUR FREIND, USE IT. IF GOOGLE FAILS THEN REFER TO THIS LINK MQ:BtG Programmer

  8. #8
    illfoundedmind is offline -Hacks Enthusiast
    Join Date
    Nov 2005
    Location
    WTF~~~~~~~~~~> Rank: %NULL
    Posts
    389
    Rep Power
    15

    Default

    Last edited by soulkiller (Today 19:06:37) <-- I wounder what that said before :cool:
    july 19

  9. #9
    soulkiller is offline -Hacks Smarty
    Join Date
    Jan 2006
    Location
    pffff I\'m not telling you
    Posts
    197
    Rep Power
    14

    Default

    heres the source code

    Code:
    function rotate(image)
    	local w = image:width()
    	local h = image:height()
    	local result = Image.createEmpty(h, w)
    	for x=0,w-1 do
    		for y=0,h-1 do
    			result:pixel(h-y-1, x, image:pixel(x, y))
    		end
    	end
    	return result
    end
    
    function printRotated(x, y, text, color, image, rotateIndex)
    	rotateIndex = math.mod(rotateIndex, 4)
    	local w = string.len(text)
    	local result = Image.createEmpty(w * 8, 8)
    	result:print(0, 0, text, color)
    	if rotateIndex > 0 then
    		rotateIndex = rotateIndex - 1
    		for i=0,rotateIndex do
    			result = rotate(result)
    		end
    	end
    	image:blit(x, y, result)
    end
    
    cadetBlue = Color.new(95, 158, 160)
    
    printRotated(132, 0, "Don't ask what Lua Player", cadetBlue, screen, 0)
    printRotated(472, 76, "can do for you,", cadetBlue, screen, 1)
    printRotated(160, 264, "ask what you can do", cadetBlue, screen, 2)
    printRotated(0, 76, "for Lua Player!", cadetBlue, screen, 3)
    screen.flip()
    while true do
    	screen.waitVblankStart()
    end
    see what you can do with it
    GOOGLE IS YOUR FREIND, USE IT. IF GOOGLE FAILS THEN REFER TO THIS LINK MQ:BtG Programmer

  10. #10
    illfoundedmind is offline -Hacks Enthusiast
    Join Date
    Nov 2005
    Location
    WTF~~~~~~~~~~> Rank: %NULL
    Posts
    389
    Rep Power
    15

    Default

    Hmmm

    printRotated(132, 0, "Don't ask what Lua Player", cadetBlue, screen, 0)

    That would be the function
    july 19

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •