Example #1
0
func QueryTexture(texture *Texture, format *uint32, access *int, w *int, h *int) int {
	_format := (*C.Uint32)(unsafe.Pointer(access))
	_access := (*C.int)(unsafe.Pointer(access))
	_w := (*C.int)(unsafe.Pointer(w))
	_h := (*C.int)(unsafe.Pointer(h))
	return int(C.SDL_QueryTexture(texture.cptr(), _format, _access, _w, _h))
}
Example #2
0
func (t *Texture) Query() (uint32, TextureAccess, int, int, error) {
	var format C.Uint32
	var access C.int
	var w, h C.int
	if C.SDL_QueryTexture(t.c, &format, &access, &w, &h) != 0 {
		return 0, 0, 0, 0, getError()
	}

	return uint32(format), TextureAccess(access), int(w), int(h), nil
}
Example #3
0
// Texture (https://wiki.libsdl.org/SDL_QueryTexture)
func (texture *Texture) Query() (uint32, int, int32, int32, error) {
	var format C.Uint32
	var access C.int
	var width C.int
	var height C.int
	ret := C.SDL_QueryTexture(texture.cptr(), &format, &access, &width, &height)
	if ret < 0 {
		return 0, 0, 0, 0, GetError()
	}
	return uint32(format), int(access), int32(width), int32(height), nil
}
Example #4
0
func (me *Font) WriteTo(text string, t *Image, c Color) bool {
	sur := C.TTF_RenderText_Blended(me.font, C.CString(text), c.toSDL_Color())

	runMainOp(func() {
		t.surface = C.SDL_CreateTextureFromSurface(renderer, sur)
	})

	var w, h C.int
	C.SDL_QueryTexture(t.surface, nil, nil, &w, &h)
	t.Width = int(w)
	t.Height = int(h)
	return t.surface != nil
}
Example #5
0
// Query returns (w, h)
func (t *Texture) GetSize() (int, int) {
	var w C.int
	var h C.int
	C.SDL_QueryTexture(t.cTexture, nil, nil, &w, &h)
	return int(w), int(h)
}
Example #6
0
func (me *Image) H() int {
	var out C.int
	C.SDL_QueryTexture(me.surface, nil, nil, nil, &out)
	return int(out)
}