xna-4.0

XNA game performance

穿精又带淫゛_ 提交于 2019-12-02 15:59:10
I am writing a game using C# 2010 and XNA 4.0. I want it to be a good game and not some "just another crap" and so one of my goals is good framerate. For this I would like to ask you for some advices, be it XNA related or C# related - what can I do to speed up my code and so improve FPS. Here is some stuff I found out: (c#) using array insted of list<> will improve performance a lot, in case you want to access huge amount of data (or even lots: having an array of 20000 items gave almost 180% FPS of list of 20000. (c#) using for instead of foreach will improve performance. On same 20000

XNA 4.0 cannot create an AudioEngine

本小妞迷上赌 提交于 2019-12-02 11:16:22
This question is a derivative of this one: Creating XNA AudioEngine on windows game project I am working from the same book, and have the same problem as the original question. The solution provided by Andrew doesn't work as doesn't exist as well. I am unable to use AudioEngine class in my project. I have tried adding this using statement: using Microsoft.Xna.Framework.Xact; I'm not sure what to do. Make sure you have the reference to Microsoft.Xna.Framework.Xact.dll In Visual Studio, in your Game project, right click on References folder -> Add Reference Select Browse tab, and navigate to

how to use skeletal joint to act as cursor using bounds (No gestures)

核能气质少年 提交于 2019-12-02 10:35:45
I just want to be able to do something when my skeletal joint (x,y,z) coordinates are over the x,y,z coordinates of the button . . I have the following code but somehow it doesnt work properly . .as soon as my hand moves it will do something without my hand reaching the button if (skeletonFrame != null) { //int skeletonSlot = 0; Skeleton[] skeletonData = new Skeleton[skeletonFrame.SkeletonArrayLength]; skeletonFrame.CopySkeletonDataTo(skeletonData); Skeleton playerSkeleton = (from s in skeletonData where s.TrackingState == SkeletonTrackingState.Tracked select s).FirstOrDefault(); if

xna 4.0 and loading images fails

守給你的承諾、 提交于 2019-12-02 09:27:18
问题 I'm trying to load png images into my game, but for some reason it can't find the images. This is my Title screen that is trying to load the images: public TitleScreen(ContentManager contentManager) { titleScreen = contentManager.Load<Texture2D>("gfx\\titleScreen"); bgScreen = contentManager.Load<Texture2D>("gfx\\bgScreen"); arialFont = contentManager.Load<SpriteFont>("Arial"); } Here I'm setting the root directory for the content: Content.RootDirectory = "Content"; When my program hits

Rotating objects attached to other objects

丶灬走出姿态 提交于 2019-12-02 04:20:29
I have a question concerning a single mesh (building) that contains a collection of animated objects (these objects make up the complete building, rising up from the ground when it is constructed, at different speeds and rotations). The animated objects in the mesh all have their own position and rotation animation tracks. I export it from 3DS Max as an ASE, convert it into a properietary format andd use it in my gaming engine. So, at the moment, I can successfully display the animated positions of all of the animated objects in the mesh. Doing the following: The scale, rotation and

xna 4.0 and loading images fails

落爺英雄遲暮 提交于 2019-12-02 03:20:35
I'm trying to load png images into my game, but for some reason it can't find the images. This is my Title screen that is trying to load the images: public TitleScreen(ContentManager contentManager) { titleScreen = contentManager.Load<Texture2D>("gfx\\titleScreen"); bgScreen = contentManager.Load<Texture2D>("gfx\\bgScreen"); arialFont = contentManager.Load<SpriteFont>("Arial"); } Here I'm setting the root directory for the content: Content.RootDirectory = "Content"; When my program hits titlescreen, it fails to find the image, however the path to it is correct and the images are also set to be

Mouse event wont update camera rotation in winforms

南笙酒味 提交于 2019-12-01 12:22:50
My app has a custom panel used to display the XNA screen within a WinForm. I've currently displayed a test model with no problem and now working on camera movement. My camera is a Free Camera (not bound to look at any specific target), but I've been having trouble getting the mouse to update the yaw and pitch of the camera on its own axis. I thought maybe something was wrong with my update method, but that wasn't the case, because the camera updates moving forward and backwards using KeyboardState . But I have no idea as to why the MouseState isn't working. FreeCamera.cs using XNAButtonState =

Mouse event wont update camera rotation in winforms

不打扰是莪最后的温柔 提交于 2019-12-01 11:27:35
问题 My app has a custom panel used to display the XNA screen within a WinForm. I've currently displayed a test model with no problem and now working on camera movement. My camera is a Free Camera (not bound to look at any specific target), but I've been having trouble getting the mouse to update the yaw and pitch of the camera on its own axis. I thought maybe something was wrong with my update method, but that wasn't the case, because the camera updates moving forward and backwards using

XNA Handling a Combination of key presses

烈酒焚心 提交于 2019-12-01 09:25:11
I have read though a a few articles dealing with this however after attempting to implement a few, a always get the same issue, quick note: This Is Home Work I'm recreating Super Smash Brothers(N64 style) for my game design class, using XNA. now i have 2 issues that are closely related anyone familiar with SSB will know of combo attacks i.e. press "Forward A", "Up B", etc. i have a currently working Yoshi and you can sometimes even get his combos off, however the main issue I'm finding is that unless the keys are pressed at the exact same moment another move i.e. for Up A, jump will go off

XNA Handling a Combination of key presses

梦想的初衷 提交于 2019-12-01 07:10:26
问题 I have read though a a few articles dealing with this however after attempting to implement a few, a always get the same issue, quick note: This Is Home Work I'm recreating Super Smash Brothers(N64 style) for my game design class, using XNA. now i have 2 issues that are closely related anyone familiar with SSB will know of combo attacks i.e. press "Forward A", "Up B", etc. i have a currently working Yoshi and you can sometimes even get his combos off, however the main issue I'm finding is