Archive

Archive for 22.06.2011

C++ Articles

22.06.2011 5 comments

My favourite C++ website, the C++ Resource Network, has just received a revamp – giving it a brand new article system. Articles can now be rated and categorised, and their content can now contain HTML. Not to mention, once can upload files to be attached to the article. All in all it’s a massive improvement, and I can but give my most heartfelt thanks to the site’s operators.

Check out the new articles section now! And you can find my article on there – about C++0x suffix return types. It’s on the blog too, of course ;)

C++0x Declared Types

Sometimes you might want to know the type of an expression. At runtime you can use RTTI (runtime type information) and typeid. But what about compile time? You can use typeof in some cases, but that is a nonstandard extension. C++0x provides a new keyword decltype which adds this functionality to the standard.

decltype stands for declared type and you can read more about it on Dr. Stroustrup’s FAQ. In summary though, if e is an expression, declytype(e) represents the type of the expression. So decltype(4) would mean int and decltype(4.0f) would mean float. Naturally this can be extended to user types.

Note that decltype is supported by Microsoft Visual C++, Intel Composer XE and GCC/MinGW.


class Blog {
	// etc
};

Blog SFMLCoder;
decltype(SFMLCoder) // <--- this means 'Blog'

Read on for examples! Read more…

Space Fight – Non Players

I’ve told you about my plans for the player, but what about other game objects? What are they? And what role will they play in the game?

Enemy Spacecraft

So what is there in Space Fight apart from the player. Well, there are enemy spaceships, which the goal is to destroy with gunfire. Their sprite is shown below. Basically, once they are implemented fully, they will navigate between asteroids and attempt kill the player with their own weapons.

Read more…

Reprise

Hi again! I’m back – just one last exam to go so I should have more time for the blog again now. I’ll try to pick up the pace of the tutorials and videos now, and also continue to post about the asteroid game I’m writing.

-Xander

Categories: Notice
Follow

Get every new post delivered to your Inbox.

Join 76 other followers