Add new functions
This commit is contained in:
parent
ba0df12858
commit
faa881fe83
3 changed files with 83 additions and 11 deletions
|
@ -318,9 +318,13 @@ const (
|
|||
KeyVolumeDown = 25
|
||||
|
||||
// Mouse Buttons
|
||||
MouseLeftButton = 0
|
||||
MouseRightButton = 1
|
||||
MouseMiddleButton = 2
|
||||
MouseLeftButton = 0
|
||||
MouseRightButton = 1
|
||||
MouseMiddleButton = 2
|
||||
MouseSideButton = 3
|
||||
MouseExtraButton = 4
|
||||
MouseForwardButton = 5
|
||||
MouseBackButton = 6
|
||||
|
||||
// Touch points registered
|
||||
MaxTouchPoints = 2
|
||||
|
@ -930,12 +934,14 @@ type BlendMode int32
|
|||
|
||||
// Color blending modes (pre-defined)
|
||||
const (
|
||||
BlendAlpha BlendMode = iota // Blend textures considering alpha (default)
|
||||
BlendAdditive // Blend textures adding colors
|
||||
BlendMultiplied // Blend textures multiplying colors
|
||||
BlendAddColors // Blend textures adding colors (alternative)
|
||||
BlendSubtractColors // Blend textures subtracting colors (alternative)
|
||||
BlendCustom // Blend textures using custom src/dst factors (use SetBlendModeCustom())
|
||||
BlendAlpha BlendMode = iota // Blend textures considering alpha (default)
|
||||
BlendAdditive // Blend textures adding colors
|
||||
BlendMultiplied // Blend textures multiplying colors
|
||||
BlendAddColors // Blend textures adding colors (alternative)
|
||||
BlendSubtractColors // Blend textures subtracting colors (alternative)
|
||||
BlendAlphaPremultiply // Blend premultiplied textures considering alpha
|
||||
BlendCustom // Blend textures using custom src/dst factors
|
||||
BlendCustomSeparate // Blend textures using custom rgb/alpha separate src/dst factors
|
||||
)
|
||||
|
||||
// Shader type (generic shader)
|
||||
|
|
|
@ -158,6 +158,28 @@ func DrawCylinderWires(position Vector3, radiusTop float32, radiusBottom float32
|
|||
C.DrawCylinderWires(*cposition, cradiusTop, cradiusBottom, cheight, cslices, *ccolor)
|
||||
}
|
||||
|
||||
// DrawCapsule - Draw a capsule with the center of its sphere caps at startPos and endPos
|
||||
func DrawCapsule(startPos, endPos Vector3, radius float32, slices, rings int32, col color.RGBA) {
|
||||
cstartPos := startPos.cptr()
|
||||
cendPos := startPos.cptr()
|
||||
cradius := (C.float)(radius)
|
||||
cslices := (C.int)(slices)
|
||||
crings := (C.int)(slices)
|
||||
ccolor := colorCptr(col)
|
||||
C.DrawCapsule(*cstartPos, *cendPos, cradius, cslices, crings, *ccolor)
|
||||
}
|
||||
|
||||
// DrawCapsuleWires - Draw capsule wireframe with the center of its sphere caps at startPos and endPos
|
||||
func DrawCapsuleWires(startPos, endPos Vector3, radius float32, slices, rings int32, col color.RGBA) {
|
||||
cstartPos := startPos.cptr()
|
||||
cendPos := startPos.cptr()
|
||||
cradius := (C.float)(radius)
|
||||
cslices := (C.int)(slices)
|
||||
crings := (C.int)(slices)
|
||||
ccolor := colorCptr(col)
|
||||
C.DrawCapsuleWires(*cstartPos, *cendPos, cradius, cslices, crings, *ccolor)
|
||||
}
|
||||
|
||||
// DrawPlane - Draw a plane XZ
|
||||
func DrawPlane(centerPos Vector3, size Vector2, col color.RGBA) {
|
||||
ccenterPos := centerPos.cptr()
|
||||
|
|
|
@ -384,7 +384,7 @@ func ImageDraw(dst, src *Image, srcRec, dstRec Rectangle, tint color.RGBA) {
|
|||
C.ImageDraw(cdst, *csrc, *csrcRec, *cdstRec, *ctint)
|
||||
}
|
||||
|
||||
// ImageDrawCircle - Draw circle within an image
|
||||
// ImageDrawCircle - Draw a filled circle within an image
|
||||
func ImageDrawCircle(dst *Image, centerX, centerY, radius int32, col color.RGBA) {
|
||||
cdst := dst.cptr()
|
||||
ccenterX := (C.int)(centerX)
|
||||
|
@ -394,7 +394,7 @@ func ImageDrawCircle(dst *Image, centerX, centerY, radius int32, col color.RGBA)
|
|||
C.ImageDrawCircle(cdst, ccenterX, ccenterY, cradius, *ccolor)
|
||||
}
|
||||
|
||||
// ImageDrawCircleV - Draw circle within an image
|
||||
// ImageDrawCircleV - Draw a filled circle within an image (Vector version)
|
||||
func ImageDrawCircleV(dst *Image, center Vector2, radius int32, col color.RGBA) {
|
||||
cdst := dst.cptr()
|
||||
ccenter := center.cptr()
|
||||
|
@ -403,6 +403,25 @@ func ImageDrawCircleV(dst *Image, center Vector2, radius int32, col color.RGBA)
|
|||
C.ImageDrawCircleV(cdst, *ccenter, cradius, *ccolor)
|
||||
}
|
||||
|
||||
// ImageDrawCircleLines - Draw circle outline within an image
|
||||
func ImageDrawCircleLines(dst *Image, centerX, centerY, radius int32, col color.RGBA) {
|
||||
cdst := dst.cptr()
|
||||
ccenterX := (C.int)(centerX)
|
||||
ccenterY := (C.int)(centerY)
|
||||
cradius := (C.int)(radius)
|
||||
ccolor := colorCptr(col)
|
||||
C.ImageDrawCircleLines(cdst, ccenterX, ccenterY, cradius, *ccolor)
|
||||
}
|
||||
|
||||
// ImageDrawCircleLinesV - Draw circle outline within an image (Vector version)
|
||||
func ImageDrawCircleLinesV(dst *Image, center Vector2, radius int32, col color.RGBA) {
|
||||
cdst := dst.cptr()
|
||||
ccenter := center.cptr()
|
||||
cradius := (C.int)(radius)
|
||||
ccolor := colorCptr(col)
|
||||
C.ImageDrawCircleLinesV(cdst, *ccenter, cradius, *ccolor)
|
||||
}
|
||||
|
||||
// ImageDrawPixel - Draw pixel within an image
|
||||
func ImageDrawPixel(dst *Image, posX, posY int32, col color.RGBA) {
|
||||
cdst := dst.cptr()
|
||||
|
@ -555,6 +574,19 @@ func GenImageWhiteNoise(width, height int, factor float32) *Image {
|
|||
return v
|
||||
}
|
||||
|
||||
// GenImagePerlinNoise - Generate image: perlin noise
|
||||
func GenImagePerlinNoise(width, height, offsetX, offsetY int, scale float32) *Image {
|
||||
cwidth := (C.int)(width)
|
||||
cheight := (C.int)(height)
|
||||
coffsetX := (C.int)(offsetX)
|
||||
coffsetY := (C.int)(offsetY)
|
||||
cscale := (C.float)(scale)
|
||||
|
||||
ret := C.GenImagePerlinNoise(cwidth, cheight, coffsetX, coffsetY, cscale)
|
||||
v := newImageFromPointer(unsafe.Pointer(&ret))
|
||||
return v
|
||||
}
|
||||
|
||||
// GenImageCellular - Generate image: cellular algorithm. Bigger tileSize means bigger cells
|
||||
func GenImageCellular(width, height, tileSize int) *Image {
|
||||
cwidth := (C.int)(width)
|
||||
|
@ -566,6 +598,18 @@ func GenImageCellular(width, height, tileSize int) *Image {
|
|||
return v
|
||||
}
|
||||
|
||||
// GenImageText - Generate image: grayscale image from text data
|
||||
func GenImageText(width, height int, text string) *Image {
|
||||
cwidth := (C.int)(width)
|
||||
cheight := (C.int)(height)
|
||||
ctext := C.CString(text)
|
||||
defer C.free(unsafe.Pointer(ctext))
|
||||
|
||||
ret := C.GenImageText(cwidth, cheight, ctext)
|
||||
v := newImageFromPointer(unsafe.Pointer(&ret))
|
||||
return v
|
||||
}
|
||||
|
||||
// GenTextureMipmaps - Generate GPU mipmaps for a texture
|
||||
func GenTextureMipmaps(texture *Texture2D) {
|
||||
ctexture := texture.cptr()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue