Results 1 to 5 of 5

Thread: Sprites

  1. #1

    Default Sprites

    Through trial and error I found out CL_Sprites cannot be created until at least one window has been created, but this doesn't seem to be documented anywhere. If you do:

    CL_ResourceManager resources = new CL_ResourceManager("resources.xml");
    CL_Sprite *sp = new CL_Sprite("mysprite", resources);
    CL_Window ....

    you get a nice Windows dialog box about an unhandled Win32 exception (sounds like the code tries to dereference a NULL pointer) but if you switch the order (CL Window ...; CL_Sprite ...) it works just fine.

    Is this correct/expected behavior or is there a problem in my code?

    TIA

  2. #2
    ClanLib Developer
    Join Date
    Sep 2006
    Location
    Bergen, Norway
    Posts
    588

    Default

    You need to create a display before loading any graphics, yes.

  3. #3

    Default

    Why is that? It makes sense to have a window before you can draw on it, but why can't sprites be loaded before windows are created? After all isn't it all about loading data into memory? Or does the code try to load the images in VRAM (as OpenGL textures)?
    I think it would be very useful to document this behavior, perhaps in the CL_Sprite constructor reference documentation (or even in the general sprites overview).

    Thanks

  4. #4
    ClanLib Developer
    Join Date
    Sep 2006
    Location
    Bergen, Norway
    Posts
    588

    Default

    When you construct sprites, they are as you say created as OpenGL textures.

    I think it is mentioned in the Display overview, but I could be wrong.. Feel free to send us patches documenting this

  5. #5

    Default

    The Display overview does mention it though specifically for Surfaces ("Note: It is important you create your surface objects after you have created the display window. Otherwise, mysterious crashes will result. This is a known bug, and might be fixed in a future version of ClanLib" in http://www.clanlib.org/docs/clanlib-...display-1.html). Since Sprites use Surfaces this applies to them as well, but I still believe it would be better for the Sprite overview (or constructor reference documentation) to explicitly state this. And BTW, is the bug fixed in 0.9.0? What's the procedure to submit patches to the documentation?

    Thanks

Similar Threads

  1. Sprites and Surfaces
    By ART_Adventures in forum Official ClanLib SDK Forums
    Replies: 1
    Last Post: 09-22-2006, 10:03 AM
  2. 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
  •