xna

How can I split a long string so that it matches with a given rectangle?

ぃ、小莉子 提交于 2020-01-14 14:00:52
问题 I have one long string and I want to split it in a few pieces so that every line of the text is always in the given rectangle. The text should not exceed the border of the rectangle. The height of the rectangle isn't the problem. The text will never touch the bottom of the rectangle because the rectangle is very tall. But the rectangle isn't very wide. How can I calculate which parts of the string should be drawn in each line? I don't want to split a word. If a word exceeds the border of the

How to get the full root directory of a ContentManager in XNA 4.0

徘徊边缘 提交于 2020-01-14 04:50:31
问题 I was wondering if anyone here knows how to find the complete path (from the drive letter onwards) of a ContentManager instance. using this I could create a string with the right number of "..\" to append to the file path when I want to load a file from anywhere else on the computer (eg. from a registry key). So basically I'm asking if there is a way. 回答1: You may just want to use System.GetFolderPath with one of these locations, most likely Program Files. From there, you can navigate to your

Efficiently convert audio bytes - byte[] to short[]

折月煮酒 提交于 2020-01-14 00:34:26
问题 I'm trying to use the XNA microphone to capture audio and pass it to an API I have that analyses the data for display purposes. However, the API requires the audio data in an array of 16 bit integers. So my question is fairly straight forward; what's the most efficient way to convert the byte array into a short array? private void _microphone_BufferReady(object sender, System.EventArgs e) { _microphone.GetData(_buffer); short[] shorts; //Convert and pass the 16 bit samples ProcessData(shorts)

Is MonoGame really cross-platform?

别等时光非礼了梦想. 提交于 2020-01-13 08:44:29
问题 When I download MonoGame (which I will use in place of XNA since I'm on a Mac) and unzip it, all the MonoDevelop solution files are named MonoGame.Framework.[PLATFORM NAME].sln , with [PLATFORM NAME] being, well, the name of the OS. And the code in the tutorials is different for each platform, so it appears that for a MonoGame app to run on a different machine, it must be ported. Is this correct? If so, what other versions of XNA are there for Mono, preferably that work on the Xbox 360? I've

How to embed flash into XNA on windows mobile

北城余情 提交于 2020-01-13 05:32:40
问题 Can I embed flash in XNA? how? Can I get data(flash game result) from the embedded flash? Thanks. http://en.wikipedia.org/wiki/Microsoft_XNA http://www.xnadevelopment.com/tutorials.shtml http://www.code-magazine.com/article.aspx?quickid=0709051&page=7 回答1: 1th question: Its 100% possible to embed flash in XNA if person finds a SWFWiever for Windows Forms.I have written an article about xna-windows controls-wpf integration here: XNA-Windows Controls-WPF Integration 回答2: There is no way

How to embed flash into XNA on windows mobile

陌路散爱 提交于 2020-01-13 05:32:07
问题 Can I embed flash in XNA? how? Can I get data(flash game result) from the embedded flash? Thanks. http://en.wikipedia.org/wiki/Microsoft_XNA http://www.xnadevelopment.com/tutorials.shtml http://www.code-magazine.com/article.aspx?quickid=0709051&page=7 回答1: 1th question: Its 100% possible to embed flash in XNA if person finds a SWFWiever for Windows Forms.I have written an article about xna-windows controls-wpf integration here: XNA-Windows Controls-WPF Integration 回答2: There is no way

Simple XNA 2D demo: why is my F# version slower than C# version?

血红的双手。 提交于 2020-01-13 04:48:11
问题 When running this XNA application it should display a rotated rectangle that moves from top-left corner to bottom-right corner. It looks like my F# version is noticeably much slower. It seems that the Draw method skips a lot of frames. I am using VS 2012 RC, XNA 4.0, .NET 4.5, F# 3.0. I am trying to make it as functional as possible. What could be the reason for poor performance? C#: class Program { static void Main(string[] args) { using (var game = new FlockGame()) { game.Run(); } } }

XNA Framework Importers

心不动则不痛 提交于 2020-01-13 03:55:22
问题 I am working on a game using the XNA framework. My game has several levels which I am storing the data in a plain old text file. In VS 2008 when I add the level file to the project and compile, I receive the following error message. Error 1 Cannot autodetect which importer to use for "Levels\0.txt". There are no importers which handle this file type. Specify the importer that handles this file type in your project. F:\Projects\BrickBreaker\BrickBreaker\Content\Levels\0.txt BrickBreaker The

XNA draw / paint onto a Texture2D at runtime

。_饼干妹妹 提交于 2020-01-12 07:17:29
问题 Morning all (if its morning where you are) I have been looking around and have not seen a satisfactory method for doing this so thought I would ask around... Ideal world I would like to be able to generate a transparent Texture2D object. Drawing this to the screen I would like to be able to "paint" to it, i.e. when the left mouse button is down whatever pixel the cursor is over should be set to black. Following this I would then need to be able to use this texture. Using the texture is the

Can't Load asset as XML file

限于喜欢 提交于 2020-01-11 13:56:18
问题 I have done my project with XNA and I'm currently trying to convert it while using Monogame. My problem is that i can't load my XML file. the error: Could not load Level asset as a non-content file! My code: file = Content.Load<XmlData[]>(path); Path = xml name file without extension. (i tried both). class XMLData : public class XmlData { public int id; public int posx; public int posy; public int rot; public int Width; public int Height; } and some of my XML file: <?xml version="1.0"