Get Screen dimensions via goncurses

This commit is contained in:
tkarrass 2016-01-19 16:38:15 +01:00
parent b4251237ba
commit ca3f1947b3
4 changed files with 25 additions and 1 deletions

View File

@ -9,7 +9,7 @@ import (
var cmdGosl = &cobra.Command{
Use: "gosl [command]",
Short: "Run a gosl instance",
Long: `Run a gosl server or client."
Long: `Run a gosl server or client.
For further instructions run 'gosl help [command]'
`,

View File

@ -4,6 +4,8 @@ import (
"fmt"
"github.com/spf13/cobra"
"code.bitsetter.de/fun/gosl/data"
)
var cmdServer = &cobra.Command{
@ -15,6 +17,7 @@ var cmdServer = &cobra.Command{
func runServer(cmd *cobra.Command, args []string) {
fmt.Println("running server ...")
data.TestNC()
}
func init() {

View File

@ -1,6 +1,27 @@
package data // code.bitsetter.de/fun/gosl/data
import (
"fmt"
"log"
"os"
"github.com/rthornton128/goncurses"
)
type Screen struct {
w, h int
data []rune
}
func TestNC() {
win, err := goncurses.Init()
if err != nil {
log.Fatal(err)
os.Exit(1)
}
win.Clear()
w, h := win.MaxYX()
goncurses.End()
fmt.Printf("screen: %d x %d", w, h)
}

BIN
gosl

Binary file not shown.