Skip to content

Commit af94e88

Browse files
authored
Merge pull request #3 from Calebsem/develop
Merge v0.1.0
2 parents 4508780 + efe7a4b commit af94e88

8 files changed

+274
-31
lines changed

.github/FUNDING.yml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
custom: ["https://www.paypal.me/cubeslam", cubeslam.net, bug.builders]

.github/workflows/dotnetcore.yml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Build codebase
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
- develop
8+
9+
jobs:
10+
build:
11+
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: Setup .NET Core
17+
uses: actions/setup-dotnet@v1
18+
with:
19+
dotnet-version: 3.1.101
20+
- name: Install dependencies
21+
run: dotnet restore
22+
- name: Build
23+
run: dotnet build --configuration Release --no-restore

README.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,13 @@ As you can guess, MacOS doesn't get a choice.
8282
## Known issues
8383

8484
- OpenGL switches y coordinates compared to the other APIs so things will be vertically switched
85-
- editor layout gets funky when there are a lot of compile errors
85+
- Vulkan doesn't like some shaders and can freeze the app on load
8686

8787
## Roadmap and contribution
8888

8989
Contributions are welcome, feel free to fork and open PRs. Here are some features that I wish to implement in the future:
9090

91-
- add fullscreen mode, just forgot about this one
92-
- a way better code editor
91+
- editor with syntax highlight? Might be hard in the current state
9392
- input textures
9493
- input audio
9594
- more exotic inputs : game controllers, midi, OSC, why not some interaction with [OSSIA Score](https://ossia.io/)

YALCT/Extensions.cs

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using System.Collections.Generic;
2+
using System.Linq;
3+
4+
namespace YALCT
5+
{
6+
public static class StringExtensions
7+
{
8+
public static string ToSystemString(this IEnumerable<char> source)
9+
{
10+
return new string(source.ToArray());
11+
}
12+
}
13+
}

YALCT/ImGuiController.cs

+10-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,12 @@ public class ImGuiController
2121
private readonly Dictionary<UIState, IImGuiComponent> components = new Dictionary<UIState, IImGuiComponent>();
2222

2323
private bool showOptions = false;
24-
private float uiAlpha = 0.5f;
24+
#if DEBUG
25+
private bool fullscreen = false;
26+
#else
27+
private bool fullscreen = true;
28+
#endif
29+
private float uiAlpha = 0.75f;
2530

2631
public RuntimeContext Context => context;
2732
public ImFontPtr MainFont => mainFont;
@@ -119,6 +124,10 @@ private void SubmitOptions(InputSnapshot inputSnapshot)
119124
ImGui.SetNextWindowSize(new Vector2(OPTIONSWIDTH, OPTIONSHEIGHT));
120125
if (ImGui.Begin("Options", ref showOptions, ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoCollapse))
121126
{
127+
if (ImGui.Checkbox("Fullscreen", ref fullscreen))
128+
{
129+
Context.Window.WindowState = fullscreen ? WindowState.BorderlessFullScreen : WindowState.Maximized;
130+
}
122131
ImGui.Text("UI Opacity");
123132
ImGui.SetNextItemWidth(OPTIONSHEIGHT - 15);
124133
if (ImGui.SliderFloat("", ref uiAlpha, 0.2f, 1))

YALCT/RuntimeContext.cs

+21-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Numerics;
33
using System.Text;
4+
using System.Text.RegularExpressions;
45
using ImGuiNET;
56
using Veldrid;
67
using Veldrid.Sdl2;
@@ -11,8 +12,8 @@ namespace YALCT
1112
{
1213
public class RuntimeContext : IDisposable
1314
{
14-
Sdl2Window window;
15-
bool windowResized = false;
15+
private Sdl2Window window;
16+
private bool windowResized = false;
1617

1718
private GraphicsBackend backend;
1819
private bool isInitialized;
@@ -35,6 +36,7 @@ public class RuntimeContext : IDisposable
3536
private ShaderDescription vertexShaderDesc;
3637
private Shader[] shaders;
3738
private string currentFragmentShader;
39+
private int fragmentHeaderLineCount = -1;
3840

3941
private ImGuiRenderer imGuiRenderer;
4042
private ImGuiController uiController;
@@ -43,6 +45,18 @@ public class RuntimeContext : IDisposable
4345
public GraphicsDevice GraphicsDevice => graphicsDevice;
4446
public int Width => window.Width;
4547
public int Height => window.Height;
48+
public Sdl2Window Window => window;
49+
public int FragmentHeaderLineCount
50+
{
51+
get
52+
{
53+
if (fragmentHeaderLineCount == -1)
54+
{
55+
fragmentHeaderLineCount = Regex.Split(fragmentHeaderCode, "\r\n|\r|\n").Length;
56+
}
57+
return fragmentHeaderLineCount;
58+
}
59+
}
4660

4761
public RuntimeContext(GraphicsBackend backend)
4862
{
@@ -56,7 +70,11 @@ public void Initialize()
5670
// SDL init
5771
WindowCreateInfo windowCI = new WindowCreateInfo()
5872
{
73+
#if DEBUG
5974
WindowInitialState = WindowState.Maximized,
75+
#else
76+
WindowInitialState = WindowState.BorderlessFullScreen,
77+
#endif
6078
WindowTitle = $"Yet Another Live Coding Tool ({backend})",
6179
WindowWidth = 200,
6280
WindowHeight = 200
@@ -344,9 +362,7 @@ void main()
344362
{
345363
gl_Position = vec4(Position, 1);
346364
}";
347-
private const string fragmentHeaderCode = @"
348-
#version 450
349-
365+
public const string fragmentHeaderCode = @"#version 450
350366
layout(set = 0, binding = 0) uniform RuntimeData
351367
{
352368
vec4 mouse;
@@ -355,8 +371,6 @@ void main()
355371
float deltaTime;
356372
int frame;
357373
};
358-
359374
layout(location = 0) out vec4 out_Color;";
360-
361375
}
362376
}

0 commit comments

Comments
 (0)