Communicating with SDL

1 view
Skip to first unread message

alan.m...@gmail.com

unread,
Dec 24, 2006, 8:45:53 AM12/24/06
to MonoXna
It's come to my attention (Garuma brought it up) that we need seperate
Enums to communicate with SDL. This is because while XNA has enums
already, they have different values to the SDL ones. How should these
best be arranged? Keep the SDL ones in a seperate SDLEnums file and the
XNA ones in an XNAEnums file?

Garuma

unread,
Dec 25, 2006, 5:07:35 AM12/25/06
to MonoXna
In fact SDL has already its own enums, the problem is to "map" the SDL
enum's values to those of XNA, (personnally I use a static Dictionary
for this in the KeyboardState struct).

alan.m...@gmail.com

unread,
Dec 25, 2006, 1:55:42 PM12/25/06
to MonoXna
Sorry, thats what i meant. I was a bit confused writing that email.

What we have is two sets of enums, neither of which can be changed (i
assume) so we need to map them to each other. We need to common way of
doing this. Should we implement a static EnumConverter class which
takes in XNA enum and returns the corresponding SDL enum, and vice
versa? Should we use giant switch statements to do the conversions? Or
should we use some kind of dictionary like Garuma already used which
maps them to each other?

I think that having a switch statment for each enum would probably be
the highest performing way to do it, especially when doing a lot of
conversions. But would a switch statement with 100 options be slower
than a dictionary lookup? I don't know ;)

Alan.

Garuma

unread,
Dec 26, 2006, 5:04:02 AM12/26/06
to MonoXna
IMHO performance must be the main concern because users shouldn't see
the difference between XNA and Mono.Xna in term of speed and fluidity.

I heard that the Dictionary of .NET v2 was really fast compared to
prior version but then I think benchmarking will decide everyone :)

Jérémie.

Reply all
Reply to author
Forward
0 new messages