Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 22 additions & 14 deletions KeplerEngine/Globals.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input.Touch;
using MonoGameGum;
using Gum.Forms;
using Gum.Forms.Controls;


namespace KeplerEngine;

public class Globals
{
public static SpriteBatch SpriteBatch { get; set; }

public static RenderTarget2D RenderTarget { get; set; }

/// <summary>
Expand All @@ -21,7 +24,7 @@ public class Globals
/// <summary>
/// VisibleRenderTargetBounds: the rectangle (in native render-target coordinates)
/// that is currently visible on screen after scaling (useful for anchoring)
/// </summary>
// </summary>
public static Rectangle VisibleRenderTargetBounds { get; set; } = Rectangle.Empty;

/// <summary>
Expand All @@ -30,13 +33,20 @@ public class Globals
public static Rectangle RenderTargetDisplayRect { get; set; } = Rectangle.Empty;

/// <summary>
/// Returns the visible render target bounds if they're not empty.
/// Otherwise, returns the bounds of the original render target.
/// The default Kepler Engine's Gum service
/// </summary>
public static Rectangle GetVisibleRenderTargetBounds() {
public GumService GumUI { get; } = GumService.Default;


/// <summary>
/// Returns the visible render target bounds if they're not empty.
/// Otherwise, returns the bounds of the original rend
{
var visible = Globals.VisibleRenderTargetBounds;
if (visible == Rectangle.Empty)
visible = Globals.RenderTarget.Bounds;
f (visible == Rectangle.Empty)
visible = Globals.RenderTarget.Bounds;

return VisibleRenderTargetBounds == Rectangle.Empty
? RenderTarget.Bounds
Expand All @@ -54,8 +64,8 @@ public enum ScalingMode
Contain,

/// <summary>
/// Fill window, may crop.
/// </summary>
/// Fi
// </summary>
Cover,

/// <summary>
Expand All @@ -70,8 +80,7 @@ public enum ScalingMode

public static MouseInputHandler Mouse { get; set; } = new MouseInputHandler();

public static TouchInputHandler Touch { get; set; } = new TouchInputHandler();

public static TouchInputHandler Touch { get; set; } = new TouchInputHandler
public static SceneManager SceneManager { get; set; } = new SceneManager();

public static GameTime UpdateTime { get; set; }
Expand All @@ -93,7 +102,6 @@ public static void Update(GameTime gameTime)
Keyboard.Update();
Mouse.Update();
Touch.Update();

SceneManager.GetCurrentScene().Update();

OnUpdate(gameTime);
Expand All @@ -102,12 +110,12 @@ public static void Update(GameTime gameTime)
public static void Draw(GameTime gameTime)
{
DrawTime = gameTime;
DeltaTime = (float)DrawTime.ElapsedGameTime.TotalSeconds;
eltaTime = (float)DrawTime.ElapsedGameTime.TotalSeconds;
SceneManager.GetCurrentScene().Draw();

OnRender(gameTime);
}

}
public static Action<GameTime> OnUpdate = (gt) => {};
public static Action<GameTime> OnRender = (gt) => {};
}
}
1 change: 1 addition & 0 deletions KeplerEngine/KeplerEngine.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Gum.MonoGame" Version="2026.1.12.1" />
<PackageReference Include="MonoGame.Framework.DesktopGL" Version="3.8.*">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
Expand Down