Archive for the ‘C++’ Category.

Multi-Threaded Programming with QtConcurrent

I’m really looking forward to QtConcurrent which will be in Qt 4.4; so I downloaded a Qt snapshot to try it out.

You can download all of the example code I wrote here, Qt Concurrent Examples
Continue reading ‘Multi-Threaded Programming with QtConcurrent’ »

QMake Major Mode for Emacs (qt-pro.el)

I finally got around to writing a major mode for Qt .pro and .pri files. It doesn’t provide any indenting features; only font locking.

Just load it up and add the following to your .emacs

(requireqt-pro)
(add-to-list ‘auto-mode-alist ‘(“\\.pr[io]$” . qt-pro-mode))

Get it here qt-pro.el

[Digg] [Reddit] [DZone]

Covariant Return Types

I ran across something weird the other day. I had assumed that the return type of an overriding function must be identical to the function that it is overriding. The C++ Standard allows one specific exception to this rule that could possibly come in handy to save some unnecessary casting.
Continue reading ‘Covariant Return Types’ »

SDL Lights Out

5×5 Grid of randomly lit and unlit boxes, clicking a box flips the boxes in a cross shape
around the box clicked
Uses SDL_Image and SDL_TTF
Press ~ to get to Console

lights.tgz

[Digg] [Reddit] [DZone]

SDL Bouncing Ball

A Simple SDL Demo that uses Hardware Acceleration and Double Buffering to draw
three Sphere images on the screen and bounce them around a bit.

It uses SDL_Image for loading the PNG file.

Copy and paste the source code to a file and compile it like this:

gcc -Wall -ansi -pedantic `sdl-config –cflags` -c bounce.c
gcc -Wall main.o -o main -lSDL_image -L/usr/X11R6/lib -L/usr/lib -lSDL -lpthread

Bounce.c

[Digg] [Reddit] [DZone]