Is this acceptable?

Started by
10 comments, last by thedo 22 years, 5 months ago
Friend classes/functions rather tend to nullify the advantages of accessor methods.

Anyway, rather than have an accessor to get the surface, why not have methods on your wrapper class to manipulate it? If your client doesn''t necessarily know anything about D3D, why expose them to any of the gory details?

--

MP3 Dancer

Get A Stripper on your desktop

Advertisement
I''m not sure if your familiar with builder so i''ll assume your not. In builder there are ways that can allow components be related to other components. (by the IDE before compilation)

As the model and scene components are separate i was thinking that in the code for the initialization of model i would need to have

void TModel::Init(TScene* scene)
{
device=scene->GetDevice();
}

the problem with this is that I would then be exposing a property (or rather a pointer to it) because Getdevice() would HAVE to be public. If the user comes along and sees a GetDevice and plays around (C++ Builder allows shortcuts in the same way as Internet Expolorer so when I type scene-> it displays all of the methods associated with it (public ones anyway). I cant rely on them having this option turned off and I dont want to expose the Device to anyone. As I am also writing the TModel class I think the friend mechanism works pretty well.

I wont be exposing the user to any methods of D3D - i will be defining methods do the dirty work - i.e. add fog, add lights, draw the model - all without a single reference to D3D by the user.

Neil
WHATCHA GONNA DO WHEN THE LARGEST ARMS IN THE WORLD RUN WILD ON YOU?!?!

This topic is closed to new replies.

Advertisement