Skip to content

Commit

Permalink
chore!: net8.0 (#10)
Browse files Browse the repository at this point in the history
* Upgrade all projects to net8.0 and lang v12

* Use primary ctors

* Various small fixes and threat warnings as errors

* Set github action to use net8.0
  • Loading branch information
stho01 authored Aug 29, 2024
1 parent d5f0691 commit 29c2011
Show file tree
Hide file tree
Showing 94 changed files with 13,507 additions and 13,719 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ jobs:
runs-on: windows-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.x
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
Expand Down
5 changes: 3 additions & 2 deletions ConsoleEngine.Abstractions/ConsoleEngine.Abstractions.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<LangVersion>10</LangVersion>
<TargetFramework>net8.0</TargetFramework>
<LangVersion>12</LangVersion>
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
</PropertyGroup>

</Project>
15 changes: 7 additions & 8 deletions ConsoleEngine.Abstractions/Inputs/IInputHandler.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
using System.Collections.Generic;
using System.Linq;

namespace ConsoleEngine.Abstractions.Inputs
namespace ConsoleEngine.Abstractions.Inputs;

public interface IInputHandler
{
public interface IInputHandler
{
public KeyState GetKey(Key key) => GetKey((int)key);
public IEnumerable<int> GetPressedKeyCodes();
KeyState GetKey(int id);
void Update();
}
public KeyState GetKey(Key key) => GetKey((int)key);
public IEnumerable<int> GetPressedKeyCodes();
KeyState GetKey(int id);
void Update();
}
95 changes: 47 additions & 48 deletions ConsoleEngine.Abstractions/Inputs/Key.cs
Original file line number Diff line number Diff line change
@@ -1,55 +1,54 @@
namespace ConsoleEngine.Abstractions.Inputs
namespace ConsoleEngine.Abstractions.Inputs;

public enum Key : short
{
public enum Key : short
{
K0 = 0x30, K1 = 0x31, K2 = 0x32, K3 = 0x33, K4 = 0x34,
K5 = 0x35, K6 = 0x36, K7 = 0x37, K8 = 0x38, K9 = 0x39,
K0 = 0x30, K1 = 0x31, K2 = 0x32, K3 = 0x33, K4 = 0x34,
K5 = 0x35, K6 = 0x36, K7 = 0x37, K8 = 0x38, K9 = 0x39,

A = 0x41, B = 0x42, C = 0x43, D = 0x44, E = 0x45,
F = 0x46, G = 0x47, H = 0x48, I = 0x49, J = 0x4A,
K = 0x4B, L = 0x4C, M = 0x4D, N = 0x4E, O = 0x4F,
P = 0x50, Q = 0x51, R = 0x52, S = 0x53, T = 0x54,
U = 0x55, V = 0x56, W = 0x57, X = 0x58, Y = 0x59,
Z = 0x5A,
A = 0x41, B = 0x42, C = 0x43, D = 0x44, E = 0x45,
F = 0x46, G = 0x47, H = 0x48, I = 0x49, J = 0x4A,
K = 0x4B, L = 0x4C, M = 0x4D, N = 0x4E, O = 0x4F,
P = 0x50, Q = 0x51, R = 0x52, S = 0x53, T = 0x54,
U = 0x55, V = 0x56, W = 0x57, X = 0x58, Y = 0x59,
Z = 0x5A,

F1 = 0x70, F2 = 0x71, F3 = 0x72, F4 = 0x73,
F5 = 0x74, F6 = 0x75, F7 = 0x76, F8 = 0x77,
F9 = 0x78, F10 = 0x79, F11 = 0x7A, F12 = 0x7B,
F1 = 0x70, F2 = 0x71, F3 = 0x72, F4 = 0x73,
F5 = 0x74, F6 = 0x75, F7 = 0x76, F8 = 0x77,
F9 = 0x78, F10 = 0x79, F11 = 0x7A, F12 = 0x7B,

ESCAPE = 0x1B,
CONVERT = 0x1C,
NONCONVERT = 0x1D,
ACCEPT = 0x1E,
MODECHANGE = 0x1F,
SPACE = 0x20,
PRIOR = 0x21,
NEXT = 0x22,
END = 0x23,
HOME = 0x24,
LEFT = 0x25,
UP = 0x26,
RIGHT = 0x27,
DOWN = 0x28,
SELECT = 0x29,
PRINT = 0x2A,
EXECUTE = 0x2B,
ENTER = 0x0D,
SNAPSHOT = 0x2C,
INSERT = 0x2D,
DELETE = 0x2E,
HELP = 0x2F,
BACKSPACE = 0x08,
ESCAPE = 0x1B,
CONVERT = 0x1C,
NONCONVERT = 0x1D,
ACCEPT = 0x1E,
MODECHANGE = 0x1F,
SPACE = 0x20,
PRIOR = 0x21,
NEXT = 0x22,
END = 0x23,
HOME = 0x24,
LEFT = 0x25,
UP = 0x26,
RIGHT = 0x27,
DOWN = 0x28,
SELECT = 0x29,
PRINT = 0x2A,
EXECUTE = 0x2B,
ENTER = 0x0D,
SNAPSHOT = 0x2C,
INSERT = 0x2D,
DELETE = 0x2E,
HELP = 0x2F,
BACKSPACE = 0x08,

NUMPAD0 = 0x60, NUMPAD1 = 0x61, NUMPAD2 = 0x62,
NUMPAD3 = 0x63, NUMPAD4 = 0x64, NUMPAD5 = 0x65,
NUMPAD6 = 0x66, NUMPAD7 = 0x67, NUMPAD8 = 0x68,
NUMPAD9 = 0x69,
NUMPAD0 = 0x60, NUMPAD1 = 0x61, NUMPAD2 = 0x62,
NUMPAD3 = 0x63, NUMPAD4 = 0x64, NUMPAD5 = 0x65,
NUMPAD6 = 0x66, NUMPAD7 = 0x67, NUMPAD8 = 0x68,
NUMPAD9 = 0x69,

MULTIPLY = 0x6A,
ADD = 0x6B,
SEPARATOR = 0x6C,
SUBTRACT = 0x6D,
DECIMAL = 0x6E,
DIVIDE = 0x6F,
}
MULTIPLY = 0x6A,
ADD = 0x6B,
SEPARATOR = 0x6C,
SUBTRACT = 0x6D,
DECIMAL = 0x6E,
DIVIDE = 0x6F,
}
15 changes: 7 additions & 8 deletions ConsoleEngine.Abstractions/Inputs/KeyState.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
namespace ConsoleEngine.Abstractions.Inputs
namespace ConsoleEngine.Abstractions.Inputs;

public struct KeyState
{
public struct KeyState
{
public bool Pressed { get; set; }
public bool Released { get; set; }
public bool Held { get; set; }
public int Index { get; set; }
}
public bool Pressed { get; set; }
public bool Released { get; set; }
public bool Held { get; set; }
public int Index { get; set; }
}
13 changes: 6 additions & 7 deletions ConsoleEngine.Abstractions/Rendering/FontInfo.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
namespace ConsoleEngine.Abstractions.Rendering
namespace ConsoleEngine.Abstractions.Rendering;

public class FontInfo
{
public class FontInfo
{
public string FontFace { get; set; }
public int FontWidth { get; set; }
public int FontHeight { get; set; }
}
public string FontFace { get; set; }
public int FontWidth { get; set; }
public int FontHeight { get; set; }
}
25 changes: 12 additions & 13 deletions ConsoleEngine.Abstractions/Rendering/IConsoleHandler.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
using System;

namespace ConsoleEngine.Abstractions.Rendering
namespace ConsoleEngine.Abstractions.Rendering;

public interface IConsoleHandler
{
public interface IConsoleHandler
{
public int Width { get; }
public int Height { get; }
public int Width { get; }
public int Height { get; }

void InitializeConsole();
void SetTitle(string title);
void SetCursorVisible(bool visible);
void Resizable(bool resizable);
void SetFont(FontInfo fontInfo);
void Render(Span<Pixel> pixels);
void Close();
}
void InitializeConsole();
void SetTitle(string title);
void SetCursorVisible(bool visible);
void Resizable(bool resizable);
void SetFont(FontInfo fontInfo);
void Render(Span<Pixel> pixels);
void Close();
}
15 changes: 7 additions & 8 deletions ConsoleEngine.Abstractions/Rendering/Pixel.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
using System;

namespace ConsoleEngine.Abstractions.Rendering
namespace ConsoleEngine.Abstractions.Rendering;

public struct Pixel
{
public struct Pixel
{
public ConsoleColor ForegroundColor { get; set; }
public ConsoleColor BackgroundColor { get; set; }
public char Char { get; set; }
public ConsoleColor ForegroundColor { get; set; }
public ConsoleColor BackgroundColor { get; set; }
public char Char { get; set; }


public static readonly Pixel Blank = new() { ForegroundColor = ConsoleColor.Black, BackgroundColor = ConsoleColor.Black, Char = ' ' };
}
public static readonly Pixel Blank = new() { ForegroundColor = ConsoleColor.Black, BackgroundColor = ConsoleColor.Black, Char = ' ' };
}
Loading

0 comments on commit 29c2011

Please sign in to comment.