本文整理匯總了Golang中C.SDL_Rect.x方法的典型用法代碼示例。如果您正苦於以下問題:Golang SDL_Rect.x方法的具體用法?Golang SDL_Rect.x怎麽用?Golang SDL_Rect.x使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類C.SDL_Rect
的用法示例。
在下文中一共展示了SDL_Rect.x方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: DrawImage
//Draws the image at the given coordinates.
func DrawImage(img *Image, destX, destY, srcX, srcY, srcW, srcH int) {
var src, dest C.SDL_Rect
dest.x = C.int(destX)
dest.y = C.int(destY)
dest.w = C.int(img.Width)
dest.h = C.int(img.Height)
src.x = C.int(srcX)
src.y = C.int(srcY)
src.w = C.int(srcW)
src.h = C.int(srcH)
C.SDL_SetTextureAlphaMod(img.surface, 255)
C.SDL_RenderCopy(renderer, img.surface, &src, &dest)
}
示例2: DrawImage
//Draws the image at the given coordinates.
func (me *Canvas) DrawImage(img *Image, x, y int) {
C.SDL_SetAlpha(img.img, C.SDL_SRCALPHA, 255)
var dest C.SDL_Rect
dest.x = C.Sint16(x + me.origin.X)
dest.y = C.Sint16(y + me.origin.Y)
C.SDL_BlitSurface(img.img, nil, me.pane, &dest)
}
示例3: sdl_Rect
func sdl_Rect(x, y, width, height int) C.SDL_Rect {
var r C.SDL_Rect
r.x = C.int(x)
r.y = C.int(y)
r.w = C.int(width)
r.h = C.int(height)
return r
}
示例4: toSDL_Rect
func toSDL_Rect(b util.Bounds) C.SDL_Rect {
var r C.SDL_Rect
r.x = C.Sint16(b.X)
r.y = C.Sint16(b.Y)
r.w = C.Uint16(b.Width)
r.h = C.Uint16(b.Height)
return r
}
示例5: FillRect
func FillRect(x, y, w, h int, c Color) {
var rect C.SDL_Rect
rect.x = C.int(x)
rect.y = C.int(y)
rect.w = C.int(w)
rect.h = C.int(h)
C.SDL_SetRenderDrawColor(renderer, C.Uint8(c.Red), C.Uint8(c.Green), C.Uint8(c.Blue), C.Uint8(c.Alpha))
C.SDL_RenderFillRect(renderer, &rect)
}
示例6: Blit
// Blit performs a fast blit from the source surface to the destination surface.
//
// srcRect represents the rectangle to be copied or image.ZR to copy the entire
// surface.
//
// dstPoint represents the destination position.
func (src *Surface) Blit(srcRect image.Rectangle, dst *Surface, dstPoint image.Point) (err error) {
cSrcRect := cRect(srcRect)
cDstRect := new(C.SDL_Rect)
cDstRect.x = C.int(dstPoint.X)
cDstRect.y = C.int(dstPoint.Y)
if C.SDL_BlitSurface(src.cSurface, cSrcRect, dst.cSurface, cDstRect) != 0 {
return getError()
}
return nil
}
示例7: DrawText
//Draws the text at the given coordinates.
func (me *Canvas) DrawText(text *Text, x, y int) {
var dest C.SDL_Rect
dest.x = C.Sint16(x + me.origin.X)
dest.y = C.Sint16(y + me.origin.Y)
C.SDL_BlitSurface(text.text, nil, me.pane, &dest)
}