Results 1 to 9 of 9

Thread: DelphiX Timer FPS

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Well SilverWarrior, thank you for the info! I will look into this. I am new to game programming and that game is my first.

    Wave.dcu is included with DelphiX I think, if you want I could attach it with a future post? I also thought that something with that code seemed wrong but couldnt lay my finger on it. I got that code from a tutorial on which I am expanding.

    If you could perhaps give me an example of how to use spriteimages differently than I currently am, I will be grateful. In the meantime I will see if I cant figure this out on my own.

    Many thanks for the help

    EDIT: I have found the following proprties that DelphiX provides: AnimCount, AnimLooped, AnimPos, AnimSpeed, AnimStart.

    Those must be what you were referring to? Although what I cannot find is a different way of "loading" different frames. It doesnt seem like DelphiX has its own spriteimage property? Or maybe I'm just not looking I'll keep looking.

    EDIT2: Lol my bad, I found that the TImageSprite has a Image property which is a TPictureCollectionItem. Although, I cannot understand how it will be any different if I use the Image property? It still has to load images from a DXImagelist, doesnt it? Unless what you meant was that by using "Player.SpriteImage.LoadfromGraphic" It has to load the image into graphic memory, is this correct? Cause by using the Image property the code will look like this: "Player.Image := PlayerGfx.Items[0];".

    Then by using that method, how will I load the correct images once the player's frame has changed? This seems like it could work, I just need to figure out how to put it all together.

    EDIT3: Lol this is pretty funny. Tell me if I am correct:

    You use the Image property to specify where the player's Image is (In which DXImagelist I mean). Then by using the AnimCount property you specify the maximum frames for the player. With AnimStart you set the number for the corresponding start frame. By doing this it will load the images from the start point that you specified with AnimStart and keep loading untill it has reached AnimCount's value, then it will loop and repeat the process. Is this correct? AnimSpeed, AnimPos and AnimLooped is self-explanatory I believe.

    Then two more things. The ChangeFrame procedure. What did you mean when you said it still changes frames when the player frames havn't changed? Cause "Player.ChangeFrame(0)" is only called when the player is walking. When I use "Player.ChangeFrame(1)" it only changes the player's picture to "PlayerGfx.Items[1]", but it doesnt loop animation?

    And how will the "DXDraw1.Surface.Draw" procedure look? Cause it requires "SrcRect: TRect" and "Source: TDirectDrawSurface", which the "Player.Image" property doesnt have
    Last edited by Proph3t; 08-10-2013 at 10:59 AM.
    IF YOU'VE FAILED TO TAKE OVER THE WORLD, CREATE A GAME WHERE YOU CAN.

  2. #2
    Quote Originally Posted by Proph3t View Post
    Wave.dcu is included with DelphiX I think, if you want I could attach it with a future post?
    DelphiX comes with DXWave.pas. Now I don't know if it is the same as the Wave.dcu that you are using. Atach it the next post and I'll check it out.


    Quote Originally Posted by Proph3t View Post
    I also thought that something with that code seemed wrong but couldnt lay my finger on it. I got that code from a tutorial on which I am expanding.
    I know the tutorial which you are using. I have read it a while ago. At that time the provided code was fine but there was some changes made in UniDelphiX is the code should probably be updated a bit especially about "DXDraw1.Beginscene" And "DXDraw1.Endscene". which are used to group multiple draw cals. This should provide some performance increase and solve some graphical glitches that sometimes ocured in original DelphiX component set.


    Quote Originally Posted by Proph3t View Post
    I found that the TImageSprite has a Image property which is a TPictureCollectionItem. Although, I cannot understand how it will be any different if I use the Image property? It still has to load images from a DXImagelist, doesnt it? Unless what you meant was that by using "Player.SpriteImage.LoadfromGraphic" It has to load the image into graphic memory, is this correct? Cause by using the Image property the code will look like this: "Player.Image := PlayerGfx.Items[0];".
    As far as I know "Player.SpriteImage.LoadFromGraphic" is used for drawing Delphi specific Graphics like TBitmap. And yes those need to be loaded into graphical memory while all images from DXImage list should be loaded into Graphical memory on application start. I might be wrong on this. Please check the uniDelphiX documentation.


    Quote Originally Posted by Proph3t View Post
    Then by using that method, how will I load the correct images once the player's frame has changed? This seems like it could work, I just need to figure out how to put it all together.
    If my memory serves me corectly you use special Image for animation sprites (it combines all animation sprites in one image formed in horizontal line). Again please check the uniDelphiX documentation on this.


    Quote Originally Posted by Proph3t View Post
    You use the Image property to specify where the player's Image is (In which DXImagelist I mean). Then by using the AnimCount property you specify the maximum frames for the player. With AnimStart you set the number for the corresponding start frame. By doing this it will load the images from the start point that you specified with AnimStart and keep loading untill it has reached AnimCount's value, then it will loop and repeat the process. Is this correct? AnimSpeed, AnimPos and AnimLooped is self-explanatory I believe.
    I belive you are correct but to be sure I still recomend you check the UniDelphiX documentation.


    Quote Originally Posted by Proph3t View Post
    Then two more things. The ChangeFrame procedure. What did you mean when you said it still changes frames when the player frames havn't changed? Cause "Player.ChangeFrame(0)" is only called when the player is walking. When I use "Player.ChangeFrame(1)" it only changes the player's picture to "PlayerGfx.Items[1]", but it doesnt loop animation?
    Code for loading graphic is outside of the if clause that you use to check whether the players picture needs to be updated.


    Quote Originally Posted by Proph3t View Post
    And how will the "DXDraw1.Surface.Draw" procedure look? Cause it requires "SrcRect: TRect" and "Source: TDirectDrawSurface", which the "Player.Image" property doesnt have
    I'm not sure. Will have to check it out more thouraly myself.

  3. #3
    Quote Originally Posted by SilverWarior View Post
    DelphiX comes with DXWave.pas. Now I don't know if it is the same as the Wave.dcu that you are using. Atach it the next post and I'll check it out.
    Problem solved. That wave.dcu was from NewAC components. Just remove "wave" from the uses clause.

    I am currently going through a tutorial about animation with one horizontal image

    Thanks alot for the help!
    IF YOU'VE FAILED TO TAKE OVER THE WORLD, CREATE A GAME WHERE YOU CAN.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •