xna

XNA Controls Settings

落爺英雄遲暮 提交于 2019-12-11 04:36:02
问题 I have a huge problem with editing controls for my game.. I have an ingame button and when you click it. The "Choose your key.." text appears, but I don't know how to actually set it up.. I have made a "waiting for input" bool.. THIS IS NOT THE REAL CODE IT'S HOW I IMAGINE IT TO BE if (buttonIsClicked) waitinForInput = true; while(waitingForInput) { kbState = Keyboard.GetState(); somehow convert it to Keys.(STH); if (Keys.STH != defaultKeys) { defaultKeys = Keys.STH; waitingForInput = false;

Make a sprite white in XNA 4.0 w/ simple shader (alpha issues)

こ雲淡風輕ζ 提交于 2019-12-11 04:27:56
问题 Using the simple shader at Tint Sprite White and the sample code at Sprite Effects Sample, I've loaded the .fx file for the shader into the sample project and replaced one of the sample effects in one of the Draw() calls to use the whitening effect. What I get is a big white square with the same dimensions as the texture itself. I obviously want only the regions of the texture where the alpha is not 0 to be made white. The shader appears to be working, as I altered the default white color to

Hosting XNA inside WPF - Weird “Phantom” Window issue

情到浓时终转凉″ 提交于 2019-12-11 04:24:32
问题 I'm trying to host an XNA game inside a WPF window using the Windows Forms host control. I've got a weird problem that a "Phantom" window is created when I run the game. It is created exactly at the first call to game's Update method exits. Here is the Update code, the default one from a new XNA project: protected override void Update(GameTime gameTime) { // Allows the game to exit if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) this.Exit(); // TODO: Add your update

Weird results using Kinect for Windsows SDK, XNA and Seated Mode

醉酒当歌 提交于 2019-12-11 04:16:33
问题 I have a weird problem when using Seated Mode in the Xna Example of the Kinect for Windows Developer Toolkit 1.5.1. The only thing I add to the code is flowing line. this.Sensor.SkeletonStream.TrackingMode = SkeletonTrackingMode.Seated; Did anybody tried using XNA and Seated Mode without having this Problem? 回答1: This looks like the XNA sample tries to draw all joints. Since only a limited set of joints is available in seated mode, the remaining joints are drawn at a default position. 回答2: I

XNA 3D Collision matrices not working

筅森魡賤 提交于 2019-12-11 04:06:48
问题 I previously asked a question about why my collision was not working. I got a good answer which makes sense: Apply the same transforms that I did in the DrawModel method to the isCollision method. This however, did not work. I was unable to figure out how to make the same transformations in the isCollision method. If anyone could help me, that would be great. Thanks! Here are the methods: private bool checkPlayerCollision(Model model1, Matrix world1) { //Make floor matrix Matrix floorMatrix =

BoundingBoxes for Collision Detection overlapping and causing issues

喜你入骨 提交于 2019-12-11 03:50:09
问题 The following code is my attempt at stopping the PC (player character) from walking through an NPC. The "if" statement checks if the two rectangles (BoundingBox) intersect. collisionBox defines the area of the overlapping BoundingBoxes moveDir defines the Vector change that the PC will be undergoing after the if statement (e.g: if moveDir=(2,0) the PC will move to the right two pixels) currentSpeed defines the value being assigned to moveDir.X or moveDir.Y depending on keyboard input (up,

How do I create a bitmap image as spritefont with multiple character regions?

对着背影说爱祢 提交于 2019-12-11 03:48:55
问题 How do I create a bitmap font image that contains characters from multiple regions and is correctly interpreted by XNA content pipeline? I want to add some special characters to my bitmap font image, but I don't know how to do it correctly. UPD: I think I'm getting closer to my answer. Sprite font texture content processor looks for non-magenta squares in the image and probably uses an xml settings file like with normal spritefonts to map each square to a corresponding symbol. I should

What are the performance implications of these C# features?

佐手、 提交于 2019-12-11 03:45:21
问题 This question was migrated from Game Development Stack Exchange because it can be answered on Stack Overflow. Migrated 8 years ago . I have been designing a component-based game library, with the overall intention of writing it in C++ (as that is my forte), with Ogre3D as the back-end. Now that I am actually ready to write some code, I thought it would be far quicker to test out my framework under the XNA4.0 framework (somewhat quicker to get results/write an editor, etc). However, whilst I

How does XNAs Content.Load<Texture2D> operate?

Deadly 提交于 2019-12-11 03:43:47
问题 I'm just curious if it actually loads the asset into memory every time it's called or if it looks it up, finds if it's loaded and if it isn't loaded it loads it once and just keeps references so the second time it's called it just grabs a reference to it? 回答1: It keeps track of what has already been loaded, and simply returns a reference to the same object if it has been loaded before (this is per-ContentManager). This applies to all content, not just textures. The upshot is that you can just

rotation around point xna 2D

独自空忆成欢 提交于 2019-12-11 03:35:20
问题 I'm trying to rotate one object (box texture) around another object (a semi-circle texture). I'm not sure where to start if anyone could help me it would be much appreciated. 回答1: http://msdn.microsoft.com/en-us/library/ff433988.aspx 来源: https://stackoverflow.com/questions/5493064/rotation-around-point-xna-2d