Refactoring.

This commit is contained in:
Harrison Deng 2020-07-05 23:45:04 -05:00
parent b2a47ebefc
commit 319ade258e
5 changed files with 6 additions and 8 deletions

View File

@ -1,8 +1,9 @@
using System; using System;
using System.Numerics; using System.Numerics;
using SlatedGameToolkit.Framework.Graphics.Render;
using SlatedGameToolkit.Framework.Utilities; using SlatedGameToolkit.Framework.Utilities;
namespace SlatedGameToolkit.Framework.Graphics.Render namespace SlatedGameToolkit.Framework.Graphics
{ {
public class Camera : IMoveable { public class Camera : IMoveable {
private bool viewUpdated = true, projectionUpdated = true, orthographic = false; private bool viewUpdated = true, projectionUpdated = true, orthographic = false;

View File

@ -1,6 +1,6 @@
using System.Numerics; using System.Numerics;
namespace SlatedGameToolkit.Framework.Graphics.Render namespace SlatedGameToolkit.Framework.Graphics
{ {
public class Camera2D : Camera { public class Camera2D : Camera {
public new Vector2 Position { public new Vector2 Position {

View File

@ -124,7 +124,7 @@ namespace SlatedGameToolkit.Framework.Graphics.Text
CharacterMetrics metrics = metricsCache.ComputeIfNonExistent(c, (p) => new CharacterMetrics(glyphIndex, info)); CharacterMetrics metrics = metricsCache.ComputeIfNonExistent(c, (p) => new CharacterMetrics(glyphIndex, info));
//Check if glyph is loaded, if not, throw exception. //Check if glyph is loaded, if not, throw exception.
if (!glyphTexLocations.ContainsKey((c, scale)) || !textures[glyphTexLocations[(c, scale)]].ContainsChar(c, scale)) { if (!glyphTexLocations.ContainsKey((c, scale)) || !textures[glyphTexLocations[(c, scale)]].ContainsChar(c, scale)) {
throw new FrameworkUsageException(string.Format("Character \'{0}\' was not prepared and is missing!", c)); throw new FrameworkUsageException(string.Format("Character \'{0}\' at pixel height {1} was not prepared and is missing!", c, PixelHeight));
} }
FontTexture texture = textures[glyphTexLocations[(c, scale)]]; FontTexture texture = textures[glyphTexLocations[(c, scale)]];

View File

@ -257,7 +257,7 @@ namespace SlatedGameToolkit.Framework.Graphics.Window
/// Instantiates a window with the given OpenGL context, or a new context. /// Instantiates a window with the given OpenGL context, or a new context.
/// </summary> /// </summary>
public WindowContext(string title, int x = -1, int y = -1, int width = 640, int height = 480, bool specialRegions = false, SDL.SDL_WindowFlags options = default(SDL.SDL_WindowFlags)) { public WindowContext(string title, int x = -1, int y = -1, int width = 640, int height = 480, bool specialRegions = false, SDL.SDL_WindowFlags options = default(SDL.SDL_WindowFlags)) {
Logger.Log(String.Format("Starting openGL window with title \"{0}\"", title)); Logger.Log(String.Format("Starting openGL window with title \"{0}\"", title), LogLevel.DEBUG);
windowHandle = SDL.SDL_CreateWindow(title, x < 0 ? SDL.SDL_WINDOWPOS_CENTERED : x, y < 0 ? SDL.SDL_WINDOWPOS_CENTERED : y, width, height, SDL.SDL_WindowFlags.SDL_WINDOW_INPUT_FOCUS | SDL.SDL_WindowFlags.SDL_WINDOW_OPENGL | SDL.SDL_WindowFlags.SDL_WINDOW_MOUSE_FOCUS | options); windowHandle = SDL.SDL_CreateWindow(title, x < 0 ? SDL.SDL_WINDOWPOS_CENTERED : x, y < 0 ? SDL.SDL_WINDOWPOS_CENTERED : y, width, height, SDL.SDL_WindowFlags.SDL_WINDOW_INPUT_FOCUS | SDL.SDL_WindowFlags.SDL_WINDOW_OPENGL | SDL.SDL_WindowFlags.SDL_WINDOW_MOUSE_FOCUS | options);
if (windowHandle == null) { if (windowHandle == null) {
throw new SDLException(); throw new SDLException();

View File

@ -1,8 +1,5 @@
using System;
using System.Drawing; using System.Drawing;
using System.IO;
using System.Numerics; using System.Numerics;
using System.Runtime.InteropServices;
using SDL2; using SDL2;
using SlatedGameToolkit.Framework.Loaders; using SlatedGameToolkit.Framework.Loaders;
using SlatedGameToolkit.Framework.Graphics.Render; using SlatedGameToolkit.Framework.Graphics.Render;
@ -12,7 +9,7 @@ using SlatedGameToolkit.Framework.Graphics.Window;
using SlatedGameToolkit.Framework.Input.Devices; using SlatedGameToolkit.Framework.Input.Devices;
using SlatedGameToolkit.Framework.StateSystem; using SlatedGameToolkit.Framework.StateSystem;
using SlatedGameToolkit.Framework.StateSystem.States; using SlatedGameToolkit.Framework.StateSystem.States;
using StbTrueTypeSharp; using SlatedGameToolkit.Framework.Graphics;
namespace SlatedGameToolkit.Tools.Utilities.Playground namespace SlatedGameToolkit.Tools.Utilities.Playground
{ {