Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / Create with image, position, Size, and show/hide sprite with one function

Author
Message
orv
20
Years of Service
User Offline
Joined: 9th Sep 2003
Location: Chicago, IL
Posted: 4th Nov 2003 00:08
if you use sprites for buttons, etc., this can make your life a whole lot easier!
one line and there is your button! and it will look the same no matter the screen rez.

params:
image# - image number which sprite will use
X - X position to place sprite
Y - Y position to place sprite
width - width you want sprite to be
height - height you want sprit to be
bHide - boolean to determine if you want to hide the sprite right away

* function assumes coords/width/heights put in are for 800x600 rez.
* function automatically scales sprite and positions it properly for the actual rez currently set when routine is called.
* if X is -1, it centers sprite on screen on the X axis.
* if Y is -1, it centers sprite on screen on the Y axis.
* if Width = 0, it will use the width of the sprite's image.
* if Height = 0, it will use the height of the sprite's image.
* if bHide = TRUE, it will hide the sprite.
* function assigns and returns a sprite#.
* the variable: nSpriteCounter must be a global integer.

If you aim at nothing you'll hit it every time. 806mhz AMD Athlon Processor. 384MB memory.
Windows XP Home Edition. RADEON 9700 Pro graphics card. - editor.exe=1.0.6.1 - DBPCompiler.exe=V1.05

Login to post a reply

Server time is: 2024-05-03 12:59:47
Your offset time is: 2024-05-03 12:59:47