Added window control grabbing and special hit testing.

Also cleaned up and added exceptions to better structure exception handling.

Many small changes to improve useability of framework.

Some refactoring.
This commit is contained in:
2020-05-23 22:48:55 -05:00
parent bd6b085687
commit 7a6f709e9a
12 changed files with 168 additions and 28 deletions

View File

@@ -0,0 +1,17 @@
using System;
namespace SlatedGameToolkit.Framework.Exceptions
{
public abstract class FrameworkException : Exception {
public FrameworkException() {
}
public FrameworkException(string message) : base(message) {
}
public FrameworkException(string message, Exception inner) : base(message, inner) {
}
}
}

View File

@@ -0,0 +1,21 @@
using System;
namespace SlatedGameToolkit.Framework.Exceptions
{
/// <summary>
/// Any errors generated by an SDL feature that the engine requires are wrapped in the form of this type of exception.
/// </summary>
public class FrameworkSDLException : SDLException {
public FrameworkSDLException() : base() {
}
public FrameworkSDLException(string message) : base(message) {
}
public FrameworkSDLException(string message, Exception inner) : base(message, inner) {
}
}
}

View File

@@ -0,0 +1,20 @@
using System;
namespace SlatedGameToolkit.Framework.Exceptions
{
/// <summary>
/// An exception that is thrown when there is an inappropriate use of the framework.
/// </summary>
public class FrameworkUsageException : FrameworkException {
public FrameworkUsageException() : base() {
}
public FrameworkUsageException(string message) : base(message) {
}
public FrameworkUsageException(string message, Exception inner) : base(message, inner) {
}
}
}

View File

@@ -0,0 +1,18 @@
using System;
namespace SlatedGameToolkit.Framework.Exceptions
{
internal class InternalFrameworkException : FrameworkException {
const string ADDITIONAL_MESSAGE = "\nThis exception is a framework bug!";
public InternalFrameworkException() : base() {
}
public InternalFrameworkException(string message) : base(message + ADDITIONAL_MESSAGE) {
}
public InternalFrameworkException(string message, Exception inner) : base(message + ADDITIONAL_MESSAGE, inner) {
}
}
}

View File

@@ -0,0 +1,22 @@
using System;
namespace SlatedGameToolkit.Framework.Exceptions
{
/// <summary>
/// This exception is produced when the error producing SDL feature is not something the framework considers critical.
/// This can happen if not all framework supported platforms support a specific feature that SDL provides.
/// </summary>
public class OptionalSDLException : SDLException {
public OptionalSDLException() : base() {
}
public OptionalSDLException(string message) : base(message) {
}
public OptionalSDLException(string message, Exception inner) : base(message, inner) {
}
}
}

View File

@@ -7,7 +7,7 @@ namespace SlatedGameToolkit.Framework.Exceptions
/// An SDLException is defined as an exception that is thrown whenever an error occurrs in any SDL functions.
/// </summary>
[Serializable]
public class SDLException : Exception {
public abstract class SDLException : Exception {
public string SDLMessage { get; }
/// <summary>

View File

@@ -1,17 +0,0 @@
using System;
namespace SlatedGameToolkit.Framework.Exceptions
{
public class SlatedGameToolkitException : Exception {
public SlatedGameToolkitException() {
}
public SlatedGameToolkitException(string message) : base(message) {
}
public SlatedGameToolkitException(string message, Exception inner) : base(message, inner) {
}
}
}