Add project files.
This commit is contained in:
parent
596edaf4f2
commit
f199ab47dc
4 changed files with 113 additions and 0 deletions
25
NetClassic.sln
Normal file
25
NetClassic.sln
Normal file
|
@ -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
|
44
NetClassic/Logger.cs
Normal file
44
NetClassic/Logger.cs
Normal file
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
12
NetClassic/NetClassic.csproj
Normal file
12
NetClassic/NetClassic.csproj
Normal file
|
@ -0,0 +1,12 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ppy.SDL2-CS" Version="1.0.82" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
32
NetClassic/Program.cs
Normal file
32
NetClassic/Program.cs
Normal file
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue