Skip to content

Commit

Permalink
Made ErrorHandler no longer have its own folder
Browse files Browse the repository at this point in the history
  • Loading branch information
TheVave committed Feb 24, 2024
1 parent 240c30e commit e4c333c
Show file tree
Hide file tree
Showing 10 changed files with 54 additions and 57 deletions.
4 changes: 2 additions & 2 deletions SharpPhysics/2d/ObjectRepresentation/Hierarchys/_2dWorld.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using SharpPhysics._2d.ObjectRepresentation.Hierarchies;
using SharpPhysics.Utilities.MISC.Errors;
using SharpPhysics.Utilities.MISC;

namespace SharpPhysics
{
[Serializable]
[Serializable]
public static class _2dWorld
{
public static _2dSceneHierarchy[] SceneHierarchies = [new()];
Expand Down
4 changes: 2 additions & 2 deletions SharpPhysics/2d/ObjectRepresentation/SimulatedObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
using SharpPhysics._2d.Objects;
using SharpPhysics._2d.Physics;
using SharpPhysics._2d.Raycasting;
using SharpPhysics.Utilities.MISC.Errors;
using SharpPhysics.Utilities.MISC;

namespace SharpPhysics._2d.ObjectRepresentation
{
public class SimulatedObject2d
public class SimulatedObject2d
{
/// <summary>
/// The object name
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
using SharpPhysics._2d.ObjectRepresentation;
using SharpPhysics.Utilities.MathUtils;
using SharpPhysics.Utilities.MathUtils.DelaunayTriangulator;
using SharpPhysics.Utilities.MISC.Errors;
using SharpPhysics.Utilities.MISC;

namespace SharpPhysics._2d.Physics.CollisionManagement
{
public static class _2dCollisionManager
public static class _2dCollisionManager
{


Expand Down
4 changes: 2 additions & 2 deletions SharpPhysics/2d/_2DSGLRenderer/Main/Color.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using SharpPhysics.Utilities.MISC.Errors;
using SharpPhysics.Utilities.MISC;

namespace SharpPhysics.Renderer
{
public class Color
public class Color
{
/// <summary>
/// The colors possible with a standard RGBA style.
Expand Down
13 changes: 6 additions & 7 deletions SharpPhysics/2d/_2DSGLRenderer/Main/Internal2dRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using SharpPhysics.Utilities.MathUtils;
using SharpPhysics.Utilities.MathUtils.DelaunayTriangulator;
using SharpPhysics.Utilities.MISC;
using SharpPhysics.Utilities.MISC.Errors;
using Silk.NET.Core;
using Silk.NET.Input;
using Silk.NET.OpenGL;
Expand All @@ -16,12 +15,12 @@

namespace SharpPhysics._2d._2DSGLRenderer.Main
{
/// <summary>
/// Handled by the MainRendererSGL class.
/// Please do not interface directly unless you know what you're doing,
/// though useful if you want to make custom rendering code.
/// </summary>
public class Internal2dRenderer
/// <summary>
/// Handled by the MainRendererSGL class.
/// Please do not interface directly unless you know what you're doing,
/// though useful if you want to make custom rendering code.
/// </summary>
public class Internal2dRenderer
{
/// <summary>
/// The time since the program started
Expand Down
4 changes: 2 additions & 2 deletions SharpPhysics/2d/_2DSGLRenderer/Shaders/ShaderCollector.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using SharpPhysics.Utilities.MISC.Errors;
using SharpPhysics.Utilities.MISC;

namespace SharpPhysics._2d._2DSGLRenderer.Shaders
{
public static class ShaderCollector
public static class ShaderCollector
{
public static string GetShader(string name)
{
Expand Down
4 changes: 2 additions & 2 deletions SharpPhysics/ProgramSaving/ObjectSaving/SaveHelperObject.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using Newtonsoft.Json;
using SharpPhysics.Utilities.MISC.Errors;
using SharpPhysics.Utilities.MISC;

namespace SharpPhysics
{
public static class SaveHelper
public static class SaveHelper
{
/// <summary>
/// Indicates the number of saves that SharpPhysics will attempt to do before over-writing one.
Expand Down
35 changes: 35 additions & 0 deletions SharpPhysics/Utilities/MISC/ErrorHandler.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using SharpPhysics.Exceptions;
using System.Runtime.InteropServices;

namespace SharpPhysics.Utilities.MISC
{
public static class ErrorHandler
{
public static bool IsWindows = true;
public static bool InitCalled = false;
public static string[] errors = File.ReadAllLines($"{Environment.CurrentDirectory}\\errors.tx");
public static void ThrowError(int messageIdx, bool crash)
{
string message = errors[messageIdx - 1];
ThrowError(message, crash);
}
public static void ThrowError(string message, bool crash)
{
if (Environment.OSVersion.Platform == PlatformID.Win32NT)
{
[DllImport("user32.dll")]
static extern int MessageBox(nint h, string m, string c, int type);
_ = MessageBox(nint.Zero, message, "Error", /* 0x01 is MB_ICONERROR (error symbol) and 0x00 is MB_OK (ok message box) */ 0x10 | 0x00);
if (crash) throw new MessageBoxException(message + " (Shown in message box)");
}
else
{
throw new Exception(message + " Non Windows OS.");
}
}
public static bool YesNoQuestion(string question, string title, bool crashOnNo)
{
return true;
}
}
}
36 changes: 0 additions & 36 deletions SharpPhysics/Utilities/MISC/Errors/ErrorHandler.cs

This file was deleted.

3 changes: 1 addition & 2 deletions SharpPhysics/Utilities/MISC/RenderingUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@
using SharpPhysics._2d.ObjectRepresentation;
using SharpPhysics.Utilities.MathUtils;
using SharpPhysics.Utilities.MathUtils.DelaunayTriangulator;
using SharpPhysics.Utilities.MISC.Errors;
using Silk.NET.Core;
using StbImageSharp;
using static SharpPhysics.Utilities.MathUtils.GenericMathUtils;

namespace SharpPhysics.Utilities.MISC
{
public static class RenderingUtils
public static class RenderingUtils
{

static int i6 = 0;
Expand Down

0 comments on commit e4c333c

Please sign in to comment.