Vankwysha
Squire
Australia
43 Posts |
Posted - Jul 28 2005 : 04:49:51 AM
|
I've almost finished writing my 2D graphics DLL and it's working to about 95% effectiveness so far. I'm using Direct3D.Texture and Direct3D.Sprite objects to render my 2D graphics, and it's working like a charm.
However.
There's still a couple of things that I want to do, and I haven't been able to find any simple ways to do them.
1) Rotation. Is there any way for me to rotate my Direct3D.Sprite without having to use all that complex meshes and matrices stuff (which I don't understand)? If not, I would appreciate some explanation of how that works.
2) Drawing simple stuff. I want to be able to draw simple 2D graphics such as lines, triangles, rectangles etc. I think i read something about triangle fans or strips or something, and I would also like to know if there's a simple way to do this, or if not an explanation.
Many thanks. |
|
Lachlan87
Moderator
USA
160 Posts |
Posted - Jul 28 2005 : 09:26:48 AM
|
When you draw your sprite, there are 7 parameters that you pass to sprite.Draw: The texture, the size, the scaling value, the centerpoint for rotation, the rotation value, the translation, and the color.
To rotate your sprite, simply pass somthing other than 0.
|
|
|
Vampire
Squire
15 Posts |
Posted - Jul 29 2005 : 12:13:53 AM
|
For drawing simple geometrics and texts: Lock the backbuffer, do the drawings just like in GUI and then unlock the surface. Don't forget the last step, Windows will crash. |
|
|
Vankwysha
Squire
Australia
43 Posts |
Posted - Jul 29 2005 : 02:17:01 AM
|
quote: Originally posted by Vampire
For drawing simple geometrics and texts: Lock the backbuffer, do the drawings just like in GUI and then unlock the surface. Don't forget the last step, Windows will crash.
That sounds more like DirectDraw, I haven't been able to see any DrawLine or DrawRectangle methods within Direct3D. |
|
|
Vankwysha
Squire
Australia
43 Posts |
Posted - Jul 30 2005 : 02:53:45 AM
|
I've been looking through the methods for the DirectX.Device class and I found a couple relating to drawing primitives. These take parameters which let you draw Line Lists, Line Strips, Triangle Strips etc. but I have absolutely no idea what the rest of the parameters do, lots of weird stuff relating to vertex buffers and the like. Could someone please explain this to me, preferably with code or an example?
Also, when I specify anything other than 0,0 for the rotational centre of a sprite it doesn't even get drawn, I think it must be off-screen, could someone also please explain that? |
|
|
|
|