作者:apcer
项目:sample-app
// Initialize the ncurses library. You must run this function prior to any
// other goncurses function in order for the library to work
func Init() (stdscr *Window, err error) {
stdscr = &Window{C.initscr()}
if unsafe.Pointer(stdscr.win) == nil {
err = errors.New("An error occurred initializing ncurses")
}
return
}
作者:jameseb
项目:roguelik
func initCurses() {
C.initscr()
C.cbreak()
C.noecho()
C.nonl()
C.intrflush(C.stdscr, true)
C.keypad(C.stdscr, false)
}
作者:jncorpro
项目:gocurs
func Initialize() (*Window, error) {
window := (*Window)(C.initscr())
if window == nil {
return nil, CursesError{"Initialize failed"}
}
return window, nil
}
作者:Aaron
项目:lightwav
func Initscr() (*Window, os.Error) {
Stdwin = (*Window)(C.initscr())
if Stdwin == nil {
return nil, CursesError{"Initscr failed"}
}
return Stdwin, nil
}
作者:zozo
项目:gocurs
func Initscr() (*Window, error) {
win := C.initscr()
if win == nil {
return nil, ErrorInit
}
return &Window{win}, nil
}
作者:wonktnod
项目:cheesesuncodedum
func Hello(s string) {
C.initscr()
p := C.CString(fmt.Sprintf("Hello, %s", s))
C.Printw(p)
C.free(unsafe.Pointer(p))
C.refresh()
C.getch()
C.endwin()
}
作者:akrennmai
项目:gocurs
func Newwin(rows int16, cols int16, starty int16, startx int16) (*Window, os.Error) {
mt := C.CString("")
C.setlocale(C.LC_ALL, mt)
defer C.free(unsafe.Pointer(mt))
Stdwin = (*Window)(C.initscr())
if Stdwin == nil {
return nil, CursesError{"Initscr failed"}
}
return Stdwin, nil
}
作者:elimistev
项目:gocurs
func Initscr() (*Window, error) {
mt := C.CString("")
C.setlocale(C.LC_ALL, mt)
defer C.free(unsafe.Pointer(mt))
Stdwin = (*Window)(C.initscr())
if Stdwin == nil {
return nil, CursesError{"Initscr failed"}
}
return Stdwin, nil
}
作者:zennr
项目:fz
func Init(color bool, color256 bool, black bool, mouse bool) {
{
in, err := os.OpenFile("/dev/tty", syscall.O_RDONLY, 0)
if err != nil {
panic("Failed to open /dev/tty")
}
_in = in
// Break STDIN
// syscall.Dup2(int(in.Fd()), int(os.Stdin.Fd()))
}
C.swapOutput()
C.setlocale(C.LC_ALL, C.CString(""))
C.initscr()
if mouse {
C.mousemask(C.ALL_MOUSE_EVENTS, nil)
}
C.cbreak()
C.noecho()
C.raw() // stty dsusp undef
intChan := make(chan os.Signal, 1)
signal.Notify(intChan, os.Interrupt, os.Kill)
go func() {
<-intChan
Close()
os.Exit(1)
}()
if color {
C.start_color()
var bg C.short
if black {
bg = C.COLOR_BLACK
} else {
C.use_default_colors()
bg = -1
}
if color256 {
DarkBG = 236
C.init_pair(ColPrompt, 110, bg)
C.init_pair(ColMatch, 108, bg)
C.init_pair(ColCurrent, 254, DarkBG)
C.init_pair(ColCurrentMatch, 151, DarkBG)
C.init_pair(ColSpinner, 148, bg)
C.init_pair(ColInfo, 144, bg)
C.init_pair(ColCursor, 161, DarkBG)
C.init_pair(ColSelected, 168, DarkBG)
} else {
DarkBG = C.COLOR_BLACK
C.init_pair(ColPrompt, C.COLOR_BLUE, bg)
C.init_pair(ColMatch, C.COLOR_GREEN, bg)
C.init_pair(ColCurrent, C.COLOR_YELLOW, DarkBG)
C.init_pair(ColCurrentMatch, C.COLOR_GREEN, DarkBG)
C.init_pair(ColSpinner, C.COLOR_GREEN, bg)
C.init_pair(ColInfo, C.COLOR_WHITE, bg)
C.init_pair(ColCursor, C.COLOR_RED, DarkBG)
C.init_pair(ColSelected, C.COLOR_MAGENTA, DarkBG)
}
_color = attrColored
} else {
_color = attrMono
}
}
作者:tncardos
项目:gocurse
// Initializes curses.
// This function should be called before using the package.
func Initscr() *Window {
Stdscr.cwin = C.initscr()
return Stdscr
}
作者:Olreic
项目:ncurse
/* Initializes NCurses library, returns the standard screen. */
func Init() *Window {
return (*Window)(C.initscr())
}
作者:gcatli
项目:gocurse
// Initializes curses.
// This function should be called before using the package.
func Initscr() *Window {
Stdscr = (*Window)(C.initscr())
return Stdscr
}
作者:repos-g
项目:curse
// Initializes curses.
// This function should be called before using the package.
func Initscr() *Window {
Stdscr = &Window{C.initscr()}
return Stdscr
}