From 4d28d1abf054bd236ae96d3d5a1e90e458d72c1b Mon Sep 17 00:00:00 2001 From: CreepyCrafter24 <33260128+CreepyCrafter24@users.noreply.github.com> Date: Sun, 29 Mar 2020 15:20:34 +0200 Subject: [PATCH] Add README --- .gitignore | 607 ++++++++++++++++++ .idea/.gitignore | 0 .../.idea.SimpleConsoleGame/.idea/.gitignore | 2 + .../.idea.SimpleConsoleGame/.idea/discord.xml | 9 + .../.idea/encodings.xml | 4 + .../.idea/indexLayout.xml | 8 + .../.idea.SimpleConsoleGame/.idea/modules.xml | 8 + .../.idea/projectSettingsUpdater.xml | 6 + .idea/.idea.SimpleConsoleGame/.idea/vcs.xml | 6 + .idea/.idea.SimpleConsoleGame/riderModule.iml | 7 + .idea/.idea.Snakity/.idea/.gitignore | 2 + .idea/.idea.Snakity/.idea/.name | 1 + .idea/.idea.Snakity/.idea/discord.xml | 9 + .idea/.idea.Snakity/.idea/encodings.xml | 4 + .idea/.idea.Snakity/.idea/indexLayout.xml | 8 + .idea/.idea.Snakity/.idea/modules.xml | 8 + .../.idea/projectSettingsUpdater.xml | 6 + .idea/.idea.Snakity/.idea/vcs.xml | 6 + .idea/.idea.Snakity/riderModule.iml | 7 + README.md | 1 + Snakity.sln | 25 + Snakity/Graphics/ColorSelector.cs | 18 + Snakity/Graphics/DiffDraw.cs | 56 ++ Snakity/Graphics/Label.cs | 31 + Snakity/Graphics/Renderer.cs | 19 + Snakity/Graphics/SpecialChars.cs | 10 + Snakity/LevelLoader.cs | 31 + Snakity/Levels.cs | 43 ++ Snakity/Loop/Enemy.cs | 38 ++ Snakity/Loop/Input.cs | 64 ++ Snakity/Loop/Program.cs | 54 ++ Snakity/Point.cs | 19 + Snakity/Resizer.cs | 18 + Snakity/Snakity.csproj | 12 + 34 files changed, 1147 insertions(+) create mode 100644 .gitignore create mode 100644 .idea/.gitignore create mode 100644 .idea/.idea.SimpleConsoleGame/.idea/.gitignore create mode 100644 .idea/.idea.SimpleConsoleGame/.idea/discord.xml create mode 100644 .idea/.idea.SimpleConsoleGame/.idea/encodings.xml create mode 100644 .idea/.idea.SimpleConsoleGame/.idea/indexLayout.xml create mode 100644 .idea/.idea.SimpleConsoleGame/.idea/modules.xml create mode 100644 .idea/.idea.SimpleConsoleGame/.idea/projectSettingsUpdater.xml create mode 100644 .idea/.idea.SimpleConsoleGame/.idea/vcs.xml create mode 100644 .idea/.idea.SimpleConsoleGame/riderModule.iml create mode 100644 .idea/.idea.Snakity/.idea/.gitignore create mode 100644 .idea/.idea.Snakity/.idea/.name create mode 100644 .idea/.idea.Snakity/.idea/discord.xml create mode 100644 .idea/.idea.Snakity/.idea/encodings.xml create mode 100644 .idea/.idea.Snakity/.idea/indexLayout.xml create mode 100644 .idea/.idea.Snakity/.idea/modules.xml create mode 100644 .idea/.idea.Snakity/.idea/projectSettingsUpdater.xml create mode 100644 .idea/.idea.Snakity/.idea/vcs.xml create mode 100644 .idea/.idea.Snakity/riderModule.iml create mode 100644 README.md create mode 100644 Snakity.sln create mode 100644 Snakity/Graphics/ColorSelector.cs create mode 100644 Snakity/Graphics/DiffDraw.cs create mode 100644 Snakity/Graphics/Label.cs create mode 100644 Snakity/Graphics/Renderer.cs create mode 100644 Snakity/Graphics/SpecialChars.cs create mode 100644 Snakity/LevelLoader.cs create mode 100644 Snakity/Levels.cs create mode 100644 Snakity/Loop/Enemy.cs create mode 100644 Snakity/Loop/Input.cs create mode 100644 Snakity/Loop/Program.cs create mode 100644 Snakity/Point.cs create mode 100644 Snakity/Resizer.cs create mode 100644 Snakity/Snakity.csproj diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..66862c6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,607 @@ + +# Created by https://www.gitignore.io/api/rider,csharp,windows,visualstudio +# Edit at https://www.gitignore.io/?templates=rider,csharp,windows,visualstudio + +### Csharp ### +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +### Rider ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +### Windows ### +# Windows thumbnail cache files +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +### VisualStudio ### + +# User-specific files + +# User-specific files (MonoDevelop/Xamarin Studio) + +# Mono auto generated files + +# Build results + +# Visual Studio 2015/2017 cache/options directory +# Uncomment if you have tasks that create the project's static files in wwwroot + +# Visual Studio 2017 auto generated files + +# MSTest test Results + +# NUnit + +# Build Results of an ATL Project + +# Benchmark Results + +# .NET Core + +# StyleCop + +# Files built by Visual Studio + +# Chutzpah Test files + +# Visual C++ cache files + +# Visual Studio profiler + +# Visual Studio Trace Files + +# TFS 2012 Local Workspace + +# Guidance Automation Toolkit + +# ReSharper is a .NET coding add-in + +# JustCode is a .NET coding add-in + +# TeamCity is a build add-in + +# DotCover is a Code Coverage Tool + +# AxoCover is a Code Coverage Tool + +# Visual Studio code coverage results + +# NCrunch + +# MightyMoose + +# Web workbench (sass) + +# Installshield output folder + +# DocProject is a documentation generator add-in + +# Click-Once directory + +# Publish Web Output +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted + +# NuGet Packages +# NuGet Symbol Packages +# The packages folder can be ignored because of Package Restore +# except build/, which is used as an MSBuild target. +# Uncomment if necessary however generally it will be regenerated when needed +# NuGet v3's project.json files produces more ignorable files + +# Microsoft Azure Build Output + +# Microsoft Azure Emulator + +# Windows Store app package directories and files + +# Visual Studio cache files +# files ending in .cache can be ignored +# but keep track of directories ending in .cache + +# Others + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) + +# RIA/Silverlight projects + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) + +# SQL Server files + +# Business Intelligence projects + +# Microsoft Fakes + +# GhostDoc plugin setting file + +# Node.js Tools for Visual Studio + +# Visual Studio 6 build log + +# Visual Studio 6 workspace options file + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) + +# Visual Studio LightSwitch build output + +# Paket dependency manager + +# FAKE - F# Make + +# CodeRush personal settings + +# Python Tools for Visual Studio (PTVS) + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio + +# Telerik's JustMock configuration file + +# BizTalk build output + +# OpenCover UI analysis results + +# Azure Stream Analytics local run output + +# MSBuild Binary and Structured Log + +# NVidia Nsight GPU debugger configuration file + +# MFractors (Xamarin productivity tool) working folder + +# Local History for Visual Studio + +# BeatPulse healthcheck temp database + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 + +# End of https://www.gitignore.io/api/rider,csharp,windows,visualstudio diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/.idea/.idea.SimpleConsoleGame/.idea/.gitignore b/.idea/.idea.SimpleConsoleGame/.idea/.gitignore new file mode 100644 index 0000000..0110b99 --- /dev/null +++ b/.idea/.idea.SimpleConsoleGame/.idea/.gitignore @@ -0,0 +1,2 @@ +# Default ignored files +/workspace.xml \ No newline at end of file diff --git a/.idea/.idea.SimpleConsoleGame/.idea/discord.xml b/.idea/.idea.SimpleConsoleGame/.idea/discord.xml new file mode 100644 index 0000000..59b11d1 --- /dev/null +++ b/.idea/.idea.SimpleConsoleGame/.idea/discord.xml @@ -0,0 +1,9 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/.idea.SimpleConsoleGame/.idea/encodings.xml b/.idea/.idea.SimpleConsoleGame/.idea/encodings.xml new file mode 100644 index 0000000..df87cf9 --- /dev/null +++ b/.idea/.idea.SimpleConsoleGame/.idea/encodings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/.idea.SimpleConsoleGame/.idea/indexLayout.xml b/.idea/.idea.SimpleConsoleGame/.idea/indexLayout.xml new file mode 100644 index 0000000..27ba142 --- /dev/null +++ b/.idea/.idea.SimpleConsoleGame/.idea/indexLayout.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/.idea.SimpleConsoleGame/.idea/modules.xml b/.idea/.idea.SimpleConsoleGame/.idea/modules.xml new file mode 100644 index 0000000..3bd4cfe --- /dev/null +++ b/.idea/.idea.SimpleConsoleGame/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/.idea.SimpleConsoleGame/.idea/projectSettingsUpdater.xml b/.idea/.idea.SimpleConsoleGame/.idea/projectSettingsUpdater.xml new file mode 100644 index 0000000..7515e76 --- /dev/null +++ b/.idea/.idea.SimpleConsoleGame/.idea/projectSettingsUpdater.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/.idea.SimpleConsoleGame/.idea/vcs.xml b/.idea/.idea.SimpleConsoleGame/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/.idea.SimpleConsoleGame/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/.idea.SimpleConsoleGame/riderModule.iml b/.idea/.idea.SimpleConsoleGame/riderModule.iml new file mode 100644 index 0000000..1a4e0d9 --- /dev/null +++ b/.idea/.idea.SimpleConsoleGame/riderModule.iml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/.idea.Snakity/.idea/.gitignore b/.idea/.idea.Snakity/.idea/.gitignore new file mode 100644 index 0000000..0110b99 --- /dev/null +++ b/.idea/.idea.Snakity/.idea/.gitignore @@ -0,0 +1,2 @@ +# Default ignored files +/workspace.xml \ No newline at end of file diff --git a/.idea/.idea.Snakity/.idea/.name b/.idea/.idea.Snakity/.idea/.name new file mode 100644 index 0000000..30e5730 --- /dev/null +++ b/.idea/.idea.Snakity/.idea/.name @@ -0,0 +1 @@ +Snakity \ No newline at end of file diff --git a/.idea/.idea.Snakity/.idea/discord.xml b/.idea/.idea.Snakity/.idea/discord.xml new file mode 100644 index 0000000..59b11d1 --- /dev/null +++ b/.idea/.idea.Snakity/.idea/discord.xml @@ -0,0 +1,9 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/.idea.Snakity/.idea/encodings.xml b/.idea/.idea.Snakity/.idea/encodings.xml new file mode 100644 index 0000000..df87cf9 --- /dev/null +++ b/.idea/.idea.Snakity/.idea/encodings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/.idea.Snakity/.idea/indexLayout.xml b/.idea/.idea.Snakity/.idea/indexLayout.xml new file mode 100644 index 0000000..27ba142 --- /dev/null +++ b/.idea/.idea.Snakity/.idea/indexLayout.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/.idea.Snakity/.idea/modules.xml b/.idea/.idea.Snakity/.idea/modules.xml new file mode 100644 index 0000000..8aef6b0 --- /dev/null +++ b/.idea/.idea.Snakity/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/.idea.Snakity/.idea/projectSettingsUpdater.xml b/.idea/.idea.Snakity/.idea/projectSettingsUpdater.xml new file mode 100644 index 0000000..7515e76 --- /dev/null +++ b/.idea/.idea.Snakity/.idea/projectSettingsUpdater.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/.idea.Snakity/.idea/vcs.xml b/.idea/.idea.Snakity/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/.idea.Snakity/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/.idea.Snakity/riderModule.iml b/.idea/.idea.Snakity/riderModule.iml new file mode 100644 index 0000000..1a4e0d9 --- /dev/null +++ b/.idea/.idea.Snakity/riderModule.iml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..9230e60 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# Snakity diff --git a/Snakity.sln b/Snakity.sln new file mode 100644 index 0000000..fccb1a2 --- /dev/null +++ b/Snakity.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29920.165 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Snakity", "Snakity\Snakity.csproj", "{068FEE48-B365-4AB4-9F64-0CCA55DCDF94}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {068FEE48-B365-4AB4-9F64-0CCA55DCDF94}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {068FEE48-B365-4AB4-9F64-0CCA55DCDF94}.Debug|Any CPU.Build.0 = Debug|Any CPU + {068FEE48-B365-4AB4-9F64-0CCA55DCDF94}.Release|Any CPU.ActiveCfg = Release|Any CPU + {068FEE48-B365-4AB4-9F64-0CCA55DCDF94}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {022F010F-BECC-4830-BC68-9139364EDE36} + EndGlobalSection +EndGlobal diff --git a/Snakity/Graphics/ColorSelector.cs b/Snakity/Graphics/ColorSelector.cs new file mode 100644 index 0000000..9f70736 --- /dev/null +++ b/Snakity/Graphics/ColorSelector.cs @@ -0,0 +1,18 @@ +using System; + +namespace Snakity.Graphics +{ + static class ColorSelector + { + public static ConsoleColor Get(char c) + { + return c switch + { + SpecialChars.Player => ConsoleColor.Green, + SpecialChars.Wall => ConsoleColor.Gray, + SpecialChars.Enemy => ConsoleColor.Yellow, + _ => ConsoleColor.White + }; + } + } +} diff --git a/Snakity/Graphics/DiffDraw.cs b/Snakity/Graphics/DiffDraw.cs new file mode 100644 index 0000000..4d2fe69 --- /dev/null +++ b/Snakity/Graphics/DiffDraw.cs @@ -0,0 +1,56 @@ +using System; + +namespace Snakity.Graphics +{ + public static class DiffDraw + { + public static char[,] Screen { get; private set; } = new char[0, 0]; + private static char[,] _last = new char[0,0]; + public static int Width => Screen.GetLength(0); + public static int Height => Screen.GetLength(1); + + public static void Draw() + { + Console.CursorTop = 0; + Console.CursorLeft = 0; + int width = Width; + int height = Height; + for (int y = 0; y < height; y++) + { + for (int x = 0; x < width; x++) + { + char tmp1 = Screen[x, y]; + if (tmp1 == _last[x, y]) continue; + Console.ForegroundColor = ColorSelector.Get(tmp1); + Console.CursorLeft = x; + Console.Write(tmp1); + } + Console.WriteLine(); + Console.CursorLeft = 0; + } + _last = Screen; + } + + public static char Get(Point p) => Get(p.X, p.Y); + + public static char Get(int x, int y) => Screen[x, y]; + + public static void Set(Point p, char c) => Set(p.X, p.Y, c); + + public static void Set(int x, int y, char c) => Screen[x, y] = c; + + public static void Clear() => Clear(Width, Height); + + public static void Clear(int width, int height) + { + Screen = new char[width, height]; + _last = _last.Resize(width, height); + } + + public static void Clear(char[,] content) + { + Screen = content; + _last = _last.Resize(Width, Height); + } + } +} diff --git a/Snakity/Graphics/Label.cs b/Snakity/Graphics/Label.cs new file mode 100644 index 0000000..956aa84 --- /dev/null +++ b/Snakity/Graphics/Label.cs @@ -0,0 +1,31 @@ +using System.Linq; + +namespace Snakity.Graphics +{ + public class Label + { + public Point Position; + public string Text; + + public Label(Point position, string text) + { + Position = position; + Text = text; + } + + public void Render() + { + string[] lines = Text.Split('\n').Select(s => s.EndsWith('\r') ? s.Remove(s.Length - 1) : s).ToArray(); + for (int i = 0; i < lines.Length; i++) + { + for (int j = 0; j < lines[i].Length; j++) + { + int tmpX = Position.X + j; + int tmpY = Position.Y + i; + if (tmpX < DiffDraw.Width && tmpY < DiffDraw.Height) + DiffDraw.Set(tmpX, tmpY, lines[i][j]); + } + } + } + } +} \ No newline at end of file diff --git a/Snakity/Graphics/Renderer.cs b/Snakity/Graphics/Renderer.cs new file mode 100644 index 0000000..f638c38 --- /dev/null +++ b/Snakity/Graphics/Renderer.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; + +namespace Snakity.Graphics +{ + public static class Renderer + { + public static readonly List> Player = new List>(); + public static readonly List Enemies = new List(); + public static readonly List