DXUT is a part of DirectX SDK examples. With may help wrapper functions and a simple DirectX based dialog/control framework, it is a good starting point of a DirectX project.
DXUT programming guide can be found here: http://msdn.microsoft.com/en-us/library/ee417532(v=VS.85).aspx
Towards my goal to a floating D3D window, I modified the CustomUI example and the DXUT framework, now the CustomUI is floating on top of desktop. What remains is to move the GUI.
Here you find my experiences and tips on programming C++ for Windows and Linux that I got from software projects I've been involved in.
Wednesday, April 21, 2010
Wednesday, April 7, 2010
Some Useful Utilities on Linux
find, xargs and rename are three useful utilities I discovered recently that make a programmer's life much easier.
Sometimes, I need to make a symbolic link to each of quite many files, I can write a perl or python script for that. I'm learning the shell script but I cannot write something effectively with it till the moment. However, I found out that I can do the job by two lines of commands.
For example, I have many files ending with .so.1.0.0
First I make a link to each file by giving the name of the link an additional .link based on the original filename:
A small problem here with xargs, I can add prefix or postfix but not modify the actual name, what I needed is a shorter name, in order to do that, I use rename to change the name as I wanted, a name shorter than the original file name.
I'll give discuss each of them in more details later.
Sometimes, I need to make a symbolic link to each of quite many files, I can write a perl or python script for that. I'm learning the shell script but I cannot write something effectively with it till the moment. However, I found out that I can do the job by two lines of commands.
For example, I have many files ending with .so.1.0.0
First I make a link to each file by giving the name of the link an additional .link based on the original filename:
find . -type f -exec ln -s '{}' '{}'.link \;or with xargs if there are too many files to handle:
find . -type f | xargs -t -l1 -i ln -s '{}' '{}'.linkSo I have many links ending with .so.1.0.0.link
A small problem here with xargs, I can add prefix or postfix but not modify the actual name, what I needed is a shorter name, in order to do that, I use rename to change the name as I wanted, a name shorter than the original file name.
rename 's/\.1.0.0.link//' *this will rename all the links I have created with name .so.1.0.0.link to .so, the 1.0.0.link is removed.
I'll give discuss each of them in more details later.
Thursday, April 1, 2010
Interesting Points about STL
In this post, I'll collect some interesting points about STL, knowing them may save me some time when the a strange problem appears.
1. The remove() algorithm is convenient sometimes. But be careful to know it does not change the number of elements in the container after some elements is "removed", it returns an iterator marking the new end.
2. Sometimes I may want to write a line of code like this: ++aCol.begin(), in this case I'm operating on a temporary variable, this is not alway allowed depending on the type of aCol and its implementation. First, modifying a temporary value of a fundamental type such as pointer is not allowed. The vector and string usually implement their iterator as a pointer, so if this is the case, ++aCol.begin() will not compile.
1. The remove() algorithm is convenient sometimes. But be careful to know it does not change the number of elements in the container after some elements is "removed", it returns an iterator marking the new end.
2. Sometimes I may want to write a line of code like this: ++aCol.begin(), in this case I'm operating on a temporary variable, this is not alway allowed depending on the type of aCol and its implementation. First, modifying a temporary value of a fundamental type such as pointer is not allowed. The vector and string usually implement their iterator as a pointer, so if this is the case, ++aCol.begin() will not compile.