Answer Questions
kawing0510 how to find elapsed time?
Is there a Windows and Xbox 360 way that I can get the elapsed time between two events For instance, I want to find the ammountt of time the user waited between two mouse clicks. It could be 200 ms, or it could be 5620 ms. I don't need the code for mouse clicks, etc. I just need to know how to get the total elapsed time in milliseconds since the last time I asked for it. Much like getTickCount in the win32 api. Thanks! Ah, that's it! thanks. You could save the gameTime.TotalGameTime.TotalMilliseconds value at the first click, and then when the user clicks a second time, subtract the total milliseconds current from the saved saved value. if(firstClick) baseTim ...Show All
Vani M Creating a terrain using ContentPipeline and XmlImporter (or a custom importer / processor)
Here's my situation: I want to create a text file describing terrain attributes, like heightmap file (raw or an image format), colormap, detailmap and splatting maps. Only the heightmap file and format will be required in this file, so the colormap, detailmap and splatting maps are optional. I then want to add this file to my XNA game project and have it pack a .xnb file containing this data. Ideally, when I do this in my game's LoadContent method: Terrain t = contentManager.Load<Terrain>(@"Content\Terrain\Test"); I should get the terrain object back ready to use, with whatever options I set in it. I couldn't get custom importers and processors to work, so I'll come back to that later, but I did get XmlImporter working with ...Show All
Matt Fraser Getting adapter format BEFORE device creation?
I have a fairly simple problem. I'd like to see if the screen is wider than 1280 or not, before deciding on a 1280x720 backbuffer or a 1024x640 backbuffer. The latter will make the game (in windowed mode) work better on 1280x800 or 1280x1024 displays, which are pretty darn common these days. (Meanwhile, for Xbox, I'll just hard-code 1280x720) However, when I create the graphics device manager inside the constructor of my game, I can't seem to actually read the current display mode / adapter format in any way, because they are all NULL. So, to get this data, I have to create the device first. But to create the device, I have to first get the data. Catch 22! I'd prefer not to have to resort to P/Invoke -- is there a way to do this within pla ...Show All
ahmedilyas Possible bug? - Textures and Source Areas
Hi, I've been experimenting and trying to draw a 2D texture (using a sprite batch) to the screen. Now I've specified a source rectangle for the texture - which is at (x, y) and of width & height 1x1. So essentially a single pixel from the source texture, which is RGBA (0, 0, 0, 255) i.e. solid black. When I render this and specify a destination rectangle, what's rendered seems to take into account the pixels either side of the source rectangle - which are RGBA (0, 0, 0, 0) i.e. transparent black. Now this seems to me slightly illogical or at the least counterintuitive - that pixels *outside* the source rectangle should affect what's being drawn! Well, if someone could explain this to me I'd appreciate it very much, or perhaps confir ...Show All
Mjoyner24 XNA Capabilities Viewer
If you come from DirectX to XNA you may know the CapsViewer that is part of the SDK. As the XNA framework is based on DirectX the caps are valid for XNA too. Naturally the DirectX version uses the DirectX names for everything. As many things like the surface formats are renamed for the XNA framework it could be hard to use the DirectX Caps Viewer for XNA. Therefore I have written a small viewer which shows the capabilities of your graphics adapter(s) using XNA identifiers. Download I will provide the source later (needs a little cleanup first). This works well, thanks. It's particularly useful for those of us without much of a DX background. ...Show All
Yuki Chen debug drawing
hrmm how are people handling not being able to draw lines Previously i've extensively used line drawing (in opengl at least) for debugging purposes, but now dx10 is all shader driven i cant do this can i what methods are you using for debug drawing currently i load up the opengl version of my engine to see debugging then load up the dx10 version to see what it looks like under dx10, but this is annoying :-/ thx for the tips, still would be nice for something like: ID3DX10Line to exist just in case something goes seriously wrong. I am not sure about what API feature you are talking here. Line drawing is still supported as primitive topology ( D3D10_PRIMITIVE ...Show All
barkingdog Another 2D Shooter
After creating the pong game using David Bailey's tutorial (thanks!), and having created most of the shooter using GDI+ in VB already, I figured I may be able to control the XNA pong's paddle with the keyboard/gamepad and maybe even shoot the ball from the top of the paddle. Turned out to go a lot smoother than I expected so I finished somewhat of a first level. www.3dnuts.com/xna/shooter1.jpg www.3dnuts.com/xna/Shooter_0_8_0_3.zip Use spacebar to fire, arrow keys to move, or use XBOX 360 gamepad to move and A button to fire. P to pause, Enter to start new game when 'game over'. It's my first C# app so I'm sure I've done a lot of don'ts, I'll post the project/code within a day or two, need to clean up and comments some sec ...Show All
sarathy Change the color of a mesh?
I'm currently using a simple mesh created in 3ds. I changed the color and exported several times until I had a rainbow of colored objects. This seems silly to me, but it got me moving along at the time. I would like to progress beyond this and be able to be able to change the color in code. I realize the answer to this might involve textures and/or lighting, so if the answer is not straightforward, could you at least tell me where to begin Do I need to create multiple textures and swap between them Thanks! Greg If you are not using textures, a simple way is just to use the BasicEffect class. BasicEffect effect = (BasicEffect)model.Meshes[0].Effects[0]; then enable default lighting, and change the ...Show All
thedo Rotation help
I think I'm being dense today, but I can't figure this out for the life of me. I have a model that I want to rotate across the X and Y axis. My issue is that when I rotate across the Y axis, I always want the rotation to occur as if the axis was vertical in terms of world space. If I multiply by my X rotation first, obviously the Y axis moves with it, so rotating about the Y axis will rotate it about its transformed axis. If I multiply by my Y rotation first, the X axis moves with it, so my X rotation is now turned along with it. I basically want to rotate downward and then left/right independently from what the actual transformed axes become...or, rotate left/right and then downward independently. When I rotate about the X, it shoul ...Show All
Charles Cox - MSFT Direct X 7 Direct Draw alphablending
Hello, I'm currently using Direct X 7(Direct Draw) & VB 2005 Express. I've already encountered some problem and solved it, and this might be the last question needed to accomplish my work. By Jack's help, I've found DirectX4VB.COM which has several useful examples and descriptions. But since it has based on VB 6, there were several techniques unappliable under VB 2005. Especially alphablend( - I really need this technique to fade in-out a surface)function. It contains following reference declaration and it requires custom DLL. is there any easy-alphablend or gamma-control(for only specific surface) example or description for DD7 I appriciate your kind answer. I've looked into several DD7 alphablend samples coded by C, but ...Show All
dotnetwizkid Will there be a Beta 2 of framework?
Will there be another beta of the framework I'd love to get started on converting my existing code to XNA, but there are currently enough deal-breakers to make me wait and see if the fixes turn up. Andy. They don't even have to call it a beta call it RC1 and maybe what Z Man said about the content pipeline is why I have not really touched 3D yet (funny never touched 2D in MDX) This is a link to the connect suggestion: https://connect.microsoft.com/feedback/ViewFeedback.aspx FeedbackID=194079&SiteID=226 (need to be logged in first) The ZMan wrote: It would also be nice for people to be able to test and give feedback on the content pipeline. Agreed - although I assum ...Show All
strix Trying to pass a cubemap.dds to a fx shader
I have been playing with these shaders: http://msdn.microsoft.com/library/default.asp url=/library/en-us/directx9_c/Goal_3___Environment_Mapping.asp and I have got these shaders up and working in my engine, with the exception of 3 and 4, they light my model correctly, but they don't seem to be rendering the cube map I am giving them. The shader manages the cubemap like this: texture EnvironmentMap < string type = "CUBE"; string name = "lobbycube.dds"; >; samplerCUBE EnvironmentSampler = sampler_state { Texture = (EnvironmentMap); MipFilter = LINEAR; MinFilter = LINEAR; MagFilter = LINEAR; }; I load the cube map like this: private TextureCube myCube; myCube = myLoa ...Show All
pmanisekaran Need assistant in volume texture
I'm still new in directx programming and quite dont understand with the volume texture. I've been learning directx programming with the example given by microsoft itself. it does quite a lot of things but lack of documentation. Straight to the point, i dont understand this chunk of code: { D3DLOCKED_BOX LockedBox; hr = m_pVolumeTexture->LockBox( 0, &LockedBox, 0, 0 ); if( FAILED(hr) ) return hr; for( UINT w=0; w<16; w++ ) { BYTE* pSliceStart = (BYTE*)LockedBox.pBits; for( UINT v=0; v<16; v++ ) { for( UINT u=0; u<16; u++ ) { FLOAT du = (u-7.5f)/7.5f; FLOAT dv = (v-7.5f)/7.5f; FLOAT dw = (w-7.5f)/7.5f; FLOAT fScale ...Show All
rabi Sprite Assets
I havn't gotten around to trying xna yet as im still learning c# in my spare time. I was just wondering how people create there sprite assets, ie say your creating a space game do you use any specific software to create the ship then save it as an image file. Im pretty good with photoshop but drawing small sprites could be tricky is there any good apps designed to aid creating sprites Also is there a package which helps animate small sprites , say you want to create something exploding, I take it you would need different sprites for each part of the animation Thanks for the info, I was mainly interested in 2D for the time being so I'll check out that pro motion. & ...Show All
Michael Herman - Parallelspace Plain ContentTypeReader
Hi I have been reading through the forum for hours now and there is something I do not quite understand: Any class that is required for readers comes from Microsoft.Xna.Framework.Content.Pipeline. This library is not available for the Xbox 360, thus leading me to the conclusion that it is currently not possible to write a custom ContentTypeReader for the Xbox 360. Is that correct My other problem is that I do not want to write an importer as I use an application to compile my models. I only want to write a ContentTypeReader to load it into XNA at runtime. Is that possible without utilising the ContentTypeWriter.GetRuntimeReader function cheers Daniel Thanks, that explains a lot :) I got it working now. ...Show All
