Jump to content
  • Advertisement
Sign in to follow this  
CandleJack

[.net] User Control Design Issue

This topic is 3765 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've come across a situation while designing a 2D tile map editor in C# that I am having a hard time coming up with an elegant solution for. Right now I have two user controls on my form that I have created. A TileLibrary control, used to manage and store all tiles added to the project, and a TileMap, used to place the actual tiles into a grid. The problem I'm having is I don't know where to place the ImageList control that stores that tile images. It seems the most intuitive answer would be that the TileLibrary should be where the ImageList resides since it also stores the collection of Tile objects, but the TileMap would need to be able to look up a tile image when it is being rendered. Since they are two separate controls how would they even know that each other exist? Is it possible to somehow link them together, so that a TileMap must have a TileLibrary attached to it before it can be used?

Share this post


Link to post
Share on other sites
Advertisement
Well it seemed like it would be a cleaner design, since each control is its own object with its own function. I didn't want it to get to be this big bloated thing. It seemed like it would be cleaner and much more manageable to have two objects each handling their own events and stuff separately. From a re-usability standpoint I guess having two controls is somewhat pointless since you would never really have one without the other (though I can think of a couple situations where I might want to have multiple tile libraries with one map, but I doubt I'll go down that road.)

Another reason is I want the tile library to be able to be hidden, so that I can use that screen real estate for other components that I plan to implement. I suppose this could also be done in the same control, but again it just seemed more intuitive that they should be separated.

But now that you got me thinking about the whole one control idea, what if I were to create a third control, which consisted of both the TileLibrary and TileMap control to act as sort of a bridge between them, and have the ImageList exist on that? I guess that's no different than just having them both on the main form though, because really, I doubt anybody besides me will ever be using these controls to develop an application. I guess my problem is that I like to design things the best way that I can, even when it doesn't really matter too much :P

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!