Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
15
Task/Window-creation/Go/window-creation-1.go
Normal file
15
Task/Window-creation/Go/window-creation-1.go
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"github.com/mattn/go-gtk/glib"
|
||||
"github.com/mattn/go-gtk/gtk"
|
||||
)
|
||||
|
||||
func main() {
|
||||
gtk.Init(nil)
|
||||
window := gtk.NewWindow(gtk.WINDOW_TOPLEVEL)
|
||||
window.Connect("destroy",
|
||||
func(*glib.CallbackContext) { gtk.MainQuit() }, "")
|
||||
window.Show()
|
||||
gtk.Main()
|
||||
}
|
||||
22
Task/Window-creation/Go/window-creation-2.go
Normal file
22
Task/Window-creation/Go/window-creation-2.go
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/veandco/go-sdl2/sdl"
|
||||
)
|
||||
|
||||
func main() {
|
||||
window, err := sdl.CreateWindow("RC Window Creation",
|
||||
sdl.WINDOWPOS_UNDEFINED, sdl.WINDOWPOS_UNDEFINED,
|
||||
320, 200, 0)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
for {
|
||||
if _, ok := sdl.WaitEvent().(*sdl.QuitEvent); ok {
|
||||
break
|
||||
}
|
||||
}
|
||||
window.Destroy()
|
||||
}
|
||||
22
Task/Window-creation/Go/window-creation-3.go
Normal file
22
Task/Window-creation/Go/window-creation-3.go
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"code.google.com/p/x-go-binding/ui"
|
||||
"code.google.com/p/x-go-binding/ui/x11"
|
||||
"log"
|
||||
)
|
||||
|
||||
func main() {
|
||||
win, err := x11.NewWindow()
|
||||
if err != nil {
|
||||
log.Fatalf("Error: %v\n", err)
|
||||
}
|
||||
defer win.Close()
|
||||
|
||||
for ev := range win.EventChan() {
|
||||
switch e := ev.(type) {
|
||||
case ui.ErrEvent:
|
||||
log.Fatalf("Error: %v\n", e.Err)
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue