SVG Game Engine Project – Now in C#

Earlier today I did the first successful test of the C# wrapper for ShivaVG.  The rest of the day was spent rewriting the code to be flexible enough to load in a file with multiple paths and correctly handle all the different SVG

Initial output of SVG loading in C#

The first output of the SVG loader rendering with ShivaVG in C# using SFML.

command types.  I briefly got stumped earlier when I was expecting to see a green test path and was instead getting blank-white screen (white was my canvas clear color at the time) only to find out that the SVG loading library I was using has member variables for the stroke and fill colors on the SvgPath class but doesn’t actually fill them in correctly, instead always defaulting them to white!

Once I figured that out I was having some other problems, namely that ShivaVG/OpenVG doesn’t appear to support implicit SVG commands (that is, when a command is repeated immediately after one of the same type, it omits the command character).  I can write a workaround in my code, but luckily Inkscape has an option to force duplicate commands.

So more work to do, namely setting up the parsing of the style attribute from paths, which will allow me to get the rendering of my drawings to display correctly, instead of the not-so-attractive picture above.  I also need to rewrite the initial element parsing code, because right now there are definitely cases where it will miss elements and end up not rendering anything (it doesn’t traverse the tree correctly at the moment, it just looks under the root element for any path elements that are siblings of the first element).


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s