Results 1 to 5 of 5

Thread: Dynamic loading of TDXImageList

  1. #1
    PGD Community Manager AthenaOfDelphi's Avatar
    Join Date
    Dec 2004
    Location
    South Wales, UK
    Posts
    1,245
    Blog Entries
    2

    Dynamic loading of TDXImageList

    Hi all,

    I'm starting to tinker with DelphiX for a little project, but I've come across a potential stumbling block. The general idea is to create a top down tiling engine ( I know there are probably already engines to do it, but its a learning thing :-) ).

    Obviously, I need tiles, so I have at the moment, a 320x320 8bit bitmap. I load this and chop out each tile with a TDib and then store it in the TDXImageList, ala an example that comes with DelphiX.

    My initial plan was to do this dynamically, allowing the user to modify the tile set on the fly, by removing unwanted/unused, loading new ones etc. etc.

    And this is where I've encountered a problem. Once the form is displayed, no matter what I try, I can't get the tiles to be drawn on the TDXDraw surface. If I load them in the formCreate event handler, it works.

    I've come to the conclusion that when the form is displayed, Direct X/DelphiX does some magic that buffers/initialises the image list and the surface to work with one another... can anyone shed any light on the issue? best of all... can anyone advise as to how to load the tiles once the form has been displayed, allowing me to dynamically change the tile set?

    I've not ruled out changing from DelphiX if someone can provide me with a better alternative that doesn't bog me down in too much code.

    Thanks in advance for any help :-)
    :: AthenaOfDelphi :: My Blog :: My Software ::

  2. #2

    Dynamic loading of TDXImageList

    Hello AoD,
    if you want to play with tiles with DelphiX I think you should have a look
    to Tile Studio.

    http://tilestudio.sourceforge.net/

    It is a tile/map editor with export tool specific for DelphiX and of course
    you can modify code once exported

    About the dynamic tile/bmp/dib loading I think it's a limitation of DelphiX
    more than being a problem of DirectX inizializing. Anyway I had the same
    problem in the past and I could not solve it too. I simply load all the tiles
    I need in the create/load stuff method and then I switch between images
    runtime. So that if you have an array map you can tell which file to load
    the tile from, or better, which pointer to tiles file to use for graphix.

    I hope this helps

    Bye
    <center>
    <br />Federico &quot;FNX&quot; Nisoli
    <br />Lead Programmer - FNX Games
    <br />http://www.fnxgames.com
    <br /><img src="http://www.fnxgames.com/imgs/banners/fnxban.gif">
    <br /></center>

  3. #3
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25

    Dynamic loading of TDXImageList

    I can personally vouch for the Tile Studio software myself. Very nice for making and testing your hand drawn tile sprites.

    I did find incorporating the completed data files into my code quite a bit involved. I also didn't succeed. But don't let that deture you, if you manage to get a working loadmap function, please by all means let us see.
    Jason McMillen
    Pascal Game Development
    Co-Founder





  4. #4
    PGD Community Manager AthenaOfDelphi's Avatar
    Join Date
    Dec 2004
    Location
    South Wales, UK
    Posts
    1,245
    Blog Entries
    2

    Dynamic loading of TDXImageList

    Quote Originally Posted by FNX
    About the dynamic tile/bmp/dib loading I think it's a limitation of DelphiX
    more than being a problem of DirectX inizializing. Anyway I had the same
    problem in the past and I could not solve it too. I simply load all the tiles
    I need in the create/load stuff method and then I switch between images
    runtime. So that if you have an array map you can tell which file to load
    the tile from, or better, which pointer to tiles file to use for graphix.

    I hope this helps
    Hi FNX,

    Help it did... it made me think about the processes that go on, and the fact that I've seen in one or two of the demos, the use of TDXDraw.finalize and TDXDraw.initialise.

    Well... in my tile loader, I do TDXDraw.finalize before I start loading... load all the tiles... and then TDXDraw.initialize. It works :-) Seems the initialize method forces DelphiX/Direct X to do what it needs to allow using the tiles that I've just loaded.

    I did take a look at Tile Studio... it looks like a neat tool, but I want an integrated editor that can edit the map and the scripting that goes with certain events/actions, plus theres this learning thing going on... have to brush up before the competition if I'm going to win ;-)

    Thanks for the answers guys.
    :: AthenaOfDelphi :: My Blog :: My Software ::

  5. #5

    Dynamic loading of TDXImageList

    Hi FNX, Help it did...
    Nice

    did take a look at Tile Studio... it looks like a neat tool, but I want an integrated editor that can edit the map and the scripting that goes with certain events/actions, plus theres this learning thing going on...
    Well, actually there is not so much to learn about tiles but to represent
    everything by a matrix of tiles insteand of pixels... Anyway I agree with
    your point of view about learning!
    I just suggested you TS because it's an easy way to see how to manage
    things. Also about adding events is not difficult too if you write your own
    class where you have property map (matrix), property tiles (one image
    or array of image pointers) and the draw method is the one brought by TS.
    The rest is up to you Anyway it's just one of the millions ways you can
    do it.

    have to brush up before the competition if I'm going to win
    I hope I can get in too! Pray for my customers not to ask 2 billions of
    new features in the next months!! :roll:
    <center>
    <br />Federico &quot;FNX&quot; Nisoli
    <br />Lead Programmer - FNX Games
    <br />http://www.fnxgames.com
    <br /><img src="http://www.fnxgames.com/imgs/banners/fnxban.gif">
    <br /></center>

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
  •