mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2026-01-14 14:07:38 -08:00
Add resources
This commit is contained in:
@@ -6,4 +6,12 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Resources\*.txt" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\00_Common\dotnet\Games.Common\Games.Common.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
8
13_Bounce/csharp/Resources/Instructions.txt
Normal file
8
13_Bounce/csharp/Resources/Instructions.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
This simulation lets you specify the initial velocity
|
||||
of a ball thrown straight up, and the coefficient of
|
||||
elasticity of the ball. Please use a decimal fraction
|
||||
coefficiency (less than 1).
|
||||
|
||||
You also specify the time increment to be used in
|
||||
'strobing' the ball's flight (try .1 initially).
|
||||
|
||||
17
13_Bounce/csharp/Resources/Resource.cs
Normal file
17
13_Bounce/csharp/Resources/Resource.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Bounce.Resources;
|
||||
|
||||
internal static class Resource
|
||||
{
|
||||
internal static class Streams
|
||||
{
|
||||
public static Stream Instructions => GetStream();
|
||||
public static Stream Title => GetStream();
|
||||
}
|
||||
|
||||
private static Stream GetStream([CallerMemberName] string? name = null)
|
||||
=> Assembly.GetExecutingAssembly().GetManifestResourceStream($"Bounce.Resources.{name}.txt")
|
||||
?? throw new ArgumentException($"Resource stream {name} does not exist", nameof(name));
|
||||
}
|
||||
5
13_Bounce/csharp/Resources/Title.txt
Normal file
5
13_Bounce/csharp/Resources/Title.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
Bounce
|
||||
Creative Computing Morristown, New Jersey
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user