budnhead/NHEngine/BootStrap.cs

78 lines
1.2 KiB
C#
Raw Normal View History

2017-04-20 16:49:43 +02:00
using System;
using System.IO;
using System.Drawing;
using System.Drawing.Imaging;
2017-04-20 16:49:43 +02:00
using OpenTK.Graphics.OpenGL4;
using OpenTK;
2017-04-25 22:01:18 +02:00
using OpenTK.Audio.OpenAL;
using OpenTK.Audio;
using ImageSharp;
2017-05-01 01:33:33 +02:00
using org.niclasundharald.engine.graphics;
2017-04-25 22:01:18 +02:00
2017-04-20 16:49:43 +02:00
namespace nhengine
{
public class BootStrap
{
public static BootStrap _instance;
public static BootStrap instance()
{
return _instance;
}
OpenGLWindow glWindow;
SquaredMap map;
public static void Main(string[] args){
2017-04-25 22:01:18 +02:00
_instance = new BootStrap();
2017-04-20 16:49:43 +02:00
2017-04-25 22:01:18 +02:00
_instance.run();
2017-04-20 16:49:43 +02:00
}
public BootStrap()
{
bootGraphics();
bootMap();
}
public SquaredMap SquaredMap {
get { return this.map; }
}
public void bootGraphics(){
glWindow = new OpenGLWindow();
2017-05-01 01:33:33 +02:00
glWindow.MakeCurrent();
2017-04-25 22:01:18 +02:00
GlobalDefaults.instance();
}
public void bootAudio(){
AL.Enable(ALCapability.Invalid);
2017-04-20 16:49:43 +02:00
}
2017-05-01 01:33:33 +02:00
public void bootMap(){
ImageSharp.Image i = ImageSharp.Image.Load( new FileStream("M3-wip.png",FileMode.Open));
i.Flip(ImageSharp.Processing.FlipType.Vertical);
map = new SquaredMap(i);
2017-05-01 01:33:33 +02:00
glWindow.Scene.RootObject.addChild( map );
2017-04-20 16:49:43 +02:00
}
public void run(){
glWindow.MakeCurrent();
glWindow.Run(30,30);
}
}
}