Allegro.cc - Online Community

Allegro.cc Forums » Allegro Development » Allegro 5.0.0rc1 released!

This thread is locked; no one can reply to it. rss feed Print
Allegro 5.0.0rc1 released!
tobing
Member #5,213
November 2004
avatar

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
avatar

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.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Evert
Member #794
November 2000
avatar

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.
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.

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.
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).

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
avatar

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.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

wonsungi
Member #11,799
March 2010
avatar

Great job you guys! Even the readme_msvc.txt build procedure is manageable. I would just add:

  • When converting an MSVC 9 project to MSVC 10 (to work around the CMake naming bug) several compiler errors will result related to int64_t. To fix this, uncomment the line: #define ALLEGRO_HAVE_STDINT_H in alplatf.h.

  • Another option is to alter the CMake file so the Allegro DLL's don't have dots in their names. In the common.cmake file change: `SUFFIX -${ALLEGRO_SOVERSION}.dll` -> `SUFFIX -${ALLEGRO_DLL_SHORTVER}.dll`. Now CMAKE will generate valid MSVC 10 project files. Note this is not a good option if you want your Allegro programs to dynamically link to the Allegro library files built and shared by everyone else.

  • Running the examples. There are two other options:

    1. Build the INSTALL project. This copies the library files into MSVC's search path (%VCINSTALLDIR%\bin). Then you can select a startup project and run it with F5 (from within MSVC).

    2. Copy the Allegro DLL files to a new directory (like C:\ALLEGRO_BIN). Then append that directory to your system %PATH%. Now you can run Allegro 5 programs from any path on your system (including from within MSVC)

I made a cursory survey of all the example programs, and I found some things that might need fixing:

  • ex_utf8, ex_ttf, ex_font and ex_config fail to compile with warning C4819 if the default locale is not set to English (mine was set to CP949, Korean). The work-around is to set the system locale to English.

  • The Windows taskbar is rendered over ex_dualies. This problem is common to most of the dual monitor/fullscreen window examples. In addition, ex_dualies has some intermittent problems:

    • Occasionally causes explorer to crash on startup.

    • Sometimes the Mysha display only shows a solid green color.

    • Sometimes the Windows taskbar is not restored to its original size+location.

  • ex_fs_resize does not work very well with a dual monitor setup. It fails to change the resolution; it just sits in a semi-opened state (the log window is open, but the other window is just a sliver in the taskbar.) ex_fs_resize works if the monitors are duplicated, showing the exact same thing at the same resolution.

  • ex_threads sometimes results in one of two types of errors:

    1. When starting: fatal error (Callstack attached.)

    2. When closing: First-chance exception at 0x7741f49f in ex_threads.exe. (Callstack attached.)

  • ex_winfull taskbar also has some issues with the Windows taskbar being rendered over the Allegro display. On a dual monitor setup, I actually see two windows: the regular one on one monitor, and fullscreen window on the other. Clicking on the regular window causes the taskbar to occlude the fullscreen one. Works fine if the monitors are set to duplicate eachother instead of extend the desktop.

  • speed also has a problem with the Windows taskbar covering the Allegro window when switching to fullscreen mode with "F". The work-around is to click the taskbar, then click the Allegro window. I do not see the "regular sized" window with this one (like ex_winfull)

  • Building the run_tests projects results in several failures. These tests all passed in a previous SVN version of Allegro. List of failed tests attached.

Environment:

  • Ran all examples from within MSVC; RelWithDebugInfo

  • Allegro 5.0.0rc1

  • MSVC Express 2010

  • Windows 7 32-bit

  • Lenovo X301 laptop

  • FS-HS240LEDT external monitor

Matthew Leverton
Supreme Loser
January 1999
avatar

Regarding CMake and MSVC 10, you can:

  • use nmake instead of project files, or

  • use my patched copy of cmake

That's assuming they haven't fixed the big in CMake yet.

Peter Wang
Member #23
April 2000

Thanks for testing!

  • Does this mean MSVC 10 has stdint.h?


  • ex_utf8, ex_ttf, ex_font and ex_config: unfortunately I can't find a decent solution to this. I don't really want to externalise the strings or use hex codes as some of these are meant to be readable examples. 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.


  • I believe the failing test cases are related to r13800. I did not have time to investigate whether the library or the test suite is at fault.

Michał Cichoń
Member #11,736
March 2010

Yes, MSVC2010 has stdint.h.

"God starts from scratch too"
Windows Allegro Build Repo: http://targonski.nazwa.pl/thedmd/allegro/

Matthew Leverton
Supreme Loser
January 1999
avatar

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
avatar

Would an option be to just rename the DLLs for windows to use the dll short version rather than SO version?

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

wonsungi
Member #11,799
March 2010
avatar

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):
warning C4566: character represented by universal-character-name '\u25A2' cannot be represented in the current code page (949)

Sample warning when compiling BOM file in English locale (CP1252):
warning C4566: character represented by universal-character-name '\u25A0' cannot be represented in the current code page (1252)

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

tobing
Member #5,213
November 2004
avatar

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
avatar

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"
Windows Allegro Build Repo: http://targonski.nazwa.pl/thedmd/allegro/

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.

--
"Either help out or stop whining" - Evert

tobing
Member #5,213
November 2004
avatar

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
avatar

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.

--
"Either help out or stop whining" - Evert

Evert
Member #794
November 2000
avatar

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... ;)
Actually that bit also wasn't so bad; A4's GUI is reasonably self-contained, so I ripped it out of whatever Allegro 4 version I had installed at the time. Then it's just a matter of replacing/emulating all the input code in there (fairly straightforward) and getting the widgets to compile (again easy with a tweaked version of a4_aux). Not that I haven't actually tested most of them, since I'm using custom widgets for most things.
There are a few glitches here and there (and some things I changed that didn't work the way I wanted to to begin with) but overall that was also more tedious than painful.

wonsungi
Member #11,799
March 2010
avatar

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.
I love Allegro, old and new.

Will support for stencils make it in to the next release, or are
there already commits? What new features are planned for 5.1 branch?

Wishlist:
I do wish support for at least 8-bit memory bitmaps had remained.
along with some blit/mask wrappers to transfer to ALLEGRO_BITMAP.
I found them particularly useful not just for sprites, but for world maps, etc.
For my project, I ended up ripping out the api from a much earlier
version or allegro and just slapping in C code to reimplement bitmap
creation and drawing primitives.
Obviously the performance is much worse than assembly.
Am I the only one living in the past. :P

Cheers.

Thomas Fjellstrom
Member #476
June 2000
avatar

Pho75_ said:

Will support for stencils make it in to the next release, or are
there already commits?

Thats something I really want, so I might help with it. Well see if I have the knowledge and skills ;D

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).

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730



Go to: