More nullable fixes, make SetTransform a part of base Renderer.
This commit is contained in:
@@ -18,7 +18,7 @@ public class UiLayer : Layer
|
||||
protected override void OnUpdate(double dt)
|
||||
{
|
||||
base.OnUpdate(dt);
|
||||
// _textLabel.Text = $"{MathF.Round(1 / (float)dt)} FPS";
|
||||
if (Scene is null) return;
|
||||
_screenContainer.UpdateRect(Vector2.Zero, Scene.Renderer.WindowSize);
|
||||
}
|
||||
|
||||
@@ -39,7 +39,8 @@ public class UiLayer : Layer
|
||||
|
||||
private void CreateUiElements()
|
||||
{
|
||||
_screenContainer = new Container();
|
||||
if (Scene is null) return;
|
||||
|
||||
_screenContainer.UpdateRect(Vector2.Zero, Scene.Renderer.WindowSize);
|
||||
|
||||
var style = new PanelStyle()
|
||||
@@ -56,7 +57,7 @@ public class UiLayer : Layer
|
||||
|
||||
var exampleText = new TextLabel()
|
||||
{
|
||||
Font = _defaultFont,
|
||||
Font = _defaultFont!,
|
||||
FontSize = 20,
|
||||
Text = "This Panel will occupy 50% of the screen.\nThis text in particular is inside a panel with an absolute margin of 16px.\nHow cool is that?"
|
||||
};
|
||||
@@ -89,10 +90,9 @@ public class UiLayer : Layer
|
||||
}
|
||||
|
||||
|
||||
private Font _defaultFont;
|
||||
private Container _screenContainer;
|
||||
private Panel _panel, _contentPanel;
|
||||
private TextLabel _textLabel;
|
||||
private Font? _defaultFont;
|
||||
private Container _screenContainer = new();
|
||||
private Panel? _panel;
|
||||
|
||||
private Logger _logger = new(nameof(UiLayer));
|
||||
}
|
||||
Reference in New Issue
Block a user