StartSprite size

Discussion forum for G-Force users

Moderators: BTT, andy55, b.dwall, juxtiphi

Post Reply
benglett
Posts: 1
Joined: Thu Sep 29, 2005 4:32 pm

StartSprite size

Post by benglett »

I'm new to G-Force and to coding. I've looked over all of the scripts and (Default).txt files and can not seem to figure out how to get my sprites to enlarge to fit the screen when I call them.

I'm sort of confused about the Flags. The comment says "If a sprite is started via a StartSprite(), call, the flags specified override the flags specified in 'Flag' (ie, 'Flag' is ignored)."
If the Flag tag is what resizes the sprite, then how do I use it and what value do I use?

Here's what I'm trying to use right now:

/*

This is a simple example that displays a specific sprite. The named sprite can be the name of any item located in the "Sprites" subfolders). As always, extensions don't matter (ie, are ignored).

*/

StartSprite( "Me" );
Flag=2;

I can get the image "Me" to show up, but only in it's original size, centered in the screen.

Thanks in advance for your help.

User avatar
chkman
Posts: 329
Joined: Mon Aug 08, 2005 12:36 pm
Location: Greensburg, PA

Post by chkman »

Okay, cool! 8) I didn't know you could set the flag on StartSprite.

In Logo.txt, I found:
StartSprite( "Mono Logo", 25, kParticleFlags_ShrinkToFit | kParticleFlags_MaintainAspect | kParticleFlags_DontCrop | kParticleFlags_AlphaBlend );
So I think it's: StartSprite("Name of JPG", SecondsToDisplay, Flag);

For the Flag you could use a number (if you understand what 1 << 1 means). Or use the predefined constants separated by the OR symbol "|" (vertical bar). You might want those in the Logo example and of course, kParticleFlags_EnlargeToFit

I totally missed the flag thing, thanks for bringing up the topic. :)

Here is a list of constants:

// Possible flags for StartSprite()
kParticleFlags_ShrinkToFit // Shrinks the sprite so that it fits in the frame
kParticleFlags_EnlargeToFit // Enlarges the sprite so that it fully fills the frame
kParticleFlags_MaintainAspect // When a sprite is enlarged/shrunk, this will maintain the aspect ratio
kParticleFlags_DontCrop // When a sprite is enlarged/shrunk, this determines which dimension (x or y) to use
kParticleFlags_Invert // Inverts the sprite's source/input intensity
kParticleFlags_ThesholdCopy // Copies from the source, except when the intensity is very low (ie, black is transparent)
kParticleFlags_AdditveBlend // Adds the source and dest pixels and clamps past 100%
kParticleFlags_SelectiveBlend // If the source intensity is greater than the dest, the dest gets the average of the two
kParticleFlags_AlphaMask // The source intensity is used as an alpha mask for the dest
kParticleFlags_AlphaBlend // The dest is the inverse source plus the dest scaled by the source
kParticleFlags_DefaultBehavior // Use the sprites 'Flag' parameter for flags

Post Reply