Atomorun2008 Opensource

bearophile bearophileHUGS at lycos.com
Wed Aug 20 17:54:30 PDT 2008


Matthias Thurau:
> So if you are interested: Atomorun2008.whosme.de

struct Vertex {
public:
    Point3D position;
    Point3D normal;
};

D Structs don't need a semicolon at the end, and their fields are always public.


myLetters[currentLetter].uv[0].x = cast(float) letterstartxl / myDimension;
myLetters[currentLetter].uv[0].y = cast(float) (y  *maxlettersize)     / myDimension;
myLetters[currentLetter].uv[1].x = cast(float) letterstartxr / myDimension;
myLetters[currentLetter].uv[1].y = cast(float) (y  *maxlettersize)     / myDimension;
myLetters[currentLetter].uv[2].x = cast(float) letterstartxr / myDimension;
etc...

To shorten that code you may use:
with (myLetters[currentLetter].uv) {...}


    void clear() { //check and unload non needed resources
       ...
    };

No need for the semicolon after the last } of a method. And I suggest you to put one blank line between methods.

struct Point2D  and struct Point3D can be merged into a single templated code, that can work with N coordinates, reducing code duplication...

Generally I see many points where the code can be shortened, there's some redundancy.

Generally I suggest to specify what names you import:
import foo: bar, baz, ect;

Bye,
bearophile


More information about the Digitalmars-d-announce mailing list