Code archives/3D Graphics - Misc/*** Sprite Control *** UPDATED 07 March 04
This code has been declared by its author to be Public Domain code.
Download source code
| |||||
VERY IMPORTANT CHANGES ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This new verison of SpriteControl has had a major overall. Therefore, quite a few subtle changes have occured. Here's a rundown on whats changed: One big improvement though is 'pixel-perfect' sprites at last. I *MUST* thank skidracer though for his pixie routines. Also, this version needs at least v.185 of Blitz3D to run. Changed ======= LoadAnimImage3D() now has an extra framesY parameter to allow loading of images where the animation is laid out in both colums AND rows. The first frame number of the animation has changed to 1 (instead of 0). ModifyText3D no longer needs to know the texture of the sprite. The handle/hotspot of loaded sprites is now top/left by default. See the new MidHandle3D command DrawImage3D handles animations with a new 'frame' parameter The global variables in SpriteControl are now called: spritecamera - handle of the main camera created by the SpriteGraphics3D command spritepivot - handle of the sprite pivot created by the SpriteGraphics3D command Removed ======= SpritePivotZoom. See CameraZoom3D CreateSpriteCamera. Use CreateSpritePivot instead New Commands ============ SpriteGraphics3D - for easy setting up of the 3d display EndGraphics3D - free up sprites, textures, brushes, and close the screen in one call CameraZoom3D - zoom the main camera and update the sprite pivot simultaneously MidHandle3D - centers the quads handle ImageToSprite - creates a sprite from an already loaded 2d image FreeImage3D - Cleans up an exiting sprite GetSpriteTexture - returns the handle of the sprites texture ImagesOverlap3D() - test if two sprites are overlapping ![]() Please see the new online webpage for more details. | |||||
;;; Example Usage Include "Sprite Control.bb" SpriteGraphics3D width,height ; set up your 3D graphics display myimage=LoadImage3D("example.bmp") ; load/create 3d image and attach to the sprite camera Repeat .... do 3d stuff DrawImage3D myimage,MouseX(),MouseY() ; positions the 3d sprite at mouse coordinates RenderWorld .... draw 2d stuff here Flip Until KeyHit(1) End |
Comments
| ||
Works great, Thank you :) Just a function I found missing, Scaling a item with a percentage. Function ScaleImage3D(sprite,x#,y#) sx=imagewidth3d(sprite) sy=imageheight3d(sprite) sx=sx*x# sy=sy*y# resizeimage3d sprite,sx,sy End Function |
| ||
wow... thanks for share... grat work! |
Code Archives Forum