xna

Visual Studio Intellisense not showing some classes

江枫思渺然 提交于 2019-12-06 07:34:12
问题 My Visual Studio is not showing a lot of the available classes in the IntelliSense auto-complete. For example, a project I'm working on has a reference to the Microsoft.Xna.Framework namespace, yet even after adding the using statement using Microsoft.Xna.Framework in a file, IntelliSense is unable to recognize classes like Texture2D and Rectangle . I can still type them in, however, without getting a compiler error. Any idea what's happening? The IntelliSense detects standard libraries like

C# HashSet2 to work exactly like the standard C# HashSet, not compiling

人走茶凉 提交于 2019-12-06 07:27:51
I'm creating my own HashSet that works as the standard HashSet, using a Dictionary. I'm doing this because C# for XNA XBox doesn't support HashSets. This code is based on code from an example I found. I've edited the example to fix some of the problems but it still won't compile. public class HashSet2<T> : ICollection<T> { private Dictionary<T, Int16> dict; // code has been edited out of this example // see further on in the question for the full class public IEnumerator<T> GetEnumerator() { throw new NotImplementedException(); } IEnumerator<T> IEnumerable<T>.GetEnumerator() { return dict

Unable to reference microsoft.xna.framework.media.phoneextensions.dll

谁都会走 提交于 2019-12-06 07:21:28
I am trying to follow this answer to add some audio files to the windows phone emulator's media library. But I get the error The type or namespace name 'PhoneExtensions' does not exist in the namespace 'Microsoft.Xna.Framework.Media' (are you missing an assembly reference?)` I am unable to reference microsoft.xna.framework.media.phoneextensions.dll as it is not present at the location C:\Program Files\Reference Assemblies\Microsoft\Framework\Silverlight\v4.0\Profile\WindowsPhone71 I installed Microsoft XNA Game Studio 4.0 but still could not find the dll in the system folders. I tried but

Getting Acces to Other Classes Variables

穿精又带淫゛_ 提交于 2019-12-06 07:20:18
I'm working on a pong game, since i'm new at programming, i don't know how to get acess to another class variable. I have seperate classes, green and blue paddles, a ball, and game1.cs. I control the ball movement with bool movingUp, movingLeft; It bounces off the borders of the screen, but i don't know how to make it work with the paddles. Basically, how do i check the position of the paddle, and make so when the ball touches the paddle, it bounces off? I mean, how to detect the collision? public class Ball { ParticleEngine particleEngine; GraphicsDeviceManager graphics; Texture2D texture;

XNA game components

我的未来我决定 提交于 2019-12-06 06:50:42
I an confused about how to pass values of variables from 1 gamecomponent to another. I am using xna 4.0. I created two gamecomponents, the drawstring and the inputmanager. I want to read the keyboard input of the user and pass it onto drawstring where it will update the position. I cant add components on drawstring(drawablegamecomponent). I can do it on class but not on gamecomponent. Can you guys post some examples here. For beginners. Use GameComponent for something that you would want to have Update called on every frame, and use DrawableGameComponent for something that you would want to

XNA screenshot shows pre-Bloom, not final render

五迷三道 提交于 2019-12-06 06:43:40
问题 I have a windows platform game coded in C# XNA 4.0 using the Reach graphics settings. My project is based on the GameStateManagement sample but I later added Bloom and spriteSheet/spriteBatch functionality to it. I desire to have a screenshot saved of the final screen output. However, when I save my screenshot it only shows the render before Bloom was applied and before my HUD text is displayed (which I draw after the Bloom). I have my screenshot saved at the end of my Draw method, after

What are my options for 2D games on Windows Phone 8?

有些话、适合烂在心里 提交于 2019-12-06 06:29:43
问题 So I've been playing around with XNA and after all this time, I finally made a game that's worth buying! And to my surprise, I see this on MSDN: XNA Game Studio 4.0 apps that target Windows Phone OS 7.1 remain fully supported and continue to run on Windows Phone 8 devices. •You can continue to develop and maintain new or existing XNA Framework apps that target Windows Phone OS 7.1. •You can’t upgrade existing XNA Framework apps that target Windows Phone OS 7.1 to target Windows Phone OS 8.0.

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

我们两清 提交于 2019-12-06 06:05:22
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); } Cheers, Dave EDIT : This is what I have come up with and seems to work, but could it be done faster

Drawing a textured cube with multiple sides in XNA 4.0

房东的猫 提交于 2019-12-06 03:51:20
问题 I have been banging my head against this problem for hours now. What I want to do is draw a cube, with different textures on each side; or more specifically, I want to be able to specify whatever texture I want per side. I used the example here to start with, and then attempted to develop it further, so I could have more than one texture. However, no matter what I do, it still only uses the last texture that is applied to the effect, and pays no heed to any previous assignments. Here is my

get a class without a lot of if statements

若如初见. 提交于 2019-12-06 03:45:48
I have a certain amount of classes which inherit from an abstract class: abstract public class baseClass { //logics } public class child1 : baseClass { } public class child2 : baseClass { } now I've got some management class which will have to create one of these classes depending on a enum which will have as value the same name so like this: public enum ClassType { child1, child2 } public class Manager { private List<baseClass> _workers; public void Initialize(ClassType type) { //what logics to put here? (resulting in correctChild) _workers.Add(correctChild); } } I was thinking of typeof but