コード例 #1
0
ファイル: surface.go プロジェクト: badgerodon/go
func (this Surface) SetPalette(flags SetPaletteFlags, colors []Color) error {
	c_surface := (*C.SDL_Surface)(this.Ptr)
	c_flags := C.int(flags)
	var c_colors *C.SDL_Color
	if len(colors) > 0 {
		c_colors = (*C.SDL_Color)(unsafe.Pointer(&colors[0]))
	}
	c_firstcolor := C.int(0)
	c_ncolors := C.int(len(colors))
	C.SDL_SetPalette(c_surface, c_flags, c_colors, c_firstcolor, c_ncolors)
	return GetError()
}
コード例 #2
0
ファイル: video.go プロジェクト: rsaarelm/teratogen
func (s *Surface) SetColors(pal Palette) {
	colPtr := (*C.SDL_Color)(unsafe.Pointer(&pal[0]))
	C.SDL_SetPalette(s.ptr, C.SDL_LOGPAL, colPtr, 0, C.int(len(pal)))
}