diff --git a/NetClassic.sln b/NetClassic.sln new file mode 100644 index 0000000..8f080ae --- /dev/null +++ b/NetClassic.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.11.35327.3 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetClassic", "NetClassic\NetClassic.csproj", "{FBEDDF31-549F-44EE-A794-BE7913AF0258}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {FBEDDF31-549F-44EE-A794-BE7913AF0258}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FBEDDF31-549F-44EE-A794-BE7913AF0258}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FBEDDF31-549F-44EE-A794-BE7913AF0258}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FBEDDF31-549F-44EE-A794-BE7913AF0258}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {4D4074D4-80F7-47DF-A7AC-A463C72CE3F5} + EndGlobalSection +EndGlobal diff --git a/NetClassic/Logger.cs b/NetClassic/Logger.cs new file mode 100644 index 0000000..33bcc4c --- /dev/null +++ b/NetClassic/Logger.cs @@ -0,0 +1,44 @@ +using System; + +namespace NetClassic +{ + public class Logger + { + private string LoggerName; + public Logger(string loggerName) + { + LoggerName = loggerName; + } + public void logInfo(string logData) + { + ConsoleColor old = Console.ForegroundColor; + Console.ForegroundColor = ConsoleColor.Gray; + Console.WriteLine($"[{DateTime.Now.ToLongTimeString()}] [INFO] [{LoggerName}] {logData}"); + Console.ForegroundColor = old; + } + + public void logWarning(string logData) + { + ConsoleColor old = Console.ForegroundColor; + Console.ForegroundColor = ConsoleColor.Yellow; + Console.WriteLine($"[{DateTime.Now.ToLongTimeString()}] [WARNING] [{LoggerName}] {logData}"); + Console.ForegroundColor = old; + } + + public void logError(string logData) + { + ConsoleColor old = Console.ForegroundColor; + Console.ForegroundColor = ConsoleColor.Red; + Console.WriteLine($"[{DateTime.Now.ToLongTimeString()}] [ERROR] [{LoggerName}] {logData}"); + Console.ForegroundColor = old; + } + + public void logFatal(string logData) + { + ConsoleColor old = Console.ForegroundColor; + Console.ForegroundColor = ConsoleColor.DarkRed; + Console.WriteLine($"[{DateTime.Now.ToLongTimeString()}] [FATAL] [{LoggerName}] {logData}"); + Console.ForegroundColor = old; + } + } +} diff --git a/NetClassic/NetClassic.csproj b/NetClassic/NetClassic.csproj new file mode 100644 index 0000000..925b0be --- /dev/null +++ b/NetClassic/NetClassic.csproj @@ -0,0 +1,12 @@ + + + + Exe + netcoreapp3.1 + + + + + + + diff --git a/NetClassic/Program.cs b/NetClassic/Program.cs new file mode 100644 index 0000000..c1567e6 --- /dev/null +++ b/NetClassic/Program.cs @@ -0,0 +1,32 @@ +using SDL2; +using System; +using System.Timers; + +namespace NetClassic +{ + public class Program + { + static bool gameRunning = true; + static Logger logger = new Logger("NetClassic.Program"); + static void Main(string[] args) + { + logger.logInfo("Initializing SDL Video and Events..."); + SDL.SDL_Init(SDL.SDL_INIT_VIDEO | SDL.SDL_INIT_EVENTS); + logger.logInfo("Creating Window..."); + IntPtr window = SDL.SDL_CreateWindow("NetClassic", SDL.SDL_WINDOWPOS_CENTERED, SDL.SDL_WINDOWPOS_CENTERED, 1024, 768, SDL.SDL_WindowFlags.SDL_WINDOW_OPENGL); + logger.logInfo("Creating Renderer..."); + IntPtr renderer = SDL.SDL_CreateRenderer(window, -1, SDL.SDL_RendererFlags.SDL_RENDERER_ACCELERATED); + while(gameRunning) + { + SDL.SDL_Event e; + if (SDL.SDL_WaitEvent(out e) != 0) + { + if (e.type == SDL.SDL_EventType.SDL_QUIT) + { + gameRunning = false; + } + } + } + } + } +}