~ Moved code around in files. SM.Base: + PostProcessing-system + OnInitialization() for Scenes. + Shader-Extensions + Added option to not react while unfocused to the window. + Added Screenshots to the window. + Connected the log system to the SM.OGL-action system. ~ Replaced IShader with abstract MaterialShader. ~ When a log compression folder doesn't exist, it will create one. SM.OGL: + Added support for UniformArrays + Added ShaderPreProcessing + Added Shader Extensions. + Added Debug actions. + SM.OGL settings ~ Framebuffer Size is automaticly changed, when the window and scale is set. SM2D: + Added easy shader drawing.
114 lines
No EOL
4.1 KiB
C#
114 lines
No EOL
4.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Drawing;
|
|
using System.Runtime.InteropServices;
|
|
using System.Security.Authentication.ExtendedProtection.Configuration;
|
|
using OpenTK;
|
|
using OpenTK.Graphics;
|
|
using SM.Base;
|
|
using SM.Base.Time;
|
|
using SM2D;
|
|
using SM2D.Drawing;
|
|
using SM2D.Object;
|
|
using SM2D.Scene;
|
|
using Font = SM.Base.Text.Font;
|
|
using Vector2 = OpenTK.Vector2;
|
|
|
|
namespace SM_TEST
|
|
{
|
|
class Program
|
|
{
|
|
static Scene scene;
|
|
private static Font font;
|
|
private static ItemCollection col;
|
|
private static DrawPolygon polyogn;
|
|
private static GLWindow2D window;
|
|
static void Main(string[] args)
|
|
{
|
|
font = new Font(@"C:\Windows\Fonts\Arial.ttf")
|
|
{
|
|
FontSize = 32
|
|
};
|
|
|
|
Log.SetLogFile(compressionFolder:"logs");
|
|
|
|
window = new GLWindow2D {Scaling = new Vector2(0, 1000)};
|
|
//window.GrabCursor();
|
|
window.SetScene(scene = new Scene());
|
|
window.Load += WindowOnLoad;
|
|
window.RenderFrame += WindowOnUpdateFrame;
|
|
window.Run();
|
|
}
|
|
|
|
private static void WindowOnUpdateFrame(object sender, FrameEventArgs e)
|
|
{
|
|
Vector2 mousepos = window.Mouse.InWorld();
|
|
//polyogn.Transform.Position.Set(mousepos);
|
|
polyogn.Transform.TurnTo(mousepos);
|
|
}
|
|
|
|
private static void WindowOnLoad(object sender, EventArgs e)
|
|
{
|
|
col = new ItemCollection()
|
|
{
|
|
Transform = { Position = new SM.Base.Types.CVector2(0, 400) },
|
|
ZIndex = 1
|
|
};
|
|
|
|
col.Add(new DrawTexture(new Bitmap("soldier_logo.png"))
|
|
{
|
|
ZIndex = 1
|
|
});
|
|
col.Add(new DrawColor(Color4.Black)
|
|
{
|
|
Transform = { Rotation = 45, Position = new SM.Base.Types.CVector2(0, 25) },
|
|
ZIndex = 2
|
|
});
|
|
|
|
scene.Objects.Add(col);
|
|
scene.Objects.Add(new DrawText(font, "Testing...")
|
|
{
|
|
Transform = { Position = new SM.Base.Types.CVector2(0, 400)},
|
|
Color = Color4.Black
|
|
});
|
|
|
|
scene.Objects.Add(new DrawPolygon(Polygon.GenerateCircle(),Color4.Blue));
|
|
scene.Objects.Add(polyogn = new DrawPolygon(new Polygon(new[]
|
|
{
|
|
new PolygonVertex(new Vector2(.25f, 0), Color4.White),
|
|
new PolygonVertex(new Vector2(.75f, 0), Color4.White),
|
|
new PolygonVertex(new Vector2(1, .25f), Color4.White),
|
|
new PolygonVertex(new Vector2(1, .75f), Color4.White),
|
|
new PolygonVertex(new Vector2(.75f, 1), Color4.White),
|
|
new PolygonVertex(new Vector2(.25f, 1), Color4.White),
|
|
new PolygonVertex(new Vector2(0, .75f), new Color4(10,10,10,255)),
|
|
new PolygonVertex(new Vector2(0, .25f), new Color4(10,10,10,255))
|
|
}), Color4.LawnGreen)
|
|
{
|
|
Transform = {Position = new SM.Base.Types.CVector2(50,0)}
|
|
});
|
|
scene.Objects.Add(new DrawPolygon(new Polygon(new[]
|
|
{
|
|
new PolygonVertex(new Vector2(.25f, 0), Color4.White),
|
|
new PolygonVertex(new Vector2(.75f, 0), Color4.White),
|
|
new PolygonVertex(new Vector2(1, .25f), Color4.White),
|
|
new PolygonVertex(new Vector2(1, .75f), Color4.White),
|
|
new PolygonVertex(new Vector2(.75f, 1), Color4.White),
|
|
new PolygonVertex(new Vector2(.25f, 1), Color4.White),
|
|
new PolygonVertex(new Vector2(0, .75f), new Color4(10,10,10,255)),
|
|
new PolygonVertex(new Vector2(0, .25f), new Color4(10,10,10,255))
|
|
}), new Bitmap("soldier_logo.png"))
|
|
{
|
|
Transform = {Position = new SM.Base.Types.CVector2(-50,0)}
|
|
});
|
|
|
|
scene.Background.Color = Color4.Beige;
|
|
|
|
/*scene.HUD.Add(new DrawText(font, "GIVE ME A HUD HUG!")
|
|
{
|
|
Color = Color4.Black,
|
|
Spacing = .75f
|
|
});*/
|
|
}
|
|
}
|
|
} |