Hiya,
I've been messing with Sprite rotation from 3D back to 2D and I tossed together a bit of code that does the following:
1) Load a 2D sprite with 3D capability
2) Rotate the Sprite a user-defined amount
3) Display it in 3D
4) Grab it from the the buffer and stick it into an array for use with 2D
The idea is that you can have 1 2D image be automagically converted into a bunch of them, rotated at certain angle-intervals, and then placed in an array. But have them be accessible as 2D objects for speed.
If you're interested in the code, Get it Here
If someone knows of a faster way to do this using PB's code, please let me know!
EDIT...
I know there are many pieces of plugin code out there, but since I'm incorporating stuff into the book I'm somewhat tied by what I can use.
...EDIT
All the best!
-Krylar
Thanks!
-Krylar
2d Sprite Rotation code
2d Sprite Rotation code
Visit me on the web
John Logsdon - Author, Musician, Geek
John Logsdon - Author, Musician, Geek
you could do it without 3d hardware using the plgblt_ api
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
( The path to enlightenment and the PureBasic Survival Guide right here... )
Heya,
Not familiar with that. I looked through the PB documentation and such but didn't find it.
If it's a library I suppose I can just have people look for it on their own from text in the book, but I'm supposed to be keeping to only actual PB commands and licensed libraries otherwise. :/
Thanks!
-Krylar
Not familiar with that. I looked through the PB documentation and such but didn't find it.
If it's a library I suppose I can just have people look for it on their own from text in the book, but I'm supposed to be keeping to only actual PB commands and licensed libraries otherwise. :/
Thanks!
-Krylar
Visit me on the web
John Logsdon - Author, Musician, Geek
John Logsdon - Author, Musician, Geek
-
- Enthusiast
- Posts: 384
- Joined: Sat May 24, 2003 8:02 pm
- Location: Canada
- Contact:
You are right it's not an internal PB command. But any Win32 API function can be called from PB without any extra help by appending a underscore as a suffix... so :
win32function_(param1,param2,param3)
would call whatever win32 function. This makes PB very powerful because the easy access to Win32 API
@blueznl
plgblt does not do rotation, heres a quote from the ms docs:
win32function_(param1,param2,param3)
would call whatever win32 function. This makes PB very powerful because the easy access to Win32 API
@blueznl
plgblt does not do rotation, heres a quote from the ms docs:
anyway maybe i'm missing something as i quickly looked this up.Scaling, translation, and reflection transformations are allowed in the source device context; however, rotation and shear transformations are not.
<br>"I deliver Justice, not Mercy"
    - Codemonger, 2004 A.D.
    - Codemonger, 2004 A.D.
Excellent information, Codemonger.
I just did a look up on MSDN as well:
http://msdn.microsoft.com/library/defau ... s_2dis.asp
Also seems that there's compatability problems with this command. From the Requirements section:
"Windows 95/98/Me: Unsupported."
I know most people are moving to XP or NT, but still may be some out there on the older ones.
Anyway, thanks to both you and blueznl for helping to guide me here. As you may imagine I'm in a bit of a crunch for getting up to speed on these things and so in a lot of cases I'm jumping forward and making assumptions on things.
-Krylar
I just did a look up on MSDN as well:
http://msdn.microsoft.com/library/defau ... s_2dis.asp
Also seems that there's compatability problems with this command. From the Requirements section:
"Windows 95/98/Me: Unsupported."
I know most people are moving to XP or NT, but still may be some out there on the older ones.
Anyway, thanks to both you and blueznl for helping to guide me here. As you may imagine I'm in a bit of a crunch for getting up to speed on these things and so in a lot of cases I'm jumping forward and making assumptions on things.
-Krylar
Visit me on the web
John Logsdon - Author, Musician, Geek
John Logsdon - Author, Musician, Geek
Krylar: For me while sprite3D rotation(1) is fast and OK for some things, it's quality is not so good for others. ATM I'm writing a small aplication, thet will rotate your sprite to the specified angles, and save them all in a single file (either contiguous or with a 1 pixel frame) Then with a small clipping procedure one will be able to use easily in games. (Code is working, just need to get the GUI stuff, I should have a working version soon)
Saddly I'm doing this with Blitz+, I'd love to do it with PB, but I don't have a good rotation routine (Anti-Alias) HINT HINT ! maybe someone would like to send me a good routine to use with PB
(1) If you not too worried about the quality, why not use sprite3D directly? Contrary to popular belief sprite3D can be used for pixel perfect collisions, and can be animated too. If people are interested, tell me and I'll write a couple of small examples.
Well, I have a very primitive version that works, as soon as I write how to use it, I'll post a link, but right now a shower and of to drink a few beers
Saddly I'm doing this with Blitz+, I'd love to do it with PB, but I don't have a good rotation routine (Anti-Alias) HINT HINT ! maybe someone would like to send me a good routine to use with PB
(1) If you not too worried about the quality, why not use sprite3D directly? Contrary to popular belief sprite3D can be used for pixel perfect collisions, and can be animated too. If people are interested, tell me and I'll write a couple of small examples.
Well, I have a very primitive version that works, as soon as I write how to use it, I'll post a link, but right now a shower and of to drink a few beers
euh, codemonger, you're right about version / compatibility, it doesn't work on pre-win2k... but i think plgblt _ does do rotations (don't have a machine at hand to test it right now, installing new licenses etc.)
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
( The path to enlightenment and the PureBasic Survival Guide right here... )
i think rotations are already done, see link here :
purearea.net site, a great lib from Mischa
purearea.net site, a great lib from Mischa
SPAMINATOR NR.1