Loads and loads of small improvements I added while developing on my game

This commit is contained in:
Michel Fedde 2021-03-02 19:54:19 +01:00
parent 41421b1df9
commit a7c71e7ea1
107 changed files with 2278 additions and 1023 deletions

View file

@ -1,7 +1,9 @@
using System;
using OpenTK;
using OpenTK.Graphics;
using OpenTK.Input;
using SM.Base;
using SM.Base.Windows;
using SM.Game.Controls;
using SM2D;
using SM2D.Drawing;
@ -15,7 +17,7 @@ namespace SM_TEST
{
static Scene scene;
private static Font font;
private static GLWindow2D window;
private static GLWindow window;
static void Main(string[] args)
{
font = new Font(@"C:\Windows\Fonts\Arial.ttf")
@ -25,8 +27,8 @@ namespace SM_TEST
Log.SetLogFile(compressionFolder:"logs");
window = new GLWindow2D {Scaling = new Vector2(0, 1000), VSync = VSyncMode.Off};
//window.GrabCursor();
window = new GLWindow {VSync = VSyncMode.Off};
window.ApplySetup(new Window2DSetup() {WorldScale = new Vector2(0,1000)});
window.SetRenderPipeline(new TestRenderPipeline());
window.SetScene(scene = new Scene());
window.Load += WindowOnLoad;
@ -45,15 +47,16 @@ namespace SM_TEST
GameControllerState s2 = new GameController(1).GetState();
}
private static void WindowOnLoad(object sender, EventArgs e)
private static void WindowOnLoad(IGenericWindow window)
{
scene.ShowAxisHelper = true;
//scene.Background.Color = Color4.White;
DrawObject2D box = new DrawObject2D();
scene.Objects.Add(box);
DrawText text = new DrawText(font, "Text");
text.Transform.Position.Set(0, 0);
text.Transform.Position.Set(50, 0);
text.Transform.Size.Set(2);
scene.Objects.Add(text);

View file

@ -1,39 +1,40 @@
using System.Collections.Generic;
using OpenTK.Graphics.OpenGL4;
using SM.Base;
using SM.Base.Contexts;
using SM.Base;
using SM.Base.Drawing;
using SM.Base.PostEffects;
using SM.Base.Windows;
using SM.OGL.Framebuffer;
using SM2D.Scene;
namespace SM_TEST
{
public class TestRenderPipeline : RenderPipeline<Scene>
public class TestRenderPipeline : RenderPipeline
{
private BloomEffect _bloom;
protected override void Initialization(GenericWindow window)
public override void Initialization()
{
base.Initialization(window);
_bloom = new BloomEffect(1);
MainFramebuffer = CreateWindowFramebuffer();
_bloom.Initilize(this);
base.Initialization();
}
protected override void RenderProcess(ref DrawContext context, Scene scene)
protected override void RenderProcess(ref DrawContext context)
{
MainFramebuffer.Activate(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
scene.DrawBackground(context);
scene.DrawMainObjects(context);
context.Scene.DrawBackground(context);
context.Scene.DrawMainObjects(context);
Framebuffer.Screen.Activate(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
_bloom.Draw(context);
scene.DrawHUD(context);
scene.DrawDebug(context);
context.Scene.DrawHUD(context);
context.Scene.DrawDebug(context);
}
}
}