1
SFML projects / Re: Zoost & Zoom : Geometry, animations and graphics
« on: August 06, 2012, 01:55:53 am »
For now, I'm busy with a home-made game engine, but I think I could work on a stroke system in a couple of week.
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.
Looks interesting, but unfortunately it works only on g++. You use C++11 initializer lists which are not supported by Visual Studio, and also the compiler flags -Wfatal-errors -std=c++0x are specific to g++.
I know other libraries like that but the problem is that they use their own vector types.
It wouldn't be a problem if the code wasn't relying on this type instead of working in a more generic way, assuming only basics about the vector type ( aka a template library ).
An SFML-specific library would be simpler though, that's why I ask here.
That being said, wouldn't the licence allow you to just take the code from zoost/zoom and change it to adapt to SFML types?
Otherwise the "best" way would be to make zoost/zoom a meta library. That would need some work...
Geom geom = Geom::polygon({{0, 0}, {25, 100}, {40, 100}, {40, 0}, {100, 0}, {100, 100}, {120, 100}, {120, 0}, {180, 0}, {180, 100}, {200, 100}, {200, 0}, {260, 0}, {260, 100}, {275, 100}, {300, 0}, {300, 120}, {240, 120}, {240, 20}, {220, 20}, {220, 120}, {160, 120}, {160, 20}, {140, 20}, {140, 120}, {80, 120}, {80, 20}, {60, 20}, {60, 120}, {0, 120}});
geom.setPosition(130, 200);
geom.scale(1.5, 1.5);
Shape shape(geom);
shape.setFaceColor(Color::SpringGreen);
shape.setLiaisonColor(Color::DarkGreen);
shape.setLiaisonWidth(3);
target.draw(shape);
Curve curve = Curve::bezier({767, 410, 1000, 900, 1000, 30, 500, 30, 1, 30, 50, 560, 169, 410}) + Curve({169, 410, 228, 321, 386, 571, 553, 261, 421, 218, 575, 464, 767, 410});
curve.setOrigin(500, 370);
Kinetic kinetic(curve, 400, 0, true); // 400 is the speed of the curse over the curve each, 0 means that it is starting at the begining (always inferior or equal to 1) and true that the kinetic is looping on itself.
// Main loop :
Vector2d coords = curve.convertToGlobal(kinetic.update(clock.restart())); // New point of curve tracking.
myShape.setPosition(coords);
int main()
{
sf:Sprite ship(Image);
function(&ship);
App.Draw(ship);
return 0;
}
void function(sf::Sprite *ship)
{
.... // calculate something...
ship->SetRotation(mov.angactual);
}
int main()
{
sf:Sprite ship(Image);
function(ship);
App.Draw(ship);
return 0;
}
void function(sf::Sprite &ship)
{
.... // calculate something...
ship.SetRotation(mov.angactual);
}