From 2aff66eac999a9eb3dc3b95bc85289068a22bb75 Mon Sep 17 00:00:00 2001 From: gered Date: Fri, 23 Aug 2013 18:02:02 -0400 Subject: [PATCH] rename Platform to Framework --- Blarg.GameFramework.SDL2/SDLApplication.cs | 4 +- Blarg.GameFramework/BaseApplication.cs | 14 +++--- .../Blarg.GameFramework.csproj | 2 +- Blarg.GameFramework/Events/EventManager.cs | 4 +- .../{Platform.cs => Framework.cs} | 6 +-- Blarg.GameFramework/Graphics/BufferObject.cs | 20 ++++---- Blarg.GameFramework/Graphics/Framebuffer.cs | 2 +- .../Graphics/GraphicsDevice.cs | 50 +++++++++---------- .../Graphics/Helpers/GraphicsHelpers.cs | 2 +- Blarg.GameFramework/Graphics/Image.cs | 2 +- Blarg.GameFramework/Graphics/Renderbuffer.cs | 6 +-- .../Graphics/ScreenEffects/DimEffect.cs | 6 +-- .../Graphics/ScreenEffects/FadeEffect.cs | 6 +-- .../Graphics/ScreenEffects/FlashEffect.cs | 6 +-- Blarg.GameFramework/Graphics/Shader.cs | 6 +-- Blarg.GameFramework/Graphics/Texture.cs | 10 ++-- Blarg.GameFramework/Graphics/ViewContext.cs | 2 +- Blarg.GameFramework/IApplication.cs | 2 +- .../Processes/ProcessManager.cs | 40 +++++++-------- Blarg.GameFramework/ServiceContainer.cs | 8 +-- Blarg.GameFramework/States/StateManager.cs | 48 +++++++++--------- .../Support/FreeMovementCamera.cs | 20 ++++---- Game.Core/GameApp.cs | 36 ++++++------- 23 files changed, 151 insertions(+), 151 deletions(-) rename Blarg.GameFramework/{Platform.cs => Framework.cs} (91%) diff --git a/Blarg.GameFramework.SDL2/SDLApplication.cs b/Blarg.GameFramework.SDL2/SDLApplication.cs index b8c6f39..9eee848 100644 --- a/Blarg.GameFramework.SDL2/SDLApplication.cs +++ b/Blarg.GameFramework.SDL2/SDLApplication.cs @@ -46,7 +46,7 @@ namespace Blarg.GameFramework get { return _os; } } - public override PlatformType Type + public override PlatformType PlatformType { get { return PlatformType.Desktop; } } @@ -145,7 +145,7 @@ namespace Blarg.GameFramework return; } - Platform.Set(this); + Framework.Set(this); OnInit(); OnNewContext(); diff --git a/Blarg.GameFramework/BaseApplication.cs b/Blarg.GameFramework/BaseApplication.cs index e44fc6f..99a2e4f 100644 --- a/Blarg.GameFramework/BaseApplication.cs +++ b/Blarg.GameFramework/BaseApplication.cs @@ -17,7 +17,7 @@ namespace Blarg.GameFramework protected IGameApp GameApp { get; set; } public abstract PlatformOS OperatingSystem { get; } - public abstract PlatformType Type { get; } + public abstract PlatformType PlatformType { get; } public abstract ILogger Logger { get; } public ServiceContainer Services { get; private set; } @@ -138,12 +138,12 @@ namespace Blarg.GameFramework { GameApp.OnUpdate(delta); - if (Platform.Keyboard != null) - Platform.Keyboard.OnPostUpdate(delta); - if (Platform.Mouse != null) - Platform.Mouse.OnPostUpdate(delta); - if (Platform.TouchScreen != null) - Platform.TouchScreen.OnPostUpdate(delta); + if (Framework.Keyboard != null) + Framework.Keyboard.OnPostUpdate(delta); + if (Framework.Mouse != null) + Framework.Mouse.OnPostUpdate(delta); + if (Framework.TouchScreen != null) + Framework.TouchScreen.OnPostUpdate(delta); } #region Disposable diff --git a/Blarg.GameFramework/Blarg.GameFramework.csproj b/Blarg.GameFramework/Blarg.GameFramework.csproj index a61edce..884256c 100644 --- a/Blarg.GameFramework/Blarg.GameFramework.csproj +++ b/Blarg.GameFramework/Blarg.GameFramework.csproj @@ -77,7 +77,6 @@ - @@ -166,6 +165,7 @@ + diff --git a/Blarg.GameFramework/Events/EventManager.cs b/Blarg.GameFramework/Events/EventManager.cs index 702b2e1..fe786ca 100644 --- a/Blarg.GameFramework/Events/EventManager.cs +++ b/Blarg.GameFramework/Events/EventManager.cs @@ -49,7 +49,7 @@ namespace Blarg.GameFramework.Events throw new InvalidOperationException("Duplicate event listener registration."); listenerTable.Add(listener); - Platform.Logger.Debug("EventManager", "Added {0} as a listener for event type {1}", listener.GetType().Name, type.Name); + Framework.Logger.Debug("EventManager", "Added {0} as a listener for event type {1}", listener.GetType().Name, type.Name); // also update the list of currently registered event types _typeList.Add(type); @@ -72,7 +72,7 @@ namespace Blarg.GameFramework.Events if (listenersForType.Contains(listener)) { listenersForType.Remove(listener); - Platform.Logger.Debug("EventManager", "Removed {0} as a listener for event type {1}", listener.GetType().Name, type.Name); + Framework.Logger.Debug("EventManager", "Removed {0} as a listener for event type {1}", listener.GetType().Name, type.Name); // if there are no more listeners for this type, remove the type // from the list of registered event types diff --git a/Blarg.GameFramework/Platform.cs b/Blarg.GameFramework/Framework.cs similarity index 91% rename from Blarg.GameFramework/Platform.cs rename to Blarg.GameFramework/Framework.cs index 884f37b..389504c 100644 --- a/Blarg.GameFramework/Platform.cs +++ b/Blarg.GameFramework/Framework.cs @@ -20,7 +20,7 @@ namespace Blarg.GameFramework Desktop } - public static class Platform + public static class Framework { public static IApplication Application { get; private set; } @@ -29,9 +29,9 @@ namespace Blarg.GameFramework get { return Application.OperatingSystem; } } - public static PlatformType Type + public static PlatformType PlatformType { - get { return Application.Type; } + get { return Application.PlatformType; } } public static ILogger Logger diff --git a/Blarg.GameFramework/Graphics/BufferObject.cs b/Blarg.GameFramework/Graphics/BufferObject.cs index 8ab06fe..45ee4cd 100644 --- a/Blarg.GameFramework/Graphics/BufferObject.cs +++ b/Blarg.GameFramework/Graphics/BufferObject.cs @@ -106,7 +106,7 @@ namespace Blarg.GameFramework.Graphics var usage = GLUsageHint; var target = GLTarget; - Platform.GraphicsDevice.GL.glBindBuffer(target, ID); + Framework.GraphicsDevice.GL.glBindBuffer(target, ID); if (SizeInBytes != currentSizeInBytes) { @@ -115,7 +115,7 @@ namespace Blarg.GameFramework.Graphics SizeInBytes = currentSizeInBytes; // and then allocate + update - Platform.GraphicsDevice.GL.glBufferData(target, SizeInBytes, Data, usage); + Framework.GraphicsDevice.GL.glBufferData(target, SizeInBytes, Data, usage); } else { @@ -124,18 +124,18 @@ namespace Blarg.GameFramework.Graphics // previous contents allowing it to do some extra optimizations which is // fine since our glBufferSubData call is going to completely replace // the contents anyway - Platform.GraphicsDevice.GL.glBufferData(target, SizeInBytes, IntPtr.Zero, usage); - Platform.GraphicsDevice.GL.glBufferSubData(target, 0, SizeInBytes, Data); + Framework.GraphicsDevice.GL.glBufferData(target, SizeInBytes, IntPtr.Zero, usage); + Framework.GraphicsDevice.GL.glBufferSubData(target, 0, SizeInBytes, Data); } - Platform.GraphicsDevice.GL.glBindBuffer(target, 0); + Framework.GraphicsDevice.GL.glBindBuffer(target, 0); IsDirty = false; } protected void CreateBufferObject() { - ID = Platform.GraphicsDevice.GL.glGenBuffers(); + ID = Framework.GraphicsDevice.GL.glGenBuffers(); SizeBufferObject(); @@ -148,7 +148,7 @@ namespace Blarg.GameFramework.Graphics if (IsInvalidated) throw new InvalidOperationException(); - Platform.GraphicsDevice.GL.glDeleteBuffers(ID); + Framework.GraphicsDevice.GL.glDeleteBuffers(ID); ID = -1; IsClientSide = true; @@ -171,9 +171,9 @@ namespace Blarg.GameFramework.Graphics SizeInBytes = NumElements * ElementWidthInBytes; // resize the buffer object without initializing it's data - Platform.GraphicsDevice.GL.glBindBuffer(target, ID); - Platform.GraphicsDevice.GL.glBufferData(target, SizeInBytes, IntPtr.Zero, usage); - Platform.GraphicsDevice.GL.glBindBuffer(target, 0); + Framework.GraphicsDevice.GL.glBindBuffer(target, ID); + Framework.GraphicsDevice.GL.glBufferData(target, SizeInBytes, IntPtr.Zero, usage); + Framework.GraphicsDevice.GL.glBindBuffer(target, 0); IsDirty = true; } diff --git a/Blarg.GameFramework/Graphics/Framebuffer.cs b/Blarg.GameFramework/Graphics/Framebuffer.cs index dbd963b..8f6694c 100644 --- a/Blarg.GameFramework/Graphics/Framebuffer.cs +++ b/Blarg.GameFramework/Graphics/Framebuffer.cs @@ -426,7 +426,7 @@ namespace Blarg.GameFramework.Graphics // TODO: check that the check for GraphicsDevice.ViewContext != _attachedViewContext is actually needed if (_attachedViewContext != null && GraphicsDevice.ViewContext != _attachedViewContext) { - Rect r = Platform.Application.Window.ClientRectangle; + Rect r = Framework.Application.Window.ClientRectangle; _attachedViewContext.OnResize(ref r, GraphicsDevice.ScreenOrientation); } diff --git a/Blarg.GameFramework/Graphics/GraphicsDevice.cs b/Blarg.GameFramework/Graphics/GraphicsDevice.cs index 49594a1..8d6c6ac 100644 --- a/Blarg.GameFramework/Graphics/GraphicsDevice.cs +++ b/Blarg.GameFramework/Graphics/GraphicsDevice.cs @@ -69,7 +69,7 @@ namespace Blarg.GameFramework.Graphics else _activeViewContext = value; - Rect r = Platform.Application.Window.ClientRectangle; + Rect r = Framework.Application.Window.ClientRectangle; _activeViewContext.OnApply(ref r, ScreenOrientation); } } @@ -115,13 +115,13 @@ namespace Blarg.GameFramework.Graphics string extensions = GL.glGetString(GL20.GL_EXTENSIONS); string shadingLangVersion = GL.glGetString(GL20.GL_SHADING_LANGUAGE_VERSION); - Platform.Logger.Info(LOG_TAG, "GL_VENDOR = {0}", vendor); - Platform.Logger.Info(LOG_TAG, "GL_RENDERER = {0}", renderer); - Platform.Logger.Info(LOG_TAG, "GL_VERSION = {0}", version); - Platform.Logger.Info(LOG_TAG, "GL_EXTENSIONS = {0}", extensions); - Platform.Logger.Info(LOG_TAG, "GL_SHADING_LANGUAGE_VERSION = {0}", shadingLangVersion); + Framework.Logger.Info(LOG_TAG, "GL_VENDOR = {0}", vendor); + Framework.Logger.Info(LOG_TAG, "GL_RENDERER = {0}", renderer); + Framework.Logger.Info(LOG_TAG, "GL_VERSION = {0}", version); + Framework.Logger.Info(LOG_TAG, "GL_EXTENSIONS = {0}", extensions); + Framework.Logger.Info(LOG_TAG, "GL_SHADING_LANGUAGE_VERSION = {0}", shadingLangVersion); - if (Platform.Type == PlatformType.Mobile) + if (Framework.PlatformType == PlatformType.Mobile) { IsNonPowerOfTwoTextureSupported = extensions.Contains("OES_texture_npot"); IsDepthTextureSupported = extensions.Contains("OES_depth_texture"); @@ -131,8 +131,8 @@ namespace Blarg.GameFramework.Graphics IsNonPowerOfTwoTextureSupported = extensions.Contains("ARB_texture_non_power_of_two"); IsDepthTextureSupported = extensions.Contains("ARB_depth_texture"); } - Platform.Logger.Info(LOG_TAG, "Non-Power-Of-2 texture support: {0}", IsNonPowerOfTwoTextureSupported); - Platform.Logger.Info(LOG_TAG, "Depth texture support: {0}", IsDepthTextureSupported); + Framework.Logger.Info(LOG_TAG, "Non-Power-Of-2 texture support: {0}", IsNonPowerOfTwoTextureSupported); + Framework.Logger.Info(LOG_TAG, "Depth texture support: {0}", IsDepthTextureSupported); _defaultViewContext = new ViewContext(this); _activeViewContext = _defaultViewContext; @@ -151,21 +151,21 @@ namespace Blarg.GameFramework.Graphics public void OnLostContext() { - Platform.Logger.Info(LOG_TAG, "Cleaning up objects/state specific to the lost OpenGL context."); + Framework.Logger.Info(LOG_TAG, "Cleaning up objects/state specific to the lost OpenGL context."); _activeViewContext.OnLostContext(); - Platform.Logger.Info(LOG_TAG, "Invoking OnLostContext callback for managed resources."); + Framework.Logger.Info(LOG_TAG, "Invoking OnLostContext callback for managed resources."); foreach (var resource in _managedResources) resource.OnLostContext(); - Platform.Logger.Info(LOG_TAG, "Finished cleaning up lost managed resources."); + Framework.Logger.Info(LOG_TAG, "Finished cleaning up lost managed resources."); } public void OnNewContext() { - Platform.Logger.Info(LOG_TAG, "Initializing default state for new OpenGL context."); + Framework.Logger.Info(LOG_TAG, "Initializing default state for new OpenGL context."); _activeViewContext.OnNewContext(); @@ -180,14 +180,14 @@ namespace Blarg.GameFramework.Graphics UnbindRenderbuffer(); UnbindFramebuffer(); - Platform.Logger.Info(LOG_TAG, "Invoking OnNewContext callback for managed resources."); + Framework.Logger.Info(LOG_TAG, "Invoking OnNewContext callback for managed resources."); foreach (var resource in _managedResources) resource.OnNewContext(); - Platform.Logger.Info(LOG_TAG, "Finished restoring managed resources."); + Framework.Logger.Info(LOG_TAG, "Finished restoring managed resources."); - Platform.Logger.Info(LOG_TAG, "Restoring image data for solid color texture cache."); + Framework.Logger.Info(LOG_TAG, "Restoring image data for solid color texture cache."); foreach (var texture in _solidColorTextures) { @@ -195,13 +195,13 @@ namespace Blarg.GameFramework.Graphics FillSolidColorTexture(texture.Value, ref color); } - Platform.Logger.Info(LOG_TAG, "Restoring standard fonts."); + Framework.Logger.Info(LOG_TAG, "Restoring standard fonts."); LoadStandardFonts(); } public void OnUnload() { - Platform.Logger.Info(LOG_TAG, "Unloading managed resources."); + Framework.Logger.Info(LOG_TAG, "Unloading managed resources."); while (_managedResources.Count > 0) { var resource = _managedResources[0]; @@ -216,11 +216,11 @@ namespace Blarg.GameFramework.Graphics System.Diagnostics.Debug.Assert(error == GL20.GL_NO_ERROR); if (error != GL20.GL_NO_ERROR) { - Platform.Logger.Error("OPENGL", "OpenGL error \"{0}\"", error.ToString()); + Framework.Logger.Error("OPENGL", "OpenGL error \"{0}\"", error.ToString()); // keep checking for and reporting errors until there are no more left while ((error = GL.glGetError()) != GL20.GL_NO_ERROR) - Platform.Logger.Error("OPENGL", "OpenGL error \"{0}\"", error.ToString()); + Framework.Logger.Error("OPENGL", "OpenGL error \"{0}\"", error.ToString()); } _activeViewContext.OnRender(delta); @@ -228,9 +228,9 @@ namespace Blarg.GameFramework.Graphics public void OnResize(ref Rect rect, ScreenOrientation orientation) { - Platform.Logger.Info(LOG_TAG, "Window resized {0}.", rect); + Framework.Logger.Info(LOG_TAG, "Window resized {0}.", rect); if (orientation != ScreenOrientation.Rotation0) - Platform.Logger.Info(LOG_TAG, "Screen is rotated (angle = {0}).", (int)orientation); + Framework.Logger.Info(LOG_TAG, "Screen is rotated (angle = {0}).", (int)orientation); ScreenOrientation = orientation; _activeViewContext.OnResize(ref rect, orientation); @@ -289,7 +289,7 @@ namespace Blarg.GameFramework.Graphics private Texture CreateSolidColorTexture(ref Color color) { - Platform.Logger.Info(LOG_TAG, "Creating texture for solid color 0x{0:x}.", color.RGBA); + Framework.Logger.Info(LOG_TAG, "Creating texture for solid color 0x{0:x}.", color.RGBA); var solidColorImage = new Image(SolidColorTextureWidth, SolidColorTextureHeight, ImageFormat.RGBA); solidColorImage.Clear(ref color); @@ -300,7 +300,7 @@ namespace Blarg.GameFramework.Graphics private void FillSolidColorTexture(Texture texture, ref Color color) { - Platform.Logger.Info(LOG_TAG, "Filling image data for solid color texture using color 0x{0:x}.", color.RGBA); + Framework.Logger.Info(LOG_TAG, "Filling image data for solid color texture using color 0x{0:x}.", color.RGBA); if (texture == null || texture.IsInvalidated || texture.Width != SolidColorTextureWidth || texture.Height != SolidColorTextureHeight) throw new ArgumentException("Invalid texture."); @@ -921,7 +921,7 @@ namespace Blarg.GameFramework.Graphics _isGlResourcesReleased = true; - Platform.Logger.Info(LOG_TAG, "Managed graphics context resources cleaned up."); + Framework.Logger.Info(LOG_TAG, "Managed graphics context resources cleaned up."); } ~GraphicsDevice() diff --git a/Blarg.GameFramework/Graphics/Helpers/GraphicsHelpers.cs b/Blarg.GameFramework/Graphics/Helpers/GraphicsHelpers.cs index 783a49d..5c7c787 100644 --- a/Blarg.GameFramework/Graphics/Helpers/GraphicsHelpers.cs +++ b/Blarg.GameFramework/Graphics/Helpers/GraphicsHelpers.cs @@ -6,7 +6,7 @@ namespace Blarg.GameFramework.Graphics.Helpers { public static void RenderCoordinateAxis(GeometryDebugRenderer debugRenderer, SpriteBatch spriteBatch, Vector3 origin, float axisLength) { - var font = Platform.GraphicsDevice.SansSerifFont; + var font = Framework.GraphicsDevice.SansSerifFont; var upLine = new LineSegment(origin.X, origin.Y, origin.Z, origin.X + 0.0f, origin.Y + axisLength, origin.Z + 0.0f); var downLine = new LineSegment(origin.X, origin.Y, origin.Z, origin.X + 0.0f, origin.Y + -axisLength, origin.Z + 0.0f); diff --git a/Blarg.GameFramework/Graphics/Image.cs b/Blarg.GameFramework/Graphics/Image.cs index 7833bbe..3100eba 100644 --- a/Blarg.GameFramework/Graphics/Image.cs +++ b/Blarg.GameFramework/Graphics/Image.cs @@ -46,7 +46,7 @@ namespace Blarg.GameFramework.Graphics if (file == null) throw new ArgumentNullException("file"); - var bitmap = Platform.Application.LoadBitmap(file); + var bitmap = Framework.Application.LoadBitmap(file); CreateBaseImage(bitmap.Width, bitmap.Height, bitmap.Format); Buffer.BlockCopy(bitmap.Pixels, 0, _pixels, 0, bitmap.Pixels.Length); diff --git a/Blarg.GameFramework/Graphics/Renderbuffer.cs b/Blarg.GameFramework/Graphics/Renderbuffer.cs index e3ec42f..1090b78 100644 --- a/Blarg.GameFramework/Graphics/Renderbuffer.cs +++ b/Blarg.GameFramework/Graphics/Renderbuffer.cs @@ -41,7 +41,7 @@ namespace Blarg.GameFramework.Graphics throw new InvalidOperationException(); int glFormat = 0; - if (Platform.Type == PlatformType.Mobile) + if (Framework.PlatformType == PlatformType.Mobile) { switch (format) { @@ -74,7 +74,7 @@ namespace Blarg.GameFramework.Graphics GraphicsDevice.GL.glRenderbufferStorage(GL20.GL_RENDERBUFFER, glFormat, Width, Height); GraphicsDevice.UnbindRenderbuffer(this); - Platform.Logger.Info(GraphicsContextResource.LOG_TAG, "Created renderbuffer. ID = {0}, format = {1}, size = {2}x{3}.", ID, Format.ToString(), Width, Height); + Framework.Logger.Info(GraphicsContextResource.LOG_TAG, "Created renderbuffer. ID = {0}, format = {1}, size = {2}x{3}.", ID, Format.ToString(), Width, Height); } #region GraphicsContextResource @@ -97,7 +97,7 @@ namespace Blarg.GameFramework.Graphics GraphicsDevice.GL.glDeleteRenderbuffers(ID); - Platform.Logger.Info(GraphicsContextResource.LOG_TAG, "Deleted Renderbuffer ID = {0}.", ID); + Framework.Logger.Info(GraphicsContextResource.LOG_TAG, "Deleted Renderbuffer ID = {0}.", ID); ID = -1; } diff --git a/Blarg.GameFramework/Graphics/ScreenEffects/DimEffect.cs b/Blarg.GameFramework/Graphics/ScreenEffects/DimEffect.cs index c7fb5e7..c986cac 100644 --- a/Blarg.GameFramework/Graphics/ScreenEffects/DimEffect.cs +++ b/Blarg.GameFramework/Graphics/ScreenEffects/DimEffect.cs @@ -18,10 +18,10 @@ namespace Blarg.GameFramework.Graphics.ScreenEffects public override void OnRender(float delta) { - int width = Platform.GraphicsDevice.ViewContext.ViewportWidth; - int height = Platform.GraphicsDevice.ViewContext.ViewportHeight; + int width = Framework.GraphicsDevice.ViewContext.ViewportWidth; + int height = Framework.GraphicsDevice.ViewContext.ViewportHeight; - var texture = Platform.GraphicsDevice.GetSolidColorTexture(Color.White); + var texture = Framework.GraphicsDevice.GetSolidColorTexture(Color.White); var color = Color; color.A = Alpha; diff --git a/Blarg.GameFramework/Graphics/ScreenEffects/FadeEffect.cs b/Blarg.GameFramework/Graphics/ScreenEffects/FadeEffect.cs index eb9494d..32ed9f7 100644 --- a/Blarg.GameFramework/Graphics/ScreenEffects/FadeEffect.cs +++ b/Blarg.GameFramework/Graphics/ScreenEffects/FadeEffect.cs @@ -44,10 +44,10 @@ namespace Blarg.GameFramework.Graphics.ScreenEffects public override void OnRender(float delta) { - int width = Platform.GraphicsDevice.ViewContext.ViewportWidth; - int height = Platform.GraphicsDevice.ViewContext.ViewportHeight; + int width = Framework.GraphicsDevice.ViewContext.ViewportWidth; + int height = Framework.GraphicsDevice.ViewContext.ViewportHeight; - var texture = Platform.GraphicsDevice.GetSolidColorTexture(Color.White); + var texture = Framework.GraphicsDevice.GetSolidColorTexture(Color.White); _color.A = _alpha; //Platform.SpriteBatch.Render(texture, 0, 0, width, height, ref _color); diff --git a/Blarg.GameFramework/Graphics/ScreenEffects/FlashEffect.cs b/Blarg.GameFramework/Graphics/ScreenEffects/FlashEffect.cs index cc6fb9a..18af972 100644 --- a/Blarg.GameFramework/Graphics/ScreenEffects/FlashEffect.cs +++ b/Blarg.GameFramework/Graphics/ScreenEffects/FlashEffect.cs @@ -26,10 +26,10 @@ namespace Blarg.GameFramework.Graphics.ScreenEffects public override void OnRender(float delta) { - int width = Platform.GraphicsDevice.ViewContext.ViewportWidth; - int height = Platform.GraphicsDevice.ViewContext.ViewportHeight; + int width = Framework.GraphicsDevice.ViewContext.ViewportWidth; + int height = Framework.GraphicsDevice.ViewContext.ViewportHeight; - var texture = Platform.GraphicsDevice.GetSolidColorTexture(Color.White); + var texture = Framework.GraphicsDevice.GetSolidColorTexture(Color.White); var color = Color; color.A = _alpha; diff --git a/Blarg.GameFramework/Graphics/Shader.cs b/Blarg.GameFramework/Graphics/Shader.cs index 77353dc..0cff775 100644 --- a/Blarg.GameFramework/Graphics/Shader.cs +++ b/Blarg.GameFramework/Graphics/Shader.cs @@ -178,7 +178,7 @@ namespace Blarg.GameFramework.Graphics if (vertexShaderCompileStatus == 0) { string log = GetShaderLog(vertexShaderId); - Platform.Logger.Error("OPENGL", "Error compiling vertex shader:\n{0}", log); + Framework.Logger.Error("OPENGL", "Error compiling vertex shader:\n{0}", log); } // and now the fragment shader @@ -201,7 +201,7 @@ namespace Blarg.GameFramework.Graphics if (fragmentShaderCompileStatus == 0) { string log = GetShaderLog(fragmentShaderId); - Platform.Logger.Error("OPENGL", "Error compiling fragment shader:\n{0}", log); + Framework.Logger.Error("OPENGL", "Error compiling fragment shader:\n{0}", log); } // only return success if both compiled successfully @@ -242,7 +242,7 @@ namespace Blarg.GameFramework.Graphics if (programLinkStatus == 0) { string log = GraphicsDevice.GL.glGetProgramInfoLog(programId); - Platform.Logger.Error("OPENGL", "Error linking program:\n{0}", log); + Framework.Logger.Error("OPENGL", "Error linking program:\n{0}", log); } if (programLinkStatus != 0) diff --git a/Blarg.GameFramework/Graphics/Texture.cs b/Blarg.GameFramework/Graphics/Texture.cs index 1d2caec..2c77a29 100644 --- a/Blarg.GameFramework/Graphics/Texture.cs +++ b/Blarg.GameFramework/Graphics/Texture.cs @@ -107,7 +107,7 @@ namespace Blarg.GameFramework.Graphics GraphicsDevice.GL.glTexImage2D(GL20.GL_TEXTURE_2D, 0, internalFormat, Width, Height, 0, pixelFormat, pixelType, image.Pixels); - Platform.Logger.Info(GraphicsContextResource.LOG_TAG, "Created texture from image. ID = {0}, bpp = {1}, size = {2}x{3}.", ID, image.BitsPerPixel, Width, Height); + Framework.Logger.Info(GraphicsContextResource.LOG_TAG, "Created texture from image. ID = {0}, bpp = {1}, size = {2}x{3}.", ID, image.BitsPerPixel, Width, Height); } private void CreateTexture(int width, int height, TextureFormat format, bool useExistingTextureParams = false) @@ -142,9 +142,9 @@ namespace Blarg.GameFramework.Graphics GraphicsDevice.GL.glTexImage2D(GL20.GL_TEXTURE_2D, 0, internalFormat, Width, Height, 0, pixelFormat, pixelType, IntPtr.Zero); if (Format == TextureFormat.Depth) - Platform.Logger.Info(GraphicsContextResource.LOG_TAG, "Created uninitialized texture. ID = {0}, depth component only, size = {1}x{2}", ID, Width, Height); + Framework.Logger.Info(GraphicsContextResource.LOG_TAG, "Created uninitialized texture. ID = {0}, depth component only, size = {1}x{2}", ID, Width, Height); else - Platform.Logger.Info(GraphicsContextResource.LOG_TAG, "Created uninitialized texture. ID = {0}, bpp = {1}, size = {2}x{3}", ID, bpp, Width, Height); + Framework.Logger.Info(GraphicsContextResource.LOG_TAG, "Created uninitialized texture. ID = {0}, bpp = {1}, size = {2}x{3}", ID, bpp, Width, Height); } #endregion @@ -226,7 +226,7 @@ namespace Blarg.GameFramework.Graphics pixelFormat = GL20.GL_DEPTH_COMPONENT; // TODO: check that these are correct ... - if (Platform.Application.Type == PlatformType.Mobile) + if (Framework.Application.PlatformType == PlatformType.Mobile) type = GL20.GL_UNSIGNED_SHORT; else type = GL20.GL_FLOAT; @@ -273,7 +273,7 @@ namespace Blarg.GameFramework.Graphics GraphicsDevice.GL.glDeleteTextures(ID); - Platform.Logger.Info(GraphicsContextResource.LOG_TAG, "Deleted Texture ID = {0}.", ID); + Framework.Logger.Info(GraphicsContextResource.LOG_TAG, "Deleted Texture ID = {0}.", ID); ID = -1; } diff --git a/Blarg.GameFramework/Graphics/ViewContext.cs b/Blarg.GameFramework/Graphics/ViewContext.cs index a03fdb0..63d8d5d 100644 --- a/Blarg.GameFramework/Graphics/ViewContext.cs +++ b/Blarg.GameFramework/Graphics/ViewContext.cs @@ -130,7 +130,7 @@ namespace Blarg.GameFramework.Graphics _graphicsDevice.Window.ClientRectangle.Bottom ); */ - var r = new Rect(0, 0, Platform.Application.Window.ClientWidth, Platform.Application.Window.ClientHeight); + var r = new Rect(0, 0, Framework.Application.Window.ClientWidth, Framework.Application.Window.ClientHeight); Init(r, false); } diff --git a/Blarg.GameFramework/IApplication.cs b/Blarg.GameFramework/IApplication.cs index 130e466..1bc1294 100644 --- a/Blarg.GameFramework/IApplication.cs +++ b/Blarg.GameFramework/IApplication.cs @@ -10,7 +10,7 @@ namespace Blarg.GameFramework public interface IApplication : IDisposable { PlatformOS OperatingSystem { get; } - PlatformType Type { get; } + PlatformType PlatformType { get; } ILogger Logger { get; } ServiceContainer Services { get; } diff --git a/Blarg.GameFramework/Processes/ProcessManager.cs b/Blarg.GameFramework/Processes/ProcessManager.cs index 3881029..4294240 100644 --- a/Blarg.GameFramework/Processes/ProcessManager.cs +++ b/Blarg.GameFramework/Processes/ProcessManager.cs @@ -57,20 +57,20 @@ namespace Blarg.GameFramework.Processes if (dueToOverlay) { - Platform.Logger.Info(LOG_TAG, "Pausing all active processes due to state being overlayed on to the parent state."); + Framework.Logger.Info(LOG_TAG, "Pausing all active processes due to state being overlayed on to the parent state."); for (var node = _processes.First; node != null; node = node.Next) { var processInfo = node.Value; if (!processInfo.IsInactive) { - Platform.Logger.Info(LOG_TAG, "Pausing process {0} due to parent state overlay.", processInfo.Descriptor); + Framework.Logger.Info(LOG_TAG, "Pausing process {0} due to parent state overlay.", processInfo.Descriptor); processInfo.Process.OnPause(true); } } } else { - Platform.Logger.Info(LOG_TAG, "Transitioning out all active processes pending pause."); + Framework.Logger.Info(LOG_TAG, "Transitioning out all active processes pending pause."); for (var node = _processes.First; node != null; node = node.Next) { var processInfo = node.Value; @@ -87,26 +87,26 @@ namespace Blarg.GameFramework.Processes if (fromOverlay) { - Platform.Logger.Info(LOG_TAG, "Resuming all active processes due to overlay state being removed from overtop of parent state."); + Framework.Logger.Info(LOG_TAG, "Resuming all active processes due to overlay state being removed from overtop of parent state."); for (var node = _processes.First; node != null; node = node.Next) { var processInfo = node.Value; if (!processInfo.IsInactive) { - Platform.Logger.Info(LOG_TAG, "Resuming process {0} due to overlay state removal.", processInfo.Descriptor); + Framework.Logger.Info(LOG_TAG, "Resuming process {0} due to overlay state removal.", processInfo.Descriptor); processInfo.Process.OnResume(true); } } } else { - Platform.Logger.Info(LOG_TAG, "Resuming processes."); + Framework.Logger.Info(LOG_TAG, "Resuming processes."); for (var node = _processes.First; node != null; node = node.Next) { var processInfo = node.Value; if (processInfo.IsInactive && !processInfo.IsBeingRemoved) { - Platform.Logger.Info(LOG_TAG, "Resuming process {0}", processInfo.Descriptor); + Framework.Logger.Info(LOG_TAG, "Resuming process {0}", processInfo.Descriptor); processInfo.Process.OnResume(false); StartTransitionIn(processInfo); @@ -240,7 +240,7 @@ namespace Blarg.GameFramework.Processes public void RemoveAll() { - Platform.Logger.Info(LOG_TAG, "Transitioning out all processes pending removal."); + Framework.Logger.Info(LOG_TAG, "Transitioning out all processes pending removal."); for (var node = _processes.First; node != null; node = node.Next) { var processInfo = node.Value; @@ -256,7 +256,7 @@ namespace Blarg.GameFramework.Processes if (newProcessInfo.Process == null) throw new ArgumentException("No GameProcess provided."); - Platform.Logger.Info(LOG_TAG, "Queueing process {0}.", newProcessInfo.Descriptor); + Framework.Logger.Info(LOG_TAG, "Queueing process {0}.", newProcessInfo.Descriptor); _queue.Enqueue(newProcessInfo); } @@ -275,7 +275,7 @@ namespace Blarg.GameFramework.Processes processInfo.IsTransitioning = true; processInfo.IsTransitioningOut = false; processInfo.IsTransitionStarting = true; - Platform.Logger.Info(LOG_TAG, "Transition into process {0} started.", processInfo.Descriptor); + Framework.Logger.Info(LOG_TAG, "Transition into process {0} started.", processInfo.Descriptor); } private void StartTransitionOut(ProcessInfo processInfo, bool forRemoval) @@ -289,7 +289,7 @@ namespace Blarg.GameFramework.Processes processInfo.IsTransitioningOut = true; processInfo.IsTransitionStarting = true; processInfo.IsBeingRemoved = forRemoval; - Platform.Logger.Info(LOG_TAG, "Transition out of process {0} started pending {1}.", processInfo.Descriptor, (forRemoval ? "removal" : "pause")); + Framework.Logger.Info(LOG_TAG, "Transition out of process {0} started pending {1}.", processInfo.Descriptor, (forRemoval ? "removal" : "pause")); } private void CleanupInactiveProcesses() @@ -304,7 +304,7 @@ namespace Blarg.GameFramework.Processes _processes.Remove(node); node = next; - Platform.Logger.Info(LOG_TAG, "Deleting inactive process {0}.", processInfo.Descriptor); + Framework.Logger.Info(LOG_TAG, "Deleting inactive process {0}.", processInfo.Descriptor); processInfo.Process.Dispose(); processInfo = null; } @@ -320,7 +320,7 @@ namespace Blarg.GameFramework.Processes var processInfo = node.Value; if (!processInfo.IsInactive && processInfo.Process.IsFinished && !processInfo.IsTransitioning) { - Platform.Logger.Info(LOG_TAG, "Process {0} marked as finished.", processInfo.Descriptor); + Framework.Logger.Info(LOG_TAG, "Process {0} marked as finished.", processInfo.Descriptor); StartTransitionOut(processInfo, true); } } @@ -332,7 +332,7 @@ namespace Blarg.GameFramework.Processes { var processInfo = _queue.Dequeue(); - Platform.Logger.Info(LOG_TAG, "Adding process {0} from queue.", processInfo.Descriptor); + Framework.Logger.Info(LOG_TAG, "Adding process {0} from queue.", processInfo.Descriptor); _processes.AddLast(processInfo); processInfo.Process.OnAdd(); @@ -350,7 +350,7 @@ namespace Blarg.GameFramework.Processes bool isDone = processInfo.Process.OnTransition(delta, processInfo.IsTransitioningOut, processInfo.IsTransitionStarting); if (isDone) { - Platform.Logger.Info(LOG_TAG, "Transition {0} into process {1} finished.", + Framework.Logger.Info(LOG_TAG, "Transition {0} into process {1} finished.", (processInfo.IsTransitioningOut ? "out of" : "into"), processInfo.Descriptor); @@ -360,12 +360,12 @@ namespace Blarg.GameFramework.Processes { if (processInfo.IsBeingRemoved) { - Platform.Logger.Info(LOG_TAG, "Removing process {0}.", processInfo.Descriptor); + Framework.Logger.Info(LOG_TAG, "Removing process {0}.", processInfo.Descriptor); processInfo.Process.OnRemove(); } else { - Platform.Logger.Info(LOG_TAG, "Pausing process {0}.", processInfo.Descriptor); + Framework.Logger.Info(LOG_TAG, "Pausing process {0}.", processInfo.Descriptor); processInfo.Process.OnPause(false); } processInfo.IsInactive = true; @@ -449,12 +449,12 @@ namespace Blarg.GameFramework.Processes if (_processes == null) return; - Platform.Logger.Info(LOG_TAG, "ProcessManager disposing."); + Framework.Logger.Info(LOG_TAG, "ProcessManager disposing."); while (_processes.Count > 0) { var processInfo = _processes.Last.Value; - Platform.Logger.Info(LOG_TAG, "Removing process {0} as part of ProcessManager shutdown.", processInfo.Descriptor); + Framework.Logger.Info(LOG_TAG, "Removing process {0} as part of ProcessManager shutdown.", processInfo.Descriptor); processInfo.Process.OnRemove(); processInfo.Process.Dispose(); _processes.RemoveLast(); @@ -464,7 +464,7 @@ namespace Blarg.GameFramework.Processes while (_queue.Count > 0) { var processInfo = _queue.Dequeue(); - Platform.Logger.Info(LOG_TAG, "Removing queued process {0} as part of ProcessManager shutdown.", processInfo.Descriptor); + Framework.Logger.Info(LOG_TAG, "Removing queued process {0} as part of ProcessManager shutdown.", processInfo.Descriptor); processInfo.Process.Dispose(); } diff --git a/Blarg.GameFramework/ServiceContainer.cs b/Blarg.GameFramework/ServiceContainer.cs index 5ce5f08..7626bd4 100644 --- a/Blarg.GameFramework/ServiceContainer.cs +++ b/Blarg.GameFramework/ServiceContainer.cs @@ -13,7 +13,7 @@ namespace Blarg.GameFramework public ServiceContainer() { _services = new Dictionary(); - Platform.Logger.Debug(LOG_TAG, "Ready for use."); + Framework.Logger.Debug(LOG_TAG, "Ready for use."); } public void Register(object service) @@ -30,7 +30,7 @@ namespace Blarg.GameFramework ((IService)service).OnRegister(); _services.Add(type, service); - Platform.Logger.Debug(LOG_TAG, "Registered object of type {0}.", type); + Framework.Logger.Debug(LOG_TAG, "Registered object of type {0}.", type); } public void Unregister(object service) @@ -48,7 +48,7 @@ namespace Blarg.GameFramework throw new InvalidOperationException("This is not the service object that was registered under this type."); _services.Remove(type); - Platform.Logger.Debug(LOG_TAG, "Unregistered object of type {0}.", type); + Framework.Logger.Debug(LOG_TAG, "Unregistered object of type {0}.", type); if (registeredService is IService) ((IService)registeredService).OnUnregister(); @@ -70,7 +70,7 @@ namespace Blarg.GameFramework public void Dispose() { - Platform.Logger.Debug(LOG_TAG, "Disposing."); + Framework.Logger.Debug(LOG_TAG, "Disposing."); foreach (var i in _services) { diff --git a/Blarg.GameFramework/States/StateManager.cs b/Blarg.GameFramework/States/StateManager.cs index 5d6ac28..25abe31 100644 --- a/Blarg.GameFramework/States/StateManager.cs +++ b/Blarg.GameFramework/States/StateManager.cs @@ -265,7 +265,7 @@ namespace Blarg.GameFramework.States if (IsTransitioning) throw new InvalidOperationException(); - Platform.Logger.Info(LOG_TAG, "Pop initiated for top-most state only."); + Framework.Logger.Info(LOG_TAG, "Pop initiated for top-most state only."); StartOnlyTopStateTransitioningOut(false); } @@ -274,7 +274,7 @@ namespace Blarg.GameFramework.States if (IsTransitioning) throw new InvalidOperationException(); - Platform.Logger.Info(LOG_TAG, "Pop initiated for all top active states"); + Framework.Logger.Info(LOG_TAG, "Pop initiated for all top active states"); StartTopStatesTransitioningOut(false); } @@ -287,7 +287,7 @@ namespace Blarg.GameFramework.States if (_pushQueueHasOverlay && !newStateInfo.IsOverlay) throw new InvalidOperationException("Cannot queue new non-overlay state while queue is active with overlay states."); - Platform.Logger.Info(LOG_TAG, "Queueing state {0} for pushing.", newStateInfo.Descriptor); + Framework.Logger.Info(LOG_TAG, "Queueing state {0} for pushing.", newStateInfo.Descriptor); if (!newStateInfo.IsOverlay) StartTopStatesTransitioningOut(true); @@ -307,7 +307,7 @@ namespace Blarg.GameFramework.States if (_swapQueueHasOverlay && !newStateInfo.IsOverlay) throw new InvalidOperationException("Cannot queue new non-overlay state while queue is active with overlay states."); - Platform.Logger.Info(LOG_TAG, "Queueing state {0} for swapping with {1}.", newStateInfo.Descriptor, (swapTopNonOverlay ? "all top active states" : "only top-most active state.")); + Framework.Logger.Info(LOG_TAG, "Queueing state {0} for swapping with {1}.", newStateInfo.Descriptor, (swapTopNonOverlay ? "all top active states" : "only top-most active state.")); if (swapTopNonOverlay) StartTopStatesTransitioningOut(false); @@ -372,7 +372,7 @@ namespace Blarg.GameFramework.States _states.Remove(node); node = next; - Platform.Logger.Info(LOG_TAG, "Deleting inactive popped state {0}.", stateInfo.Descriptor); + Framework.Logger.Info(LOG_TAG, "Deleting inactive popped state {0}.", stateInfo.Descriptor); stateInfo.State.Dispose(); stateInfo = null; } @@ -400,7 +400,7 @@ namespace Blarg.GameFramework.States var topNonOverlayStateInfo = TopNonOverlay; if (!topNonOverlayStateInfo.IsInactive && topNonOverlayStateInfo.State.IsFinished) { - Platform.Logger.Info(LOG_TAG, "State {0} marked as finished.", topNonOverlayStateInfo.Descriptor); + Framework.Logger.Info(LOG_TAG, "State {0} marked as finished.", topNonOverlayStateInfo.Descriptor); TransitionOut(topNonOverlayStateInfo, true); needToAlsoTransitionOutOverlays = true; @@ -420,7 +420,7 @@ namespace Blarg.GameFramework.States var stateInfo = node.Value; if (!stateInfo.IsInactive && (stateInfo.State.IsFinished || needToAlsoTransitionOutOverlays)) { - Platform.Logger.Info(LOG_TAG, "State {0} marked as finished.", stateInfo.Descriptor); + Framework.Logger.Info(LOG_TAG, "State {0} marked as finished.", stateInfo.Descriptor); TransitionOut(stateInfo, true); } } @@ -452,7 +452,7 @@ namespace Blarg.GameFramework.States var currentTopStateInfo = Top; if (stateInfo.IsOverlay && !currentTopStateInfo.IsInactive && !currentTopStateInfo.IsOverlayed) { - Platform.Logger.Info(LOG_TAG, "Pausing {0}state {1} due to overlay.", (currentTopStateInfo.IsOverlay ? "overlay " : ""), currentTopStateInfo.Descriptor); + Framework.Logger.Info(LOG_TAG, "Pausing {0}state {1} due to overlay.", (currentTopStateInfo.IsOverlay ? "overlay " : ""), currentTopStateInfo.Descriptor); currentTopStateInfo.State.OnPause(true); // also mark the current top state as being overlay-ed @@ -460,7 +460,7 @@ namespace Blarg.GameFramework.States } } - Platform.Logger.Info(LOG_TAG, "Pushing {0}state {1} from push-queue.", (stateInfo.IsOverlay ? "overlay " : ""), stateInfo.Descriptor); + Framework.Logger.Info(LOG_TAG, "Pushing {0}state {1} from push-queue.", (stateInfo.IsOverlay ? "overlay " : ""), stateInfo.Descriptor); stateInfo.State.OnPush(); TransitionIn(stateInfo, false); @@ -478,14 +478,14 @@ namespace Blarg.GameFramework.States var currentTopStateInfo = Top; if (stateInfo.IsOverlay && !currentTopStateInfo.IsInactive && !currentTopStateInfo.IsOverlayed) { - Platform.Logger.Info(LOG_TAG, "Pausing {0}state {1} due to overlay.", (currentTopStateInfo.IsOverlay ? "overlay " : ""), currentTopStateInfo.Descriptor); + Framework.Logger.Info(LOG_TAG, "Pausing {0}state {1} due to overlay.", (currentTopStateInfo.IsOverlay ? "overlay " : ""), currentTopStateInfo.Descriptor); currentTopStateInfo.State.OnPause(true); // also mark the current top state as being overlay-ed currentTopStateInfo.IsOverlayed = true; } - Platform.Logger.Info(LOG_TAG, "Pushing {0}state {1} from swap-queue.", (stateInfo.IsOverlay ? "overlay " : ""), stateInfo.Descriptor); + Framework.Logger.Info(LOG_TAG, "Pushing {0}state {1} from swap-queue.", (stateInfo.IsOverlay ? "overlay " : ""), stateInfo.Descriptor); stateInfo.State.OnPush(); TransitionIn(stateInfo, false); @@ -515,7 +515,7 @@ namespace Blarg.GameFramework.States if (stateInfo.IsInactive || !stateInfo.IsOverlayed) throw new InvalidOperationException(); - Platform.Logger.Info(LOG_TAG, "Resuming {0}state {1} due to overlay removal.", (stateInfo.IsOverlay ? "overlay " : ""), stateInfo.Descriptor); + Framework.Logger.Info(LOG_TAG, "Resuming {0}state {1} due to overlay removal.", (stateInfo.IsOverlay ? "overlay " : ""), stateInfo.Descriptor); stateInfo.State.OnResume(true); stateInfo.IsOverlayed = false; @@ -527,7 +527,7 @@ namespace Blarg.GameFramework.States if (!Top.IsInactive) return; - Platform.Logger.Info(LOG_TAG, "Top-most state is inactive. Resuming all top states up to and including the next non-overlay."); + Framework.Logger.Info(LOG_TAG, "Top-most state is inactive. Resuming all top states up to and including the next non-overlay."); // top state is inactive, time to resume one or more states... // find the topmost non-overlay state and take it and all overlay @@ -535,7 +535,7 @@ namespace Blarg.GameFramework.States for (var node = TopNonOverlayNode; node != null; node = node.Next) { var stateInfo = node.Value; - Platform.Logger.Info(LOG_TAG, "Resuming {0}state {1}.", (stateInfo.IsOverlay ? "overlay " : ""), stateInfo.Descriptor); + Framework.Logger.Info(LOG_TAG, "Resuming {0}state {1}.", (stateInfo.IsOverlay ? "overlay " : ""), stateInfo.Descriptor); stateInfo.State.OnResume(false); TransitionIn(stateInfo, true); @@ -553,7 +553,7 @@ namespace Blarg.GameFramework.States bool isDone = stateInfo.State.OnTransition(delta, stateInfo.IsTransitioningOut, stateInfo.IsTransitionStarting); if (isDone) { - Platform.Logger.Info(LOG_TAG, "Transition {0} {1}state {2} finished.", + Framework.Logger.Info(LOG_TAG, "Transition {0} {1}state {2} finished.", (stateInfo.IsTransitioningOut ? "out of" : "into"), (stateInfo.IsOverlay ? "overlay " : ""), stateInfo.Descriptor); @@ -564,18 +564,18 @@ namespace Blarg.GameFramework.States { if (stateInfo.IsBeingPopped) { - Platform.Logger.Info(LOG_TAG, "Popping {0}state {1}", (stateInfo.IsOverlay ? "overlay " : ""), stateInfo.Descriptor); + Framework.Logger.Info(LOG_TAG, "Popping {0}state {1}", (stateInfo.IsOverlay ? "overlay " : ""), stateInfo.Descriptor); stateInfo.State.OnPop(); if (stateInfo.State.ReturnValue != null) { LastReturnValue = stateInfo.State.ReturnValue; - Platform.Logger.Info(LOG_TAG, "Return value of {0} retrieved from {1}.", LastReturnValue.Value, stateInfo.Descriptor); + Framework.Logger.Info(LOG_TAG, "Return value of {0} retrieved from {1}.", LastReturnValue.Value, stateInfo.Descriptor); } } else { - Platform.Logger.Info(LOG_TAG, "Pausing {0}state {1}.", (stateInfo.IsOverlay ? "overlay " : ""), stateInfo.Descriptor); + Framework.Logger.Info(LOG_TAG, "Pausing {0}state {1}.", (stateInfo.IsOverlay ? "overlay " : ""), stateInfo.Descriptor); stateInfo.State.OnPause(false); } stateInfo.IsInactive = true; @@ -597,7 +597,7 @@ namespace Blarg.GameFramework.States stateInfo.IsTransitioning = true; stateInfo.IsTransitioningOut = false; stateInfo.IsTransitionStarting = true; - Platform.Logger.Info(LOG_TAG, "Transition into {0}state {1} started.", (stateInfo.IsOverlay ? "overlay " : ""), stateInfo.Descriptor); + Framework.Logger.Info(LOG_TAG, "Transition into {0}state {1} started.", (stateInfo.IsOverlay ? "overlay " : ""), stateInfo.Descriptor); if (forResuming) stateInfo.State.ProcessManager.OnResume(false); @@ -609,7 +609,7 @@ namespace Blarg.GameFramework.States stateInfo.IsTransitioningOut = true; stateInfo.IsTransitionStarting = true; stateInfo.IsBeingPopped = forPopping; - Platform.Logger.Info(LOG_TAG, "Transition out of {0}state {1} started.", (stateInfo.IsOverlay ? "overlay " : ""), stateInfo.Descriptor); + Framework.Logger.Info(LOG_TAG, "Transition out of {0}state {1} started.", (stateInfo.IsOverlay ? "overlay " : ""), stateInfo.Descriptor); if (forPopping) stateInfo.State.ProcessManager.RemoveAll(); @@ -677,12 +677,12 @@ namespace Blarg.GameFramework.States if (_states == null) return; - Platform.Logger.Info(LOG_TAG, "StateManager disposing."); + Framework.Logger.Info(LOG_TAG, "StateManager disposing."); while (_states.Count > 0) { var stateInfo = _states.Last.Value; - Platform.Logger.Info(LOG_TAG, "Popping state {0} as part of StateManager shutdown.", stateInfo.Descriptor); + Framework.Logger.Info(LOG_TAG, "Popping state {0} as part of StateManager shutdown.", stateInfo.Descriptor); stateInfo.State.OnPop(); stateInfo.State.Dispose(); _states.RemoveLast(); @@ -692,13 +692,13 @@ namespace Blarg.GameFramework.States while (_pushQueue.Count > 0) { var stateInfo = _pushQueue.Dequeue(); - Platform.Logger.Info(LOG_TAG, "Deleting push-queued state {0} as part of StateManager shutdown.", stateInfo.Descriptor); + Framework.Logger.Info(LOG_TAG, "Deleting push-queued state {0} as part of StateManager shutdown.", stateInfo.Descriptor); stateInfo.State.Dispose(); } while (_swapQueue.Count > 0) { var stateInfo = _swapQueue.Dequeue(); - Platform.Logger.Info(LOG_TAG, "Deleting swap-queued state {0} as part of StateManager shutdown.", stateInfo.Descriptor); + Framework.Logger.Info(LOG_TAG, "Deleting swap-queued state {0} as part of StateManager shutdown.", stateInfo.Descriptor); stateInfo.State.Dispose(); } diff --git a/Blarg.GameFramework/Support/FreeMovementCamera.cs b/Blarg.GameFramework/Support/FreeMovementCamera.cs index 592786e..de150c1 100644 --- a/Blarg.GameFramework/Support/FreeMovementCamera.cs +++ b/Blarg.GameFramework/Support/FreeMovementCamera.cs @@ -29,16 +29,16 @@ namespace Blarg.GameFramework.Support float pointerDeltaY = 0.0f; bool isPointerTouching = false; - if (Platform.Mouse != null && Platform.Mouse.IsDown(MouseButton.Left)) + if (Framework.Mouse != null && Framework.Mouse.IsDown(MouseButton.Left)) { - pointerDeltaX = Platform.Mouse.DeltaX; - pointerDeltaY = Platform.Mouse.DeltaY; + pointerDeltaX = Framework.Mouse.DeltaX; + pointerDeltaY = Framework.Mouse.DeltaY; isPointerTouching = true; } - else if (Platform.TouchScreen != null && Platform.TouchScreen.IsTouching) + else if (Framework.TouchScreen != null && Framework.TouchScreen.IsTouching) { - pointerDeltaX = Platform.TouchScreen.PrimaryPointer.DeltaX; - pointerDeltaY = Platform.TouchScreen.PrimaryPointer.DeltaY; + pointerDeltaX = Framework.TouchScreen.PrimaryPointer.DeltaX; + pointerDeltaY = Framework.TouchScreen.PrimaryPointer.DeltaY; isPointerTouching = true; } @@ -58,13 +58,13 @@ namespace Blarg.GameFramework.Support _movement = Vector3.Zero; - if (Platform.Keyboard.IsDown(Key.Up)) + if (Framework.Keyboard.IsDown(Key.Up)) _movement.Z -= delta * 6.0f; - if (Platform.Keyboard.IsDown(Key.Down)) + if (Framework.Keyboard.IsDown(Key.Down)) _movement.Z += delta * 6.0f; - if (Platform.Keyboard.IsDown(Key.Left)) + if (Framework.Keyboard.IsDown(Key.Left)) _movement.X -= delta * 6.0f; - if (Platform.Keyboard.IsDown(Key.Right)) + if (Framework.Keyboard.IsDown(Key.Right)) _movement.X += delta * 6.0f; UpdateLookAtMatrix(ref _movement); diff --git a/Game.Core/GameApp.cs b/Game.Core/GameApp.cs index f7e5b9f..414de94 100644 --- a/Game.Core/GameApp.cs +++ b/Game.Core/GameApp.cs @@ -45,18 +45,18 @@ namespace Game public void OnLoad() { - _camera = new FreeMovementCamera(Platform.GraphicsDevice.ViewContext); + _camera = new FreeMovementCamera(Framework.GraphicsDevice.ViewContext); _camera.Position = new Vector3(0.0f, 5.0f, 0.0f); - Platform.GraphicsDevice.ViewContext.Camera = _camera; + Framework.GraphicsDevice.ViewContext.Camera = _camera; - _grid = new FlatWireframeGrid(Platform.GraphicsDevice, 32, 32); + _grid = new FlatWireframeGrid(Framework.GraphicsDevice, 32, 32); - _spriteBatch = new SpriteBatch(Platform.GraphicsDevice); + _spriteBatch = new SpriteBatch(Framework.GraphicsDevice); } public void OnUnload() { - Platform.GraphicsDevice.ViewContext.Camera = null; + Framework.GraphicsDevice.ViewContext.Camera = null; } public void OnLostContext() @@ -69,26 +69,26 @@ namespace Game public void OnRender(float delta) { - Platform.GraphicsDevice.Clear(0.25f, 0.5f, 1.0f, 1.0f); + Framework.GraphicsDevice.Clear(0.25f, 0.5f, 1.0f, 1.0f); - var shader = Platform.GraphicsDevice.SimpleColorShader; - Platform.GraphicsDevice.BindShader(shader); - shader.SetModelViewMatrix(Platform.GraphicsDevice.ViewContext.ModelViewMatrix); - shader.SetProjectionMatrix(Platform.GraphicsDevice.ViewContext.ProjectionMatrix); + var shader = Framework.GraphicsDevice.SimpleColorShader; + Framework.GraphicsDevice.BindShader(shader); + shader.SetModelViewMatrix(Framework.GraphicsDevice.ViewContext.ModelViewMatrix); + shader.SetProjectionMatrix(Framework.GraphicsDevice.ViewContext.ProjectionMatrix); _grid.Render(); - Platform.GraphicsDevice.UnbindShader(); + Framework.GraphicsDevice.UnbindShader(); long gcmem = GC.GetTotalMemory(false); _sb.Clear(); _sb.Append("GC Mem Usage: ").AppendNumber((int)gcmem).Append('\n') - .Append("FPS: ").AppendNumber(Platform.Application.FPS) - .Append(", ").AppendNumber(Platform.Application.FrameTime).Append(" ms") - .Append(", RT: ").AppendNumber(Platform.Application.RenderTime).Append(" (").AppendNumber(Platform.Application.RendersPerSecond).Append(")") - .Append(", UT: ").AppendNumber(Platform.Application.UpdateTime).Append(" (").AppendNumber(Platform.Application.UpdatesPerSecond).Append(")") + .Append("FPS: ").AppendNumber(Framework.Application.FPS) + .Append(", ").AppendNumber(Framework.Application.FrameTime).Append(" ms") + .Append(", RT: ").AppendNumber(Framework.Application.RenderTime).Append(" (").AppendNumber(Framework.Application.RendersPerSecond).Append(")") + .Append(", UT: ").AppendNumber(Framework.Application.UpdateTime).Append(" (").AppendNumber(Framework.Application.UpdatesPerSecond).Append(")") .Append(", RD: ").AppendNumber(delta); _spriteBatch.Begin(); - _spriteBatch.Render(Platform.GraphicsDevice.SansSerifFont, 10, 10, Color.White, _sb); + _spriteBatch.Render(Framework.GraphicsDevice.SansSerifFont, 10, 10, Color.White, _sb); _spriteBatch.End(); } @@ -98,8 +98,8 @@ namespace Game public void OnUpdate(float delta) { - if (Platform.Keyboard.IsPressed(Blarg.GameFramework.Input.Key.Escape)) - Platform.Application.Quit(); + if (Framework.Keyboard.IsPressed(Blarg.GameFramework.Input.Key.Escape)) + Framework.Application.Quit(); _camera.OnUpdate(delta); }