tzachshabtay / MonoAGS

AGS (Adventure Game Studio) reimagined in Mono
https://tzachshabtay.github.io/MonoAGS/
Artistic License 2.0
27 stars 8 forks source link

Label text is not rendered if resolution factor is 1 #218

Closed ghost closed 6 years ago

ghost commented 6 years ago

[ rant ] Found this after spending 2 hours trying to make a label appear on screen [ /rant ]

If text resolution factor is 1, the label text won't be rendered: on labels, buttons, speech, etc. NOTE: for some reason it is still drawn in the Features window.

Steps to reproduce:

  1. Open DemoGame project and find Run method in DemoStarter class.
  2. Comment out following lines:
    //Rendering the text at a 4 time higher resolution than the actual game, so it will still look sharp when maximizing the window.
    GLText.TextResolutionFactorX = 4;
    GLText.TextResolutionFactorY = 4;
    

    Alternatively, replace 4 with 1.

  3. Run the game. No text will be visible on screen.

On possible reasons: I think there is something wrong with algorithm in GLLabelRenderer.updateBoundingBoxes:

resolutionMatches = AGSModelMatrixComponent.GetVirtualResolution(false, _virtualResolution, drawable,
                                                                                  textScaleFactor, out hitTestResolutionFactor,
                                                                                  out resolution);

If resolutionMatches is false (which only happens if TextResolutionFactor is not 1), then the text eventually gets drawn on bitmap. If it is true (TextResolutionFactor is 1), then only measurement pass is made, and actual drawing never happens.