xna

Get music tempo or BPM?

雨燕双飞 提交于 2020-01-24 07:50:26
问题 I'm currently building a game in windows phone 7 using xna i'm trying to get beat per minute from song that played in background song, i also not quite sure if what i want is BPM, what i want is something like pace or tempo in music, faster the pace ,faster the sprites is moving. What i'm thinking right now, BPM is how much a frequency from music hits a range of defined constant, e.g 20 Mhz - 30 MHz, Feel free to correct me if i'm wrong, i'm not really familiar with audio thing, i have tried

XNA Rectangle intersection

ぃ、小莉子 提交于 2020-01-23 17:19:06
问题 I recently started on XNA development and having some (very limited) experience with it in the past, I decided to try and make a Pong clone to see how much I could remember. Most of what I knew came back to me, but I am having problems with collision detection between the bats and the ball. I have 3 rectangles set to update position along with the sprites that I am using, and when the ball rectangle intersects with a bat rectangle, I multiply the X speed of the ball by -1. However this

Super blurry textures - XNA

女生的网名这么多〃 提交于 2020-01-23 02:44:38
问题 I seem to be getting really blurry textures when I look at my textures up close. I am creating a minecraft-like terrain thing and I would like the textures to be pixelated - like it is made rather than XNA try to smooth it out for me. Here is how it appears: http://s1100.photobucket.com/albums/g420/darestium/?action=view&current=bluryminecraftterrain.png Any suggestions would be much appeciated. 回答1: It's not related to anti-aliasing... it's related to how the hardware samples the texels in

Creating XNA AudioEngine on windows game project

岁酱吖の 提交于 2020-01-22 02:51:05
问题 I'm reading this book "Learning XNA 4.0", and in chapter 6 it teaches how to play sounds using XACT Audio files. It asks me to create an AudioEngine object, but I can't find that class.AudioEngine I have the right using statement (Microsoft.Xna.Framework.Audio) and the right reference (microsoft.xna.framework.dll). does anybody have any idea whats wrong? 回答1: This is an error in the documentation. AudioEngine is actually in the Microsoft.Xna.Framework.Xact assembly. Add a reference to that,

Using CreateOrthographicOffCenter in XNA

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-21 02:30:17
问题 I'm trying to figure out how to draw graphics in XNA, and someone else suggested this. But before I attempt to use this... If I create and use this camera, and set LEFT,TOP to 0 and WIDTH=256 and HEIGHT=240, anything I render to the screen will use these coordinates? So a box with a width and height of 1, if set to 0,0 will take up space from 0,0 to 1,1? 回答1: The function you are referring to is: Matrix.CreateOrthographicOffCenter(left, right, bottom, top, zNearPlane, zFarPlane) . This

Issue with transparent texture on 3D primitive, XNA 4.0

為{幸葍}努か 提交于 2020-01-21 02:28:00
问题 I need to draw a large set of cubes, all with (possibly) unique textures on each side. Some of the textures also have parts of transparency. The cubes that are behind ones with transparent textures should show through the transparent texture. However, it seems that the order in which I draw the cubes decides if the transparency works or not, which is something I want to avoid. Look here: cubeEffect.CurrentTechnique = cubeEffect.Techniques["Textured"]; Block[] cubes = new Block[4]; cubes[0] =

How to run a C# winform in an XNA C# project

只愿长相守 提交于 2020-01-17 04:07:14
问题 I am trying to use the PDFsharp library in an XNA game. The example code I am trying to get to work is: static void Main() { Renderer renderer = new Renderer(); PreviewForm form = new PreviewForm(); form.RenderEvent = new PagePreview.RenderEvent(renderer.Render); Application.Run(form); } But I don't know how to get this to run in XNA. Is it possible to pass the graphics that are passed to the winform to the XNA graphics engine instead? 回答1: update 2 It appears that the original links to MSDN

XNA Textured primitives are see-through

我只是一个虾纸丫 提交于 2020-01-16 19:23:09
问题 I'm having a problem with primitives on XNA. As you can see in the link, http://imgur.com/12UTd2s, some of the textured walls are see-through and some aren't. Can someone explain why this happens and help me come up with a solution? Here's the see through wall declaration: testWall.Add(new VertexPositionNormalTexture(new Vector3(x2, 0, z2), new Vector3(1, 0, 0), new Vector2(0,0))); testWall.Add(new VertexPositionNormalTexture(new Vector3(x2, 0, z2 - 50), new Vector3(1, 0, 0), new Vector2(1,0)

Monogame Ambiguous Vector2

痞子三分冷 提交于 2020-01-16 05:08:04
问题 I am having an issue where I keep getting ambiguity errors between Monogame and XNA libraries. No matter what I do, I cannot get it to compile. I have removed XNA off my computer and yet the error still persists. The full error is: Error 4 Argument 1: cannot convert from 'Microsoft.Xna.Framework.Vector2 [c:\Program Files (x86)\MonoGame\v3.0\Assemblies\WindowsPhone\x86\MonoGame.Framework.dll]' to 'Microsoft.Xna.Framework.Vector2' on lines such as: EngineGlobal.world = new World(new Vector2(0,9

Application runs out of memory while saving textures to PNG files

偶尔善良 提交于 2020-01-16 04:26:06
问题 I'm using SaveAsPng() on a RenderTarget2D object every frame. I dispose of both the RenderTarget2D and the input stream on every frame too. Yet, just before about 500 images saved I get a message saying the application ran out of memory. I tried changing around when I call Dispose(), but I got the same result every time. RenderTarget2D rt; protected override void Update(GameTime gameTime) { if (rt != null) { rt.Dispose(); } rt = new RenderTarget2D(GraphicsDevice, graphics