Skip to content

Commit

Permalink
working graphics
Browse files Browse the repository at this point in the history
  • Loading branch information
LeNitrous committed Jun 11, 2023
1 parent dc4aadf commit be1bafa
Show file tree
Hide file tree
Showing 202 changed files with 10,948 additions and 6,054 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ charset = utf-8
indent_style = space
trim_trailing_whitespace = true

[*.{json,csproj,targets,props}]
[*.{json,csproj,targets,props,xml}]
indent_size = 2

[*.cs]
Expand Down
4 changes: 1 addition & 3 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
"recommendations": [
"ms-dotnettools.csharp",
"editorconfig.editorconfig",
"josefpihrt-vscode.roslynator",
"ryanluker.vscode-coverage-gutters",
"formulahendry.dotnet-test-explorer"
"ryanluker.vscode-coverage-gutters"
]
}
26 changes: 26 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"version": "0.2.0",
"configurations": [
{
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/samples/SampleGame/bin/Debug/net7.0/SampleGame.dll",
"args": [],
"cwd": "${workspaceFolder}/samples/SampleGame",
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
"console": "internalConsole",
"stopAtEntry": false
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach"
}
]
}
5 changes: 2 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"dotnet-test-explorer.testProjectPath": "**/*.Tests.csproj",
"dotnet-test-explorer.testArguments": "/p:CollectCoverage=true /p:CoverletOutputFormat=lcov /p:CoverletOutput=./lcov.info",
"coverage-gutters.coverageFileNames": [
"lcov.info",
]
],
"dotnet.defaultSolution": "Sekai.sln"
}
41 changes: 41 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/samples/SampleGame/SampleGame.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/samples/SampleGame/SampleGame.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"--project",
"${workspaceFolder}/samples/SampleGame/SampleGame.csproj"
],
"problemMatcher": "$msCompile"
}
]
}
54 changes: 33 additions & 21 deletions Sekai.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,51 @@ VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "source", "source", "{11EBA343-73D5-4FC5-ADB9-2921D759C406}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sekai.Core", "source\Sekai.Core\Sekai.Core.csproj", "{3BAACCFF-05E5-468D-81EE-BB0BC500C03B}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sekai.Desktop", "source\Sekai.Desktop\Sekai.Desktop.csproj", "{DCECC07D-6F46-4511-A940-5FF7C0068CC4}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{0F7F9E4F-39F9-479E-8463-20AE6B578EBB}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{931CD6DD-07D5-47F9-9D1A-4321FFD5E900}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sekai.Core.Tests", "tests\Sekai.Core.Tests\Sekai.Core.Tests.csproj", "{BC56622C-7A59-4175-B510-CE13DEA1C67C}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SampleGame", "samples\SampleGame\SampleGame.csproj", "{630A50FA-9900-4066-BF8F-9A788690B96B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sekai.Core.Benchmarks", "tests\Sekai.Core.Benchmarks\Sekai.Core.Benchmarks.csproj", "{27C7C5FF-875C-4781-8A70-F20CDEE248DB}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sekai", "source\Sekai\Sekai.csproj", "{160AE02F-F9F2-461E-9F7F-EDE78D56ECCB}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{2442ACA6-EA9E-45A8-A658-4258641220B9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sekai.Tests", "tests\Sekai.Tests\Sekai.Tests.csproj", "{600253DF-B794-4FA8-80DB-1A3A8A531AEB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{DCECC07D-6F46-4511-A940-5FF7C0068CC4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DCECC07D-6F46-4511-A940-5FF7C0068CC4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DCECC07D-6F46-4511-A940-5FF7C0068CC4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DCECC07D-6F46-4511-A940-5FF7C0068CC4}.Release|Any CPU.Build.0 = Release|Any CPU
{630A50FA-9900-4066-BF8F-9A788690B96B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{630A50FA-9900-4066-BF8F-9A788690B96B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{630A50FA-9900-4066-BF8F-9A788690B96B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{630A50FA-9900-4066-BF8F-9A788690B96B}.Release|Any CPU.Build.0 = Release|Any CPU
{160AE02F-F9F2-461E-9F7F-EDE78D56ECCB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{160AE02F-F9F2-461E-9F7F-EDE78D56ECCB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{160AE02F-F9F2-461E-9F7F-EDE78D56ECCB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{160AE02F-F9F2-461E-9F7F-EDE78D56ECCB}.Release|Any CPU.Build.0 = Release|Any CPU
{600253DF-B794-4FA8-80DB-1A3A8A531AEB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{600253DF-B794-4FA8-80DB-1A3A8A531AEB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{600253DF-B794-4FA8-80DB-1A3A8A531AEB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{600253DF-B794-4FA8-80DB-1A3A8A531AEB}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3BAACCFF-05E5-468D-81EE-BB0BC500C03B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3BAACCFF-05E5-468D-81EE-BB0BC500C03B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3BAACCFF-05E5-468D-81EE-BB0BC500C03B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3BAACCFF-05E5-468D-81EE-BB0BC500C03B}.Release|Any CPU.Build.0 = Release|Any CPU
{BC56622C-7A59-4175-B510-CE13DEA1C67C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BC56622C-7A59-4175-B510-CE13DEA1C67C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BC56622C-7A59-4175-B510-CE13DEA1C67C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BC56622C-7A59-4175-B510-CE13DEA1C67C}.Release|Any CPU.Build.0 = Release|Any CPU
{27C7C5FF-875C-4781-8A70-F20CDEE248DB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{27C7C5FF-875C-4781-8A70-F20CDEE248DB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{27C7C5FF-875C-4781-8A70-F20CDEE248DB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{27C7C5FF-875C-4781-8A70-F20CDEE248DB}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{3BAACCFF-05E5-468D-81EE-BB0BC500C03B} = {11EBA343-73D5-4FC5-ADB9-2921D759C406}
{BC56622C-7A59-4175-B510-CE13DEA1C67C} = {0F7F9E4F-39F9-479E-8463-20AE6B578EBB}
{27C7C5FF-875C-4781-8A70-F20CDEE248DB} = {0F7F9E4F-39F9-479E-8463-20AE6B578EBB}
{DCECC07D-6F46-4511-A940-5FF7C0068CC4} = {11EBA343-73D5-4FC5-ADB9-2921D759C406}
{630A50FA-9900-4066-BF8F-9A788690B96B} = {931CD6DD-07D5-47F9-9D1A-4321FFD5E900}
{160AE02F-F9F2-461E-9F7F-EDE78D56ECCB} = {11EBA343-73D5-4FC5-ADB9-2921D759C406}
{600253DF-B794-4FA8-80DB-1A3A8A531AEB} = {2442ACA6-EA9E-45A8-A658-4258641220B9}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {B6237647-4791-4690-81D9-284B3F1F63D2}
EndGlobalSection
EndGlobal
89 changes: 89 additions & 0 deletions samples/SampleGame/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
// Copyright (c) Cosyne and The Vignette Authors
// Licensed under MIT. See LICENSE for details.

using System;
using System.Numerics;
using Sekai;
using Sekai.Desktop;
using Sekai.Graphics;
using Sekai.Platform;

namespace SampleGame;

internal static class Program
{
private static void Main()
{
if (RuntimeInfo.IsDesktop)
{
var host = new DesktopGameHost();
var game = new Sample();
host.Run(game);
}
else
{
throw new PlatformNotSupportedException();
}
}
}

internal class Sample : Game
{
private Shader? shd;
private GraphicsBuffer? vbo;

protected override void Load()
{
shd = Graphics!.CreateShader
(
ShaderCode.From(shader_v_code, ShaderStage.Vertex),
ShaderCode.From(shader_f_code, ShaderStage.Fragment)
);

ReadOnlySpan<Vector3> vertices = stackalloc Vector3[]
{
new(-0.5f, -0.5f, 0.0f),
new( 0.5f, -0.5f, 0.0f),
new( 0.0f, 0.5f, 0.0f)
};

vbo = Graphics.CreateBuffer(BufferType.Vertex, vertices);
}

protected override void Draw()
{
Graphics!.SetShader(shd!);
Graphics.SetVertexBuffer(vbo!, new VertexLayout(new VertexMember(3, false, VertexMemberFormat.Float)));
Graphics.Draw(PrimitiveType.TriangleList, 3);
}

protected override void Unload()
{
shd?.Dispose();
vbo?.Dispose();
}

private const string shader_v_code =
@"
#version 450
layout (location = 0) in vec3 a_position;
void main()
{
gl_Position = vec4(a_position.x, a_position.y, a_position.z, 1.0);
}
";

private const string shader_f_code =
@"
#version 450
layout (location = 0) out vec4 v_color;
void main()
{
v_color = vec4(1.0, 0.5, 0.2, 1.0);
}
";
}
16 changes: 16 additions & 0 deletions samples/SampleGame/SampleGame.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<PublishAot>true</PublishAot>
<PublishTrimmed>true</PublishTrimmed>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="../../source/Sekai/Sekai.csproj" />
<ProjectReference Include="../../source/Sekai.Desktop/Sekai.Desktop.csproj" />
</ItemGroup>

</Project>
5 changes: 5 additions & 0 deletions source/Sekai.Android/Class1.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
namespace Sekai.Android;
public class Class1
{

}
9 changes: 9 additions & 0 deletions source/Sekai.Android/Sekai.Android.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

</Project>
Loading

0 comments on commit be1bafa

Please sign in to comment.