It's quite hard, yes. Try playing with this, it's interesting enough that I might try come up with a class to do that instead in the next week when I'm bored during C lecture.
int main(int argc,char * argv[])
{
int i=0;
sf::Vector2f coords[2];
coords[1]=sf::Vector2f(0.f,64.f);
coords[0]=sf::Vector2f(64.f,64.f);
sf::Texture one;
one.setSmooth(true);
one.loadFromFile("laser.tga");
sf::VertexArray arr(sf::TrianglesStrip);
arr.append(sf::Vertex(sf::Vector2f(0.f,0.f),sf::Vector2f(0.f,0.f)));
sf::RenderWindow app(sf::VideoMode(600,600),"aha");
while(1)
{
sf::Event eve;
while(app.pollEvent(eve))
{
if(eve.type==sf::Event::MouseButtonPressed)
{
++i;
arr.append(sf::Vertex(app.convertCoords(sf::Vector2i(eve.mouseButton.x,eve.mouseButton.y)),coords[i%2]));
}
}
app.clear();
app.draw(arr,&one);
app.display();
}
}
For example this:
Quote
Take a texture of straight laser beam and map it onto a triangle strip to get bending line? Or fan to get circle.
Sounds simple enough, but I don't have the slightest clue of how to bring the explanation to practice, I'm still new to game programming.
Me too.
But this is quite logical conclusion, since everything in video card is made of triangles, and sfml let's you set each triangle's position and texture mapping..