|
Boost : |
From: Andy Little (andy_at_[hidden])
Date: 2005-10-05 01:27:52
"Vladimir Prus" <ghost_at_[hidden]> wrote
> Andy Little wrote:
>> Just provide alternative unit systems. Then we can all choose the ones we
>> want, when we want.
>>
>> Hows that? :-)
>
> template<class CoordinateUnit>
> class Widget {};
>
> ?
> Well, over my dead body ;-)
The cleanest way to deal with units would be as a world to device transform
which is applied to the window at runtime as has been mentioned before. So it
would be:
Transform t;
Widget w(t);
... code dealing with coordinates needs only use floats or ints ,
Now you can change the transform to whatever unit you wish. and your code will
be units independent. Of course the default could be pixels so that "old
timers" such as yourself who may be slightly frightened of units dont ever have
to see them. ;-)
regards
Andy Little
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk