Skip to content

Instantly share code, notes, and snippets.

@hypevhs
Created June 23, 2015 02:20
Show Gist options
  • Save hypevhs/1999b3e7b94b2104424a to your computer and use it in GitHub Desktop.
Save hypevhs/1999b3e7b94b2104424a to your computer and use it in GitHub Desktop.
Basic GLSL SFML.Net skeleton
using SFML.Graphics;
using SFML.System;
using SFML.Window;
using System;
using System.Collections.Generic;
using System.Linq;
namespace OMGITSANAMESPACE
{
class Program
{
private static RenderWindow window;
private static RenderStates shaderState;
static void Main(string[] args)
{
PreRun();
LoadContentInitialize();
while (window.IsOpen)
{
UpdateDraw(window);
}
}
private static void PreRun()
{
rand = new Random();
}
private static void LoadContentInitialize()
{
window = new RenderWindow(new VideoMode(768, 768), "Circle Mix");
window.SetFramerateLimit(60);
window.Closed += (s, e) =>
{
window.Close();
};
Shader shader = new Shader(null, "circlemix.frag");
shaderState = new RenderStates(shader);
}
private static void UpdateDraw(RenderWindow window)
{
window.Clear(Color.Black);
window.DispatchEvents();
RectangleShape rect = new RectangleShape(new Vector2f(768, 768));
//TODO: send some params here
window.Draw(rect, shaderState);
window.Display();
if (Keyboard.IsKeyPressed(Keyboard.Key.Escape))
{
window.Close();
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment