Results 1 to 2 of 2

Thread: Z-ordering of sprites

  1. #1

    Default Z-ordering of sprites

    Hello. This might be a question asked before, but I couldn't find it on a quick search. Does ClanLib support z-ordering of sprites somehow? That is, is it possible to avoid having to mind the order in which you render things?

  2. #2
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    Assuming you are working in 2D (using CL_Sprites)

    No, ClanLib does not have functions to handle Z-ordering of sprites.

    This is because it should be a simple process, with the algorithm dependant on the application.

    For example:
    Find the maximum Z of the sprite set, draw it, and flag it drawn

    Or create a linked list of sprites, linked by the Z position. Mantain each link when the Z position changes

    Or bubble sort the list of sprites Z position

    Or use C++ <sort> to sort the sprites Z position

    Or use C qsort() to sort the sprites Z position

    Or store the sprite in a Z position array from 0 to maximum depth (with a link list if the sprite is at same Z position). Scan the array from 0 to maximum depth when drawing

Similar Threads

  1. Sprites
    By fdaniels in forum Novashell Game Creation System
    Replies: 2
    Last Post: 10-01-2009, 07:52 AM
  2. Sprites and more...
    By Ledorax in forum Novashell Game Creation System
    Replies: 8
    Last Post: 09-28-2009, 04:47 PM
  3. [TAB Ordering] - How it works (Svn Version) ?
    By Fr3DBr in forum Official ClanLib SDK Forums
    Replies: 5
    Last Post: 09-06-2009, 09:01 PM
  4. Sprites
    By lixopmstp in forum Official ClanLib SDK Forums
    Replies: 4
    Last Post: 01-21-2007, 02:36 AM
  5. sprites
    By seyah3 in forum Dink Smallwood HD
    Replies: 0
    Last Post: 02-03-2006, 03:05 AM

Bookmarks

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
  •