Add new functions
This commit is contained in:
parent
70200c3151
commit
cf628212a1
4 changed files with 121 additions and 21 deletions
|
@ -181,6 +181,13 @@ func SetSoundPitch(sound Sound, pitch float32) {
|
|||
C.SetSoundPitch(*csound, cpitch)
|
||||
}
|
||||
|
||||
// SetSoundPan - Set pan for a sound (0.5 is center)
|
||||
func SetSoundPan(sound Sound, pan float32) {
|
||||
csound := sound.cptr()
|
||||
cpan := (C.float)(pan)
|
||||
C.SetSoundPan(*csound, cpan)
|
||||
}
|
||||
|
||||
// WaveFormat - Convert wave data to desired format
|
||||
func WaveFormat(wave Wave, sampleRate int32, sampleSize int32, channels int32) {
|
||||
cwave := wave.cptr()
|
||||
|
@ -310,6 +317,13 @@ func SetMusicPitch(music Music, pitch float32) {
|
|||
C.SetMusicPitch(cmusic, cpitch)
|
||||
}
|
||||
|
||||
// SetMusicPan - Set pan for a music (0.5 is center)
|
||||
func SetMusicPan(music Music, pan float32) {
|
||||
cmusic := *(*C.Music)(unsafe.Pointer(&music))
|
||||
cpan := (C.float)(pan)
|
||||
C.SetMusicPan(cmusic, cpan)
|
||||
}
|
||||
|
||||
// GetMusicTimeLength - Get music time length (in seconds)
|
||||
func GetMusicTimeLength(music Music) float32 {
|
||||
cmusic := *(*C.Music)(unsafe.Pointer(&music))
|
||||
|
@ -336,7 +350,7 @@ func LoadAudioStream(sampleRate uint32, sampleSize uint32, channels uint32) Audi
|
|||
return v
|
||||
}
|
||||
|
||||
//UnloadAudioStream - Unload audio stream and free memory
|
||||
// UnloadAudioStream - Unload audio stream and free memory
|
||||
func UnloadAudioStream(stream AudioStream) {
|
||||
cstream := stream.cptr()
|
||||
C.UnloadAudioStream(*cstream)
|
||||
|
@ -404,6 +418,13 @@ func SetAudioStreamPitch(stream AudioStream, pitch float32) {
|
|||
C.SetAudioStreamPitch(*cstream, cpitch)
|
||||
}
|
||||
|
||||
// SetAudioStreamPan - Set pan for audio stream (0.5 is centered)
|
||||
func SetAudioStreamPan(stream AudioStream, pan float32) {
|
||||
cstream := stream.cptr()
|
||||
cpan := (C.float)(pan)
|
||||
C.SetAudioStreamPan(*cstream, cpan)
|
||||
}
|
||||
|
||||
// SetAudioStreamBufferSizeDefault - Default size for new audio streams
|
||||
func SetAudioStreamBufferSizeDefault(size int32) {
|
||||
csize := (C.int)(size)
|
||||
|
|
|
@ -193,6 +193,8 @@ const (
|
|||
FlagWindowTransparent = 0x00000010
|
||||
// Set to support HighDPI
|
||||
FlagWindowHighdpi = 0x00002000
|
||||
// Set to support mouse passthrough, only supported when FLAG_WINDOW_UNDECORATED
|
||||
FlagWindowMousePassthrough = 0x00004000
|
||||
// Set to try enabling MSAA 4X
|
||||
FlagMsaa4xHint = 0x00000020
|
||||
// Set to try enabling interlaced video format (for V3D)
|
||||
|
|
|
@ -197,6 +197,18 @@ func SetWindowSize(w, h int) {
|
|||
C.SetWindowSize(cw, ch)
|
||||
}
|
||||
|
||||
// SetWindowOpacity - Set window opacity [0.0f..1.0f] (only PLATFORM_DESKTOP)
|
||||
func SetWindowOpacity(opacity float32) {
|
||||
copacity := (C.float)(opacity)
|
||||
C.SetWindowOpacity(copacity)
|
||||
}
|
||||
|
||||
// GetWindowHandle - Get native window handle
|
||||
func GetWindowHandle() unsafe.Pointer {
|
||||
v := unsafe.Pointer((C.GetWindowHandle()))
|
||||
return v
|
||||
}
|
||||
|
||||
// GetScreenWidth - Get current screen width
|
||||
func GetScreenWidth() int {
|
||||
ret := C.GetScreenWidth()
|
||||
|
@ -211,6 +223,20 @@ func GetScreenHeight() int {
|
|||
return v
|
||||
}
|
||||
|
||||
// GetRenderWidth - Get current render width (it considers HiDPI)
|
||||
func GetRenderWidth() int {
|
||||
ret := C.GetRenderWidth()
|
||||
v := (int)(ret)
|
||||
return v
|
||||
}
|
||||
|
||||
// GetRenderHeight - Get current render height (it considers HiDPI)
|
||||
func GetRenderHeight() int {
|
||||
ret := C.GetRenderHeight()
|
||||
v := (int)(ret)
|
||||
return v
|
||||
}
|
||||
|
||||
// GetMonitorCount - Get number of connected monitors
|
||||
func GetMonitorCount() int {
|
||||
ret := C.GetMonitorCount()
|
||||
|
@ -309,6 +335,16 @@ func GetClipboardText() string {
|
|||
return v
|
||||
}
|
||||
|
||||
// EnableEventWaiting - Enable waiting for events on EndDrawing(), no automatic event polling
|
||||
func EnableEventWaiting() {
|
||||
C.EnableEventWaiting()
|
||||
}
|
||||
|
||||
// DisableEventWaiting - Disable waiting for events on EndDrawing(), automatic events polling
|
||||
func DisableEventWaiting() {
|
||||
C.DisableEventWaiting()
|
||||
}
|
||||
|
||||
// ClearBackground - Sets Background Color
|
||||
func ClearBackground(col color.RGBA) {
|
||||
ccolor := colorCptr(col)
|
||||
|
@ -406,15 +442,6 @@ func GetWorldToScreen(position Vector3, camera Camera) Vector2 {
|
|||
return v
|
||||
}
|
||||
|
||||
// GetWorldToScreen2D - Returns the screen space position for a 2d camera world space position
|
||||
func GetWorldToScreen2D(position Vector2, camera Camera2D) Vector2 {
|
||||
cposition := position.cptr()
|
||||
ccamera := camera.cptr()
|
||||
ret := C.GetWorldToScreen2D(*cposition, *ccamera)
|
||||
v := newVector2FromPointer(unsafe.Pointer(&ret))
|
||||
return v
|
||||
}
|
||||
|
||||
// GetScreenToWorld2D - Returns the world space position for a 2d camera screen space position
|
||||
func GetScreenToWorld2D(position Vector2, camera Camera2D) Vector2 {
|
||||
cposition := position.cptr()
|
||||
|
@ -424,6 +451,26 @@ func GetScreenToWorld2D(position Vector2, camera Camera2D) Vector2 {
|
|||
return v
|
||||
}
|
||||
|
||||
// GetWorldToScreenEx - Get size position for a 3d world space position
|
||||
func GetWorldToScreenEx(position Vector3, camera Camera, width int32, height int32) Vector2 {
|
||||
cposition := position.cptr()
|
||||
ccamera := camera.cptr()
|
||||
cwidth := (C.int)(width)
|
||||
cheight := (C.int)(height)
|
||||
ret := C.GetWorldToScreenEx(*cposition, *ccamera, cwidth, cheight)
|
||||
v := newVector2FromPointer(unsafe.Pointer(&ret))
|
||||
return v
|
||||
}
|
||||
|
||||
// GetWorldToScreen2D - Returns the screen space position for a 2d camera world space position
|
||||
func GetWorldToScreen2D(position Vector2, camera Camera2D) Vector2 {
|
||||
cposition := position.cptr()
|
||||
ccamera := camera.cptr()
|
||||
ret := C.GetWorldToScreen2D(*cposition, *ccamera)
|
||||
v := newVector2FromPointer(unsafe.Pointer(&ret))
|
||||
return v
|
||||
}
|
||||
|
||||
// SetTargetFPS - Set target FPS (maximum)
|
||||
func SetTargetFPS(fps int32) {
|
||||
cfps := (C.int)(fps)
|
||||
|
@ -582,6 +629,13 @@ func GetRandomValue(min, max int32) int32 {
|
|||
return v
|
||||
}
|
||||
|
||||
// OpenURL - Open URL with default system browser (if available)
|
||||
func OpenURL(url string) {
|
||||
curl := C.CString(url)
|
||||
defer C.free(unsafe.Pointer(curl))
|
||||
C.OpenURL(curl)
|
||||
}
|
||||
|
||||
// SetConfigFlags - Setup some window configuration flags
|
||||
func SetConfigFlags(flags uint32) {
|
||||
cflags := (C.uint)(flags)
|
||||
|
@ -724,7 +778,7 @@ func GetGamepadAxisMovement(gamepad, axis int32) float32 {
|
|||
}
|
||||
|
||||
// SetGamepadMappings - Set internal gamepad mappings (SDL_GameControllerDB)
|
||||
func SetGamepadMapping(mappings string) int32 {
|
||||
func SetGamepadMappings(mappings string) int32 {
|
||||
cmappings := C.CString(mappings)
|
||||
defer C.free(unsafe.Pointer(cmappings))
|
||||
ret := C.SetGamepadMappings(cmappings)
|
||||
|
@ -813,13 +867,26 @@ func SetMouseScale(scaleX, scaleY float32) {
|
|||
C.SetMouseScale(cscaleX, cscaleY)
|
||||
}
|
||||
|
||||
// GetMouseWheelMove - Returns mouse wheel movement Y
|
||||
func GetMouseWheelMove() int32 {
|
||||
// GetMouseWheelMove - Get mouse wheel movement for X or Y, whichever is larger
|
||||
func GetMouseWheelMove() float32 {
|
||||
ret := C.GetMouseWheelMove()
|
||||
v := (int32)(ret)
|
||||
v := (float32)(ret)
|
||||
return v
|
||||
}
|
||||
|
||||
// GetMouseWheelMoveV - Get mouse wheel movement for both X and Y
|
||||
func GetMouseWheelMoveV() Vector2 {
|
||||
ret := C.GetMouseWheelMoveV()
|
||||
v := newVector2FromPointer(unsafe.Pointer(&ret))
|
||||
return v
|
||||
}
|
||||
|
||||
// SetMouseCursor - Set mouse cursor
|
||||
func SetMouseCursor(cursor int32) {
|
||||
ccursor := (C.int)(cursor)
|
||||
C.SetMouseCursor(ccursor)
|
||||
}
|
||||
|
||||
// GetTouchX - Returns touch position X for touch point 0 (relative to screen size)
|
||||
func GetTouchX() int32 {
|
||||
ret := C.GetTouchX()
|
||||
|
|
|
@ -622,15 +622,14 @@ func DrawTextureRec(texture Texture2D, sourceRec Rectangle, position Vector2, ti
|
|||
C.DrawTextureRec(*ctexture, *csourceRec, *cposition, *ctint)
|
||||
}
|
||||
|
||||
// DrawTexturePro - Draw a part of a texture defined by a rectangle with 'pro' parameters
|
||||
func DrawTexturePro(texture Texture2D, sourceRec, destRec Rectangle, origin Vector2, rotation float32, tint color.RGBA) {
|
||||
// DrawTextureQuad - Draw texture quad with tiling and offset parameters
|
||||
func DrawTextureQuad(texture Texture2D, tiling, offset Vector2, rectangle Rectangle, tint color.RGBA) {
|
||||
ctexture := texture.cptr()
|
||||
csourceRec := sourceRec.cptr()
|
||||
cdestRec := destRec.cptr()
|
||||
corigin := origin.cptr()
|
||||
crotation := (C.float)(rotation)
|
||||
ctiling := tiling.cptr()
|
||||
coffset := offset.cptr()
|
||||
crectangle := rectangle.cptr()
|
||||
ctint := colorCptr(tint)
|
||||
C.DrawTexturePro(*ctexture, *csourceRec, *cdestRec, *corigin, crotation, *ctint)
|
||||
C.DrawTextureQuad(*ctexture, *ctiling, *coffset, *crectangle, *ctint)
|
||||
}
|
||||
|
||||
// DrawTextureTiled - Draw part of a texture (defined by a rectangle) with rotation and scale tiled into dest
|
||||
|
@ -644,3 +643,14 @@ func DrawTextureTiled(texture Texture2D, sourceRec, destRec Rectangle, origin Ve
|
|||
ctint := colorCptr(tint)
|
||||
C.DrawTextureTiled(*ctexture, *csourceRec, *cdestRec, *corigin, crotation, cscale, *ctint)
|
||||
}
|
||||
|
||||
// DrawTexturePro - Draw a part of a texture defined by a rectangle with 'pro' parameters
|
||||
func DrawTexturePro(texture Texture2D, sourceRec, destRec Rectangle, origin Vector2, rotation float32, tint color.RGBA) {
|
||||
ctexture := texture.cptr()
|
||||
csourceRec := sourceRec.cptr()
|
||||
cdestRec := destRec.cptr()
|
||||
corigin := origin.cptr()
|
||||
crotation := (C.float)(rotation)
|
||||
ctint := colorCptr(tint)
|
||||
C.DrawTexturePro(*ctexture, *csourceRec, *cdestRec, *corigin, crotation, *ctint)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue