Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using SFML;
- using SFML.Graphics;
- using SFML.Window;
- namespace sfmlcsharp
- {
- class Program
- {
- static RenderWindow window = new RenderWindow(new VideoMode(800, 600), "sfml");
- static uint FPS = 60;
- private void Init()
- {
- window.SetFramerateLimit(FPS);
- window.Closed += OnClosed;
- window.KeyPressed += OnKeyPressed;
- }
- public Program()
- {
- Init();
- while (window.IsOpen)
- {
- window.DispatchEvents();
- window.Clear(new Color(255, 128, 0));
- window.Display();
- }
- }
- static void OnClosed(object sender, EventArgs e)
- {
- var window = (RenderWindow)sender;
- window.Close();
- }
- static void OnKeyPressed(object sender, KeyEventArgs e)
- {
- if (e.Code == Keyboard.Key.Escape)
- {
- window.Close();
- }
- if(e.Code == Keyboard.Key.A)
- {
- Console.WriteLine("A pressed");
- }
- }
- static void Main(string[] args)
- {
- new Program();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement