On 03/14/2016 03:14 PM, WhatMeWorry wrote:
>
> -------------------- sprite_renderer.h --------------
>
> class SpriteRenderer
> {
> ...
> };

Same thing in D without the semicolon. :)

> -------------------- game.cpp ------------------------
>
> #include "sprite_renderer.h"
>
> SpriteRenderer  *Renderer;

Like in Java and C#, class variables are object references in D. So, the following is sufficient:

SpriteRenderer Renderer;  // Although, I would name it 'renderer'

However, unlike C++, that variable is thread-local, meaning that if you have more than one thread, each will have their own variable. If you really need it, in multithreaded code you may want to define it shared:

shared(SpriteRenderer) renderer;

But then you will have to deal with thread synchronization.

> I tried taking due diligence with the documentation.

There is something here:

  http://ddili.org/ders/d.en/class.html#ix_class.variable,%20class

Ali

Reply via email to