Skip to main content
gamedev.net
🔒 Locked

Module internal method

Started by ToohrVyk 1 reply 400+ views
Original Post
ToohrVyk
ToohrVyk
I am currently polishing a small (minimalistic) game engine design. I am concerned with the elegance of a particular feature. My engine does not allow direct rendering, but instead allows the user to place images at given positions on the screen and move them around (by associating an image with a position). The image class I use has the methods one would expect from it (for instance, its dimension in arbitray units), but it also has another method, which is required by the engine itself: a rendering function that allows me to draw the image at a given position. This function should of course not be available to the user, which is why I want to hide it. My approach to this is to give image a method that returns an internal object which represents the image data, and which can be rendered using adapted functions. Then, I hide the internal type definition from the user of the library, so that only the library may use it. However, the internal-returning method is still there, in image. Do you think this design is not elegant, or "bad"?
SiCrane
SiCrane
My first question would be what programming language you are using? Some languages have built-in support for this kind of thing.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.