Post

 Resources 

Console

Home | Profile | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 VBGamer
 VBGamer
 Modifying existing vertices in Directx 9

Note: You must be registered in order to post a reply.

Screensize:
UserName:
Password:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkInsert EmailInsert Image Insert CodeInsert QuoteInsert List Spell Checker
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

   Insert an File
Check here to include your profile signature.
Check here to subscribe to this topic.
    

T O P I C    R E V I E W
RedMonkeyRon Posted - Aug 10 2005 : 01:35:08 AM
I have a working Pokemon-like 2D game, but it runs like a slug. I based it on this tutorial: http://dotnetforums.net/showthread.php?t=87878, but the tutorial didn't go into how to actually alter the vertices of each sprite. Therefore, to simulate movement, I'm disposing and re-creating 150 sprites for each time the little man moves. Ugh.

I suspect that can just change topleft.x and topleft.y of each vertex (each sprite contains 4) and then re-render the scene, therefore simulating movement. However, I don't know how to edit the vertices in an existing sprite.

The sprite class clsSprite contains:
Private dxDevice As Device
Public SpriteImage As Texture
Public vBuffer As VertexBuffer

Question: How do I reference something life clsSprite.vBuffer.Vertex(x).TopLeftX and edit them? If I can get the performance to a less embarrassing point, I promise I'll put the base code out here. Thanks!!!
1   L A T E S T    R E P L I E S    (Newest First)
Eric Coleman Posted - Aug 10 2005 : 12:07:42 PM
You don't alter the vertices of the sprite after you create it.

The trick is to use a matrix for each sprite. A matrix allows you to specify things like position (commonly refered to as "translation"), rotation, shearing (like a parrallelogram), and stretching/shrinking.

Look at the directx 9 section here, http://directx4vb.vbgamer.com/ for more information. Of course, you should also consider downloading the Directx 9 SDK. I know it doesn't have any VB.NET examples, but it's still a good source of information.

VBGamer © Go To Top Of Page
This page was generated in 0.08 seconds. Snitz Forums 2000

Copyright © 2002 - 2004 Eric Coleman, Peter Kuchnio , et. al.