Archive for the 'Programming' Category

std::map and std::string

Monday, May 25th, 2009

Categories: Programming

This is a bit trivial, but there is a chance that this information will save someone a lot of time looking in the wrong place, so I thought I’d post it. I ran into this using Visual C++ 2008, but it probably applies to some other C++-compilers as well.

If you are using an std::map that has an std::string as a key or value and you get all kinds of error messages from your compiler about template argument deduction or implicit conversions, you probably forgot to include <string>.

Some thoughts about Python

Wednesday, February 25th, 2009

Categories: Game development, Programming

Lately, I’ve been using Python for game development. It’s a very pragmatic language, that’s a lot faster to develop in than something like C++. Here are some of the things I like and dislike about Python.

» Read the rest of this post.

What the loop!

Monday, February 23rd, 2009

Categories: Programming

Here’s something I found in some old notes of mine. What does the following piece of C++ code do?

#include <algorithm>
#include <iostream>
#include <vector>

int main()
{
  // initialize a vector with ten random integers
  std::vector<int> numbers;
  generate_n(back_inserter(numbers), 10, rand);

  // loop through the vector backwards
  for (size_t i = numbers.size() - 1; i >= 0; i--)
  {
    std::cout << i << ":" << numbers[i] << std::endl;
  }
}

Console windows and standard streams

Sunday, September 30th, 2007

Categories: Programming

Console windows can be convenient for outputting debug information, but you don’t need them all the time. With the Windows API, you can create and destroy a console window whenever you want, so this gives you the opportunity to only create a console window when your program actually has something to report. However, by default these console windows aren’t connected to the standard streams, so std::cout, std::cerr and std::cin won’t work. Fortunately, it’s not that hard to fix. I spent some time to solve this problem and I thought I’d share my solution.

» Read the rest of this post.

Tutorial

Wednesday, May 2nd, 2007

Categories: Programming

Today I received a compliment on a game programming tutorial I put online several years ago (it’s in Dutch). It’s not the best tutorial I’ve ever written, but apparently people like it, because once in a while I receive positive e-mails about it. It has made me think whether I should put more tutorials online.

» Read the rest of this post.


Bad Behavior has blocked 41 access attempts in the last 7 days.