|
Allegro 5.0.0rc1 released! |
tobing
Member #5,213
November 2004
|
Evert said: have a look at the demos/speed/a4_aux.c file for the basic idea Yes, I have seen that. Quote: I think the reason it's done this way is to accomodate different encodings in the filesystem and in the Allegro strings (which are always UTF-8) Ah, right, files are UTF8 on modern systems, so things tend to be more complicated. Sigh. SiegeLord said: How would you get that filename in the first place? The native file dialog addon returns ALLEGRO_PATH for example. The filesystem functions don't... but I think that's a problem of those functions, not of the ALLEGRO_PATH concept. Well, good point. I think I get the file name from a function which traverses a directory and calls a callback function for each file name that matches a simple pattern, like "*.lua". Inside I have a ALLEGRO_FS_ENTRY from which I get the path name... After all, it might be necessary to change more code than I anticipated. There's a lot of small things that pile up. |
Thomas Fjellstrom
Member #476
June 2000
|
tobing said: Inside I have a ALLEGRO_FS_ENTRY from which I get the path name... I really would have liked there to be functions to get an ALLEGRO_PATH from an ALLEGRO_FS_ENTRY as well as from al_read_directory. Would have made everything nice, but It never got done. -- |
Evert
Member #794
November 2000
|
tobing said: Ah, right, files are UTF8 on modern systems, so things tend to be more complicated.
If only. In that case things would be easier. Quote: After all, it might be necessary to change more code than I anticipated. There's a lot of small things that pile up.
Yes. Thomas Fjellstrom said: I really would have liked there to be functions to get an ALLEGRO_PATH from an ALLEGRO_FS_ENTRY as well as from al_read_directory. Would have made everything nice, but It never got done. No reason we couldn't add those in 5.1, right? |
Thomas Fjellstrom
Member #476
June 2000
|
Evert said: As I recall, it's UTF8 on OS X (or at least the interface lets you pretend its all UTF8), but it's UTF16 (?) on Windows, and whatever you want on Linux. Most times on linux its some ASCII code page, or UTF-8. More modern systems will choose UTF-8. And since Allegro 5 has gone for "All UTF-8 all the time", it accepts ONLY valid UTF-8 for its own strings, and will convert to UCS-2 or UTF-16 on windows. Quote: No reason we couldn't add those in 5.1, right? I would've LOVEed it if the versions that handle char* were never added to begin with. But that may have made more people un-happy. But yeah, they can probably be added in 5.1. -- |
wonsungi
Member #11,799
March 2010
|
Great job you guys! Even the readme_msvc.txt build procedure is manageable. I would just add:
I made a cursory survey of all the example programs, and I found some things that might need fixing:
Environment:
|
Matthew Leverton
Supreme Loser
January 1999
|
Regarding CMake and MSVC 10, you can:
That's assuming they haven't fixed the big in CMake yet. |
Peter Wang
Member #23
April 2000
|
Thanks for testing!
|
Michał Cichoń
Member #11,736
March 2010
|
Yes, MSVC2010 has stdint.h. "God starts from scratch too" |
Matthew Leverton
Supreme Loser
January 1999
|
Peter Wang said: Does this mean MSVC 10 has stdint.h Yes, and Allegro supports it correctly. The problem is CMake does not build proper MSVC 10 files, and the MSVC 9 ones are not compatible. |
Thomas Fjellstrom
Member #476
June 2000
|
Would an option be to just rename the DLLs for windows to use the dll short version rather than SO version? -- |
wonsungi
Member #11,799
March 2010
|
Peter Wang said: Apparently MSVC will treat these files are UTF-8 encoded if they have the stupid byte order mark (BOM) at the start; can you test if that works? I can't believe there is no command line option to force the input encoding. Yes, it compiles... but it doesn't quite fix it. The BOM introduces compilation warnings in the English locale, then! There are still (different) warnings for the Korean local, too. The Unicode literal outputs of both programs are not properly printed; the UTF tests fail and/or hang. Sample warning when compiling BOM file in Korean locale (CP949): Sample warning when compiling BOM file in English locale (CP1252): I tried several other encodings, too: Unicode, Unicode Big-Endian, UFT-7. The only combination that worked was UFT-8 without signature compiled in English Locale.
|
Peter Wang
Member #23
April 2000
|
Ok, thanks. What happens to wide character strings, L"€"? If we can convince MSVC to use UTF-16 encoding for those, we can do a runtime conversion to UTF-8. With a C++ class it should be relatively painless.
|
Michał Cichoń
Member #11,736
March 2010
|
And of course build for Windows: "God starts from scratch too" |
tobing
Member #5,213
November 2004
|
Evert said: I've kept notes of my porting effort for my game, which I'll clean up and post here at some point (sooner rather than later, I hope). This I'm looking forward to, I guess that it will be of great help for newbies to A5. One of the big things I'm going to port next is the game loop, which I think will have to look very different from the previous implementation. |
wonsungi
Member #11,799
March 2010
|
Peter Wang said: Ok, thanks. What happens to wide character strings, L"€"? If we can convince MSVC to use UTF-16 encoding for those, we can do a runtime conversion to UTF-8. With a C++ class it should be relatively painless. I forgot to mention I tried L"", too. MSVC complains about incompatible types. I also tried the "_T()" macro without any luck. I suppose it might work if we modify Allegro a little. Is that what you mean by runtime conversion? I was reading the L"" macro messes up non-MSVC compilers, though...
|
Peter Wang
Member #23
April 2000
|
Allegro would remain the same. In the one or two examples, we would write U("føø"), where U(s) is a macro that expands to convert(L"føø") on MSVC, and "føø" everywhere else. convert() would return a pointer a UTF-8 string. This just requires that MSVC consistently output a UTF-16 string whenever we use the L"" syntax, which surely it does? EDIT: attached a patch you can try (specifically ex_ttf).
|
Michał Cichoń
Member #11,736
March 2010
|
L"" convert to UCS-2, not UTF-16. "God starts from scratch too" |
Elias
Member #358
May 2000
|
tobing said: I'm really missing a lot of convenient functions, which looks like I have to re-implement things that have been present in allegro 4.4. I ported the 4.4 skater demo to the 5.0 API and it's true to some extent. Basically I had to spend most time in unexpected places, like string/path handling and config files. In my case for the config files I used the versions from a4_aux.h with builtin types and default values. For path handling i changed to using ALLEGRO_PATH, which was some work but made the code more readable than the original. All the old u* functions need to be replaced with ALLEGRO_USTR, which actually has more convenience functions than the old ones. Replacing all the messy code which randomly queries key[] and uses a timer and rest() for timing and implements 3 different double buffering methods was rather easy on the other hand. And the new events code is more reliable (e.g. no key presses can't be missed like with key[]), and it's also shorter and easier to read. -- |
tobing
Member #5,213
November 2004
|
Yes, I have seen the stuff in a4_aux* already. I think I'll do similar things for config files, I just have to add support for override_config_file to what you have already done there. Path and file system handling is an issue. For example, I have a function in place that takes care of auto saves. So all auto saves are collected from the file system, then the oldest are deleted, such that only a given maximum number of such auto saves exists. This requires matching file names, using a pattern like "auto*.vacs", then sorting the entries by modification date. Sure, this is possible with the new interfaces, except for the pattern matching... how would I do that? Which library to use here, that doesn't come a with massive overkill? For the game loop and display stuff, I think I'll just re-write those parts. Will hopefully result in less and cleaner code. And yes, there's an occasional access to key[] and mouse_b... |
Evert
Member #794
November 2000
|
tobing said: One of the big things I'm going to port next is the game loop, which I think will have to look very different from the previous implementation. I was dreading this part, but in the end, it was all very painless. The way I'd set up the code probably helped here though. |
Elias
Member #358
May 2000
|
Evert said: I was dreading this part, but in the end, it was all very painless. The way I'd set up the code probably helped here though. Yes, that was just like my experience with the skater demo. I have to praise whoever wrote that demo for doing input handling the way it was done. Also for not using the A4 GUI, in which case I'd not have attempted the port. -- |
Evert
Member #794
November 2000
|
Elias said: Also for not using the A4 GUI, in which case I'd not have attempted the port.
Guess what my project was using for the menu screens... |
wonsungi
Member #11,799
March 2010
|
Peter Wang said: Allegro would remain the same. In the one or two examples, we would write U("føø"), where U(s) is a macro that expands to convert(L"føø") on MSVC, and "føø" everywhere else. convert() would return a pointer a UTF-8 string. This just requires that MSVC consistently output a UTF-16 string whenever we use the L"" syntax, which surely it does? EDIT: attached a patch you can try (specifically ex_ttf). The patch seems to do the trick. No MSVC compiler warnings in US or Korean locales, and the UTF output looks good in both the resulting executables.
|
Pho75_
Member #12,377
November 2010
|
Congrats to Allegro team on their impending 5.0 release. Will support for stencils make it in to the next release, or are Wishlist: Cheers. |
Thomas Fjellstrom
Member #476
June 2000
|
Pho75_ said: Will support for stencils make it in to the next release, or are Thats something I really want, so I might help with it. Well see if I have the knowledge and skills Quote: I do wish support for at least 8-bit memory bitmaps had remained. The only way that's happening is if someone who wants it, writes the code. I don't have anything against that feature, I just don't want or need it I do believe that the loaders will load 8 bit bitmaps, but up convert on load (not entirely sure). -- |
|
|