Sign in to follow this  
Napivo

Replacing IDrawable and IUpdateble

Recommended Posts

The thing I hate most about XNA are the interfaces IDrawable and IUpdatable, they are completely useless.

I have my own implementations of them. iDrawable and iUpdatable. Honestly they are extended versions that I use with my own update and draw managers.

Of course that works just fine except that they old ones still exist and that interfaces should start with a capital 'I'. furthermore it is kind of confusing for outsiders. Since they have nothing to do with one another yet almost are the same.

Is there any way to not load the interfaces, or disable them is some way or is the only way to get around this, changing the names of my interfaces to ICanDraw, INapivoDraw or .... I don't know.

Suggestions for naming these interfaces would be welcome.

Share this post


Link to post
Share on other sites
[quote name='Napivo' timestamp='1318168713' post='4870791']
The thing I hate most about XNA are the interfaces IDrawable and IUpdatable, they are completely useless.

I have my own implementations of them. iDrawable and iUpdatable. Honestly they are extended versions that I use with my own update and draw managers.

Of course that works just fine except that they old ones still exist and that interfaces should start with a capital 'I'. furthermore it is kind of confusing for outsiders. Since they have nothing to do with one another yet almost are the same.

Is there any way to not load the interfaces, or disable them is some way or is the only way to get around this, changing the names of my interfaces to ICanDraw, INapivoDraw or .... I don't know.

Suggestions for naming these interfaces would be welcome.
[/quote]

Just use namespaces properly, this is why they exist.

[code]
namespace Foo
{
interface IDrawable { // stuff }
}
[/code]

elsewhere
[code]
class Bar : Foo.IDrawable { // stuff }
[/code]

Share this post


Link to post
Share on other sites
[quote]

Just use namespaces properly, this is why they exist.

[code]
namespace Foo
{
interface IDrawable { // stuff }
}
[/code]

elsewhere
[code]
class Bar : Foo.IDrawable { // stuff }
[/code]
[/quote]

I really don't want to be typing Napivo.Xna.Core.IDrawable all over my code or resolve the name conflict everytime I need both Namespaces which is about everywhere... Maybe I am just too lazy.

And yes I know I can shorten it to NXC.IDrawable If I use "using NXC = Napivo.Xna.Core;"

Share this post


Link to post
Share on other sites
[quote name='Napivo' timestamp='1318186754' post='4870869']
I really don't want to be typing Napivo.Xna.Core.IDrawable all over my code or resolve the name conflict everytime I need both Namespaces which is about everywhere... Maybe I am just too lazy.

And yes I know I can shorten it to NXC.IDrawable If I use "using NXC = Napivo.Xna.Core;"
[/quote]

Then remove the Microsoft.XNA.Framework using statement, as long as you don't need it. If you need it and you have naming clashes, this is how things work. If you never want to use a namespace name, then I suggest not using any libraries.

What is wrong with the existing interfaces anyway? It seems lightweight and straight forward.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this