Jump to content
Xtreme .Net Talk

Re: C# - Drawing an image (sprite) with Direct3D


Recommended Posts

Posted (edited)

Re: C# - Drawing an image (sprite) with Direct3D

 

Split from http://www.xtremedotnettalk.com/showthread.php?t=92593

 

Note: Please do not reply in old threads. You may create a new thread with a link to the old thread if necessary.

 

hi everybody

 

1)

 

i try to code game 2D program using c# and directx

 

i creat a sprite and it move on screet it is fine (frame rate about 60 fps)

but i try to add more sprite it getting slower (frame rate about 2,3 fps up to sprite count)

 

i load sprite image with texture object and draw it

 

sprite.Draw(texture ...

 

2) which file format is faster i use png in project

 

 

thaks a lot

Edited by snarfblam
  • Leaders
Posted

Re: C# - Drawing an image (sprite) with Direct3D

 

  1. We can't identify what is wrong with your code based only on knowing that it is running slowly. I recommend you post the code that is run each frame.
  2. I wouldn't worry about which file format is faster. The texture should only be loaded once, either when the program starts or when it is first needed. Once a texture is loaded, it is stored as a texture, not a PNG, BMP, or whatever. So unless you are experiencing an extraordinarily long load time when the program starts, I wouldn't worry about which format loads the fastest.

[sIGPIC]e[/sIGPIC]
Posted

Re: C# - Drawing an image (sprite) with Direct3D

 

  1. We can't identify what is wrong with your code based only on knowing that it is running slowly. I recommend you post the code that is run each frame.
  2. I wouldn't worry about which file format is faster. The texture should only be loaded once, either when the program starts or when it is first needed. Once a texture is loaded, it is stored as a texture, not a PNG, BMP, or whatever. So unless you are experiencing an extraordinarily long load time when the program starts, I wouldn't worry about which format loads the fastest.

 

thank

 

i actualy dispose the texture when i show it on screen

for every image my i use one texture?

for animate hero move my i use 4 texture (4 diff position)?

texture1 = posti1

texture2 = posti2

texture3 = posti3

texture4 = posti4

  • 5 months later...
Posted

Re: C# - Drawing an image (sprite) with Direct3D

 

do not dispose the texture as that releases its resources and will need to be reloaded again, if you know you will be using the sprites allot, there is no need to dispose them.

 

if you have already solved it, sorry for posting to an old thread.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...