On Saturday, 23 May 2020 at 09:48:57 UTC, Mike Parker wrote:
Since you're using classes, one way is to use a common base
class or an interface. But assuming "parent" is the owner of
the Sprite instance, you might eliminate the dependency on the
parent and have it update the Sprite's position
On Saturday, 23 May 2020 at 09:27:46 UTC, Tim wrote:
Hi all, I'm a little new to D and I'm wondering how I can store
a reference to the calling object. I want to create a reference
to an object's parent so that each time I go to update the
sprite, it is able to grab its position from the
On Saturday, 23 May 2020 at 09:27:46 UTC, Tim wrote:
Hi all, I'm a little new to D and I'm wondering how I can store
a reference to the calling object. I want to create a reference
to an object's parent so that each time I go to update the
sprite, it is able to grab its position from the
23.05.2020 12:27, Tim пишет:
class Sprite{
/// Postional components of the sprite
int* x, y;
SDL_Surface* image_surface;
auto parent;
this(const char* path, auto parent){
writeln(*x);
this.parent = parent;
}
void update(){
// Copy
Hi all, I'm a little new to D and I'm wondering how I can store a
reference to the calling object. I want to create a reference to
an object's parent so that each time I go to update the sprite,
it is able to grab its position from the parent.
So if I have:
class Sprite{
/// Postional