Results 1 to 3 of 3

Thread: CL_CommandLine with Cross-platform application main

  1. #1

    Default CL_CommandLine with Cross-platform application main

    If one uses the cross platform application main, for example:
    Code:
    CL_ClanApplication app(&Main::main);
    The arguments are given as a vector of CL_Strings. CL_CommandLine seems to only have this function:
    Code:
    void parse_args(int argc, char** argv);
    It seems like it would be useful then to have CL_CommandLine able to parse the arguments from a "const std::vector<CL_String> &args" directly. Maybe there is already something and I'm missing it? If not, attached is a patch that adds:
    Code:
    void CL_CommandLine::parse_args(const std::vector<CL_String> &args);
    If the patch is not up to standards and you don't want to fix it, let me know what changes are needed and I'll work on it. Particularly I currently do not have a complete understanding of Clanlib strings, as I've read on the wiki it handles things a bit different than std::string with references.

    Thank you.
    Attached Files Attached Files

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

    Default

    It looks good to me, although I have not tried it.

    It seems like the CL_CommandLine function has been forgotten about for a long time (From ClanLib 0.8)

    Maybe "void parse_args(int argc, char** argv);" should also be removed?

  3. #3

    Default

    Maybe. Attached is a patch that removes it and only takes in a vector of arguments. One thing that might be a concern is everything is forced to CL_String8. There is probably a issue further up, as I don't think there is any converting of encoding type when it originally set the arguments in the vector.

    However, this works for my purposes. I mainly wanted command line parsing as a quick way to go to certain points in a game quickly for debugging and play test purposes, and to override currently set configuration options (Display, key input, etc.).
    Attached Files Attached Files

Similar Threads

  1. Polishing an application
    By MagicPantsBoy in forum Official ClanLib SDK Forums
    Replies: 1
    Last Post: 01-09-2010, 05:21 PM
  2. Errors while trying to Cross-Compile
    By juicebox360 in forum Official ClanLib SDK Forums
    Replies: 4
    Last Post: 01-29-2009, 04:36 PM
  3. Main Developer ?
    By zyklo in forum Official ClanLib SDK Forums
    Replies: 2
    Last Post: 08-21-2008, 03:00 AM
  4. Oh Sh!t - Platform game
    By Pleng in forum Novashell Game Creation System
    Replies: 17
    Last Post: 06-01-2008, 01:04 PM
  5. Python as a win32 gaming platform
    By jjohn in forum Game development
    Replies: 1
    Last Post: 03-09-2007, 02:42 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
  •