Skip to content

Commit

Permalink
chore: create empty scene guide project
Browse files Browse the repository at this point in the history
  • Loading branch information
CalvinWilkinson committed Apr 24, 2024
1 parent 3d74545 commit 5380cd6
Show file tree
Hide file tree
Showing 8 changed files with 165 additions and 0 deletions.
20 changes: 20 additions & 0 deletions SampleProjects/.run/Scenes.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Scenes" type="DotNetProject" factoryName=".NET Project">
<option name="EXE_PATH" value="$PROJECT_DIR$/Guides/Scenes/bin/Debug/net8.0/Scenes.exe" />
<option name="PROGRAM_PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/Guides/Scenes/bin/Debug/net8.0" />
<option name="PASS_PARENT_ENVS" value="1" />
<option name="USE_EXTERNAL_CONSOLE" value="0" />
<option name="USE_MONO" value="0" />
<option name="RUNTIME_ARGUMENTS" value="" />
<option name="PROJECT_PATH" value="$PROJECT_DIR$/Guides/Scenes/Scenes.csproj" />
<option name="PROJECT_EXE_PATH_TRACKING" value="1" />
<option name="PROJECT_ARGUMENTS_TRACKING" value="1" />
<option name="PROJECT_WORKING_DIRECTORY_TRACKING" value="1" />
<option name="PROJECT_KIND" value="DotNetCore" />
<option name="PROJECT_TFM" value="net8.0" />
<method v="2">
<option name="Build" />
</method>
</configuration>
</component>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
85 changes: 85 additions & 0 deletions SampleProjects/Guides/Scenes/Game.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
// <copyright file="Game.cs" company="KinsonDigital">
// Copyright (c) KinsonDigital. All rights reserved.
// </copyright>

namespace Scenes;

using System.Drawing;
using System.Numerics;
using Velaptor;
using Velaptor.Batching;
using Velaptor.Content;
using Velaptor.ExtensionMethods;
using Velaptor.Factories;
using Velaptor.Graphics.Renderers;
using Velaptor.Input;
using Velaptor.UI;

public class Game : Window
{
private readonly ILoader<ITexture> textureLoader;
private readonly ITextureRenderer renderer;
private readonly IBatcher batcher;
private readonly IAppInput<MouseState> mouse;
private ITexture logoTexture;
private MouseState currentMouseState;
private Point logoPosition;

/// <summary>
/// Initializes a new instance of the <see cref="Game"/> class.
/// </summary>
public Game()

Check warning on line 31 in SampleProjects/Guides/Scenes/Game.cs

View workflow job for this annotation

GitHub Actions / CSharp Projects Build Status Check / Build Velaptor Tutorials Solution

Non-nullable field 'logoTexture' must contain a non-null value when exiting constructor. Consider declaring the field as nullable.

Check warning on line 31 in SampleProjects/Guides/Scenes/Game.cs

View workflow job for this annotation

GitHub Actions / CSharp Projects Build Status Check / Build Velaptor Tutorials Solution

Non-nullable field 'logoTexture' must contain a non-null value when exiting constructor. Consider declaring the field as nullable.
{
Title = "Scenes";
Width = 1000;
Height = 1000;

this.textureLoader = ContentLoaderFactory.CreateTextureLoader();
this.batcher = RendererFactory.CreateBatcher();
this.renderer = RendererFactory.CreateTextureRenderer();
this.mouse = HardwareFactory.GetMouse();
}

/// <summary>
/// Loads game content.
/// </summary>
protected override void OnLoad()
{
this.logoTexture = this.textureLoader.Load("kd-logo");

base.OnLoad();
}

/// <summary>
/// Unload the content to free resources.
/// </summary>
protected override void OnUnload()
{
base.OnUnload();
}

/// <summary>
/// Updates the application. Executes one time for every iteration of the game loop
/// and always BEFORE the <see cref="Window.OnDraw"/> method.
/// </summary>
/// <param name="frameTime">The amount of time that has passed for the current frame.</param>
protected override void OnUpdate(FrameTime frameTime)
{
this.currentMouseState = this.mouse.GetState();

this.logoPosition = this.currentMouseState.GetPosition();

base.OnUpdate(frameTime);
}

protected override void OnDraw(FrameTime frameTime)
{
this.batcher.Begin();

this.renderer.Render(this.logoTexture, this.logoPosition.X, this.logoPosition.Y);

this.batcher.End();

base.OnDraw(frameTime);
}
}
6 changes: 6 additions & 0 deletions SampleProjects/Guides/Scenes/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// <copyright file="Program.cs" company="KinsonDigital">
// Copyright (c) KinsonDigital. All rights reserved.
// </copyright>

var game = new Scenes.Game();
game.Show();
33 changes: 33 additions & 0 deletions SampleProjects/Guides/Scenes/Scenes.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="KinsonDigital.Velaptor" Version="1.0.0-preview.35" />
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="8.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<None Remove="stylecop.json" />
<AdditionalFiles Include="stylecop.json" />
<None Update="Content\Graphics\velaptor-mascot.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Content\Graphics\kd-logo.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>
14 changes: 14 additions & 0 deletions SampleProjects/Guides/Scenes/stylecop.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
// ACTION REQUIRED: This file was automatically added to your project, but it
// will not take effect until additional steps are taken to enable it. See the
// following page for additional information:
//
// https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/EnableConfiguration.md

"$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json",
"settings": {
"documentationRules": {
"companyName": "KinsonDigital"
}
}
}
7 changes: 7 additions & 0 deletions SampleProjects/SampleProjects.sln
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpaceShooter", "Games\Space
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EmptyProject", "Guides\EmptyProject\EmptyProject.csproj", "{B7C0844B-F5F2-404A-BE9F-F7E39C551A56}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Scenes", "Guides\Scenes\Scenes.csproj", "{69DD1F16-C28E-4ECC-9E9B-A404A28B0F8C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -64,6 +66,10 @@ Global
{B7C0844B-F5F2-404A-BE9F-F7E39C551A56}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B7C0844B-F5F2-404A-BE9F-F7E39C551A56}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B7C0844B-F5F2-404A-BE9F-F7E39C551A56}.Release|Any CPU.Build.0 = Release|Any CPU
{69DD1F16-C28E-4ECC-9E9B-A404A28B0F8C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{69DD1F16-C28E-4ECC-9E9B-A404A28B0F8C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{69DD1F16-C28E-4ECC-9E9B-A404A28B0F8C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{69DD1F16-C28E-4ECC-9E9B-A404A28B0F8C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{1352A677-C91D-41AF-B8DC-DB01B714B25D} = {02B09EF2-D131-4628-BAD5-602A3BD9188E}
Expand All @@ -75,5 +81,6 @@ Global
{A184D6C5-29CF-47A8-93DC-45161DB14100} = {02B09EF2-D131-4628-BAD5-602A3BD9188E}
{640294BA-F14D-4563-80BE-49988000C8EF} = {C24458DA-05B6-4102-BD79-61D3B6FD2FA7}
{B7C0844B-F5F2-404A-BE9F-F7E39C551A56} = {02B09EF2-D131-4628-BAD5-602A3BD9188E}
{69DD1F16-C28E-4ECC-9E9B-A404A28B0F8C} = {02B09EF2-D131-4628-BAD5-602A3BD9188E}
EndGlobalSection
EndGlobal

0 comments on commit 5380cd6

Please sign in to comment.