|
-
December 19th, 2007, 11:01 PM
#16
Re: C# 2D Images, GDI too slow, XNA/DirectX/OpenGL???
Ok, I have images drawing in the game projects, and everything works.
Now I need to take this functionality and put it in a regular C# project (The kind that extends Form, not Game).
It seems like the hard part is initializing, the graphicsdevice. Any ideas, or tips?
-
December 20th, 2007, 05:43 AM
#17
Re: C# 2D Images, GDI too slow, XNA/DirectX/OpenGL???
Well I gave with getting it to work in a :Form instead of a :Game, and am porting my app over to it.
Anyways, is there a way to speed up mouse response? I assume it is something in my code. Is there a standard way of doing it? I click a button, and it takes about 1seconds to reflect a change. The screen is being updated in 1ms at most and quite often. So I think it is the actual mouse event capturing.
I am creating a system.windows.form.form from the handle pointer of the game class. From there I can change the formborderstyle, and such. So I setup .mousedown and .mousemove events on that form, but they seem to have a delay.
Bettery ways?
-
December 20th, 2007, 07:32 AM
#18
Re: C# 2D Images, GDI too slow, XNA/DirectX/OpenGL???
Why not manually handle where the mouse is on the screen? Xna doesn't really have events but in the update method you could check where the mouse is and if the button is down.
Also, I thought I heard someone from the Xna team discussing a way to put a game onto a form. Try searching for it as it may be a new feature of Game Studio 2.0
-
December 20th, 2007, 05:25 PM
#19
Re: C# 2D Images, GDI too slow, XNA/DirectX/OpenGL???
It is definately not "supported" at all! You can create a graphics device and it seems to work, but nothing displays...
Perhaps I didnt override the Onpaint command correctly.
Anyways, there are no actual buttons as defined by system.windows.form. They are images of buttons as Texture2D painted onto the XNA layer. Then I use the mouse to check the bounds of the button and the position of the mouse.
It just seems much slower that I thought it would be. Everything is really fast, but the button changing visual appearance to reflect being clicked is slow... really slow.
If I try to draw a real button on the xna device with a transparent back colour, it just shows black, not the XNA background. So this is why I need to do everything in the XNA area.
Also regarding text, is the only way to do it via images? Is there really no way to draw text?
-
December 20th, 2007, 06:20 PM
#20
Re: C# 2D Images, GDI too slow, XNA/DirectX/OpenGL???
 Originally Posted by 2k1Toaster
Also regarding text, is the only way to do it via images? Is there really no way to draw text?
Drawing text is very simple. In the early betas, there was only TextureFont so you had to use images but you can use a SpriteFont instead.
Just add a SpriteFont to your project, open it and adjust the font name, size, and style. Then you import it with the content and you can use the DrawString method of a Spritebatch.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|