![]() |
| Forums | Gaming News | Videos | Downloads | Today's Posts | Mark Forums Read | Chat | FAQ | Members List | Contact |
| ||||||
This is a discussion on Rotating function in C within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; hi. i need a function/lib which will allow me to rotate an image by the given angle. (in C, not ...
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 |
![]() ![]() Your Fate is Grim...
|
hi.
i need a function/lib which will allow me to rotate an image by the given angle. (in C, not C++) ive googled, and found no good results. some people told me that oslib allowed me to rotate images. but i have yet to find that function, and i prefer that i use the "original" lib that came with cygwin and not oslib. thanks to everyone!
__________________
-------------------------------------------------------------------------------------- ![]() |
|
|
|
|
|
#2 | |
![]() ![]() Developer
|
You have two options really.
Option 1: Do it using hardware. You're wanting to rotate images, I assume on the Z plane. Read up on sceGumRotateZ. This is probably harder than the second option, it depends on how you're setting up the graphics. Option2: Do it in software. Use maths to calculate your new vertices based on an angle. Namely just using sin/cos to calculate new position for your 'image'.
__________________
![]() Check out my homebrew & C tutorials at http://insomniac.0x89.org/ Coder formerly known as Insomniac197 Quote:
|
|
|
|
|
|
|
#3 |
![]() ![]() ...in a dream...
|
Smerity has tried mathematically rotating an image... Horrible results as it slows your fraemrate considerably. Your best bet would be to use the hardware rotation. The graphics library will allow sceGumRotateZ() if you 'touch-up' the blitting function... I suggest OSlib over anything, as you can do pretty much everything a quality 2D game needs. Best of luck Grimfate
__________________
...you'll never know what it's like... spending your whole life in a dream...
Launch a Kitten out of a Cannon and win real cash! Checkout my newly updated site for all my projects (Kitten Cannon, BOXHEAD, Light Cycle 3D) |
|
|
|
|
|
#4 | |
![]() ![]() Your Fate is Grim...
|
Quote:
@insomniac, il try the first option.
__________________
-------------------------------------------------------------------------------------- ![]() |
|
|
|
|
|
|
#7 | |
![]() ![]() Your Fate is Grim...
|
Quote:
-= Double Post =- i need help installing OSlib. i read the manual and heres what (part of) it says: Code:
Finally, the OSLib directory is what it's all about; you should copy this to a suitable place on your hard disc; probably in the same place as your other libraries. Don't put it too low down in the directory structure; if you do the path name will become too long for the system to resolve it. Two or three levels down should be OK. It is possible to use OSLib within the archive, but you will find it will significantly slow down the compilation process. Using OSLib ----------- At the top level in the OSLib directory you will find an Obey file named SetVars. When this is run, the OSLib: path is set up. If you want to change it, that's fine, but the default is really all you need. Make sure SetVars is executed before you attempt to build anything using the library. i put the oslib folder in my cygwin folder. BUT, when i try to run "SetVars" in cygwin, it says command not found... how do i install it??
__________________
-------------------------------------------------------------------------------------- ![]() Last edited by Grimfate126; 09-07-2006 at 02:38 PM.. Reason: Automerged Doublepost |
|
|
|
|
|
|
#8 |
![]() ![]() ...in a dream...
|
Uhhh, install it? SVN and download OSlib using Cygwin. 'cd' into the folder, type make, then make install... See what happens. I for one, have OSlib installed right now, but can't quite remember how I did it, so I just did the usual make, make install...
__________________
...you'll never know what it's like... spending your whole life in a dream...
Launch a Kitten out of a Cannon and win real cash! Checkout my newly updated site for all my projects (Kitten Cannon, BOXHEAD, Light Cycle 3D) |
|
|
|
|
|
#9 | |
![]() ![]() Your Fate is Grim...
|
Quote:
__________________
-------------------------------------------------------------------------------------- ![]() |
|
|
|
|
|
|
#11 |
![]() ![]() ...in a dream...
|
By hardcore you mean 'hardcore game-size-increase'? lol
__________________
...you'll never know what it's like... spending your whole life in a dream...
Launch a Kitten out of a Cannon and win real cash! Checkout my newly updated site for all my projects (Kitten Cannon, BOXHEAD, Light Cycle 3D) |
|
|
|
|
|
#13 | |
![]() ![]() Your Fate is Grim...
|
Quote:
__________________
-------------------------------------------------------------------------------------- ![]() |
|
|
|
|
|
|
#14 |
![]() |
First thing you need to do is get the most recent version of oslib. You install it with "install.bat". From there the documentation covers everything you need to know to get started programming with it, and the samples will help understand the documentation.
I don't know what you've got, but I suspect it's not a PSP library. Make sure to add "psp" when googling for it. |
|
|
|
|
|
#16 |
![]() ![]() ...in a dream...
|
Rotating an image to pre-defined angles in an image, youll need to load additional images. And if you need 360* rotation, youll be adding 360 images... That is, if your rotated image is small enough to fit 360 of them n on 512x512 image, then youll need 1 image
![]() I just think you should use hardware rotation... OSlib has that I believe (?)
__________________
...you'll never know what it's like... spending your whole life in a dream...
Launch a Kitten out of a Cannon and win real cash! Checkout my newly updated site for all my projects (Kitten Cannon, BOXHEAD, Light Cycle 3D) |
|
|
|
|
|
#17 |
![]() ![]() Developer
|
There's something else too beyond whole degrees, you know... but if you're desperate on wasting space, you could also have images for every 0.5° or even 0.25° or 0.01°... not that anyone would notice the difference... but you have rotation on fractional degree precision!!!!!111eleven
Apart from the fact that a circle is point-symmetrical, it's also axis-symmetrical, and if you put some logics in that, you'll find that you only need to store 1/4 of those angles rotations, because the others can be achieved by simple horizontal/vertical flipping. Also, what ravine was talking about was seriously NOT having an image for every possible degree, but maybe only for every 30° (ie 4 images in total), or if really more precise rotation is needed, every 10° (10 images). That's nothing that will blow your PSPs memory out of the roof... PS: Rotating 4 vectors in software and giving them to GU will only cripple your apps speed if you don't know what you're doing. PPS: Still the fully hardware rotation would be the most favorable, it's little bit slower than ravines implementation but still very fast and also has no memory footprint. |
|
|
|
|
|
#18 |
![]() ![]() 100% Pure Awesome
|
My idea works best for action/arcade games, such as Gauntlet. I wasn't exactly sure what you were doing so I threw it out there. You could still use mine and have it look kind of choppy on the rotation of the gun.
|
|
|
|
![]() |
| Tags |
| function , rotating |
| Thread Tools | |
|
|