J
Javier Waldo
Guest
Hi,
I have just started learning how to use openTK library. I was performing the first tutorial on openTK's web.
This program consist on create a window, and allow the user to press Escape key to close it. I have followed all of the instructions and the program is not working, the window opens but it doesn't close on pressing Escape key.
I attach the code here:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CreatingWindow
{
class Program
{
static void Main(string[] args)
{
using (Game game = new Game(800, 600, "LearnOpenTK"))
{
game.Run(60.0);
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using OpenTK;
using OpenTK.Graphics;
using OpenTK.Input;
namespace CreatingWindow
{
public class Game : GameWindow
{
public Game(int width, int height, string title) : base(width, height, GraphicsMode.Default, title)
{
}
protected override void OnUpdateFrame(FrameEventArgs e)
{
KeyboardState input = Keyboard.GetState();
if (input.IsKeyDown(Key.Escape))
{
Exit();
}
base.OnUpdateFrame(e);
}
}
}
Continue reading...
I have just started learning how to use openTK library. I was performing the first tutorial on openTK's web.
This program consist on create a window, and allow the user to press Escape key to close it. I have followed all of the instructions and the program is not working, the window opens but it doesn't close on pressing Escape key.
I attach the code here:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CreatingWindow
{
class Program
{
static void Main(string[] args)
{
using (Game game = new Game(800, 600, "LearnOpenTK"))
{
game.Run(60.0);
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using OpenTK;
using OpenTK.Graphics;
using OpenTK.Input;
namespace CreatingWindow
{
public class Game : GameWindow
{
public Game(int width, int height, string title) : base(width, height, GraphicsMode.Default, title)
{
}
protected override void OnUpdateFrame(FrameEventArgs e)
{
KeyboardState input = Keyboard.GetState();
if (input.IsKeyDown(Key.Escape))
{
Exit();
}
base.OnUpdateFrame(e);
}
}
}
Continue reading...