all tasks
This commit is contained in:
parent
b83f433714
commit
68f8f3e56b
14735 changed files with 178959 additions and 0 deletions
14
Task/Window-creation/Go/window-creation-1.go
Normal file
14
Task/Window-creation/Go/window-creation-1.go
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
package main
|
||||
|
||||
import "gtk"
|
||||
|
||||
func main() {
|
||||
gtk.Init(nil)
|
||||
window := gtk.Window(gtk.GTK_WINDOW_TOPLEVEL)
|
||||
window.Connect("destroy", func(*gtk.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 (
|
||||
"sdl"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func main() {
|
||||
if sdl.Init(sdl.INIT_VIDEO) != 0 {
|
||||
fmt.Println(sdl.GetError())
|
||||
return
|
||||
}
|
||||
defer sdl.Quit()
|
||||
|
||||
if sdl.SetVideoMode(200, 200, 32, 0) == nil {
|
||||
fmt.Println(sdl.GetError())
|
||||
return
|
||||
}
|
||||
|
||||
for e := new(sdl.Event); e.Wait() && e.Type != sdl.QUIT; {
|
||||
}
|
||||
}
|
||||
26
Task/Window-creation/Go/window-creation-3.go
Normal file
26
Task/Window-creation/Go/window-creation-3.go
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"code.google.com/p/x-go-binding/ui"
|
||||
"code.google.com/p/x-go-binding/ui/x11"
|
||||
"fmt"
|
||||
"os"
|
||||
)
|
||||
|
||||
func main() {
|
||||
win, err := x11.NewWindow()
|
||||
if err != nil {
|
||||
fmt.Printf("Error: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
defer win.Close()
|
||||
|
||||
evchan := win.EventChan()
|
||||
for ev := range evchan {
|
||||
switch e := ev.(type) {
|
||||
case ui.ErrEvent:
|
||||
fmt.Printf("Error: %v\n", e.Err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue