class A{
void say(){std::cout<<"hi";}
};
int main()
{
A * a=nullptr;
a->say(); //no crash, works fine
}
Is this undefined behavior?
Not Telling
lride hasn't added any contacts yet.
Posted by lride
on 24 March 2013 - 01:48 PM
class A{
void say(){std::cout<<"hi";}
};
int main()
{
A * a=nullptr;
a->say(); //no crash, works fine
}
Is this undefined behavior?
Posted by lride
on 23 March 2013 - 11:26 PM
class A{...};
int main()
{
std::vector<A*> vec;
vec.resize(10);
std::cout<<(vec[9]==nullptr); //prints 1
}
I want to make sure this happens on every system.
Are pointers initialized to nullptr?
Posted by lride
on 20 January 2013 - 12:57 PM
Git is really simple to use once you learn it.
I liked this tutorial http://www.youtube.com/watch?v=mYjZtU1-u9Y
Posted by lride
on 06 January 2013 - 12:07 PM
To me your way should work because even though the animation stops when the up key is released, it should start again because the left key is being pressed.
But this is how I implemented SFML animation in my project
It's simple. Don't start the animation only if(sf::Event::keyIsPressed). Start the animation always even though the key is not pressed and stop it later if key is not pressed
Below code is in the main loop
animation.start(); //Just start the animation
if(sf::Keyboard::isKeyPressed(sf::Keyboard::Left))
....
else if(sf::Keyboard::isKeyPressed(sf::Keyboard::Up))
....
else if(sf::Keyboard::isKeyPressed(sf::Keyboard::Right))
.....
else if(sf::Keyboard::isKeyPressed(sf::Keyboard::Down))
.....
else
animation.stop(); // -Stop the animation when keys are not pressed
....
animation.update(dt); // -Animation only gets updated when the animation has not been stopped
Posted by lride
on 02 January 2013 - 02:18 PM
The program will look for the file in the executable's directory.
You can't really make your level files invisible, but you can hide them by packing all your level files in a "level" folder and placing the folder in your executable's directory.
Then you can load the levels like
loadLevel("level/level1.txt");
loadLevel("level/level2.txt");
Posted by lride
on 15 December 2012 - 10:12 PM
But still on basics
Posted by lride
on 09 December 2012 - 07:44 PM
5 is the row and 10 is the column?You can just make a std::array of std::arrays. Ex: std::array<std::array<int, 5>, 10>.
Posted by lride
on 08 December 2012 - 11:42 AM
Posted by lride
on 03 December 2012 - 03:33 PM
+1 to compensate for that downvote.I am a noob here. So I have a noobish question. I just received a downvote for this post. Is there a reason for this, and something I can avoid in the future? Because I don't like offending people or posting inappropriate content.
Posted by lride
on 23 November 2012 - 11:17 PM
Posted by lride
on 23 November 2012 - 08:20 AM
Posted by lride
on 19 November 2012 - 04:21 PM
Posted by lride
on 18 November 2012 - 05:25 PM
You will need a lot of time and patience, but after a 5+ years, you should be able to program almost everything you wish (but be aware that the time needed to do it will still be in years).
5+ years, That's ridiculous. I started programming not much older than him and I picked up C++ in a year, a year later I was writing full blown 3d games in C++. My advice is skip C# and spend a while getting to know C++ and you should be able to program almost anything in 2+ years if you work hard.
Posted by lride
on 17 November 2012 - 09:43 PM
Find content