Jump to content

  • Log In with Google      Sign In   
  • Create Account

Dan Berliner

Member Since 06 Apr 2011
Offline Last Active Feb 04 2013 10:06 AM

Posts I've Made

In Topic: All a bit...Overwhelming. Where do I start?

10 January 2013 - 12:50 AM

What is your goal? Are you simply looking to make a game or are you looking to know how to program? A graphical game will be well above the capabilities of a beginner programmer; there's just too much involved. If all you want to do is make a game use a tool like Game Maker. If you really want to do it with a programming language you are going to have the spend time getting better at general programming before doing something as ambitious as this. 

In Topic: C++ arbitrarily sorting a struct

16 December 2012 - 09:54 PM

My code returns true only whan a's all fields are less than b's

This isn't a legal comparison for use with std::set. A valid comparison needs to be a strict weak ordering. One of the properties of a strict weak ordering is that if you have three objects A, B and C if A and B are equivalent and B and C are equivalent then A and C must also be equivalent. However, with this kind of comparison this property doesn't hold. One way to do this is to use a lexicographical comparison. Ex:
if (a.dir < b.dir) return true;
if (a.dir > b.dir) return false;
if (a.startx < b.startx) return true;
if (a.startx > b.startx) return false;
return a.starty < b.starty;

Interesting, thanks for sharing.

In Topic: C++ arbitrarily sorting a struct

16 December 2012 - 09:02 PM

That's roughly the same idea, I like your approach better. Thanks.

The exact order it sorts in is unimportant, it just needs some way to do so.

In Topic: Updated: SDL 1.3 will be more community-oriented

14 April 2011 - 09:55 PM

I'm glad this happened when it did, a few days later and I would have bought a commercial license.

In Topic: Working with a C++ data type on a bit by bit level

08 April 2011 - 07:28 PM

Remember that the MSVC debug and release settings aren't magic; they're both just a combination of presets of compiler and linker options. Modern versions of MSVC allow debugging of optimized release builds as well as standard debug builds. If you want you can create a debug mode that disables things like _SECURE_SCL and _HAS_ITERATOR_DEBUGGING so they run faster or a release mode that disables optimizations so it's easier to debug.

Interestingly enough if I hit the "debug now" button while on the release configuration it sees no performance hit at all.