1
General discussions / Re: SFML Game Development by Example - 4th SFML book
« on: February 14, 2017, 02:36:54 pm »
Thanks. I bought it
Looks good.

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
uniform sampler2D current; //set this to sf::Shader::CurrentTexture as explained in the tutorials
void main()
{
vec2 thisposition = gl_TexCoord[0].xy;
float alpha = thisposition.y; //this is the y coordinate, from 0 to 1
vec4 pixel = texture2D(current, gl_TexCoord[0].xy);
pixel.a = alpha;
gl_FragColor = pixel;
}
class wBullet
{
int speed;
double x,y;
Sprite bullet;
static Image bHolder;
wBullet();
};
Image wxBullet::bHolder;
wBullet::wBullet()
{
static bool hasImageBeenLoaded = false;
if (!hasImageBeenLoaded)
{
Image.LoadFromFile("myfile.png");
hasImageBeenLoaded = true;
}
//other stuff
}