Ejemplo n.º 1
0
// Sets the window title and icon name.
func WM_SetCaption(title, icon string) {
	ctitle := C.CString(title)
	cicon := C.CString(icon)
	C.SDL_WM_SetCaption(ctitle, cicon)
	C.free(unsafe.Pointer(ctitle))
	C.free(unsafe.Pointer(cicon))
}
Ejemplo n.º 2
0
// Sets the window title and icon name.
func WM_SetCaption(title, icon string) {
	ctitle := C.CString(title)
	cicon := C.CString(icon)

	GlobalMutex.Lock()
	C.SDL_WM_SetCaption(ctitle, cicon)
	GlobalMutex.Unlock()

	C.free(unsafe.Pointer(ctitle))
	C.free(unsafe.Pointer(cicon))
}
Ejemplo n.º 3
0
func NewDisplay(title string, width, height int) (*Display, error) {
	d := Display{frame: make(chan *C.AVFrame)}
	d.width = C.int(width)
	d.height = C.int(height)
	d.screen = C.SDL_SetVideoMode(d.width, d.height, 0, 0)
	d.overlay = C.SDL_CreateYUVOverlay(d.width, d.height, C.SDL_IYUV_OVERLAY, d.screen)
	t := C.CString(title)
	C.SDL_WM_SetCaption(t, (*C.char)(null))
	C.free(unsafe.Pointer(t))
	return &d, nil
}
Ejemplo n.º 4
0
//Opens a window.
//Returns an indicator of success.
func OpenDisplay(width, height int, fullscreen bool) bool {
	if C.SDL_Init(C.SDL_INIT_VIDEO) != 0 {
		return false
	}
	C.TTF_Init()
	var flags C.Uint32 = C.SDL_DOUBLEBUF
	flags |= C.SDL_SWSURFACE
	flags |= C.SDL_HWACCEL

	if fullscreen {
		screen = C.openDisplayFullscreen(C.int(width), C.int(height))
	} else {
		screen = C.openDisplay(C.int(width), C.int(height))
	}
	if screen == nil {
		return false
	}
	C.SDL_WM_SetCaption(C.CString(displayTitle), C.CString(""))
	C.SDL_GL_SetAttribute(C.SDL_GL_SWAP_CONTROL, 1)

	return true
}
Ejemplo n.º 5
0
//Sets the title of the window.
func SetDisplayTitle(title string) {
	displayTitle = title
	if screen != nil {
		C.SDL_WM_SetCaption(C.CString(displayTitle), C.CString(""))
	}
}
Ejemplo n.º 6
0
//
// Sets/Gets the title and icon text of the display window (UTF-8 encoded)
func WM_SetCaption(title, icon string) {
	ctitle := cstr(title)
	cicon := cstr(icon)
	C.SDL_WM_SetCaption(ctitle, cicon)
}