Lots of progress on rendering textures.

This commit is contained in:
2020-06-05 23:49:45 -05:00
parent 23597f02b1
commit 1c4ca6c97b
47 changed files with 620 additions and 246 deletions

View File

@@ -0,0 +1,74 @@
using System;
using System.Drawing;
using System.Numerics;
using SlatedGameToolkit.Framework.Exceptions;
using SlatedGameToolkit.Framework.Graphics.Programs;
using SlatedGameToolkit.Framework.Graphics.Render;
using SlatedGameToolkit.Framework.Graphics.Shaders;
using SlatedGameToolkit.Framework.Graphics.Textures;
using SlatedGameToolkit.Framework.Graphics.Window;
using SlatedGameToolkit.Framework.Loader;
using SlatedGameToolkit.Framework.StateSystem;
using SlatedGameToolkit.Framework.StateSystem.States;
namespace SlatedGameToolkit.Tools.Utilities.Playground
{
public class MainState : IState
{
private WindowContext window;
private GLShaderProgram program;
private Camera2D camera;
private Renderer renderer;
private Texture texture;
private Sprite2D sprite;
public WindowContext CurrentWindow { get { return window;}}
public bool Activate()
{
return true;
}
public bool Deactivate()
{
return true;
}
public void Deinitialize()
{
window.Dispose();
program.Dispose();
texture.Dispose();
renderer.Dispose();
}
public string getName()
{
return "main state";
}
public void Initialize(StateManager manager)
{
window = new WindowContext("SlatedGameToolkit Playground");
camera = new Camera2D();
camera.Width = window.WindowBoundaries.Width;
camera.Height = window.WindowBoundaries.Height;
camera.Position = new Vector2(camera.Width / 2, camera.Height / 2);
program = new GLShaderProgram(new NormalVertexShader(), new NormalFragmentShader());
renderer = new Renderer(camera, program);
texture = new TextureLoader("Resources/Playground/yhdnbgnc.png").Load();
sprite = new Sprite2D(texture, Color.White);
}
public void Render(double delta)
{
OpenGLErrorException.CheckGLErrorStatus();
renderer.Queue(sprite, Matrix4x4.Identity);
renderer.Render();
}
public void Update(double delta)
{
}
}
}