adventuregamestudio / ags

AGS editor and engine source code
Other
707 stars 159 forks source link

AGS 4: Support proper 32-bit color values #2501

Closed ivan-mogilko closed 2 months ago

ivan-mogilko commented 3 months ago

Resolves #1980

What is done:

Additionally:

What is left:

ivan-mogilko commented 3 months ago

I've been wondering, would that make sense to handle existing duality of Color / ColorNumber properties by hiding one of this pair depending on the current game's color depth? That is - display ColorNumber if game is 8-bit and Color (rgb) if game is 32-bit.

But then, it would also be nice to have color displayed on ColorNumber field. Maybe even add a [...] ColorNumber property which opens a palette for selecting a color.

Alternatively, how feasible that would be to merge Color and ColorNumber properties together? Only ColorNumber is serialized, and Color (rgb) field is there only for editing at design time. This makes it possible to remove one, rename ColorNumber's "display name" to just Color. But the biggest question is whether it would be possible to change the looks and functionality of the field depending on game settings. Supposedly the field may have a custom editor attribute, that draws the field and provides [...] button depending on some condition.

ivan-mogilko commented 3 months ago

The "Github Actions" are failing because of the test games. I suspect the DrawingSurface tests will have to be adjusted after this is merged.

ivan-mogilko commented 3 months ago

I managed to figure out how to make a property that may have two meanings and textual representation in a PropertyGrid, depending on game settings (see two commits above).

This lets merge a pair of properties ColorNumber and Color (rgb) into a single one. I used "ColorNumber", since it's the one that was serialized, so to keep data format unmodified.

The idea is that this property will now look like a "color number" if the game is 8-bit, and like a RGB string when the game is 32-bit. Internally it is always integer (either palette index, or encoded RGB). In 32-bit mode it opens color picker on pressing a button. In 8-bit mode button is removed, but in theory it might be possible to implement a "palette selector" in the future.

Merged all existing color property pairs into a single property (in character, gui, etc), and even made "cursor hotspot colors" properties to work the same way, so you can have a colored rectangle and color picker there too, without adding more properties.

Same property depending on a game setting: doublecolorproperty

ivan-mogilko commented 3 months ago

If I understood right, @AlanDrake have tested this PR (he mentioned this on Discord).

AlanDrake commented 3 months ago

Yes. I've tested upgrading a 32bit project, a 8bit one, and some simple DynamicSprite drawings.

ivan-mogilko commented 2 months ago

Alright, fingers crossed...