Hi.  I am learning go, and have no trouble w/ the CLI interface on either
Ubuntu 16.04-64 bit or win10-64 bit.
However, I am trying to learn termbox-go.  My simple hello world works on
Ubuntu but does not on win10.
First time I tried this on win10, I got a runtime error about a deadlock
situation.  I re-compiled and now all I get is a program that does not show
the termbox.

package main;

import (
"fmt"
"os"
"bufio"
tb "github.com/nsf/termbox-go"
"runtime"
       )

func print_tb(x,y int, fg,bg tb.Attribute, msg string) {
  for _,c := range msg {
    tb.SetCell(x,y,c,fg,bg);
    x++;
  }
}

func printf_tb(x,y int, fg,bg tb.Attribute, format string, args
...interface{}) {
  s := fmt.Sprintf(format,args...);
  print_tb(x,y,fg,bg,s);
}


func main() {
  var x,y int;
  var fg,fgBold,bg tb.Attribute;


  fmt.Println(" On", runtime.GOOS,", ARCH =",runtime.GOARCH,".  Press any
key to <enter>.");
  scanner := bufio.NewScanner(os.Stdin)
  scanner.Scan();
  _ = scanner.Text();

  err := tb.Init();
  if err != nil {
    fmt.Println(" Init call to termbox-go failed with error:",err);
    os.Exit(1);
  }
  defer tb.Close();

  x = 0;
  y = 0;

  fg = tb.ColorYellow;
  fgBold = tb.ColorYellow | tb.AttrBold;
  fgcyan := tb.ColorCyan
  fgboldcyan := tb.ColorCyan | tb.AttrBold;
  fgblue := tb.ColorBlue
  fgboldblue := tb.ColorBlue | tb.AttrBold;
  bg = tb.ColorBlack;
  err = tb.Clear(fg,bg);
  if err != nil {
    fmt.Println(" First Clear call to termbox-go Clear failed with
error:",err);
    os.Exit(1);
  }
  print_tb(x,y,fg,bg,"Hello World in Yellow");
  y++
  print_tb(x,y,fgBold,bg,"Hello World in Bold Yellow.");
  y++
  print_tb(x,y,fgcyan,bg,"Hello World in Cyan");
  y++
  print_tb(x,y,fgboldcyan,bg,"Hello World in Bold Cyan");
  y++
  print_tb(x,y,fgblue,bg,"Hello World in Blue");
  y++
  print_tb(x,y,fgboldblue,bg,"Hello World in Bold Blue, and then hit any
key to exit");
  err = tb.Flush();
  if err != nil {
    panic(err);
  }
  event := tb.PollEvent();
  switch event.Type {
  case tb.EventKey:
  case tb.EventResize:
  case tb.EventNone:
  default:
  }

}
Thanks for your help

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to