adventuregamestudio / ags

AGS editor and engine source code
Other
701 stars 160 forks source link

Inverted text color in AGS Editor on Label GUI #6

Closed ghost closed 12 years ago

ghost commented 12 years ago

As of 2012/09/12 "refactory" branch has following bug: in the Editor's GUI preview the Label objects draw text with color that seems to be an inversion of the one that was set in GUI's properties. This does not affect the running game. I suspect some of the previous changes in shared code broke compatibility with Editor and it may use incorrect drawing implementation. NOTE: this bug is present at the stage before Bitmap class, can't tell for how long it's been there.

ghost commented 12 years ago

First impression was wrong, the color is not strictly inverted, but red and blue hues are swapped, similar to what happens according to this issue: https://github.com/adventuregamestudio/ags/issues/4

Also happens not only on Labels, but pretty much everywhere where text is drawn.

jjsat commented 12 years ago

This seems to be related to the removal of the WGT2ALLEGRO_NOFUNCTIONS define.

e: Only an idea, but it might be possible that the editor passes color values in Windows BGR format while the drawing functions expect RGB. Conversion should be done in the C# code if that holds true.

e2: Switching red and blue in MapRgbColorToAgsColourNumber() does the trick. I wonder what that breaks though.

ghost commented 12 years ago

Now I recall that many functions were redeclared as macros under that define. There's a chance I overlooked some of their uses by mistake. I will check that out too.

e: I found it is actually related to SWAP_RB_HICOL macro in wgt2allg unit. Problem is that originally this file was compiled as one with both Editor and Engine, and now it is in a separate library (for windows solution) and can't use that macro, at least not for compiling with editor. Some different solution is needed here.

ghost commented 12 years ago

Allright, I made a fix... probably not the best one, but it's simple. Eventually drawing should be rewritten in OO way anyway, I guess.

Interesting thing is that PSP version required this conversion too (in one case). I guess it worked well because all the engine is being compiled as one without separation to Common and Engine I made for Win version.

e: oh... I was too fast. The macro names I used are incorrect :/ Not a big deal for now, but need to fix later.