xna

How to know if a phone running a XNA application has a keyboard?

Hello, For the purpose of a game which must respect MS' TRC, I need to know if a phone has a physical keyboard to handle it. How can I know it? Here is an integrated function which permit to know it? Thanks, KiTe ...

Does array resizing invoke the GC?

Hi, I looked into the implementation of Array.Resize() and noticed that a new array is created and returned. I'm aiming for zero memory allocation during gameplay and so I need to avoid creating any new reference types. Does resizing an array trigger the Garbage Collector on the previous array? I'm creating my own 2D array resizer, but ...

How to perform a Bitwise Operator on a byte array in C#

Hello people, I am using C# and Microsoft.Xna.Framework.Audio; I have managed to record some audio into a byte[] array and I am able to play it back. The audio comes in as 8 bit unsigned data, and I would like to convert it into 16 bit mono signed audio so I can read the frequency what not. I have read a few places that for sound sam...

Drag/Swipe to scroll the screen

What would be the best way to have a vertical scrolling screen? My game will consume two screens high, the user should be able to move between the two screens by a simple drag or swipe action. The background is not tiled and sprites will be placed on it. What would be the best way to go about such screen management? ...

Installing XNA Game Studio in Visual Studio 2010

So I'd like to try out XNA Game Studio, but although the last stable version seems to be 3.1 (I am not sure about this), it's asking me for Visual Studio Express 2008 (I'm using a full Visual Studio 2010). How to solve this issue? Must I install the XNA's 4.0 beta? I can't find a place to download it. Thanks ...

dynamic xna video playback speed?

When calling getTexture from a video object in XNA 3.1 you get the current frame of the playing video based on how much time elapsed since the video started to play. However, I need to play back the video while changing the playback speed dynamically based on the players actions. I wonder if there is a way to play back the video at a f...

"Realistic" collision in pong

I want to write a pong in C# and XNA with friction and bounce. I tried to implement the collision as described by Garet Rees in a previous question. Here is the basic algorithm I use for pong: Seperate the colliding objects so that they are no longer colliding. Get the surface normal for collision response. Compute the new velocity - ...

How to see scaling matrices from a geometric perspective

I'm using XNA but it doesn't matter too much for this example. So let's say I have a sprite. I then apply a scaling matrix before anything. Is the scaling matrix applied scaling the local axis of the sprite or just moving the points down? In other words, is applying a scaling matrix of 0.5f in the world space to my sprite at the world or...

Recording a live video stream in C#/XNA

Hey everyone, I have a project that renders the web cam stream onto a texture. I was wondering if there was a way, either through DirectX's Audio/Video functionality or through XNA directly where I can record the stream into an avi file format? Thanks in advance for the help. ...

C#: UDP Socket - Receive data with unknown size

Hi, i use a UDP-socket for sending/receiving objects. I serialize the objects into a byte array send it and receive it with a client. But before i can receive i have to allocate a byte array. I must do it before and then handle the Socket.Receive()-methode the array. But my objects have a variable length. How can i discover the array-si...

XNA - Getting mouse coordinates with a 2d Camera system with rotation/zoom/translation

I have a 2d Camera with this translation matrix: Transform = Matrix.CreateTranslation(new Vector3(-Position.X, -Position.Y, 0)) * Matrix.CreateRotationZ(Rotation) * Matrix.CreateScale(new Vector3(Scale, Scale, 0)) * Matrix.CreateTranslation(new Vector3((GraphicsDevic...

Moving a 3d camera on XNA

Hello, Im doing some practices on XNA, and i created a class that represents a Camera. My objective is that when the user press some keys make a translation of the camera (not the target) 90 degrees in the X axys (to see an object that i placed in the scene from different angles). By the moment i move the camera in X, Y, and Z without...

XNA, occlusing culling and collision detection

I've put together a quadtree/BSP hybrid prototype to test collision detection and occlusion culling in the engine for an XNA game I'm putting together. As I understand it, one of the optimizations that hardware acceleration gives us is the ability to store vertex and index lists on the card, so that calls to draw the associated geometry...

XNA Window Resize Invokes LoadContent

Hi, Anytime I resize my XNA Window to the smallest possible resolution (0 pixels high) the program starts invoking LoadContent again which causes my app to crash (since I only want it to load content once). What can I do, is there a way I can stop the user from resizing my window too much (such as setMinimumSize in Java). Or is there an...

Xna 4.0 3D Vertex example

Hello, I'm currently trying to make a simple square by combining two triangles, like in the tutorials by Riemer (Link to tutorial), but since a lot has changed from 3.x to 4.0, I find it difficult. I would also like to know how to texture this "square", so if anyone could help me by giving some example or whatsoever, I would appreciate ...

Static abstract methods in C# (alternatives for particular use case)

Like a lot of C# programmers, I eventually found myself in need of what would essentially be static abstract method functionality. I'm fully aware of why it can't be done, and it makes sense, but I'm in need of a workaround. I'm working on an XNA game, but the problem doesn't involve too much XNA code, fortunately. I have an abstract ba...

Set constant when compiling in C#

Hi, I am using XNA 3.1 to develop a small game and I want to add the following two features: 1) Increment the build value every time I compile 2) Set the date/time of compilation I want to be able to set the Date/Time of compile in the Window Title (like Crysis) I found this but I need more details. I am using Visual Studio 2008. Tha...

XNA Initialize in Game only called once?

Hi, I know that LoadContent and UnloadContent have a chance of being called more than once. However I am wondering if Initialize will have a chance to be called more than once. The documentation doesn't really go into this. Or is it better to do most of my "initialization" in the constructor? Thanks, ...

Xna many mouse buttons

Hi, How can I get information about additional mouse buttons in xna. For instance, I know I can use MouseState to check if the regular three buttons are pressed but how can I take advantage of something like the G5 or Naga mouse which have more than just three buttons? Thanks, ...

XNA MediaPlayer.Volume setter being extremely slow

I've recently added audio to my game loaded under the "Song" class from the XNA framework. Everything seemed to work fine, until I decided to add the possibility to change the volume of the song, using the MediaPlayer.Volume setter. However, when I try to change the volume for the first time, it runs really slowly(like 3 to 4 seconds, ...