How to write a simple .txt content processor in XNA?

I really don't understand how the Content Importer / Processor works in XNA.

I need to read a text file (Content / levels / level1.txt) of the form:

x x
x x
x x

where x are integers into the array int [,].

Any tips for writing an importer SIMPLE.txt ??? When searching google / msdn, I found only examples of importers of .x / .fbx files. And they seem too complicated.

+3
source share
4 answers

Do you really need to process the text file? If not, then you can probably skip most of the content pipeline.

Sort of:

string filename = "Content/TextFiles/sometext.txt";
string path = Path.Combine(StorageContainer.TitleLocation, filename);

string lineOfText;
StreamReader sr = new StreamReader(path);
while ((lineOfText = sr.ReadLine()) != null)
{
  // do something
}

, " " "" " " ", " , . , .

( ) RacingGame, Microsoft. (XML) .

+10

There doesn’t seem to be much information, but this blog post shows how you can upload .txt files through code using XNA.

I hope this helps you get the file in memory, from there it should be simple to analyze it in any way.

XNA 3.0 - Read Text Files on Xbox

+2
source

http://www.ziggyware.com/readarticle.php?article_id=69 is probably a good place to start. It covers the creation of a core content processor.

+2
source

Source: https://habr.com/ru/post/1706855/


All Articles