예제 #1
0
파일: ui.go 프로젝트: velour/ui
// NewWindow returns a new window.
func NewWindow(title string, w, h int) *Window {
	win := &Window{
		events: make(chan interface{}, eventChanSize),
		imgs:   make(map[string]texture),
	}
	do(func() {
		ctitle := C.CString(title)
		defer C.free(unsafe.Pointer(ctitle))
		x, y := C.SDL_WINDOWPOS_UNDEFINED, C.SDL_WINDOWPOS_UNDEFINED
		flags := C.SDL_WINDOW_SHOWN | C.SDL_WINDOW_OPENGL

		win.win = C.SDL_CreateWindow(ctitle, C.int(x), C.int(y), C.int(w), C.int(h), C.Uint32(flags))
		if win.win == nil {
			panic(sdlError())
		}

		win.rend = C.SDL_CreateRenderer(win.win, 0, C.SDL_RENDERER_ACCELERATED)
		if win.rend == nil {
			panic(sdlError())
		}
		if C.SDL_SetRenderDrawBlendMode(win.rend, C.SDL_BLENDMODE_BLEND) < 0 {
			panic(sdlError())
		}

		win.id = windowID(C.SDL_GetWindowID(win.win))
		windows[win.id] = win
	})
	return win
}
예제 #2
0
파일: render.go 프로젝트: emlai/go-sdl2
// Renderer (https://wiki.libsdl.org/SDL_SetRenderDrawBlendMode)
func (renderer *Renderer) SetDrawBlendMode(bm BlendMode) error {
	_ret := C.SDL_SetRenderDrawBlendMode(renderer.cptr(), bm.c())
	if _ret < 0 {
		return GetError()
	}
	return nil
}
예제 #3
0
파일: render.go 프로젝트: willemvds/sdl
func (r *Renderer) SetDrawBlendMode(mode BlendMode) error {
	if C.SDL_SetRenderDrawBlendMode(r.c, mode.c()) != 0 {
		return getError()
	}

	return nil
}
예제 #4
0
파일: sdl.go 프로젝트: gtalent/starfish
func OpenDisplay(w, h int, full bool) {
	runtime.LockOSThread()
	var i C.int = 0
	if full {
		i = 1
	}
	screen = C.openDisplay(C.int(w), C.int(h), i)
	renderer = C.SDL_CreateRenderer(screen, -1, C.SDL_RENDERER_ACCELERATED)
	C.SDL_SetRenderDrawBlendMode(renderer, C.SDL_BLENDMODE_BLEND)

	Event_DrawEvent = C.SDL_RegisterEvents(1)
	Event_MainOpEvent = C.SDL_RegisterEvents(1)
}
예제 #5
0
func SetRenderDrawBlendMode(_renderer *Renderer, _mode int) {
	C.SDL_SetRenderDrawBlendMode(_renderer.Get(), C.SDL_BlendMode(_mode))
}
예제 #6
0
파일: render.go 프로젝트: jbondeson/Go-SDL2
func (r *Renderer) SetDrawBlendMode(blendmode int) bool {
	ret := C.SDL_SetRenderDrawBlendMode(r.cRenderer, C.SDL_BlendMode(blendmode))
	return int(ret) == 0
}
예제 #7
0
func (renderer *Renderer) SetDrawBlendMode(blendMode uint32) int {
	_renderer := (*C.SDL_Renderer)(unsafe.Pointer(renderer))
	_blendMode := (C.SDL_BlendMode)(blendMode)
	return (int)(C.SDL_SetRenderDrawBlendMode(_renderer, _blendMode))
}
예제 #8
0
파일: render.go 프로젝트: JalfResi/go-sdl2
func (renderer *Renderer) SetDrawBlendMode(bm BlendMode) int {
	return int(C.SDL_SetRenderDrawBlendMode(renderer.cptr(), bm.c()))
}