func main() { fmt.Println("Starting") allegro.Init() allegro.InstallKeyboard() allegro.InstallMouse() runtime.GOMAXPROCS(10) doneChan := make(chan bool) var disp *allegro.Display alFuncs <- func() { disp = allegro.CreateDisplay(600, 400, allegro.WINDOWED) color = allegro.CreateColor(100, 0, 0, 255) color.Clear() allegro.Flip() doneChan <- true } <-doneChan fmt.Println("Created window") handleEvents(disp) fmt.Println("Ended") }
func createDisp(conf *allegro.Config) *allegro.Display { /* width := config.GetInt(conf, "display", "width", DEFAULT_WIDTH) height := config.GetInt(conf, "display", "height", DEFAULT_HEIGHT)*/ flags := allegro.RESIZABLE switch config.GetString(conf, "display", "windowed", "fullscreenwindow") { case "fullscreen": flags |= allegro.FULLSCREEN case "windowed": flags |= allegro.WINDOWED default: log.Printf("display.windowed not one of \"fullscreen\", \"fullscreenwindow\", or \"windowed\"") log.Printf("Defaulting to display.windowed=\"fullscreenwindow\"") fallthrough case "fullscreenwindow": flags |= allegro.FULLSCREEN_WINDOW } disp := allegro.CreateDisplay(1, 1, flags) if disp == nil { log.Fatalf("Could not create display") } return disp }