31
Graphics / 3d ~ Or SFML + Irrlicht
« on: November 20, 2011, 12:09:47 pm »
Not to be unsupportive of SFML, but Irrlicht does have a 2d module. I've not really used it myself but it seems quite capable.
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.
I think you should consider that both of your links are implementations of State Machines.
are you sure you're actually releasing the mouse button before pressing Shift?
int main()
{
sf::RenderWindow window(sf::VideoMode(1024, 768, 32), "Blah");
sf::Vector2f pos(0, 0);
bool running = true;
while (running)
{
sf::Event ev;
while (window.PollEvent(ev))
{
if (ev.Type == sf::Event::Closed)
{
running = false;
}
}
if (sf::Keyboard::IsKeyPressed(sf::Keyboard::LShift) && sf::Mouse::IsButtonPressed(sf::Mouse::Left))
{
//this code can be executed by pressing Left mouse, then shift
pos.x = sf::Mouse::GetPosition(window).x;
pos.y = sf::Mouse::GetPosition(window).y;
}
window.Clear();
sf::Shape shape = sf::Shape::Circle(pos, 10, sf::Color::Red);
window.Draw(shape);
window.Display();
}
return 0;
}