xna

Error while deserializing intermediate XML. Cannot find type

对着背影说爱祢 提交于 2019-12-12 02:34:30
问题 The whole error message is here: There was an error while deserializing intermediate XML. Cannot find type "WindowsGame1.Tile". I'm making an XNA game, and right now I'm trying to load in a tile-based level from an xml file. Right now, my xml file looks like this: <?xml version="1.0" encoding="utf-8"?> <XnaContent> <Asset Type="WindowsGame1.Tile"> <Tile> <X>0</X> <Y>0</Y> <ImageName>grass-tile</ImageName> </Tile> </Asset> </XnaContent> And my C# file looks like this: using System; using

Get values from object through class

谁说我不能喝 提交于 2019-12-12 02:28:15
问题 public class BlockType { public static BlockType Dirt_Block = new Block("Blah! values here"); } public struct Block { public static string Value; public Block(string value) { value = value; } } Is there any way I can get the value from DirtBlock? BlockType.Dirt_Block.Value Dosent work, Im not sure if this is possible, if not any ways to get the same result? (Theres more values, but I shortened it for size) Btw, Im accessing BlockType.Dirt.value from anouther class. I only want to get one

Changing a game server platform

爷,独闯天下 提交于 2019-12-12 02:19:24
问题 I'm developing a small multiplayer game, and currently the game server runs in a c# console application. This limits me because: the server gets stuck whenever I even start a text select in the console. If I even accidentally touch the console, the server gets stuck and I'm left shocked that the client is stuck somewhy, whereas it gets timed-out as soon as I right click the console and the select is canceled I'm limited with supplying user input to the server. Say, I want to implement server

XNA Rotate a bone with an offset translation

送分小仙女□ 提交于 2019-12-12 02:16:09
问题 I have a model that has a bone which has a translated offset from the parent bone (it is not positioned at the tail of the parent bone). In Blender, where the model was made, I can rotate the bone and see the attached mesh rotate correctly. However, when I attempt to rotate the bone in my code, it seems to rotate it about the tail of the parent. I'm messing something up in the Matrix math (my worst enemy). Update: protected override void Update(GameTime gameTime) { bone.Transform = Matrix

ResolveTexture2D - The nightmare in XNA 4

淺唱寂寞╮ 提交于 2019-12-12 01:59:21
问题 I have the following declaration: ResolveTexture2D rightTex; And I use it in the Draw method like so: GraphicsDevice.ResolveBackBuffer(rightTex); Now, I then draw it out using the SpriteBatch : spriteBatch.Draw(rightTex, new Rectangle(0, 0, 800, 600), Color.Cyan); This works fantastic in XNA 3.1. But, now I'm converting to XNA 4, ResolveTexture2D and the ResolveBackBuffer method have been removed. How would I re-code this in order to work in XNA 4.0? EDIT So, here is some more code to maybe

XNA and RenderTargets

依然范特西╮ 提交于 2019-12-12 01:35:27
问题 I have a problem with using render targets that I am hoping someone can explain to me. I am trying to use a render target to render some sprites, and then draw said render target onto the normal back buffer 50% opaque (null). It works great, except if I use the target more than once in a draw call, in which case only the last group of sprites will appear on the screen. Here is some psuedo code. // Normal Sprite Drawing. DrawSomeSprites(); SetRenderTarget(CompositeTarget); // These go on the

XNA 3D custom collision method?

丶灬走出姿态 提交于 2019-12-12 01:09:34
问题 Ok, after 10 hours of digging, I've come to the conclusion XNA really doesn't offer good collision support. Here is my problem.. imagine an apartment building in your game world. Wrap it with a bounding box.. rotate it on the Y axis 45 degrees. Now walk around it. If your camera intersects that bounding box.. you cant walk.. Well.. 50% of the bounding box is incorrect, because the box is axis oriented.. Now, use a sphere. A sphere that large, has ALOT of error.. I guess the question is.. how

Updating physics engine ina separate thread, is this wise?

微笑、不失礼 提交于 2019-12-11 23:39:39
问题 I'm 100% new to threading, as a start I've decided I want to muck around with using it to update my physics in a separate thread. I'm using a third party physics engine called Farseer, here's what I'm doing: // class level declarations System.Threading.Thread thread; Stopwatch threadUpdate = new Stopwatch(); //In the constructor: PhysicsEngine() { (...) thread = new System.Threading.Thread( new System.Threading.ThreadStart(PhysicsThread)); threadUpdate.Start(); thread.Start(); } public void

c# how to check if an object is of a certain type

久未见 提交于 2019-12-11 23:37:43
问题 I am just wondering what the process is for checking the object type of something. Basically I have an array of parent objects and I want to check if one of those objects is of a particular child type. more specifically, I want to check if an array of GameScreen objects contains a GameScreen object of type GameplayScreen. GameScreen[] screens = mScreenManager.GetScreens(); // loop through array and check if the object equals gameplayscreen } 回答1: You can check the type using is operator like:

Transferring Texture Across Classes

旧巷老猫 提交于 2019-12-11 20:22:31
问题 (Resizing and LoadContent() ) I want to separate textures by having my Title Screen be in a class and call on it when needed. This would help with neatness but I have only been working with moving sprites across classes and Texture2D is not the same. I have an image 1024X768 and am calling on the image in Title Screen.cs and want to be able to use LoadContent() in Title Screen.cs to load anything with out having to go to Game1.cs to Load the image and come back to Title Screen.cs . Using load