From 6787d9585c16f8f0f4261fd7c291cd013a2ff78e Mon Sep 17 00:00:00 2001 From: faiface Date: Sat, 4 May 2019 15:37:30 +0200 Subject: remove key constants, represent keys as strings --- event.go | 3 -- keys.go | 21 ----------- win/win.go | 121 ++++++++++++++++++++++++++++++++++--------------------------- 3 files changed, 68 insertions(+), 77 deletions(-) delete mode 100644 keys.go diff --git a/event.go b/event.go index d520849..f673f34 100644 --- a/event.go +++ b/event.go @@ -23,9 +23,6 @@ import "fmt" // // window closed // case event.Matches("mo/move/%d/%d", &x, &y): // // mouse moved to (x, y) -// case event.Matches("mo/down/%d/%d", &x, &y): -// // mouse pressed on (x, y) -// case event.Matches("mo/up/%d/%d", &x, &y): // // mouse released on (x, y) // case event.Matches("kb/type/%d", &r): // // rune r typed on the keyboard (encoded as a number in the event string) diff --git a/keys.go b/keys.go deleted file mode 100644 index a22b086..0000000 --- a/keys.go +++ /dev/null @@ -1,21 +0,0 @@ -package gui - -const ( - KeyLeft int = iota - KeyRight - KeyUp - KeyDown - KeyEscape - KeySpace - KeyBackspace - KeyDelete - KeyEnter - KeyTab - KeyHome - KeyEnd - KeyPageUp - KeyPageDown - KeyShift - KeyCtrl - KeyAlt -) diff --git a/win/win.go b/win/win.go index 977830c..ba97cd0 100644 --- a/win/win.go +++ b/win/win.go @@ -110,6 +110,27 @@ func makeGLFWWin(o *options) (*glfw.Window, error) { // Win is an Env that handles an actual graphical window. // // It receives its events from the OS and it draws to the surface of the window. +// +// Here are all kinds of events that a window can produce, along with descriptions. +// Things enclosed in <> are values that are filled in. +// +// resize// Window resized to w x h. +// wi/close Window close button pressed. +// mo/move// Mouse moved to (x, y). +// mo/down///