cleanup & bugfixes

This commit is contained in:
Baipyrus 2022-10-18 09:05:53 +02:00
parent bdf930c834
commit a87391ef17
2 changed files with 13 additions and 11 deletions

View File

@ -1,14 +1,9 @@
using System;
using System.Diagnostics;
using System.Threading;
using SnakeGame;
using FlappyBird;
// using static Tetris.Tetris;
using rpi_rgb_led_matrix_sharp;
namespace RPI_Matrix {
class RPI_Matrix {
public static class RPI_Matrix {
public static void Main() {
RGBLedMatrix matrix = new(
new RGBLedMatrixOptions {
@ -22,13 +17,17 @@ namespace RPI_Matrix {
Cols = 64,
});
RGBLedCanvas canvas = matrix.CreateOffscreenCanvas();
SnakeGame.SnakeGame.Init(matrix, canvas);
FlappyBird.FlappyBird.Init(matrix, canvas);
// Tetris.Tetris.Init(matrix, canvas);
RGBLedFont font = new("fonts/5x8.bdf");
Color col = new(255, 255, 255);
Console.Clear();
bool startover = true;
while (startover) {
Console.Clear();
canvas.Clear();
canvas.DrawText(font, 0, 8, col, "Spielauswahl:");
canvas.DrawText(font, 0, 24, col, "0) Beenden");
@ -50,11 +49,11 @@ namespace RPI_Matrix {
break;
case ConsoleKey.D1:
selection = false;
SnakeGame.SnakeGame.Main(new[] { "-s" }, matrix, canvas);
SnakeGame.SnakeGame.Main(new[] { "-s" });
break;
case ConsoleKey.D2:
selection = false;
FlappyBird.FlappyBird.Main(matrix, canvas);
FlappyBird.FlappyBird.Main(Array.Empty<string>());
break;
case ConsoleKey.D3:
selection = false;
@ -66,7 +65,7 @@ namespace RPI_Matrix {
if (frameCount >= keypressFrame + 150) {
selection = false;
keypressFrame = frameCount;
SnakeGame.SnakeGame.Main(new[] { "-b" }, matrix, canvas);
SnakeGame.SnakeGame.Main(new[] { "-b" });
}
Thread.Sleep(100);

View File

@ -6,10 +6,12 @@
<ItemGroup>
<ProjectReference Include="..\RPI-Snake\SnakeGame.csproj" />
<ProjectReference Include="..\RPI-Flappy\FlappyBird.csproj" />
<!-- <ProjectReference Include="..\RPI-Tetris\Tetris.csproj" />-->
<Reference Include="RGBLedMatrix.dll" />
</ItemGroup>
<PropertyGroup>
<MainEntryPoint>RPI_Matrix.RPI_Matrix</MainEntryPoint>
<OutputType>Exe</OutputType>
<Nullable>enable</Nullable>
<SelfContained>true</SelfContained>
@ -17,6 +19,7 @@
<PublishReadyToRun>true</PublishReadyToRun>
<RuntimeIdentifier>linux-arm64</RuntimeIdentifier>
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
<StartupObject>RPI_Matrix.RPI_Matrix</StartupObject>
</PropertyGroup>
<ItemGroup>