Answer Questions
adroit_91 No text input in WinForm controls
I am putting some WinForm controls on the Game's window, like this: protected override void Initialize() { // TODO: Add your initialization logic here TextBox t = new TextBox (); Form f = ( Form ) Form .FromHandle( this .Window.Handle); f.Controls.Add(t); base .Initialize(); } This works fine for Buttons etc., but entered text does not show up in a TextBox. Not using Keyboard.GetState() does not help. I suppose that the game window consumes all keystrokes and does not pass them to the controls. Any help Thanks, Leaf. I tried as you suggested, and used a separate "floating" form for my GUI: static void Main( string [] args) { using ( F ...Show All
.Adrian Flash Movie in fullscreen Direct3D game
n VS2005, i need to embed a SWF flash movie in a fullscreen Direct3D 9.0 based game. I have successfully added my swf(which was painful) and played the movie without problem. But, when I tried to switch the display from SWF flash move to Direct3D device. It failed! The followings illustrate the general flow of my problem: 1. load and display the SWF 2. user press space to start game (SWF get focused and read space bar), set SWF invisible by AxShockWaveFlash1.visible = false 3. start game, render Direct3D 4. game ended, stop rendering Direct3D 5. show the SWF movie again, set SWF visible by AxShockWaveFlash1.visible = true, focus SWF Problem raised from Step 4 to Step 5. This problem do not exist when I am not using the ful ...Show All
Puffarbubbole First Community Sample
We would like to announce our first community sample provided by Matthew Clever. Matthew demonstrates how to poll mouse input and then uses that input to make a cursor on the screen. http://www.xnaspot.com/Sample_Mouse.aspx As always we love to hear from you. Please email us Submit@XNASpot.com . Also if you have any sample code or tutorials you would like to share please send them in. Thanks That helped me out some, using that same principal, I've figured out a rather simple way of catching keyboard input. For the sake of supplying the community with information, and samples. Here is the code I have used, I hope this helps somebody //Declare the keyboard state yo ...Show All
Burt Harris Rendering To Textures in Beta2
I used Texture2D's heavily with the usage RenderTarget, however in Beta 2 its like a whole new API. I understand that Surface no longer exists and RenderTarget/2D should be used. The problem is, the whole mentality is backwards compared to what im used to. From what I see I should create a RenderTarget2D and set that as a render target, then do rendertarget.GetTexture() if I want to set it. Thats fine. However, how do I copy between render targets There is no StretchRect or equivelent function I can see, which I used alot before. Surely I dont have to go about getting a texture, setting it, creating a 'copy' effect, setting a new render target, resolving the new render target just to copy from one to another Is there no alte ...Show All
NeoBugs Disposing Resources?
Hi, I've been working on a few game components in my XNA project but I've become curious what is the correct way to dispose of resources that the component loads I load these resources either in LoadGraphicsContent or a load method of my own, but when the component is disposed, UnloadGraphicsContent is not called. I assume UnloadGraphicsContent is only called when the graphics device is reset. Now, the question is, where to I dispose my resources (spritebatch, textures, IO streams) - in the Disposed event If so, how can I detect whether the class is disposed and throw ObjectDisposedExceptions when a public member handling a resource is attempted to be accessed Thanks in advance for any help... Alex Ah ...Show All
Mike Batton Accessing the game window properties from within an object???
I'm working on a simple 2D game (Asteroids clone) where objects are flying into and off the screen. The player shoots at these as they pass through the screen. Blah, blah blah... What I need is for these 'targets' to recognize when they have left the game window and I need the factory that creates them to know the size of the window so it can put them in at random off the screen, point then towards the screen, then send them on their way. My question is: Is there a way to access the game window properties from within an object without passing the window into the constructor of those objects The info in this thread answers your question, I believe. Looks like there may be something in the GameServic ...Show All
EvilOneSD DreamBuildPlay is up!!!
Now go register!! Actual contest details to come the week of Feb 5th No Tennesee either... Count me as registered!!! Whoo Hoo! I don't really know any valid zipcode and phone number for the US, nor any address for that matter. Thanks for the advice, anyway! I guess I'll just have to wait until they fix this. uphhh....they turned this piece of junk off. M$ please keep pro. I guess NEW JERSEY isn't in the United States, I swear to god it isn't in the list of states... :( More missing states... North Dakota, New Jersey, and Vermont are all missing... ..jeez whoever designed the we ...Show All
Trisk2 DXGI_USAGE_BACK_BUFFER <-> DXGI_USAGE_RENDER_TARGET_OUTPUT
Currently I specify in D3D10CreateDeviceAndSwapChain() in the buffer usage the DXGI_USAGE_RENDER_TARGET_OUTPUT flag. If I specify the DXGI_USAGE_BACK_BUFFER flag I get an error message. What is the difference between those two flags Isn't a back buffer not a render target ... I can't think of anything that makes a back buffer so special to give it its own flag :-) Enlighten me please, - Wolfgang Hi Sam, thanks for your help. What do you mean with scan out - Wolfgang Hi Wolf, Scan out is an old nick name for buffers that can be presented and seen by the user. Comes from the old days of RAMDACs and CRTs which would 'scan' the memory in horizontal lines (and t ...Show All
twolfkg Is texture shader access available?
I've been looking for the Xna.Framework equivalent of Managed DirectX's TextureLoader.FillTexture and can't seem to find it. Does it exist Is there some other way to access texture shaders from XNA Should I request this feature Thank you for your reply. I have submitted a request for texture shader support. However if there is no way to provide it, I will look into using Render-To-Texture or locking the texture(get/set data in XNA) and filling in the values myself. It would be great if there were some way to do this completely on the gpu though. - Midnight_Conjurer This post explains the website for submitting official feedback and requests: http://forums.microsoft. ...Show All
Dennis Mulder - dennismulder.net Using additive blender on the fly in a SpriteBatch (possible bug)
Hello, I'm trying to draw some sprites of a 2D sidescroller with an additive blender, like the "burn" effect of a rocket. However the SpriteBatch.Begin() method takes a single blending effect and has no way of changing it "on the fly" during the batch. So how can I procede to achive the desired effect Ending/Beginning the batches everytime I need the additive effect is not practical at all... I've searched on this forum and I've found this topic about the subject: http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=976132&SiteID=1 Which suggest the use of graphics.GraphicsDevice .RenderState.SourceBlend = Blend .SourceAlpha; graphics.GraphicsDevice .RenderState.DestinationBlend = Blend .One; with a SpriteSo ...Show All
JohnFromNwPA Programs used to make .bmp files and such?
I was wondering what programs people use to make the .bmp files and other image files for their heightmaps and stuff. Please dont say Adobe Photoshop as one, I have GIMP where that comes in. but any other program names will be very helpful, thanks OK, you are forgiven :-) Not sure what search terms would find the threads, but unfortunatly a lot of people do not search for stuff in advance so we always warn when there are repeats. My apologies. If you are painting a new picture as opposed to adjusting an existing image, then you could paint it in black and white directly if you want. If you are converting an existing image and your goal is to make a height map, the grayscale conversion may work ...Show All
Tom_Liu Controlling Game By MIDI
I'd like to be able to control directx games via MIDI - eg use a guitar footboard that has a pedal and switches etc to generate game controller events. All the vaguely related references I've found on the web are for using directx controllers to generate MIDI events! I want to use MIDI events to generate the equivalent of key presses, mouse buttons or (say) a throttle control. Are there any drivers that do this already If not, how difficult would it be to roll my own, and what would it involve I'm quite competent at C/C++ etc but most of my experience is in an embedded environment, not Direct X. Thanks, Chris Thanks for the pointer. I've written some custom PCI drivers for NT4/Win2k and a custom IPS ...Show All
Nordsee Relative mouse pos
Mouse.GetState(); Returns absolute position, for x, y and mouse wheel. That is cool But also it should return relative position like DX and DY and DWheel. Like DirectInput does. We've made several improvements to Mouse since Beta 1, but the value it returns are still absolute. Kobingo wrote: Then I have to calculate the relative position myself (relativePosition = oldPosition + newPosition). If the mouse cursor already is at X=0, then my game code won't respond to the mouse when dragging it to the left. (relativePosition = 0 + 0) = (relativePosition = 0). You can get the relative mouse movement by reading the mouse position as an offset from the centre of the game wi ...Show All
Kevin Hoffman all in one shader = better performance?
Again a question from an unexperienced user who wants maximum performance ;) I draw really a huge number of vertices and started with a simple position/normal/color vertex declaration, which worked fine. It allowed me to draw anything in just very few indexed vertices batch calls (about 20) Now I want to use some textures, too, to give the whole scene more life.I was looking at some of the normal approaches: you pass the texture to the shader and draw all vertices using this texture, switch the texture and or effect and draw the next batch, the vertex declaration would change to a position/normal/texture/(probably)color combination. As far as I can tell, if I would use 20 textures, this would in the worst case increase the number of ...Show All
UppyJC Collisions for user controlled sprites
I've looked at every post I could find for sprite collision but all of them seem to assume a sprite with a given velocity (already in motion) I have written the code to display two sprites. They are controlled by two different sets of keys on the keyboard (awsd, arrows) They finally rotate and move along their vectors like I want them to (that took two days for me to figure out, lol), but I can't figure out how to keep them from going off the screen and going through eachother. All of the examples that reverse direction on collision are useless to me as my sprites move a set number of pixels per keystroke (or held key per update loop). I need help figuring out how to tell them that they cannot rotate or move in a direction wher ...Show All
