Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Shannon Barber

Member Since 23 Jun 2000
Online Last Active Today, 10:43 PM

Posts I've Made

In Topic: Why automake?

21 June 2015 - 12:10 PM

I just use make.  

MinGW or Cygwin solve the problem on Windows.

MinGW is simpler but it has an older version of make, 3.8.

Cygwin is running 4.x


In Topic: Easy source control for educational uses?

21 June 2015 - 11:42 AM

Use BitBucket and host a Mercurial (hg) repository instead of git.

A lot easier to learn but still a peer source control tool.


In Topic: CMake or Custom ?

07 April 2015 - 09:26 AM

I would not use a custom build system.

 

Every time I have tried something else I have always come home to GNU make.


In Topic: Casting Pointer to Derived Type

16 November 2014 - 12:02 PM

Performance et. al. are not arguments in this matter.

 

dynamic_cast is thee mechanism designed into C++ to handle the exact scenario the OP is asking about.

 

If you don't want to use RTTI then you can't use RTTI and down-casting properly requires RTTI.

If you turn it off, you are just going to have to implement it yourself with a virtual call to get an enumeration (and design some mechanism to ensure those ID's are unique).

Next is if you use a interface-based design then your RTTI implementation is going to have to handle reporting multiple IDs ...

COM's QueryInterfacePointer is the abomination that resulted from going down this path.

 

If you have a tree or whatever of ITiles and want to know which of them implement ITilePlayer then you check for that when you put the instance into the container (with dynamic_cast) and maintain a second parallel container with just ITilePlayer's in it. Now you can iterate the player tiles without testing for it during an iteration of the general tiles thus avoiding dynamic cast during the part that matters. (Since it's a mix of different types of tiles, static_cast is not appropriate.)

 

I personally wouldn't consider the player a tile - I would have an 'overlay' concept the movable entities / sprites implemented.

Render in two (or more) passes. Render the tiles then render the entities (overlayed on the tiles).

You now have a game-engine reason to main separate list of the different things as well.

 

Though it does beg the question why not just have two functions to add stuff to the game and treat the tiles and entities differently (thus avoiding RTTI & dynamic cast entirely).


In Topic: A short discussion on PODs

31 October 2014 - 09:34 AM

Under C++11 POD's can have trivial ctor's & dtor's. I think you can even inherit (with restrictions).

 

Practically speaking you just can't do anything that results in the class having a vtable.

 

This has all worked for years it just was guaranteed by the standard.


PARTNERS