Results 1 to 6 of 6

Thread: CL_CSSDocument

  1. #1

    Exclamation CL_CSSDocument

    Hey im kinda new to ClanLib and got me first question

    I'm playing with the gui right now and therefore i have to load an xml and css file to give the gui an hint about her appearance.

    The thing is, i'm also playing around with the virtual file system. Right now i have a vfs mapped to a directory within me project.

    I load the needed xml resource per:

    m_ResMgr = new CL_ResourceManager("gui/resources.xml", m_VFS->get_root_directory());

    This works just fine.

    No i wanna load the css file too from an virtual mapped file, and it seems it aint work in the current build and im wondering why. How should i load a css file from a zip then?

    I mean you can use:

    CL_CSSDocument::load(const CL_StringRef &path, CL_IODevice &input)

    which loads the ccs from the given IODevice, thats fine too, but within:

    CL_CSSDocument_Impl::load() it will call:

    CL_CSSDocument_Impl::load_import() and her is where i got stuck, because it use CL_File with the path given to CL_CSSDocument::load(). So to me it seems its not true VFS ready, now is it?

    Maybe im overlookin something, im kinda stuck here so any help is appreciated!

    Thanks in advance.

    Imp

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

    Default

    This has now been fixed (in SVN)

    I have added:
    Code:
    void CL_GUIManager::set_css_document(const CL_String &filename, const CL_VirtualDirectory &directory);
    Also I have added convenience functions for file i/o. Most functions now accept "fullname", "filename with virtual directory" and "CL_IODevice"

  3. #3

    Thumbs up

    Wow, thats good news, thank you very much

  4. #4

    Default

    Hey i just checked out the updated source and i tried to load a css file from an vfs but i aint got much success with it.

    Lets see, i've this directory structure:
    Code:
    c:\myGame\data\
    c:\myGame\data\gui\
    c:\myGame\data\gui\images
    i setup the vfs like this:
    Code:
    CL_String resPath = CL_PathHelp::get_fullpath(CL_System::get_exe_path()) + "Data";
    myVFS = new CL_VirtualFileSystem(resPath, false);
    The vfs root directory is now "data". Now i wanna load the "theme.css" file within "data\gui\". I do it like:

    Code:
    myGUIMgr->set_css_document("gui/theme.css", myVFS()->get_root_directory());
    And thats where i throws me an exception which says: "Could not open c:\myGame\date\theme.css". Obviously he does not use the "gui" path and i'm wondering why that is.

    This however works just fine:
    Code:
    myResMgr = new CL_ResourceManager("gui/resources.xml", myVFS()->get_root_directory());
    Am i overlooking something here?

    Thanks in advance!

    Imp

  5. #5

    Exclamation

    Hey i've just got it working. I changed:

    Code:
    myGUIMgr->set_css_document("gui/theme.css", myVFS()->get_root_directory());
    to:

    Code:
    myGUIMgr->set_css_document("theme.css", myVFS()->open_directory("gui"));
    The last one does work. I wonder why the first dosn't. Is this a desired behavior?

    Thanks!

    Imp

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

    Default

    It should work, I guess I should have tested it before committing it to SVN

    Note, myGUIMgr->set_css_document("data/gui/theme.css"); should also work, assuming your current directory is c:\mygame

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
  •