How can I use a scml animation from spriter in XNA - c#

I have a program to make 2d animation and when I save my animation the format is scml and I can't open that animation in XNA.
Do I have to put it in another format?
The software is Spriter.

For one, XNA dosen't include content loaders for anything more than your default file types such as PNG, JPEG, TxT, etc.
I saw an exacmple of a scml file from spriter, and you will need to create your own content loader for it, but that is probably going to be a bit hard.
Your best bet is to take an animation example, and take the pictures that Spriter has made, and arrange them into a spritesheet.
I'm afraid this isnt as simple as you thought, but manually making a spritesheet will probably be your best bet.
Important Edit:
Your in luck, someone already made a content loader for Spriter in XNA!
https://github.com/schmelze/SpriterXNA and I belive a newer version https://bitbucket.org/dylanwolf/xspriter

Related

Playing Flash swf files in XNA

Is this possible? It would be great..
I've tried:
http://fci-h.blogspot.kr/2007/06/how-to-play-flash-swf-inside-c.html
which gives me a attempted to read protected memory error
and
http://blog.debreuil.com/?p=35
which I just can't work out how to use - I just want the code to play a .swf file I've made already in my XNA game.
I would just love to be able to do cutscenes or live backgrounds in this way, especially if they can be streamed from file instead of preloaded.
Thanks a lot for any help!
Sorry, but this is not possible without extreme hard work that's just not going to be within your reach. (Or some painfully awkward method, like embedding a Webpage below your game)
On the bright side - there's pretty much no need for .swf embedding. Anything flash can do, XNA can do better!
Use animated images or videos for live backgrounds / cutscenes - or program them yourself in XNA using manipulation of static images - if you need help with that, post a new question asking for help with some specific thing you need done.
Also, if you want, you can ask for help converting Flash Actionscript to its C#/XNA equivalent - it can be done without too much work by anyone with a little experience in both languages.

How do you change the color of an Image in WPF?

I have a .png image that's just white-on-transparent, and I'm wondering if there's an easy way to make that green-on-transparent, red-on-transparent, etc so I don't need to make separate .png files for each color.
Take a look at these CodeProject Articles
Image Processing Lab
ImageMagic-WPF Image Color Spaces
Image Processing Lab is a simple tool for image processing, which
includes different filters and tools to analyze images available in
the AForge.NET framework.
You could also take a look at the FormatConvertedBitmap, ColorConvertedBitmap or WritableBitmap Class's
For a simpler solution that doesn't require pulling in huge libraries and lets you understand what's going on under their hood (and thus gives you greater flexibility), learn how to use WPF Pixel Shaders (google it).
Then you can use something like the multiply shader here: http://rakeshravuri.blogspot.com/2008/08/blending-modes-in-wpf-using.html

Graphing variables in real time for debugging in C#

I'm working on a project in C# using XNA. It would be useful to have a way to graph the value of certain variables in real time as the game is running. (Just for debugging, I don't want the graphs in the final project.)
This seems like something that has probably been done before, but I can't find anything other than this:
http://devmag.org.za/2011/02/09/using-graphs-to-debug-physics-ai-and-animation-effectively/
I'm willing to write my own system or use someone else's. If there is an existing released project, I'd like to find it so I don't have to reinvent the wheel. If not, what;s the best way to handle this?
Thanks!
You could probably write a pretty easy system using XNA.
You should have something very basic for plotting lines:
public void DrawLine(Point first, Point second);
Run this system on every frame to collect the variable's value. Keep track of previous value.
Draw a line between previous value to current value.
If the sampling frequency is high enough, you can get a pretty decent looking graph like this.
You could write the values you want to check in a csv file, then draw a graph with excel. Here's a tutorial on writing a csv file writer/parser in C#.
The XNA hasn't support for drawing single line/pixels to screen directly (need to pass through a SpriteBatch). The only thing else I can imagine of is using a texture2D and draw your graph's pixels on it. You'll have to keep the texture in front of the camera though, with some strange matrix magics of which I don't actually know much. :P
The Xen graphics API has this feature. It appears to be for some built in variables, such as FPS, but it's all open source so I suspect it will be easy to add graphs of your own: http://xen.codeplex.com/
EDIT
I just remembered that Farseer physics also has code to do this http://farseerphysics.codeplex.com/. It's probably easier to rip out than the Xen graphs.

Dynamic image/animation combining

I'm working on a solution for my new project (in C#). I'm trying to make a dynamic image/animation combiner (maybe later even work with video's, but that's not required atm).
So basically my program is reading a xml file with all kinds of instructions the user needs to do. In the xml file it is possible that for 1 instruction multiple pictures are needed. So when there are 2 or 3 pictures (the maximum amount of pictures is 4) they need to be combined to 1 picture so I can show that on the image object on the main form. Also it is important that the pictures keep there proportions so the image doesn't look deformed.
I found a solution with GDI+ but it isn't that good as I wanted it and runs pretty slow on a bit older computers. Also combining animations with normal images is a real pain and goes very slow!
Is there a faster/easier way to do this? Maybe WPF is a solution but I got no experience with this.
Thnx for any help in advance!
This questsion is open now for mor then a year but I found the solution some time ago so I will post it here in case it is usefull for somebody else.
The best way to do this was creating to set up a grid dynamic. And then fill up each element of the grid with the needed media (Video, Image, animated gif's and even Viewport3D from another xaml file). Creating a grid in code is really easy so it should be a good solution for everybody who wants to do this in WPF.

C# Video Playback

I'm looking at trying to create a simple 'slider puzzle' game. You've seen the ones, you have an image and you shuffle the tiles.
However, I want to make one that will play back videos instead. What I'm trying to determine is whether it's possible to playback a video in C# and render the video on different controls (probably buttons, or panels). I've spotted the Microsoft.DirectX.AudioVideoPlayback classes but haven't found much documentation on them yet.
So to throw it up in the air, is this going to be possible to do without too much difficulty? Are there any useful (free) libraries that might help me along?
Have a look at DirectShowNet that wraps the DirectShow API, in the samples page there is a sample called PlayWnd the shows how to play a video file.
Depending upon how large and how long your video sources are, you could accomplish this very simply by first converting your videos to animated GIFs. A .Net PictureBox control will display and animate a GIF automatically, and you could easily use PictureBoxes for your tiles.
One big advantage of this approach is that (thanks to Mono) your application could work unaltered on Windows, Mac and the iPhone (also Linux and a couple others).

Categories

Resources