Add new functions
This commit is contained in:
parent
9deb95087d
commit
9e0799a313
2 changed files with 31 additions and 9 deletions
|
@ -347,15 +347,6 @@ func CheckCollisionCircleRec(center Vector2, radius float32, rec Rectangle) bool
|
||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetCollisionRec - Get collision rectangle for two rectangles collision
|
|
||||||
func GetCollisionRec(rec1, rec2 Rectangle) Rectangle {
|
|
||||||
crec1 := rec1.cptr()
|
|
||||||
crec2 := rec2.cptr()
|
|
||||||
ret := C.GetCollisionRec(*crec1, *crec2)
|
|
||||||
v := newRectangleFromPointer(unsafe.Pointer(&ret))
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
// CheckCollisionPointRec - Check if point is inside rectangle
|
// CheckCollisionPointRec - Check if point is inside rectangle
|
||||||
func CheckCollisionPointRec(point Vector2, rec Rectangle) bool {
|
func CheckCollisionPointRec(point Vector2, rec Rectangle) bool {
|
||||||
cpoint := point.cptr()
|
cpoint := point.cptr()
|
||||||
|
@ -386,6 +377,27 @@ func CheckCollisionPointTriangle(point, p1, p2, p3 Vector2) bool {
|
||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CheckCollisionLines - Check the collision between two lines defined by two points each, returns collision point by reference
|
||||||
|
func CheckCollisionLines(startPos1, endPos1, startPos2, endPos2 Vector2, point *Vector2) bool {
|
||||||
|
cstartPos1 := startPos1.cptr()
|
||||||
|
cendPos1 := endPos1.cptr()
|
||||||
|
cstartPos2 := startPos2.cptr()
|
||||||
|
cendPos2 := endPos2.cptr()
|
||||||
|
cpoint := point.cptr()
|
||||||
|
ret := C.CheckCollisionLines(*cstartPos1, *cendPos1, *cstartPos2, *cendPos2, cpoint)
|
||||||
|
v := bool(ret)
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetCollisionRec - Get collision rectangle for two rectangles collision
|
||||||
|
func GetCollisionRec(rec1, rec2 Rectangle) Rectangle {
|
||||||
|
crec1 := rec1.cptr()
|
||||||
|
crec2 := rec2.cptr()
|
||||||
|
ret := C.GetCollisionRec(*crec1, *crec2)
|
||||||
|
v := newRectangleFromPointer(unsafe.Pointer(&ret))
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
|
||||||
// SetShapesTexture - Define default texture used to draw shapes
|
// SetShapesTexture - Define default texture used to draw shapes
|
||||||
func SetShapesTexture(texture Texture2D, source Rectangle) {
|
func SetShapesTexture(texture Texture2D, source Rectangle) {
|
||||||
ctexture := texture.cptr()
|
ctexture := texture.cptr()
|
||||||
|
|
|
@ -62,6 +62,16 @@ func LoadImageRaw(fileName string, width, height int32, format PixelFormat, head
|
||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// LoadImageAnim - Load image sequence from file (frames appended to image.data)
|
||||||
|
func LoadImageAnim(fileName string, frames *int32) *Image {
|
||||||
|
cfileName := C.CString(fileName)
|
||||||
|
defer C.free(unsafe.Pointer(cfileName))
|
||||||
|
cframes := (*C.int)(frames)
|
||||||
|
ret := C.LoadImageAnim(cfileName, cframes)
|
||||||
|
v := newImageFromPointer(unsafe.Pointer(&ret))
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
|
||||||
// LoadTexture - Load an image as texture into GPU memory
|
// LoadTexture - Load an image as texture into GPU memory
|
||||||
func LoadTexture(fileName string) Texture2D {
|
func LoadTexture(fileName string) Texture2D {
|
||||||
cfileName := C.CString(fileName)
|
cfileName := C.CString(fileName)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue