Results 1 to 5 of 5

Thread: Feedback from testing Rabbits2

  1. #1
    Lesser Knight
    Join Date
    Dec 2010
    Posts
    35

    Default Feedback from testing Rabbits2

    Hi, I've posted my simple game Rabbits2 in other thread.

    I've found three things worth to mention.

    First, no CL_NUMPAD_ENTER - as I see there's a patch 4 days old.

    Second, on different OSes key id's are different. For me it was a suprise. First version of my game didn't work when playing on the net with different OSes. Maybe some note on documentation would be a good solution? I've just sent key id's from client to server but some keys were ignored as their id's were unrecognized.

    Third, I've run to problems with my Windows-1250 filesystem encoding. I can't use polish special characters in filepath because it does not work. On linux there's no problem.
    I use code like:
    Code:
    CL_File file(CL_Directory::get_current() + "/config.xml");
    Maybe someone can confirm it's a bug or maybe I misunderstand something.

    So I'll wait for next release to recompile my game with 2.2.6 version and working numpad enter key.

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

    Default

    Second, on different OSes key id's are different. For me it was a suprise. First version of my game didn't work when playing on the net with different OSes. Maybe some note on documentation would be a good solution? I've just sent key id's from client to server but some keys were ignored as their id's were unrecognized
    That surprises me as well.

    As far as I know, the keyboard id's have not changed since clanlib 0.8, maybe before.

    Do you mean: CL_InputEvent::id or CL_InputEvent::str ?
    Id's should respond to the CL_xxx key id's

    On a second note, on linux, I see:

    Code:
    key.str = CL_StringHelp::local8_to_text(CL_String8(buff, result));
    I wonder if that works when the keyboard sends a utf-8 char

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

    Default

    Third, I've run to problems with my Windows-1250 filesystem encoding. I can't use polish special characters in filepath because it does not work. On linux there's no problem.
    On windows, CL_IODeviceProvider_File::open() contains:
    Code:
    	handle = CreateFile(
    		CL_StringHelp::utf8_to_ucs2(filename).c_str(),
    		win32_desired_access,
    		win32_share_mode,
    		win32_security_attributes,
    		win32_create_mode,
    		win32_flags,
    		0);
    and

    Code:
    	/// \brief Utf8 to ucs2
    	///
    	/// \param utf8 = String Ref8
    	///
    	/// \return Temp String16
    	static CL_String16 utf8_to_ucs2(const CL_StringRef8 &utf8);
    It would be interesting to see what that function is returning at that stage. (UTF-8 to widechar conversion)

    Are you sure the initial filename is UTF-8? You may need to save the source code file with UTF-8 encoding.

  4. #4
    Lesser Knight
    Join Date
    Dec 2010
    Posts
    35

    Default

    I'm using key.id because key.str returns empty string for keys such as up arrow.
    For example on windows machine I get key.id=38 for up arrow and on linux machine i get key.id=65362 for the same key.
    As you can see sending key.id between two operating system is not a good idea.
    I think single line in documentation that ids can differ on different OSes is enough.

    About filesystem encoding.
    User can unpack the game anywhere (s)he wants. So the path can contain special characters. I'm using current directory to find config.xml file.
    Until there are no special characters in path everything works fine.
    I've made quick test of this code:
    Code:
    const char *c = CL_Directory::get_current().c_str();
    for (int i=0; i < 256 && c[i] != 0; i++) CL_Console::write_line("CHAR %1 %2", i, c[i]);
    and for special character ń (0xF1 on Windows-1250) the code prints 0x44 (the less significant byte of 0x0144 Unicode encoded character)

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

    Default

    Okay...

    These do not work...

    Visual Studio 2010 - Encoding: Unicode - Codepage1200

    CL_File file("test_ń.txt");

    Compile Warning: 1>Sources\basic2d.cpp(37): warning C4566: character represented by universal-character-name '\u0144' cannot be represented in the current code page (1252)
    (As expected)

    Visual Studio 2010 - Encoding: Unicode - Codepage1200

    CL_File file(L"test_ń.txt"); <-- widechar

    Compile: Okay
    Run: Cannot open file "test_D.txt"
    (As expected, codepage conversion not performed)

    Visual Studio 2010 - Encoding: Central European (Windows) - Codepage1250

    CL_File file("test_ń.txt");

    Compile: Okay
    Run: Cannot open file "test_?t"
    (As expected, clanlib does not support this codepage)

    Visual Studio 2010 - Encoding: Unicode (UTF-8 with signature) - Codepage 65001

    CL_File file("test_ń.txt");

    Compile Warning: 1>Sources\basic2d.cpp(37): warning C4566: character represented by universal-character-name '\u0144' cannot be represented in the current code page (1252)
    (Not expected, Bug in visual studio editor - in my opinion)

    But these works!

    Visual Studio 2010 - Encoding: Unicode - Codepage1200

    CL_File file(CL_StringHelp::ucs2_to_utf8(L"test_ń.txt"));

    Compile: Okay
    Run: Okay

    Visual Studio 2010 - Encoding: Unicode (UTF-8 without signature) - Codepage 65001

    CL_File file("test_ń.txt");

    Compile: Okay
    Run: Okay


    It appears it works with UTF-8 without signature, but it does not work with the UTF-8 signature.

    This is strange, and is probably a Visual Studio bug (google shows that other people have reported it)
    Last edited by rombust; 01-11-2011 at 10:12 AM. Reason: tidy posting

Similar Threads

  1. Rabbits2: Total Demolition
    By pkowal1982 in forum Official ClanLib SDK Forums
    Replies: 9
    Last Post: 06-25-2011, 11:50 AM
  2. Testing ClanLib 0.9 CL_PathHelp
    By rombust in forum Official ClanLib SDK Forums
    Replies: 3
    Last Post: 07-24-2007, 11:36 AM
  3. Quick feedback for why I won't be buying
    By in forum Other RTsoft Games
    Replies: 1
    Last Post: 12-13-2003, 05:01 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
  •