This commit is contained in:
Milan Nikolic 2017-02-21 15:06:11 +01:00
parent 5d5a0e708f
commit 29546140b9
19 changed files with 432 additions and 432 deletions

View file

@ -368,22 +368,22 @@ var propertyName = []string{
"TEXTBOX_TEXT_FONTSIZE", "TEXTBOX_TEXT_FONTSIZE",
} }
// Get background color // BackgroundColor - Get background color
func BackgroundColor() raylib.Color { func BackgroundColor() raylib.Color {
return raylib.GetColor(int32(style[GlobalBackgroundColor])) return raylib.GetColor(int32(style[GlobalBackgroundColor]))
} }
// Get lines color // LinesColor - Get lines color
func LinesColor() raylib.Color { func LinesColor() raylib.Color {
return raylib.GetColor(int32(style[GlobalLinesColor])) return raylib.GetColor(int32(style[GlobalLinesColor]))
} }
// Label element, show text // Label - Label element, show text
func Label(bounds raylib.Rectangle, text string) { func Label(bounds raylib.Rectangle, text string) {
LabelEx(bounds, text, raylib.GetColor(int32(style[LabelTextColor])), raylib.NewColor(0, 0, 0, 0), raylib.NewColor(0, 0, 0, 0)) LabelEx(bounds, text, raylib.GetColor(int32(style[LabelTextColor])), raylib.NewColor(0, 0, 0, 0), raylib.NewColor(0, 0, 0, 0))
} }
// Label element extended, configurable colors // LabelEx - Label element extended, configurable colors
func LabelEx(bounds raylib.Rectangle, text string, textColor, border, inner raylib.Color) { func LabelEx(bounds raylib.Rectangle, text string, textColor, border, inner raylib.Color) {
// Update control // Update control
textWidth := raylib.MeasureText(text, int32(style[GlobalTextFontsize])) textWidth := raylib.MeasureText(text, int32(style[GlobalTextFontsize]))
@ -402,7 +402,7 @@ func LabelEx(bounds raylib.Rectangle, text string, textColor, border, inner rayl
raylib.DrawText(text, bounds.X+((bounds.Width/2)-(textWidth/2)), bounds.Y+((bounds.Height/2)-(int32(style[GlobalTextFontsize])/2)), int32(style[GlobalTextFontsize]), textColor) raylib.DrawText(text, bounds.X+((bounds.Width/2)-(textWidth/2)), bounds.Y+((bounds.Height/2)-(int32(style[GlobalTextFontsize])/2)), int32(style[GlobalTextFontsize]), textColor)
} }
// Button element, returns true when clicked // Button - Button element, returns true when clicked
func Button(bounds raylib.Rectangle, text string) bool { func Button(bounds raylib.Rectangle, text string) bool {
buttonState := ButtonDefault buttonState := ButtonDefault
mousePoint := raylib.GetMousePosition() mousePoint := raylib.GetMousePosition()
@ -465,7 +465,7 @@ func Button(bounds raylib.Rectangle, text string) bool {
return false return false
} }
// Toggle Button element, returns true when active // ToggleButton - Toggle Button element, returns true when active
func ToggleButton(bounds raylib.Rectangle, text string, toggle bool) bool { func ToggleButton(bounds raylib.Rectangle, text string, toggle bool) bool {
toggleState := ToggleUnactive toggleState := ToggleUnactive
toggleButton := bounds toggleButton := bounds
@ -533,7 +533,7 @@ func ToggleButton(bounds raylib.Rectangle, text string, toggle bool) bool {
return toggle return toggle
} }
// Toggle Group element, returns toggled button index // ToggleGroup - Toggle Group element, returns toggled button index
func ToggleGroup(bounds raylib.Rectangle, toggleText []string, toggleActive int) int { func ToggleGroup(bounds raylib.Rectangle, toggleText []string, toggleActive int) int {
for i := 0; i < len(toggleText); i++ { for i := 0; i < len(toggleText); i++ {
if i == toggleActive { if i == toggleActive {
@ -546,7 +546,7 @@ func ToggleGroup(bounds raylib.Rectangle, toggleText []string, toggleActive int)
return toggleActive return toggleActive
} }
// Combo Box element, returns selected item index // ComboBox - Combo Box element, returns selected item index
func ComboBox(bounds raylib.Rectangle, comboText []string, comboActive int) int { func ComboBox(bounds raylib.Rectangle, comboText []string, comboActive int) int {
comboBoxState := ComboboxUnactive comboBoxState := ComboboxUnactive
comboBoxButton := bounds comboBoxButton := bounds
@ -637,7 +637,7 @@ func ComboBox(bounds raylib.Rectangle, comboText []string, comboActive int) int
return comboActive return comboActive
} }
// Check Box element, returns true when active // CheckBox - Check Box element, returns true when active
func CheckBox(bounds raylib.Rectangle, text string, checked bool) bool { func CheckBox(bounds raylib.Rectangle, text string, checked bool) bool {
checkBoxState := CheckboxStatus checkBoxState := CheckboxStatus
mousePoint := raylib.GetMousePosition() mousePoint := raylib.GetMousePosition()
@ -683,7 +683,7 @@ func CheckBox(bounds raylib.Rectangle, text string, checked bool) bool {
return checked return checked
} }
// Slider element, returns selected value // Slider - Slider element, returns selected value
func Slider(bounds raylib.Rectangle, value, minValue, maxValue float32) float32 { func Slider(bounds raylib.Rectangle, value, minValue, maxValue float32) float32 {
sliderPos := float32(0) sliderPos := float32(0)
sliderState := SliderDefault sliderState := SliderDefault
@ -755,7 +755,7 @@ func Slider(bounds raylib.Rectangle, value, minValue, maxValue float32) float32
return minValue + (maxValue-minValue)*sliderPos return minValue + (maxValue-minValue)*sliderPos
} }
// Slider Bar element, returns selected value // SliderBar - Slider Bar element, returns selected value
func SliderBar(bounds raylib.Rectangle, value, minValue, maxValue float32) float32 { func SliderBar(bounds raylib.Rectangle, value, minValue, maxValue float32) float32 {
sliderState := SliderDefault sliderState := SliderDefault
mousePoint := raylib.GetMousePosition() mousePoint := raylib.GetMousePosition()
@ -826,7 +826,7 @@ func SliderBar(bounds raylib.Rectangle, value, minValue, maxValue float32) float
return fixedValue + minValue return fixedValue + minValue
} }
// Progress Bar element, shows current progress value // ProgressBar - Progress Bar element, shows current progress value
func ProgressBar(bounds raylib.Rectangle, value float32) { func ProgressBar(bounds raylib.Rectangle, value float32) {
if value > 1.0 { if value > 1.0 {
value = 1.0 value = 1.0
@ -843,7 +843,7 @@ func ProgressBar(bounds raylib.Rectangle, value float32) {
raylib.DrawRectangleRec(progressValue, raylib.GetColor(int32(style[ProgressbarProgressColor]))) raylib.DrawRectangleRec(progressValue, raylib.GetColor(int32(style[ProgressbarProgressColor])))
} }
// Spinner element, returns selected value // Spinner - Spinner element, returns selected value
func Spinner(bounds raylib.Rectangle, value, minValue, maxValue int) int { func Spinner(bounds raylib.Rectangle, value, minValue, maxValue int) int {
spinnerState := SpinnerDefault spinnerState := SpinnerDefault
labelBoxBound := raylib.NewRectangle(bounds.X+bounds.Width/4+1, bounds.Y, bounds.Width/2, bounds.Height) labelBoxBound := raylib.NewRectangle(bounds.X+bounds.Width/4+1, bounds.Y, bounds.Width/2, bounds.Height)
@ -1006,7 +1006,7 @@ func Spinner(bounds raylib.Rectangle, value, minValue, maxValue int) int {
return value return value
} }
// Text Box element, returns input text // TextBox - Text Box element, returns input text
func TextBox(bounds raylib.Rectangle, text string) string { func TextBox(bounds raylib.Rectangle, text string) string {
keyBackspaceText := int32(259) // GLFW BACKSPACE: 3 + 256 keyBackspaceText := int32(259) // GLFW BACKSPACE: 3 + 256
@ -1056,7 +1056,7 @@ func TextBox(bounds raylib.Rectangle, text string) string {
return text return text
} }
// Save GUI style file // SaveGuiStyle - Save GUI style file
func SaveGuiStyle(fileName string) { func SaveGuiStyle(fileName string) {
var styleFile string var styleFile string
for i := 0; i < len(propertyName); i++ { for i := 0; i < len(propertyName); i++ {
@ -1066,7 +1066,7 @@ func SaveGuiStyle(fileName string) {
ioutil.WriteFile(fileName, []byte(styleFile), 0644) ioutil.WriteFile(fileName, []byte(styleFile), 0644)
} }
// Load GUI style file // LoadGuiStyle - Load GUI style file
func LoadGuiStyle(fileName string) { func LoadGuiStyle(fileName string) {
file, err := raylib.OpenAsset(fileName) file, err := raylib.OpenAsset(fileName)
if err != nil { if err != nil {
@ -1105,7 +1105,7 @@ func LoadGuiStyle(fileName string) {
} }
} }
// Set one style property // SetStyleProperty - Set one style property
func SetStyleProperty(guiProperty Property, value int64) { func SetStyleProperty(guiProperty Property, value int64) {
numColorSamples := 10 numColorSamples := 10
@ -1216,7 +1216,7 @@ func SetStyleProperty(guiProperty Property, value int64) {
} }
} }
// Get one style property // GetStyleProperty - Get one style property
func GetStyleProperty(guiProperty Property) int64 { func GetStyleProperty(guiProperty Property) int64 {
return style[int(guiProperty)] return style[int(guiProperty)]
} }

View file

@ -26,12 +26,12 @@ func (w *Wave) cptr() *C.Wave {
return (*C.Wave)(unsafe.Pointer(w)) return (*C.Wave)(unsafe.Pointer(w))
} }
// Returns new Wave // NewWave - Returns new Wave
func NewWave(sampleCount, sampleRate, sampleSize, channels uint32, data unsafe.Pointer) Wave { func NewWave(sampleCount, sampleRate, sampleSize, channels uint32, data unsafe.Pointer) Wave {
return Wave{sampleCount, sampleRate, sampleSize, channels, data} return Wave{sampleCount, sampleRate, sampleSize, channels, data}
} }
// Returns new Wave from pointer // NewWaveFromPointer - Returns new Wave from pointer
func NewWaveFromPointer(ptr unsafe.Pointer) Wave { func NewWaveFromPointer(ptr unsafe.Pointer) Wave {
return *(*Wave)(ptr) return *(*Wave)(ptr)
} }
@ -50,12 +50,12 @@ func (s *Sound) cptr() *C.Sound {
return (*C.Sound)(unsafe.Pointer(s)) return (*C.Sound)(unsafe.Pointer(s))
} }
// Returns new Sound // NewSound - Returns new Sound
func NewSound(source, buffer uint32, format int32) Sound { func NewSound(source, buffer uint32, format int32) Sound {
return Sound{source, buffer, format} return Sound{source, buffer, format}
} }
// Returns new Sound from pointer // NewSoundFromPointer - Returns new Sound from pointer
func NewSoundFromPointer(ptr unsafe.Pointer) Sound { func NewSoundFromPointer(ptr unsafe.Pointer) Sound {
return *(*Sound)(ptr) return *(*Sound)(ptr)
} }
@ -85,40 +85,40 @@ func (a *AudioStream) cptr() *C.AudioStream {
return (*C.AudioStream)(unsafe.Pointer(a)) return (*C.AudioStream)(unsafe.Pointer(a))
} }
// Returns new AudioStream // NewAudioStream - Returns new AudioStream
func NewAudioStream(sampleRate, sampleSize, channels uint32, format int32, source uint32, buffers [2]uint32) AudioStream { func NewAudioStream(sampleRate, sampleSize, channels uint32, format int32, source uint32, buffers [2]uint32) AudioStream {
return AudioStream{sampleRate, sampleSize, channels, format, source, buffers} return AudioStream{sampleRate, sampleSize, channels, format, source, buffers}
} }
// Returns new AudioStream from pointer // NewAudioStreamFromPointer - Returns new AudioStream from pointer
func NewAudioStreamFromPointer(ptr unsafe.Pointer) AudioStream { func NewAudioStreamFromPointer(ptr unsafe.Pointer) AudioStream {
return *(*AudioStream)(ptr) return *(*AudioStream)(ptr)
} }
// Initialize audio device and context // InitAudioDevice - Initialize audio device and context
func InitAudioDevice() { func InitAudioDevice() {
C.InitAudioDevice() C.InitAudioDevice()
} }
// Close the audio device and context // CloseAudioDevice - Close the audio device and context
func CloseAudioDevice() { func CloseAudioDevice() {
C.CloseAudioDevice() C.CloseAudioDevice()
} }
// Check if audio device has been initialized successfully // IsAudioDeviceReady - Check if audio device has been initialized successfully
func IsAudioDeviceReady() bool { func IsAudioDeviceReady() bool {
ret := C.IsAudioDeviceReady() ret := C.IsAudioDeviceReady()
v := bool(int(ret) == 1) v := bool(int(ret) == 1)
return v return v
} }
// Set master volume (listener) // SetMasterVolume - Set master volume (listener)
func SetMasterVolume(volume float32) { func SetMasterVolume(volume float32) {
cvolume := (C.float)(volume) cvolume := (C.float)(volume)
C.SetMasterVolume(cvolume) C.SetMasterVolume(cvolume)
} }
// Load wave data from file into RAM // LoadWave - Load wave data from file into RAM
func LoadWave(fileName string) Wave { func LoadWave(fileName string) Wave {
cfileName := C.CString(fileName) cfileName := C.CString(fileName)
defer C.free(unsafe.Pointer(cfileName)) defer C.free(unsafe.Pointer(cfileName))
@ -127,7 +127,7 @@ func LoadWave(fileName string) Wave {
return v return v
} }
// Load wave data from float array data (32bit) // LoadWaveEx - Load wave data from float array data (32bit)
func LoadWaveEx(data unsafe.Pointer, sampleCount int32, sampleRate int32, sampleSize int32, channels int32) Wave { func LoadWaveEx(data unsafe.Pointer, sampleCount int32, sampleRate int32, sampleSize int32, channels int32) Wave {
csampleCount := (C.int)(sampleCount) csampleCount := (C.int)(sampleCount)
csampleRate := (C.int)(sampleRate) csampleRate := (C.int)(sampleRate)
@ -138,7 +138,7 @@ func LoadWaveEx(data unsafe.Pointer, sampleCount int32, sampleRate int32, sample
return v return v
} }
// Load sound to memory // LoadSound - Load sound to memory
func LoadSound(fileName string) Sound { func LoadSound(fileName string) Sound {
cfileName := C.CString(fileName) cfileName := C.CString(fileName)
defer C.free(unsafe.Pointer(cfileName)) defer C.free(unsafe.Pointer(cfileName))
@ -147,7 +147,7 @@ func LoadSound(fileName string) Sound {
return v return v
} }
// Load sound to memory from wave data // LoadSoundFromWave - Load sound to memory from wave data
func LoadSoundFromWave(wave Wave) Sound { func LoadSoundFromWave(wave Wave) Sound {
cwave := wave.cptr() cwave := wave.cptr()
ret := C.LoadSoundFromWave(*cwave) ret := C.LoadSoundFromWave(*cwave)
@ -155,7 +155,7 @@ func LoadSoundFromWave(wave Wave) Sound {
return v return v
} }
// Update sound buffer with new data // UpdateSound - Update sound buffer with new data
func UpdateSound(sound Sound, data unsafe.Pointer, samplesCount int32) { func UpdateSound(sound Sound, data unsafe.Pointer, samplesCount int32) {
csound := sound.cptr() csound := sound.cptr()
cdata := (unsafe.Pointer)(unsafe.Pointer(data)) cdata := (unsafe.Pointer)(unsafe.Pointer(data))
@ -163,43 +163,43 @@ func UpdateSound(sound Sound, data unsafe.Pointer, samplesCount int32) {
C.UpdateSound(*csound, cdata, csamplesCount) C.UpdateSound(*csound, cdata, csamplesCount)
} }
// Unload wave data // UnloadWave - Unload wave data
func UnloadWave(wave Wave) { func UnloadWave(wave Wave) {
cwave := wave.cptr() cwave := wave.cptr()
C.UnloadWave(*cwave) C.UnloadWave(*cwave)
} }
// Unload sound // UnloadSound - Unload sound
func UnloadSound(sound Sound) { func UnloadSound(sound Sound) {
csound := sound.cptr() csound := sound.cptr()
C.UnloadSound(*csound) C.UnloadSound(*csound)
} }
// Play a sound // PlaySound - Play a sound
func PlaySound(sound Sound) { func PlaySound(sound Sound) {
csound := sound.cptr() csound := sound.cptr()
C.PlaySound(*csound) C.PlaySound(*csound)
} }
// Pause a sound // PauseSound - Pause a sound
func PauseSound(sound Sound) { func PauseSound(sound Sound) {
csound := sound.cptr() csound := sound.cptr()
C.PauseSound(*csound) C.PauseSound(*csound)
} }
// Resume a paused sound // ResumeSound - Resume a paused sound
func ResumeSound(sound Sound) { func ResumeSound(sound Sound) {
csound := sound.cptr() csound := sound.cptr()
C.ResumeSound(*csound) C.ResumeSound(*csound)
} }
// Stop playing a sound // StopSound - Stop playing a sound
func StopSound(sound Sound) { func StopSound(sound Sound) {
csound := sound.cptr() csound := sound.cptr()
C.StopSound(*csound) C.StopSound(*csound)
} }
// Check if a sound is currently playing // IsSoundPlaying - Check if a sound is currently playing
func IsSoundPlaying(sound Sound) bool { func IsSoundPlaying(sound Sound) bool {
csound := sound.cptr() csound := sound.cptr()
ret := C.IsSoundPlaying(*csound) ret := C.IsSoundPlaying(*csound)
@ -207,21 +207,21 @@ func IsSoundPlaying(sound Sound) bool {
return v return v
} }
// Set volume for a sound (1.0 is max level) // SetSoundVolume - Set volume for a sound (1.0 is max level)
func SetSoundVolume(sound Sound, volume float32) { func SetSoundVolume(sound Sound, volume float32) {
csound := sound.cptr() csound := sound.cptr()
cvolume := (C.float)(volume) cvolume := (C.float)(volume)
C.SetSoundVolume(*csound, cvolume) C.SetSoundVolume(*csound, cvolume)
} }
// Set pitch for a sound (1.0 is base level) // SetSoundPitch - Set pitch for a sound (1.0 is base level)
func SetSoundPitch(sound Sound, pitch float32) { func SetSoundPitch(sound Sound, pitch float32) {
csound := sound.cptr() csound := sound.cptr()
cpitch := (C.float)(pitch) cpitch := (C.float)(pitch)
C.SetSoundPitch(*csound, cpitch) C.SetSoundPitch(*csound, cpitch)
} }
// Convert wave data to desired format // WaveFormat - Convert wave data to desired format
func WaveFormat(wave Wave, sampleRate int32, sampleSize int32, channels int32) { func WaveFormat(wave Wave, sampleRate int32, sampleSize int32, channels int32) {
cwave := wave.cptr() cwave := wave.cptr()
csampleRate := (C.int)(sampleRate) csampleRate := (C.int)(sampleRate)
@ -230,7 +230,7 @@ func WaveFormat(wave Wave, sampleRate int32, sampleSize int32, channels int32) {
C.WaveFormat(cwave, csampleRate, csampleSize, cchannels) C.WaveFormat(cwave, csampleRate, csampleSize, cchannels)
} }
// Copy a wave to a new wave // WaveCopy - Copy a wave to a new wave
func WaveCopy(wave Wave) Wave { func WaveCopy(wave Wave) Wave {
cwave := wave.cptr() cwave := wave.cptr()
ret := C.WaveCopy(*cwave) ret := C.WaveCopy(*cwave)
@ -238,7 +238,7 @@ func WaveCopy(wave Wave) Wave {
return v return v
} }
// Crop a wave to defined samples range // WaveCrop - Crop a wave to defined samples range
func WaveCrop(wave Wave, initSample int32, finalSample int32) { func WaveCrop(wave Wave, initSample int32, finalSample int32) {
cwave := wave.cptr() cwave := wave.cptr()
cinitSample := (C.int)(initSample) cinitSample := (C.int)(initSample)
@ -246,7 +246,7 @@ func WaveCrop(wave Wave, initSample int32, finalSample int32) {
C.WaveCrop(cwave, cinitSample, cfinalSample) C.WaveCrop(cwave, cinitSample, cfinalSample)
} }
// Get samples data from wave as a floats array // GetWaveData - Get samples data from wave as a floats array
func GetWaveData(wave Wave) []float32 { func GetWaveData(wave Wave) []float32 {
var data []float32 var data []float32
cwave := wave.cptr() cwave := wave.cptr()
@ -260,7 +260,7 @@ func GetWaveData(wave Wave) []float32 {
return data return data
} }
// Load music stream from file // LoadMusicStream - Load music stream from file
func LoadMusicStream(fileName string) Music { func LoadMusicStream(fileName string) Music {
cfileName := C.CString(fileName) cfileName := C.CString(fileName)
defer C.free(unsafe.Pointer(cfileName)) defer C.free(unsafe.Pointer(cfileName))
@ -269,43 +269,43 @@ func LoadMusicStream(fileName string) Music {
return v return v
} }
// Unload music stream // UnloadMusicStream - Unload music stream
func UnloadMusicStream(music Music) { func UnloadMusicStream(music Music) {
cmusic := *(*C.Music)(unsafe.Pointer(&music)) cmusic := *(*C.Music)(unsafe.Pointer(&music))
C.UnloadMusicStream(cmusic) C.UnloadMusicStream(cmusic)
} }
// Start music playing // PlayMusicStream - Start music playing
func PlayMusicStream(music Music) { func PlayMusicStream(music Music) {
cmusic := *(*C.Music)(unsafe.Pointer(&music)) cmusic := *(*C.Music)(unsafe.Pointer(&music))
C.PlayMusicStream(cmusic) C.PlayMusicStream(cmusic)
} }
// Updates buffers for music streaming // UpdateMusicStream - Updates buffers for music streaming
func UpdateMusicStream(music Music) { func UpdateMusicStream(music Music) {
cmusic := *(*C.Music)(unsafe.Pointer(&music)) cmusic := *(*C.Music)(unsafe.Pointer(&music))
C.UpdateMusicStream(cmusic) C.UpdateMusicStream(cmusic)
} }
// Stop music playing // StopMusicStream - Stop music playing
func StopMusicStream(music Music) { func StopMusicStream(music Music) {
cmusic := *(*C.Music)(unsafe.Pointer(&music)) cmusic := *(*C.Music)(unsafe.Pointer(&music))
C.StopMusicStream(cmusic) C.StopMusicStream(cmusic)
} }
// Pause music playing // PauseMusicStream - Pause music playing
func PauseMusicStream(music Music) { func PauseMusicStream(music Music) {
cmusic := *(*C.Music)(unsafe.Pointer(&music)) cmusic := *(*C.Music)(unsafe.Pointer(&music))
C.PauseMusicStream(cmusic) C.PauseMusicStream(cmusic)
} }
// Resume playing paused music // ResumeMusicStream - Resume playing paused music
func ResumeMusicStream(music Music) { func ResumeMusicStream(music Music) {
cmusic := *(*C.Music)(unsafe.Pointer(&music)) cmusic := *(*C.Music)(unsafe.Pointer(&music))
C.ResumeMusicStream(cmusic) C.ResumeMusicStream(cmusic)
} }
// Check if music is playing // IsMusicPlaying - Check if music is playing
func IsMusicPlaying(music Music) bool { func IsMusicPlaying(music Music) bool {
cmusic := *(*C.Music)(unsafe.Pointer(&music)) cmusic := *(*C.Music)(unsafe.Pointer(&music))
ret := C.IsMusicPlaying(cmusic) ret := C.IsMusicPlaying(cmusic)
@ -313,14 +313,14 @@ func IsMusicPlaying(music Music) bool {
return v return v
} }
// Set volume for music (1.0 is max level) // SetMusicVolume - Set volume for music (1.0 is max level)
func SetMusicVolume(music Music, volume float32) { func SetMusicVolume(music Music, volume float32) {
cmusic := *(*C.Music)(unsafe.Pointer(&music)) cmusic := *(*C.Music)(unsafe.Pointer(&music))
cvolume := (C.float)(volume) cvolume := (C.float)(volume)
C.SetMusicVolume(cmusic, cvolume) C.SetMusicVolume(cmusic, cvolume)
} }
// Set pitch for a music (1.0 is base level) // SetMusicPitch - Set pitch for a music (1.0 is base level)
func SetMusicPitch(music Music, pitch float32) { func SetMusicPitch(music Music, pitch float32) {
cmusic := *(*C.Music)(unsafe.Pointer(&music)) cmusic := *(*C.Music)(unsafe.Pointer(&music))
cpitch := (C.float)(pitch) cpitch := (C.float)(pitch)
@ -328,14 +328,14 @@ func SetMusicPitch(music Music, pitch float32) {
} }
// Set music loop count (loop repeats) // Set music loop count (loop repeats)
// NOTE: If set to -1, means infinite loop // SetMusicLoopCount - NOTE: If set to -1, means infinite loop
func SetMusicLoopCount(music Music, count float32) { func SetMusicLoopCount(music Music, count float32) {
cmusic := *(*C.Music)(unsafe.Pointer(&music)) cmusic := *(*C.Music)(unsafe.Pointer(&music))
ccount := (C.float)(count) ccount := (C.float)(count)
C.SetMusicLoopCount(cmusic, ccount) C.SetMusicLoopCount(cmusic, ccount)
} }
// Get music time length (in seconds) // GetMusicTimeLength - Get music time length (in seconds)
func GetMusicTimeLength(music Music) float32 { func GetMusicTimeLength(music Music) float32 {
cmusic := *(*C.Music)(unsafe.Pointer(&music)) cmusic := *(*C.Music)(unsafe.Pointer(&music))
ret := C.GetMusicTimeLength(cmusic) ret := C.GetMusicTimeLength(cmusic)
@ -343,7 +343,7 @@ func GetMusicTimeLength(music Music) float32 {
return v return v
} }
// Get current music time played (in seconds) // GetMusicTimePlayed - Get current music time played (in seconds)
func GetMusicTimePlayed(music Music) float32 { func GetMusicTimePlayed(music Music) float32 {
cmusic := *(*C.Music)(unsafe.Pointer(&music)) cmusic := *(*C.Music)(unsafe.Pointer(&music))
ret := C.GetMusicTimePlayed(cmusic) ret := C.GetMusicTimePlayed(cmusic)
@ -351,7 +351,7 @@ func GetMusicTimePlayed(music Music) float32 {
return v return v
} }
// Init audio stream (to stream raw audio pcm data) // InitAudioStream - Init audio stream (to stream raw audio pcm data)
func InitAudioStream(sampleRate uint32, sampleSize uint32, channels uint32) AudioStream { func InitAudioStream(sampleRate uint32, sampleSize uint32, channels uint32) AudioStream {
csampleRate := (C.uint)(sampleRate) csampleRate := (C.uint)(sampleRate)
csampleSize := (C.uint)(sampleSize) csampleSize := (C.uint)(sampleSize)
@ -361,7 +361,7 @@ func InitAudioStream(sampleRate uint32, sampleSize uint32, channels uint32) Audi
return v return v
} }
// Update audio stream buffers with data // UpdateAudioStream - Update audio stream buffers with data
func UpdateAudioStream(stream AudioStream, data unsafe.Pointer, samplesCount int32) { func UpdateAudioStream(stream AudioStream, data unsafe.Pointer, samplesCount int32) {
cstream := stream.cptr() cstream := stream.cptr()
cdata := (unsafe.Pointer)(unsafe.Pointer(data)) cdata := (unsafe.Pointer)(unsafe.Pointer(data))
@ -369,13 +369,13 @@ func UpdateAudioStream(stream AudioStream, data unsafe.Pointer, samplesCount int
C.UpdateAudioStream(*cstream, cdata, csamplesCount) C.UpdateAudioStream(*cstream, cdata, csamplesCount)
} }
// Close audio stream and free memory // CloseAudioStream - Close audio stream and free memory
func CloseAudioStream(stream AudioStream) { func CloseAudioStream(stream AudioStream) {
cstream := stream.cptr() cstream := stream.cptr()
C.CloseAudioStream(*cstream) C.CloseAudioStream(*cstream)
} }
// Check if any audio stream buffers requires refill // IsAudioBufferProcessed - Check if any audio stream buffers requires refill
func IsAudioBufferProcessed(stream AudioStream) bool { func IsAudioBufferProcessed(stream AudioStream) bool {
cstream := stream.cptr() cstream := stream.cptr()
ret := C.IsAudioBufferProcessed(*cstream) ret := C.IsAudioBufferProcessed(*cstream)
@ -383,25 +383,25 @@ func IsAudioBufferProcessed(stream AudioStream) bool {
return v return v
} }
// Play audio stream // PlayAudioStream - Play audio stream
func PlayAudioStream(stream AudioStream) { func PlayAudioStream(stream AudioStream) {
cstream := stream.cptr() cstream := stream.cptr()
C.PlayAudioStream(*cstream) C.PlayAudioStream(*cstream)
} }
// Pause audio stream // PauseAudioStream - Pause audio stream
func PauseAudioStream(stream AudioStream) { func PauseAudioStream(stream AudioStream) {
cstream := stream.cptr() cstream := stream.cptr()
C.PauseAudioStream(*cstream) C.PauseAudioStream(*cstream)
} }
// Resume audio stream // ResumeAudioStream - Resume audio stream
func ResumeAudioStream(stream AudioStream) { func ResumeAudioStream(stream AudioStream) {
cstream := stream.cptr() cstream := stream.cptr()
C.ResumeAudioStream(*cstream) C.ResumeAudioStream(*cstream)
} }
// Stop audio stream // StopAudioStream - Stop audio stream
func StopAudioStream(stream AudioStream) { func StopAudioStream(stream AudioStream) {
cstream := stream.cptr() cstream := stream.cptr()
C.StopAudioStream(*cstream) C.StopAudioStream(*cstream)

View file

@ -24,12 +24,12 @@ func (c *Camera) cptr() *C.Camera {
return (*C.Camera)(unsafe.Pointer(c)) return (*C.Camera)(unsafe.Pointer(c))
} }
// Returns new Camera // NewCamera - Returns new Camera
func NewCamera(pos, target, up Vector3, fovy float32) Camera { func NewCamera(pos, target, up Vector3, fovy float32) Camera {
return Camera{pos, target, up, fovy} return Camera{pos, target, up, fovy}
} }
// Returns new Camera from pointer // NewCameraFromPointer - Returns new Camera from pointer
func NewCameraFromPointer(ptr unsafe.Pointer) Camera { func NewCameraFromPointer(ptr unsafe.Pointer) Camera {
return *(*Camera)(ptr) return *(*Camera)(ptr)
} }
@ -50,12 +50,12 @@ func (c *Camera2D) cptr() *C.Camera2D {
return (*C.Camera2D)(unsafe.Pointer(c)) return (*C.Camera2D)(unsafe.Pointer(c))
} }
// Returns new Camera2D // NewCamera2D - Returns new Camera2D
func NewCamera2D(offset, target Vector2, rotation, zoom float32) Camera2D { func NewCamera2D(offset, target Vector2, rotation, zoom float32) Camera2D {
return Camera2D{offset, target, rotation, zoom} return Camera2D{offset, target, rotation, zoom}
} }
// Returns new Camera2D from pointer // NewCamera2DFromPointer - Returns new Camera2D from pointer
func NewCamera2DFromPointer(ptr unsafe.Pointer) Camera2D { func NewCamera2DFromPointer(ptr unsafe.Pointer) Camera2D {
return *(*Camera2D)(ptr) return *(*Camera2D)(ptr)
} }
@ -72,38 +72,38 @@ const (
CameraThirdPerson CameraMode = C.CAMERA_THIRD_PERSON CameraThirdPerson CameraMode = C.CAMERA_THIRD_PERSON
) )
// Set camera mode (multiple camera modes available) // SetCameraMode - Set camera mode (multiple camera modes available)
func SetCameraMode(camera Camera, mode CameraMode) { func SetCameraMode(camera Camera, mode CameraMode) {
ccamera := camera.cptr() ccamera := camera.cptr()
cmode := (C.int)(mode) cmode := (C.int)(mode)
C.SetCameraMode(*ccamera, cmode) C.SetCameraMode(*ccamera, cmode)
} }
// Update camera position for selected mode // UpdateCamera - Update camera position for selected mode
func UpdateCamera(camera *Camera) { func UpdateCamera(camera *Camera) {
ccamera := camera.cptr() ccamera := camera.cptr()
C.UpdateCamera(ccamera) C.UpdateCamera(ccamera)
} }
// Set camera pan key to combine with mouse movement (free camera) // SetCameraPanControl - Set camera pan key to combine with mouse movement (free camera)
func SetCameraPanControl(panKey int32) { func SetCameraPanControl(panKey int32) {
cpanKey := (C.int)(panKey) cpanKey := (C.int)(panKey)
C.SetCameraPanControl(cpanKey) C.SetCameraPanControl(cpanKey)
} }
// Set camera alt key to combine with mouse movement (free camera) // SetCameraAltControl - Set camera alt key to combine with mouse movement (free camera)
func SetCameraAltControl(altKey int32) { func SetCameraAltControl(altKey int32) {
caltKey := (C.int)(altKey) caltKey := (C.int)(altKey)
C.SetCameraAltControl(caltKey) C.SetCameraAltControl(caltKey)
} }
// Set camera smooth zoom key to combine with mouse (free camera) // SetCameraSmoothZoomControl - Set camera smooth zoom key to combine with mouse (free camera)
func SetCameraSmoothZoomControl(szKey int32) { func SetCameraSmoothZoomControl(szKey int32) {
cszKey := (C.int)(szKey) cszKey := (C.int)(szKey)
C.SetCameraSmoothZoomControl(cszKey) C.SetCameraSmoothZoomControl(cszKey)
} }
// Set camera move controls (1st person and 3rd person cameras) // SetCameraMoveControls - Set camera move controls (1st person and 3rd person cameras)
func SetCameraMoveControls(frontKey int32, backKey int32, rightKey int32, leftKey int32, upKey int32, downKey int32) { func SetCameraMoveControls(frontKey int32, backKey int32, rightKey int32, leftKey int32, upKey int32, downKey int32) {
cfrontKey := (C.int)(frontKey) cfrontKey := (C.int)(frontKey)
cbackKey := (C.int)(backKey) cbackKey := (C.int)(backKey)

View file

@ -239,12 +239,12 @@ func (v *Vector2) cptr() *C.Vector2 {
return (*C.Vector2)(unsafe.Pointer(v)) return (*C.Vector2)(unsafe.Pointer(v))
} }
// Returns new Vector2 // NewVector2 - Returns new Vector2
func NewVector2(x, y float32) Vector2 { func NewVector2(x, y float32) Vector2 {
return Vector2{x, y} return Vector2{x, y}
} }
// Returns new Vector2 from pointer // NewVector2FromPointer - Returns new Vector2 from pointer
func NewVector2FromPointer(ptr unsafe.Pointer) Vector2 { func NewVector2FromPointer(ptr unsafe.Pointer) Vector2 {
return *(*Vector2)(ptr) return *(*Vector2)(ptr)
} }
@ -260,12 +260,12 @@ func (v *Vector3) cptr() *C.Vector3 {
return (*C.Vector3)(unsafe.Pointer(v)) return (*C.Vector3)(unsafe.Pointer(v))
} }
// Returns new Vector3 // NewVector3 - Returns new Vector3
func NewVector3(X, Y, Z float32) Vector3 { func NewVector3(X, Y, Z float32) Vector3 {
return Vector3{X, Y, Z} return Vector3{X, Y, Z}
} }
// Returns new Vector3 from pointer // NewVector3FromPointer - Returns new Vector3 from pointer
func NewVector3FromPointer(ptr unsafe.Pointer) Vector3 { func NewVector3FromPointer(ptr unsafe.Pointer) Vector3 {
return *(*Vector3)(ptr) return *(*Vector3)(ptr)
} }
@ -282,12 +282,12 @@ func (m *Matrix) cptr() *C.Matrix {
return (*C.Matrix)(unsafe.Pointer(m)) return (*C.Matrix)(unsafe.Pointer(m))
} }
// Returns new Matrix // NewMatrix - Returns new Matrix
func NewMatrix(m0, m4, m8, m12, m1, m5, m9, m13, m2, m6, m10, m14, m3, m7, m11, m15 float32) Matrix { func NewMatrix(m0, m4, m8, m12, m1, m5, m9, m13, m2, m6, m10, m14, m3, m7, m11, m15 float32) Matrix {
return Matrix{m0, m4, m8, m12, m1, m5, m9, m13, m2, m6, m10, m14, m3, m7, m11, m15} return Matrix{m0, m4, m8, m12, m1, m5, m9, m13, m2, m6, m10, m14, m3, m7, m11, m15}
} }
// Returns new Matrix from pointer // NewMatrixFromPointer - Returns new Matrix from pointer
func NewMatrixFromPointer(ptr unsafe.Pointer) Matrix { func NewMatrixFromPointer(ptr unsafe.Pointer) Matrix {
return *(*Matrix)(ptr) return *(*Matrix)(ptr)
} }
@ -300,7 +300,7 @@ type Quaternion struct {
W float32 W float32
} }
// Returns new Quaternion // NewQuaternion - Returns new Quaternion
func NewQuaternion(x, y, z, w float32) Quaternion { func NewQuaternion(x, y, z, w float32) Quaternion {
return Quaternion{x, y, z, w} return Quaternion{x, y, z, w}
} }
@ -317,12 +317,12 @@ func (color *Color) cptr() *C.Color {
return (*C.Color)(unsafe.Pointer(color)) return (*C.Color)(unsafe.Pointer(color))
} }
// Returns new Color // NewColor - Returns new Color
func NewColor(r, g, b, a uint8) Color { func NewColor(r, g, b, a uint8) Color {
return Color{r, g, b, a} return Color{r, g, b, a}
} }
// Returns new Color from pointer // NewColorFromPointer - Returns new Color from pointer
func NewColorFromPointer(ptr unsafe.Pointer) Color { func NewColorFromPointer(ptr unsafe.Pointer) Color {
return *(*Color)(ptr) return *(*Color)(ptr)
} }
@ -339,12 +339,12 @@ func (r *Rectangle) cptr() *C.Rectangle {
return (*C.Rectangle)(unsafe.Pointer(r)) return (*C.Rectangle)(unsafe.Pointer(r))
} }
// Returns new Rectangle // NewRectangle - Returns new Rectangle
func NewRectangle(x, y, width, height int32) Rectangle { func NewRectangle(x, y, width, height int32) Rectangle {
return Rectangle{x, y, width, height} return Rectangle{x, y, width, height}
} }
// Returns new Rectangle from pointer // NewRectangleFromPointer - Returns new Rectangle from pointer
func NewRectangleFromPointer(ptr unsafe.Pointer) Rectangle { func NewRectangleFromPointer(ptr unsafe.Pointer) Rectangle {
return *(*Rectangle)(ptr) return *(*Rectangle)(ptr)
} }
@ -361,12 +361,12 @@ func (b *BoundingBox) cptr() *C.BoundingBox {
return (*C.BoundingBox)(unsafe.Pointer(b)) return (*C.BoundingBox)(unsafe.Pointer(b))
} }
// Returns new BoundingBox // NewBoundingBox - Returns new BoundingBox
func NewBoundingBox(min, max Vector3) BoundingBox { func NewBoundingBox(min, max Vector3) BoundingBox {
return BoundingBox{min, max} return BoundingBox{min, max}
} }
// Returns new BoundingBox from pointer // NewBoundingBoxFromPointer - Returns new BoundingBox from pointer
func NewBoundingBoxFromPointer(ptr unsafe.Pointer) BoundingBox { func NewBoundingBoxFromPointer(ptr unsafe.Pointer) BoundingBox {
return *(*BoundingBox)(ptr) return *(*BoundingBox)(ptr)
} }
@ -377,100 +377,100 @@ type Asset interface {
io.Closer io.Closer
} }
// Close Window and Terminate Context // CloseWindow - Close Window and Terminate Context
func CloseWindow() { func CloseWindow() {
C.CloseWindow() C.CloseWindow()
} }
// Detect if KEY_ESCAPE pressed or Close icon pressed // WindowShouldClose - Detect if KEY_ESCAPE pressed or Close icon pressed
func WindowShouldClose() bool { func WindowShouldClose() bool {
ret := C.WindowShouldClose() ret := C.WindowShouldClose()
v := bool(int(ret) == 1) v := bool(int(ret) == 1)
return v return v
} }
// Detect if window has been minimized (or lost focus) // IsWindowMinimized - Detect if window has been minimized (or lost focus)
func IsWindowMinimized() bool { func IsWindowMinimized() bool {
ret := C.IsWindowMinimized() ret := C.IsWindowMinimized()
v := bool(int(ret) == 1) v := bool(int(ret) == 1)
return v return v
} }
// Fullscreen toggle (only PLATFORM_DESKTOP) // ToggleFullscreen - Fullscreen toggle (only PLATFORM_DESKTOP)
func ToggleFullscreen() { func ToggleFullscreen() {
C.ToggleFullscreen() C.ToggleFullscreen()
} }
// Set icon for window (only PLATFORM_DESKTOP) // SetWindowIcon - Set icon for window (only PLATFORM_DESKTOP)
func SetWindowIcon(image Image) { func SetWindowIcon(image Image) {
cimage := image.cptr() cimage := image.cptr()
C.SetWindowIcon(*cimage) C.SetWindowIcon(*cimage)
} }
// Get current screen width // GetScreenWidth - Get current screen width
func GetScreenWidth() int32 { func GetScreenWidth() int32 {
ret := C.GetScreenWidth() ret := C.GetScreenWidth()
v := (int32)(ret) v := (int32)(ret)
return v return v
} }
// Get current screen height // GetScreenHeight - Get current screen height
func GetScreenHeight() int32 { func GetScreenHeight() int32 {
ret := C.GetScreenHeight() ret := C.GetScreenHeight()
v := (int32)(ret) v := (int32)(ret)
return v return v
} }
// Sets Background Color // ClearBackground - Sets Background Color
func ClearBackground(color Color) { func ClearBackground(color Color) {
ccolor := color.cptr() ccolor := color.cptr()
C.ClearBackground(*ccolor) C.ClearBackground(*ccolor)
} }
// Setup drawing canvas to start drawing // BeginDrawing - Setup drawing canvas to start drawing
func BeginDrawing() { func BeginDrawing() {
C.BeginDrawing() C.BeginDrawing()
} }
// End canvas drawing and Swap Buffers (Double Buffering) // EndDrawing - End canvas drawing and Swap Buffers (Double Buffering)
func EndDrawing() { func EndDrawing() {
C.EndDrawing() C.EndDrawing()
} }
// Initialize 2D mode with custom camera // Begin2dMode - Initialize 2D mode with custom camera
func Begin2dMode(camera Camera2D) { func Begin2dMode(camera Camera2D) {
ccamera := camera.cptr() ccamera := camera.cptr()
C.Begin2dMode(*ccamera) C.Begin2dMode(*ccamera)
} }
// Ends 2D mode custom camera usage // End2dMode - Ends 2D mode custom camera usage
func End2dMode() { func End2dMode() {
C.End2dMode() C.End2dMode()
} }
// Initializes 3D mode for drawing (Camera setup) // Begin3dMode - Initializes 3D mode for drawing (Camera setup)
func Begin3dMode(camera Camera) { func Begin3dMode(camera Camera) {
ccamera := camera.cptr() ccamera := camera.cptr()
C.Begin3dMode(*ccamera) C.Begin3dMode(*ccamera)
} }
// Ends 3D mode and returns to default 2D orthographic mode // End3dMode - Ends 3D mode and returns to default 2D orthographic mode
func End3dMode() { func End3dMode() {
C.End3dMode() C.End3dMode()
} }
// Initializes render texture for drawing // BeginTextureMode - Initializes render texture for drawing
func BeginTextureMode(target RenderTexture2D) { func BeginTextureMode(target RenderTexture2D) {
ctarget := target.cptr() ctarget := target.cptr()
C.BeginTextureMode(*ctarget) C.BeginTextureMode(*ctarget)
} }
// Ends drawing to render texture // EndTextureMode - Ends drawing to render texture
func EndTextureMode() { func EndTextureMode() {
C.EndTextureMode() C.EndTextureMode()
} }
// Returns a ray trace from mouse position // GetMouseRay - Returns a ray trace from mouse position
func GetMouseRay(mousePosition Vector2, camera Camera) Ray { func GetMouseRay(mousePosition Vector2, camera Camera) Ray {
cmousePosition := mousePosition.cptr() cmousePosition := mousePosition.cptr()
ccamera := camera.cptr() ccamera := camera.cptr()
@ -479,7 +479,7 @@ func GetMouseRay(mousePosition Vector2, camera Camera) Ray {
return v return v
} }
// Returns the screen space position from a 3d world space position // GetWorldToScreen - Returns the screen space position from a 3d world space position
func GetWorldToScreen(position Vector3, camera Camera) Vector2 { func GetWorldToScreen(position Vector3, camera Camera) Vector2 {
cposition := position.cptr() cposition := position.cptr()
ccamera := camera.cptr() ccamera := camera.cptr()
@ -488,7 +488,7 @@ func GetWorldToScreen(position Vector3, camera Camera) Vector2 {
return v return v
} }
// Returns camera transform matrix (view matrix) // GetCameraMatrix - Returns camera transform matrix (view matrix)
func GetCameraMatrix(camera Camera) Matrix { func GetCameraMatrix(camera Camera) Matrix {
ccamera := camera.cptr() ccamera := camera.cptr()
ret := C.GetCameraMatrix(*ccamera) ret := C.GetCameraMatrix(*ccamera)
@ -496,27 +496,27 @@ func GetCameraMatrix(camera Camera) Matrix {
return v return v
} }
// Set target FPS (maximum) // SetTargetFPS - Set target FPS (maximum)
func SetTargetFPS(fps int32) { func SetTargetFPS(fps int32) {
cfps := (C.int)(fps) cfps := (C.int)(fps)
C.SetTargetFPS(cfps) C.SetTargetFPS(cfps)
} }
// Returns current FPS // GetFPS - Returns current FPS
func GetFPS() float32 { func GetFPS() float32 {
ret := C.GetFPS() ret := C.GetFPS()
v := (float32)(ret) v := (float32)(ret)
return v return v
} }
// Returns time in seconds for one frame // GetFrameTime - Returns time in seconds for one frame
func GetFrameTime() float32 { func GetFrameTime() float32 {
ret := C.GetFrameTime() ret := C.GetFrameTime()
v := (float32)(ret) v := (float32)(ret)
return v return v
} }
// Returns a Color struct from hexadecimal value // GetColor - Returns a Color struct from hexadecimal value
func GetColor(hexValue int32) Color { func GetColor(hexValue int32) Color {
chexValue := (C.int)(hexValue) chexValue := (C.int)(hexValue)
ret := C.GetColor(chexValue) ret := C.GetColor(chexValue)
@ -524,7 +524,7 @@ func GetColor(hexValue int32) Color {
return v return v
} }
// Returns hexadecimal value for a Color // GetHexValue - Returns hexadecimal value for a Color
func GetHexValue(color Color) int32 { func GetHexValue(color Color) int32 {
ccolor := color.cptr() ccolor := color.cptr()
ret := C.GetHexValue(*ccolor) ret := C.GetHexValue(*ccolor)
@ -532,7 +532,7 @@ func GetHexValue(color Color) int32 {
return v return v
} }
// Converts Color to float array and normalizes // ColorToFloat - Converts Color to float array and normalizes
func ColorToFloat(color Color) []float32 { func ColorToFloat(color Color) []float32 {
ccolor := color.cptr() ccolor := color.cptr()
ret := C.ColorToFloat(*ccolor) ret := C.ColorToFloat(*ccolor)
@ -546,7 +546,7 @@ func ColorToFloat(color Color) []float32 {
return data return data
} }
// Converts Vector3 to float array // VectorToFloat - Converts Vector3 to float array
func VectorToFloat(vec Vector3) []float32 { func VectorToFloat(vec Vector3) []float32 {
cvec := vec.cptr() cvec := vec.cptr()
ret := C.VectorToFloat(*cvec) ret := C.VectorToFloat(*cvec)
@ -560,7 +560,7 @@ func VectorToFloat(vec Vector3) []float32 {
return data return data
} }
// Converts Matrix to float array // MatrixToFloat - Converts Matrix to float array
func MatrixToFloat(mat Matrix) []float32 { func MatrixToFloat(mat Matrix) []float32 {
cmat := mat.cptr() cmat := mat.cptr()
ret := C.MatrixToFloat(*cmat) ret := C.MatrixToFloat(*cmat)
@ -574,7 +574,7 @@ func MatrixToFloat(mat Matrix) []float32 {
return data return data
} }
// Returns a random value between min and max (both included) // GetRandomValue - Returns a random value between min and max (both included)
func GetRandomValue(min int32, max int32) int32 { func GetRandomValue(min int32, max int32) int32 {
cmin := (C.int)(min) cmin := (C.int)(min)
cmax := (C.int)(max) cmax := (C.int)(max)
@ -583,7 +583,7 @@ func GetRandomValue(min int32, max int32) int32 {
return v return v
} }
// Color fade-in or fade-out, alpha goes from 0.0f to 1.0f // Fade - Color fade-in or fade-out, alpha goes from 0.0f to 1.0f
func Fade(color Color, alpha float32) Color { func Fade(color Color, alpha float32) Color {
ccolor := color.cptr() ccolor := color.cptr()
calpha := (C.float)(alpha) calpha := (C.float)(alpha)
@ -592,25 +592,25 @@ func Fade(color Color, alpha float32) Color {
return v return v
} }
// Setup some window configuration flags // SetConfigFlags - Setup some window configuration flags
func SetConfigFlags(flags byte) { func SetConfigFlags(flags byte) {
cflags := (C.char)(flags) cflags := (C.char)(flags)
C.SetConfigFlags(cflags) C.SetConfigFlags(cflags)
} }
// Activates raylib logo at startup (can be done with flags) // ShowLogo - Activates raylib logo at startup (can be done with flags)
func ShowLogo() { func ShowLogo() {
C.ShowLogo() C.ShowLogo()
} }
// Storage save integer value (to defined position) // StorageSaveValue - Storage save integer value (to defined position)
func StorageSaveValue(position int32, value int32) { func StorageSaveValue(position int32, value int32) {
cposition := (C.int)(position) cposition := (C.int)(position)
cvalue := (C.int)(value) cvalue := (C.int)(value)
C.StorageSaveValue(cposition, cvalue) C.StorageSaveValue(cposition, cvalue)
} }
// Storage load integer value (from defined position) // StorageLoadValue - Storage load integer value (from defined position)
func StorageLoadValue(position int32) int32 { func StorageLoadValue(position int32) int32 {
cposition := (C.int)(position) cposition := (C.int)(position)
ret := C.StorageLoadValue(cposition) ret := C.StorageLoadValue(cposition)
@ -618,7 +618,7 @@ func StorageLoadValue(position int32) int32 {
return v return v
} }
// Detect if a key has been pressed once // IsKeyPressed - Detect if a key has been pressed once
func IsKeyPressed(key int32) bool { func IsKeyPressed(key int32) bool {
ckey := (C.int)(key) ckey := (C.int)(key)
ret := C.IsKeyPressed(ckey) ret := C.IsKeyPressed(ckey)
@ -626,7 +626,7 @@ func IsKeyPressed(key int32) bool {
return v return v
} }
// Detect if a key is being pressed // IsKeyDown - Detect if a key is being pressed
func IsKeyDown(key int32) bool { func IsKeyDown(key int32) bool {
ckey := (C.int)(key) ckey := (C.int)(key)
ret := C.IsKeyDown(ckey) ret := C.IsKeyDown(ckey)
@ -634,7 +634,7 @@ func IsKeyDown(key int32) bool {
return v return v
} }
// Detect if a key has been released once // IsKeyReleased - Detect if a key has been released once
func IsKeyReleased(key int32) bool { func IsKeyReleased(key int32) bool {
ckey := (C.int)(key) ckey := (C.int)(key)
ret := C.IsKeyReleased(ckey) ret := C.IsKeyReleased(ckey)
@ -642,7 +642,7 @@ func IsKeyReleased(key int32) bool {
return v return v
} }
// Detect if a key is NOT being pressed // IsKeyUp - Detect if a key is NOT being pressed
func IsKeyUp(key int32) bool { func IsKeyUp(key int32) bool {
ckey := (C.int)(key) ckey := (C.int)(key)
ret := C.IsKeyUp(ckey) ret := C.IsKeyUp(ckey)
@ -650,20 +650,20 @@ func IsKeyUp(key int32) bool {
return v return v
} }
// Get latest key pressed // GetKeyPressed - Get latest key pressed
func GetKeyPressed() int32 { func GetKeyPressed() int32 {
ret := C.GetKeyPressed() ret := C.GetKeyPressed()
v := (int32)(ret) v := (int32)(ret)
return v return v
} }
// Set a custom key to exit program (default is ESC) // SetExitKey - Set a custom key to exit program (default is ESC)
func SetExitKey(key int32) { func SetExitKey(key int32) {
ckey := (C.int)(key) ckey := (C.int)(key)
C.SetExitKey(ckey) C.SetExitKey(ckey)
} }
// Detect if a gamepad is available // IsGamepadAvailable - Detect if a gamepad is available
func IsGamepadAvailable(gamepad int32) bool { func IsGamepadAvailable(gamepad int32) bool {
cgamepad := (C.int)(gamepad) cgamepad := (C.int)(gamepad)
ret := C.IsGamepadAvailable(cgamepad) ret := C.IsGamepadAvailable(cgamepad)
@ -671,7 +671,7 @@ func IsGamepadAvailable(gamepad int32) bool {
return v return v
} }
// Check gamepad name (if available) // IsGamepadName - Check gamepad name (if available)
func IsGamepadName(gamepad int32, name string) bool { func IsGamepadName(gamepad int32, name string) bool {
cgamepad := (C.int)(gamepad) cgamepad := (C.int)(gamepad)
cname := C.CString(name) cname := C.CString(name)
@ -681,7 +681,7 @@ func IsGamepadName(gamepad int32, name string) bool {
return v return v
} }
// Return gamepad internal name id // GetGamepadName - Return gamepad internal name id
func GetGamepadName(gamepad int32) string { func GetGamepadName(gamepad int32) string {
cgamepad := (C.int)(gamepad) cgamepad := (C.int)(gamepad)
ret := C.GetGamepadName(cgamepad) ret := C.GetGamepadName(cgamepad)
@ -689,7 +689,7 @@ func GetGamepadName(gamepad int32) string {
return v return v
} }
// Detect if a gamepad button has been pressed once // IsGamepadButtonPressed - Detect if a gamepad button has been pressed once
func IsGamepadButtonPressed(gamepad int32, button int32) bool { func IsGamepadButtonPressed(gamepad int32, button int32) bool {
cgamepad := (C.int)(gamepad) cgamepad := (C.int)(gamepad)
cbutton := (C.int)(button) cbutton := (C.int)(button)
@ -698,7 +698,7 @@ func IsGamepadButtonPressed(gamepad int32, button int32) bool {
return v return v
} }
// Detect if a gamepad button is being pressed // IsGamepadButtonDown - Detect if a gamepad button is being pressed
func IsGamepadButtonDown(gamepad int32, button int32) bool { func IsGamepadButtonDown(gamepad int32, button int32) bool {
cgamepad := (C.int)(gamepad) cgamepad := (C.int)(gamepad)
cbutton := (C.int)(button) cbutton := (C.int)(button)
@ -707,7 +707,7 @@ func IsGamepadButtonDown(gamepad int32, button int32) bool {
return v return v
} }
// Detect if a gamepad button has been released once // IsGamepadButtonReleased - Detect if a gamepad button has been released once
func IsGamepadButtonReleased(gamepad int32, button int32) bool { func IsGamepadButtonReleased(gamepad int32, button int32) bool {
cgamepad := (C.int)(gamepad) cgamepad := (C.int)(gamepad)
cbutton := (C.int)(button) cbutton := (C.int)(button)
@ -716,7 +716,7 @@ func IsGamepadButtonReleased(gamepad int32, button int32) bool {
return v return v
} }
// Detect if a gamepad button is NOT being pressed // IsGamepadButtonUp - Detect if a gamepad button is NOT being pressed
func IsGamepadButtonUp(gamepad int32, button int32) bool { func IsGamepadButtonUp(gamepad int32, button int32) bool {
cgamepad := (C.int)(gamepad) cgamepad := (C.int)(gamepad)
cbutton := (C.int)(button) cbutton := (C.int)(button)
@ -725,14 +725,14 @@ func IsGamepadButtonUp(gamepad int32, button int32) bool {
return v return v
} }
// Get the last gamepad button pressed // GetGamepadButtonPressed - Get the last gamepad button pressed
func GetGamepadButtonPressed() int32 { func GetGamepadButtonPressed() int32 {
ret := C.GetGamepadButtonPressed() ret := C.GetGamepadButtonPressed()
v := (int32)(ret) v := (int32)(ret)
return v return v
} }
// Return gamepad axis count for a gamepad // GetGamepadAxisCount - Return gamepad axis count for a gamepad
func GetGamepadAxisCount(gamepad int32) int32 { func GetGamepadAxisCount(gamepad int32) int32 {
cgamepad := (C.int)(gamepad) cgamepad := (C.int)(gamepad)
ret := C.GetGamepadAxisCount(cgamepad) ret := C.GetGamepadAxisCount(cgamepad)
@ -740,7 +740,7 @@ func GetGamepadAxisCount(gamepad int32) int32 {
return v return v
} }
// Return axis movement value for a gamepad axis // GetGamepadAxisMovement - Return axis movement value for a gamepad axis
func GetGamepadAxisMovement(gamepad int32, axis int32) float32 { func GetGamepadAxisMovement(gamepad int32, axis int32) float32 {
cgamepad := (C.int)(gamepad) cgamepad := (C.int)(gamepad)
caxis := (C.int)(axis) caxis := (C.int)(axis)
@ -749,7 +749,7 @@ func GetGamepadAxisMovement(gamepad int32, axis int32) float32 {
return v return v
} }
// Detect if a mouse button has been pressed once // IsMouseButtonPressed - Detect if a mouse button has been pressed once
func IsMouseButtonPressed(button int32) bool { func IsMouseButtonPressed(button int32) bool {
cbutton := (C.int)(button) cbutton := (C.int)(button)
ret := C.IsMouseButtonPressed(cbutton) ret := C.IsMouseButtonPressed(cbutton)
@ -757,7 +757,7 @@ func IsMouseButtonPressed(button int32) bool {
return v return v
} }
// Detect if a mouse button is being pressed // IsMouseButtonDown - Detect if a mouse button is being pressed
func IsMouseButtonDown(button int32) bool { func IsMouseButtonDown(button int32) bool {
cbutton := (C.int)(button) cbutton := (C.int)(button)
ret := C.IsMouseButtonDown(cbutton) ret := C.IsMouseButtonDown(cbutton)
@ -765,7 +765,7 @@ func IsMouseButtonDown(button int32) bool {
return v return v
} }
// Detect if a mouse button has been released once // IsMouseButtonReleased - Detect if a mouse button has been released once
func IsMouseButtonReleased(button int32) bool { func IsMouseButtonReleased(button int32) bool {
cbutton := (C.int)(button) cbutton := (C.int)(button)
ret := C.IsMouseButtonReleased(cbutton) ret := C.IsMouseButtonReleased(cbutton)
@ -773,7 +773,7 @@ func IsMouseButtonReleased(button int32) bool {
return v return v
} }
// Detect if a mouse button is NOT being pressed // IsMouseButtonUp - Detect if a mouse button is NOT being pressed
func IsMouseButtonUp(button int32) bool { func IsMouseButtonUp(button int32) bool {
cbutton := (C.int)(button) cbutton := (C.int)(button)
ret := C.IsMouseButtonUp(cbutton) ret := C.IsMouseButtonUp(cbutton)
@ -781,55 +781,55 @@ func IsMouseButtonUp(button int32) bool {
return v return v
} }
// Returns mouse position X // GetMouseX - Returns mouse position X
func GetMouseX() int32 { func GetMouseX() int32 {
ret := C.GetMouseX() ret := C.GetMouseX()
v := (int32)(ret) v := (int32)(ret)
return v return v
} }
// Returns mouse position Y // GetMouseY - Returns mouse position Y
func GetMouseY() int32 { func GetMouseY() int32 {
ret := C.GetMouseY() ret := C.GetMouseY()
v := (int32)(ret) v := (int32)(ret)
return v return v
} }
// Returns mouse position XY // GetMousePosition - Returns mouse position XY
func GetMousePosition() Vector2 { func GetMousePosition() Vector2 {
ret := C.GetMousePosition() ret := C.GetMousePosition()
v := NewVector2FromPointer(unsafe.Pointer(&ret)) v := NewVector2FromPointer(unsafe.Pointer(&ret))
return v return v
} }
// Set mouse position XY // SetMousePosition - Set mouse position XY
func SetMousePosition(position Vector2) { func SetMousePosition(position Vector2) {
cposition := position.cptr() cposition := position.cptr()
C.SetMousePosition(*cposition) C.SetMousePosition(*cposition)
} }
// Returns mouse wheel movement Y // GetMouseWheelMove - Returns mouse wheel movement Y
func GetMouseWheelMove() int32 { func GetMouseWheelMove() int32 {
ret := C.GetMouseWheelMove() ret := C.GetMouseWheelMove()
v := (int32)(ret) v := (int32)(ret)
return v return v
} }
// Returns touch position X for touch point 0 (relative to screen size) // GetTouchX - Returns touch position X for touch point 0 (relative to screen size)
func GetTouchX() int32 { func GetTouchX() int32 {
ret := C.GetTouchX() ret := C.GetTouchX()
v := (int32)(ret) v := (int32)(ret)
return v return v
} }
// Returns touch position Y for touch point 0 (relative to screen size) // GetTouchY - Returns touch position Y for touch point 0 (relative to screen size)
func GetTouchY() int32 { func GetTouchY() int32 {
ret := C.GetTouchY() ret := C.GetTouchY()
v := (int32)(ret) v := (int32)(ret)
return v return v
} }
// Returns touch position XY for a touch point index (relative to screen size) // GetTouchPosition - Returns touch position XY for a touch point index (relative to screen size)
func GetTouchPosition(index int32) Vector2 { func GetTouchPosition(index int32) Vector2 {
cindex := (C.int)(index) cindex := (C.int)(index)
ret := C.GetTouchPosition(cindex) ret := C.GetTouchPosition(cindex)

View file

@ -25,13 +25,13 @@ const (
GesturePinchOut Gestures = C.GESTURE_PINCH_OUT GesturePinchOut Gestures = C.GESTURE_PINCH_OUT
) )
// Enable a set of gestures using flags // SetGesturesEnabled - Enable a set of gestures using flags
func SetGesturesEnabled(gestureFlags uint32) { func SetGesturesEnabled(gestureFlags uint32) {
cgestureFlags := (C.uint)(gestureFlags) cgestureFlags := (C.uint)(gestureFlags)
C.SetGesturesEnabled(cgestureFlags) C.SetGesturesEnabled(cgestureFlags)
} }
// Check if a gesture have been detected // IsGestureDetected - Check if a gesture have been detected
func IsGestureDetected(gesture Gestures) bool { func IsGestureDetected(gesture Gestures) bool {
cgesture := (C.int)(gesture) cgesture := (C.int)(gesture)
ret := C.IsGestureDetected(cgesture) ret := C.IsGestureDetected(cgesture)
@ -39,49 +39,49 @@ func IsGestureDetected(gesture Gestures) bool {
return v return v
} }
// Get latest detected gesture // GetGestureDetected - Get latest detected gesture
func GetGestureDetected() Gestures { func GetGestureDetected() Gestures {
ret := C.GetGestureDetected() ret := C.GetGestureDetected()
v := (Gestures)(ret) v := (Gestures)(ret)
return v return v
} }
// Get touch points count // GetTouchPointsCount - Get touch points count
func GetTouchPointsCount() int32 { func GetTouchPointsCount() int32 {
ret := C.GetTouchPointsCount() ret := C.GetTouchPointsCount()
v := (int32)(ret) v := (int32)(ret)
return v return v
} }
// Get gesture hold time in milliseconds // GetGestureHoldDuration - Get gesture hold time in milliseconds
func GetGestureHoldDuration() float32 { func GetGestureHoldDuration() float32 {
ret := C.GetGestureHoldDuration() ret := C.GetGestureHoldDuration()
v := (float32)(ret) v := (float32)(ret)
return v return v
} }
// Get gesture drag vector // GetGestureDragVector - Get gesture drag vector
func GetGestureDragVector() Vector2 { func GetGestureDragVector() Vector2 {
ret := C.GetGestureDragVector() ret := C.GetGestureDragVector()
v := NewVector2FromPointer(unsafe.Pointer(&ret)) v := NewVector2FromPointer(unsafe.Pointer(&ret))
return v return v
} }
// Get gesture drag angle // GetGestureDragAngle - Get gesture drag angle
func GetGestureDragAngle() float32 { func GetGestureDragAngle() float32 {
ret := C.GetGestureDragAngle() ret := C.GetGestureDragAngle()
v := (float32)(ret) v := (float32)(ret)
return v return v
} }
// Get gesture pinch delta // GetGesturePinchVector - Get gesture pinch delta
func GetGesturePinchVector() Vector2 { func GetGesturePinchVector() Vector2 {
ret := C.GetGesturePinchVector() ret := C.GetGesturePinchVector()
v := NewVector2FromPointer(unsafe.Pointer(&ret)) v := NewVector2FromPointer(unsafe.Pointer(&ret))
return v return v
} }
// Get gesture pinch angle // GetGesturePinchAngle - Get gesture pinch angle
func GetGesturePinchAngle() float32 { func GetGesturePinchAngle() float32 {
ret := C.GetGesturePinchAngle() ret := C.GetGesturePinchAngle()
v := (float32)(ret) v := (float32)(ret)

View file

@ -38,12 +38,12 @@ func (m *Mesh) cptr() *C.Mesh {
return (*C.Mesh)(unsafe.Pointer(m)) return (*C.Mesh)(unsafe.Pointer(m))
} }
// Returns new Mesh // NewMesh - Returns new Mesh
func NewMesh(vertexCount, triangleCount int32, vertices, texcoords, texcoords2, normals, tangents *[]float32, colors *[]uint8, indices *[]uint16, vaoID uint32, vboID [7]uint32) Mesh { func NewMesh(vertexCount, triangleCount int32, vertices, texcoords, texcoords2, normals, tangents *[]float32, colors *[]uint8, indices *[]uint16, vaoID uint32, vboID [7]uint32) Mesh {
return Mesh{vertexCount, triangleCount, vertices, texcoords, texcoords2, normals, tangents, colors, indices, vaoID, vboID} return Mesh{vertexCount, triangleCount, vertices, texcoords, texcoords2, normals, tangents, colors, indices, vaoID, vboID}
} }
// Returns new Mesh from pointer // NewMeshFromPointer - Returns new Mesh from pointer
func NewMeshFromPointer(ptr unsafe.Pointer) Mesh { func NewMeshFromPointer(ptr unsafe.Pointer) Mesh {
return *(*Mesh)(ptr) return *(*Mesh)(ptr)
} }
@ -72,12 +72,12 @@ func (m *Material) cptr() *C.Material {
return (*C.Material)(unsafe.Pointer(m)) return (*C.Material)(unsafe.Pointer(m))
} }
// Returns new Material // NewMaterial - Returns new Material
func NewMaterial(shader Shader, texDiffuse, texNormal, texSpecular Texture2D, colDiffuse, colAmbient, colSpecular Color, glossiness float32) Material { func NewMaterial(shader Shader, texDiffuse, texNormal, texSpecular Texture2D, colDiffuse, colAmbient, colSpecular Color, glossiness float32) Material {
return Material{shader, texDiffuse, texNormal, texSpecular, colDiffuse, colAmbient, colSpecular, glossiness} return Material{shader, texDiffuse, texNormal, texSpecular, colDiffuse, colAmbient, colSpecular, glossiness}
} }
// Returns new Material from pointer // NewMaterialFromPointer - Returns new Material from pointer
func NewMaterialFromPointer(ptr unsafe.Pointer) Material { func NewMaterialFromPointer(ptr unsafe.Pointer) Material {
return *(*Material)(ptr) return *(*Material)(ptr)
} }
@ -98,12 +98,12 @@ func (m *Model) cptr() *C.Model {
return (*C.Model)(unsafe.Pointer(m)) return (*C.Model)(unsafe.Pointer(m))
} }
// Returns new Model // NewModel - Returns new Model
func NewModel(mesh Mesh, transform Matrix, material Material) Model { func NewModel(mesh Mesh, transform Matrix, material Material) Model {
return Model{mesh, transform, material, [4]byte{}} return Model{mesh, transform, material, [4]byte{}}
} }
// Returns new Model from pointer // NewModelFromPointer - Returns new Model from pointer
func NewModelFromPointer(ptr unsafe.Pointer) Model { func NewModelFromPointer(ptr unsafe.Pointer) Model {
return *(*Model)(ptr) return *(*Model)(ptr)
} }
@ -120,17 +120,17 @@ func (r *Ray) cptr() *C.Ray {
return (*C.Ray)(unsafe.Pointer(r)) return (*C.Ray)(unsafe.Pointer(r))
} }
// Returns new Ray // NewRay - Returns new Ray
func NewRay(position, direction Vector3) Ray { func NewRay(position, direction Vector3) Ray {
return Ray{position, direction} return Ray{position, direction}
} }
// Returns new Ray from pointer // NewRayFromPointer - Returns new Ray from pointer
func NewRayFromPointer(ptr unsafe.Pointer) Ray { func NewRayFromPointer(ptr unsafe.Pointer) Ray {
return *(*Ray)(ptr) return *(*Ray)(ptr)
} }
// Draw a line in 3D world space // DrawLine3D - Draw a line in 3D world space
func DrawLine3D(startPos Vector3, endPos Vector3, color Color) { func DrawLine3D(startPos Vector3, endPos Vector3, color Color) {
cstartPos := startPos.cptr() cstartPos := startPos.cptr()
cendPos := endPos.cptr() cendPos := endPos.cptr()
@ -138,7 +138,7 @@ func DrawLine3D(startPos Vector3, endPos Vector3, color Color) {
C.DrawLine3D(*cstartPos, *cendPos, *ccolor) C.DrawLine3D(*cstartPos, *cendPos, *ccolor)
} }
// Draw a circle in 3D world space // DrawCircle3D - Draw a circle in 3D world space
func DrawCircle3D(center Vector3, radius float32, rotationAxis Vector3, rotationAngle float32, color Color) { func DrawCircle3D(center Vector3, radius float32, rotationAxis Vector3, rotationAngle float32, color Color) {
ccenter := center.cptr() ccenter := center.cptr()
cradius := (C.float)(radius) cradius := (C.float)(radius)
@ -148,7 +148,7 @@ func DrawCircle3D(center Vector3, radius float32, rotationAxis Vector3, rotation
C.DrawCircle3D(*ccenter, cradius, *crotationAxis, crotationAngle, *ccolor) C.DrawCircle3D(*ccenter, cradius, *crotationAxis, crotationAngle, *ccolor)
} }
// Draw cube // DrawCube - Draw cube
func DrawCube(position Vector3, width float32, height float32, length float32, color Color) { func DrawCube(position Vector3, width float32, height float32, length float32, color Color) {
cposition := position.cptr() cposition := position.cptr()
cwidth := (C.float)(width) cwidth := (C.float)(width)
@ -158,7 +158,7 @@ func DrawCube(position Vector3, width float32, height float32, length float32, c
C.DrawCube(*cposition, cwidth, cheight, clength, *ccolor) C.DrawCube(*cposition, cwidth, cheight, clength, *ccolor)
} }
// Draw cube (Vector version) // DrawCubeV - Draw cube (Vector version)
func DrawCubeV(position Vector3, size Vector3, color Color) { func DrawCubeV(position Vector3, size Vector3, color Color) {
cposition := position.cptr() cposition := position.cptr()
csize := size.cptr() csize := size.cptr()
@ -166,7 +166,7 @@ func DrawCubeV(position Vector3, size Vector3, color Color) {
C.DrawCubeV(*cposition, *csize, *ccolor) C.DrawCubeV(*cposition, *csize, *ccolor)
} }
// Draw cube wires // DrawCubeWires - Draw cube wires
func DrawCubeWires(position Vector3, width float32, height float32, length float32, color Color) { func DrawCubeWires(position Vector3, width float32, height float32, length float32, color Color) {
cposition := position.cptr() cposition := position.cptr()
cwidth := (C.float)(width) cwidth := (C.float)(width)
@ -176,7 +176,7 @@ func DrawCubeWires(position Vector3, width float32, height float32, length float
C.DrawCubeWires(*cposition, cwidth, cheight, clength, *ccolor) C.DrawCubeWires(*cposition, cwidth, cheight, clength, *ccolor)
} }
// Draw cube textured // DrawCubeTexture - Draw cube textured
func DrawCubeTexture(texture Texture2D, position Vector3, width float32, height float32, length float32, color Color) { func DrawCubeTexture(texture Texture2D, position Vector3, width float32, height float32, length float32, color Color) {
ctexture := texture.cptr() ctexture := texture.cptr()
cposition := position.cptr() cposition := position.cptr()
@ -187,7 +187,7 @@ func DrawCubeTexture(texture Texture2D, position Vector3, width float32, height
C.DrawCubeTexture(*ctexture, *cposition, cwidth, cheight, clength, *ccolor) C.DrawCubeTexture(*ctexture, *cposition, cwidth, cheight, clength, *ccolor)
} }
// Draw sphere // DrawSphere - Draw sphere
func DrawSphere(centerPos Vector3, radius float32, color Color) { func DrawSphere(centerPos Vector3, radius float32, color Color) {
ccenterPos := centerPos.cptr() ccenterPos := centerPos.cptr()
cradius := (C.float)(radius) cradius := (C.float)(radius)
@ -195,7 +195,7 @@ func DrawSphere(centerPos Vector3, radius float32, color Color) {
C.DrawSphere(*ccenterPos, cradius, *ccolor) C.DrawSphere(*ccenterPos, cradius, *ccolor)
} }
// Draw sphere with extended parameters // DrawSphereEx - Draw sphere with extended parameters
func DrawSphereEx(centerPos Vector3, radius float32, rings int32, slices int32, color Color) { func DrawSphereEx(centerPos Vector3, radius float32, rings int32, slices int32, color Color) {
ccenterPos := centerPos.cptr() ccenterPos := centerPos.cptr()
cradius := (C.float)(radius) cradius := (C.float)(radius)
@ -205,7 +205,7 @@ func DrawSphereEx(centerPos Vector3, radius float32, rings int32, slices int32,
C.DrawSphereEx(*ccenterPos, cradius, crings, cslices, *ccolor) C.DrawSphereEx(*ccenterPos, cradius, crings, cslices, *ccolor)
} }
// Draw sphere wires // DrawSphereWires - Draw sphere wires
func DrawSphereWires(centerPos Vector3, radius float32, rings int32, slices int32, color Color) { func DrawSphereWires(centerPos Vector3, radius float32, rings int32, slices int32, color Color) {
ccenterPos := centerPos.cptr() ccenterPos := centerPos.cptr()
cradius := (C.float)(radius) cradius := (C.float)(radius)
@ -215,7 +215,7 @@ func DrawSphereWires(centerPos Vector3, radius float32, rings int32, slices int3
C.DrawSphereWires(*ccenterPos, cradius, crings, cslices, *ccolor) C.DrawSphereWires(*ccenterPos, cradius, crings, cslices, *ccolor)
} }
// Draw a cylinder/cone // DrawCylinder - Draw a cylinder/cone
func DrawCylinder(position Vector3, radiusTop float32, radiusBottom float32, height float32, slices int32, color Color) { func DrawCylinder(position Vector3, radiusTop float32, radiusBottom float32, height float32, slices int32, color Color) {
cposition := position.cptr() cposition := position.cptr()
cradiusTop := (C.float)(radiusTop) cradiusTop := (C.float)(radiusTop)
@ -226,7 +226,7 @@ func DrawCylinder(position Vector3, radiusTop float32, radiusBottom float32, hei
C.DrawCylinder(*cposition, cradiusTop, cradiusBottom, cheight, cslices, *ccolor) C.DrawCylinder(*cposition, cradiusTop, cradiusBottom, cheight, cslices, *ccolor)
} }
// Draw a cylinder/cone wires // DrawCylinderWires - Draw a cylinder/cone wires
func DrawCylinderWires(position Vector3, radiusTop float32, radiusBottom float32, height float32, slices int32, color Color) { func DrawCylinderWires(position Vector3, radiusTop float32, radiusBottom float32, height float32, slices int32, color Color) {
cposition := position.cptr() cposition := position.cptr()
cradiusTop := (C.float)(radiusTop) cradiusTop := (C.float)(radiusTop)
@ -237,7 +237,7 @@ func DrawCylinderWires(position Vector3, radiusTop float32, radiusBottom float32
C.DrawCylinderWires(*cposition, cradiusTop, cradiusBottom, cheight, cslices, *ccolor) C.DrawCylinderWires(*cposition, cradiusTop, cradiusBottom, cheight, cslices, *ccolor)
} }
// Draw a plane XZ // DrawPlane - Draw a plane XZ
func DrawPlane(centerPos Vector3, size Vector2, color Color) { func DrawPlane(centerPos Vector3, size Vector2, color Color) {
ccenterPos := centerPos.cptr() ccenterPos := centerPos.cptr()
csize := size.cptr() csize := size.cptr()
@ -245,27 +245,27 @@ func DrawPlane(centerPos Vector3, size Vector2, color Color) {
C.DrawPlane(*ccenterPos, *csize, *ccolor) C.DrawPlane(*ccenterPos, *csize, *ccolor)
} }
// Draw a ray line // DrawRay - Draw a ray line
func DrawRay(ray Ray, color Color) { func DrawRay(ray Ray, color Color) {
cray := ray.cptr() cray := ray.cptr()
ccolor := color.cptr() ccolor := color.cptr()
C.DrawRay(*cray, *ccolor) C.DrawRay(*cray, *ccolor)
} }
// Draw a grid (centered at (0, 0, 0)) // DrawGrid - Draw a grid (centered at (0, 0, 0))
func DrawGrid(slices int32, spacing float32) { func DrawGrid(slices int32, spacing float32) {
cslices := (C.int)(slices) cslices := (C.int)(slices)
cspacing := (C.float)(spacing) cspacing := (C.float)(spacing)
C.DrawGrid(cslices, cspacing) C.DrawGrid(cslices, cspacing)
} }
// Draw simple gizmo // DrawGizmo - Draw simple gizmo
func DrawGizmo(position Vector3) { func DrawGizmo(position Vector3) {
cposition := position.cptr() cposition := position.cptr()
C.DrawGizmo(*cposition) C.DrawGizmo(*cposition)
} }
// Load mesh from file // LoadMesh - Load mesh from file
func LoadMesh(fileName string) Mesh { func LoadMesh(fileName string) Mesh {
cfileName := C.CString(fileName) cfileName := C.CString(fileName)
defer C.free(unsafe.Pointer(cfileName)) defer C.free(unsafe.Pointer(cfileName))
@ -274,7 +274,7 @@ func LoadMesh(fileName string) Mesh {
return v return v
} }
// Load mesh from vertex data // LoadMeshEx - Load mesh from vertex data
func LoadMeshEx(numVertex int32, vData []float32, vtData []float32, vnData []float32, cData []Color) Mesh { func LoadMeshEx(numVertex int32, vData []float32, vtData []float32, vnData []float32, cData []Color) Mesh {
cnumVertex := (C.int)(numVertex) cnumVertex := (C.int)(numVertex)
cvData := (*C.float)(unsafe.Pointer((*reflect.SliceHeader)(unsafe.Pointer(&vData)).Data)) cvData := (*C.float)(unsafe.Pointer((*reflect.SliceHeader)(unsafe.Pointer(&vData)).Data))
@ -286,7 +286,7 @@ func LoadMeshEx(numVertex int32, vData []float32, vtData []float32, vnData []flo
return v return v
} }
// Load model from file // LoadModel - Load model from file
func LoadModel(fileName string) Model { func LoadModel(fileName string) Model {
cfileName := C.CString(fileName) cfileName := C.CString(fileName)
defer C.free(unsafe.Pointer(cfileName)) defer C.free(unsafe.Pointer(cfileName))
@ -295,7 +295,7 @@ func LoadModel(fileName string) Model {
return v return v
} }
// Load model from mesh data // LoadModelFromMesh - Load model from mesh data
func LoadModelFromMesh(data Mesh, dynamic bool) Model { func LoadModelFromMesh(data Mesh, dynamic bool) Model {
cdata := data.cptr() cdata := data.cptr()
cdynamic := 0 cdynamic := 0
@ -307,7 +307,7 @@ func LoadModelFromMesh(data Mesh, dynamic bool) Model {
return v return v
} }
// Load heightmap model from image data // LoadHeightmap - Load heightmap model from image data
func LoadHeightmap(heightmap *Image, size Vector3) Model { func LoadHeightmap(heightmap *Image, size Vector3) Model {
cheightmap := heightmap.cptr() cheightmap := heightmap.cptr()
csize := size.cptr() csize := size.cptr()
@ -316,7 +316,7 @@ func LoadHeightmap(heightmap *Image, size Vector3) Model {
return v return v
} }
// Load cubes-based map model from image data // LoadCubicmap - Load cubes-based map model from image data
func LoadCubicmap(cubicmap *Image) Model { func LoadCubicmap(cubicmap *Image) Model {
ccubicmap := cubicmap.cptr() ccubicmap := cubicmap.cptr()
ret := C.LoadCubicmap(*ccubicmap) ret := C.LoadCubicmap(*ccubicmap)
@ -324,19 +324,19 @@ func LoadCubicmap(cubicmap *Image) Model {
return v return v
} }
// Unload mesh from memory (RAM and/or VRAM) // UnloadMesh - Unload mesh from memory (RAM and/or VRAM)
func UnloadMesh(mesh *Mesh) { func UnloadMesh(mesh *Mesh) {
cmesh := mesh.cptr() cmesh := mesh.cptr()
C.UnloadMesh(cmesh) C.UnloadMesh(cmesh)
} }
// Unload model from memory (RAM and/or VRAM) // UnloadModel - Unload model from memory (RAM and/or VRAM)
func UnloadModel(model Model) { func UnloadModel(model Model) {
cmodel := model.cptr() cmodel := model.cptr()
C.UnloadModel(*cmodel) C.UnloadModel(*cmodel)
} }
// Load material data (.MTL) // LoadMaterial - Load material data (.MTL)
func LoadMaterial(fileName string) Material { func LoadMaterial(fileName string) Material {
cfileName := C.CString(fileName) cfileName := C.CString(fileName)
defer C.free(unsafe.Pointer(cfileName)) defer C.free(unsafe.Pointer(cfileName))
@ -345,20 +345,20 @@ func LoadMaterial(fileName string) Material {
return v return v
} }
// Load default material (uses default models shader) // LoadDefaultMaterial - Load default material (uses default models shader)
func LoadDefaultMaterial() Material { func LoadDefaultMaterial() Material {
ret := C.LoadDefaultMaterial() ret := C.LoadDefaultMaterial()
v := NewMaterialFromPointer(unsafe.Pointer(&ret)) v := NewMaterialFromPointer(unsafe.Pointer(&ret))
return v return v
} }
// Unload material textures from VRAM // UnloadMaterial - Unload material textures from VRAM
func UnloadMaterial(material Material) { func UnloadMaterial(material Material) {
cmaterial := material.cptr() cmaterial := material.cptr()
C.UnloadMaterial(*cmaterial) C.UnloadMaterial(*cmaterial)
} }
// Draw a model (with texture if set) // DrawModel - Draw a model (with texture if set)
func DrawModel(model Model, position Vector3, scale float32, tint Color) { func DrawModel(model Model, position Vector3, scale float32, tint Color) {
cmodel := model.cptr() cmodel := model.cptr()
cposition := position.cptr() cposition := position.cptr()
@ -367,7 +367,7 @@ func DrawModel(model Model, position Vector3, scale float32, tint Color) {
C.DrawModel(*cmodel, *cposition, cscale, *ctint) C.DrawModel(*cmodel, *cposition, cscale, *ctint)
} }
// Draw a model with extended parameters // DrawModelEx - Draw a model with extended parameters
func DrawModelEx(model Model, position Vector3, rotationAxis Vector3, rotationAngle float32, scale Vector3, tint Color) { func DrawModelEx(model Model, position Vector3, rotationAxis Vector3, rotationAngle float32, scale Vector3, tint Color) {
cmodel := model.cptr() cmodel := model.cptr()
cposition := position.cptr() cposition := position.cptr()
@ -378,7 +378,7 @@ func DrawModelEx(model Model, position Vector3, rotationAxis Vector3, rotationAn
C.DrawModelEx(*cmodel, *cposition, *crotationAxis, crotationAngle, *cscale, *ctint) C.DrawModelEx(*cmodel, *cposition, *crotationAxis, crotationAngle, *cscale, *ctint)
} }
// Draw a model wires (with texture if set) // DrawModelWires - Draw a model wires (with texture if set)
func DrawModelWires(model Model, position Vector3, scale float32, tint Color) { func DrawModelWires(model Model, position Vector3, scale float32, tint Color) {
cmodel := model.cptr() cmodel := model.cptr()
cposition := position.cptr() cposition := position.cptr()
@ -387,7 +387,7 @@ func DrawModelWires(model Model, position Vector3, scale float32, tint Color) {
C.DrawModelWires(*cmodel, *cposition, cscale, *ctint) C.DrawModelWires(*cmodel, *cposition, cscale, *ctint)
} }
// Draw a model wires (with texture if set) with extended parameters // DrawModelWiresEx - Draw a model wires (with texture if set) with extended parameters
func DrawModelWiresEx(model Model, position Vector3, rotationAxis Vector3, rotationAngle float32, scale Vector3, tint Color) { func DrawModelWiresEx(model Model, position Vector3, rotationAxis Vector3, rotationAngle float32, scale Vector3, tint Color) {
cmodel := model.cptr() cmodel := model.cptr()
cposition := position.cptr() cposition := position.cptr()
@ -398,14 +398,14 @@ func DrawModelWiresEx(model Model, position Vector3, rotationAxis Vector3, rotat
C.DrawModelWiresEx(*cmodel, *cposition, *crotationAxis, crotationAngle, *cscale, *ctint) C.DrawModelWiresEx(*cmodel, *cposition, *crotationAxis, crotationAngle, *cscale, *ctint)
} }
// Draw bounding box (wires) // DrawBoundingBox - Draw bounding box (wires)
func DrawBoundingBox(box BoundingBox, color Color) { func DrawBoundingBox(box BoundingBox, color Color) {
cbox := box.cptr() cbox := box.cptr()
ccolor := color.cptr() ccolor := color.cptr()
C.DrawBoundingBox(*cbox, *ccolor) C.DrawBoundingBox(*cbox, *ccolor)
} }
// Draw a billboard texture // DrawBillboard - Draw a billboard texture
func DrawBillboard(camera Camera, texture Texture2D, center Vector3, size float32, tint Color) { func DrawBillboard(camera Camera, texture Texture2D, center Vector3, size float32, tint Color) {
ccamera := camera.cptr() ccamera := camera.cptr()
ctexture := texture.cptr() ctexture := texture.cptr()
@ -415,7 +415,7 @@ func DrawBillboard(camera Camera, texture Texture2D, center Vector3, size float3
C.DrawBillboard(*ccamera, *ctexture, *ccenter, csize, *ctint) C.DrawBillboard(*ccamera, *ctexture, *ccenter, csize, *ctint)
} }
// Draw a billboard texture defined by sourceRec // DrawBillboardRec - Draw a billboard texture defined by sourceRec
func DrawBillboardRec(camera Camera, texture Texture2D, sourceRec Rectangle, center Vector3, size float32, tint Color) { func DrawBillboardRec(camera Camera, texture Texture2D, sourceRec Rectangle, center Vector3, size float32, tint Color) {
ccamera := camera.cptr() ccamera := camera.cptr()
ctexture := texture.cptr() ctexture := texture.cptr()
@ -426,7 +426,7 @@ func DrawBillboardRec(camera Camera, texture Texture2D, sourceRec Rectangle, cen
C.DrawBillboardRec(*ccamera, *ctexture, *csourceRec, *ccenter, csize, *ctint) C.DrawBillboardRec(*ccamera, *ctexture, *csourceRec, *ccenter, csize, *ctint)
} }
// Calculate mesh bounding box limits // CalculateBoundingBox - Calculate mesh bounding box limits
func CalculateBoundingBox(mesh Mesh) BoundingBox { func CalculateBoundingBox(mesh Mesh) BoundingBox {
cmesh := mesh.cptr() cmesh := mesh.cptr()
ret := C.CalculateBoundingBox(*cmesh) ret := C.CalculateBoundingBox(*cmesh)
@ -434,7 +434,7 @@ func CalculateBoundingBox(mesh Mesh) BoundingBox {
return v return v
} }
// Detect collision between two spheres // CheckCollisionSpheres - Detect collision between two spheres
func CheckCollisionSpheres(centerA Vector3, radiusA float32, centerB Vector3, radiusB float32) bool { func CheckCollisionSpheres(centerA Vector3, radiusA float32, centerB Vector3, radiusB float32) bool {
ccenterA := centerA.cptr() ccenterA := centerA.cptr()
cradiusA := (C.float)(radiusA) cradiusA := (C.float)(radiusA)
@ -445,7 +445,7 @@ func CheckCollisionSpheres(centerA Vector3, radiusA float32, centerB Vector3, ra
return v return v
} }
// Detect collision between two bounding boxes // CheckCollisionBoxes - Detect collision between two bounding boxes
func CheckCollisionBoxes(box1 BoundingBox, box2 BoundingBox) bool { func CheckCollisionBoxes(box1 BoundingBox, box2 BoundingBox) bool {
cbox1 := box1.cptr() cbox1 := box1.cptr()
cbox2 := box2.cptr() cbox2 := box2.cptr()
@ -454,7 +454,7 @@ func CheckCollisionBoxes(box1 BoundingBox, box2 BoundingBox) bool {
return v return v
} }
// Detect collision between box and sphere // CheckCollisionBoxSphere - Detect collision between box and sphere
func CheckCollisionBoxSphere(box BoundingBox, centerSphere Vector3, radiusSphere float32) bool { func CheckCollisionBoxSphere(box BoundingBox, centerSphere Vector3, radiusSphere float32) bool {
cbox := box.cptr() cbox := box.cptr()
ccenterSphere := centerSphere.cptr() ccenterSphere := centerSphere.cptr()
@ -464,7 +464,7 @@ func CheckCollisionBoxSphere(box BoundingBox, centerSphere Vector3, radiusSphere
return v return v
} }
// Detect collision between ray and sphere // CheckCollisionRaySphere - Detect collision between ray and sphere
func CheckCollisionRaySphere(ray Ray, spherePosition Vector3, sphereRadius float32) bool { func CheckCollisionRaySphere(ray Ray, spherePosition Vector3, sphereRadius float32) bool {
cray := ray.cptr() cray := ray.cptr()
cspherePosition := spherePosition.cptr() cspherePosition := spherePosition.cptr()
@ -474,7 +474,7 @@ func CheckCollisionRaySphere(ray Ray, spherePosition Vector3, sphereRadius float
return v return v
} }
// Detect collision between ray and sphere with extended parameters and collision point detection // CheckCollisionRaySphereEx - Detect collision between ray and sphere with extended parameters and collision point detection
func CheckCollisionRaySphereEx(ray Ray, spherePosition Vector3, sphereRadius float32, collisionPoint Vector3) bool { func CheckCollisionRaySphereEx(ray Ray, spherePosition Vector3, sphereRadius float32, collisionPoint Vector3) bool {
cray := ray.cptr() cray := ray.cptr()
cspherePosition := spherePosition.cptr() cspherePosition := spherePosition.cptr()
@ -485,7 +485,7 @@ func CheckCollisionRaySphereEx(ray Ray, spherePosition Vector3, sphereRadius flo
return v return v
} }
// Detect collision between ray and box // CheckCollisionRayBox - Detect collision between ray and box
func CheckCollisionRayBox(ray Ray, box BoundingBox) bool { func CheckCollisionRayBox(ray Ray, box BoundingBox) bool {
cray := ray.cptr() cray := ray.cptr()
cbox := box.cptr() cbox := box.cptr()

View file

@ -24,7 +24,7 @@ import (
var callbackHolder func(unsafe.Pointer) var callbackHolder func(unsafe.Pointer)
// Initialize Window and OpenGL Graphics // InitWindow - Initialize Window and OpenGL Graphics
func InitWindow(width int32, height int32, t interface{}) { func InitWindow(width int32, height int32, t interface{}) {
cwidth := (C.int)(width) cwidth := (C.int)(width)
cheight := (C.int)(height) cheight := (C.int)(height)
@ -36,7 +36,7 @@ func InitWindow(width int32, height int32, t interface{}) {
} }
} }
// Sets callback function // SetCallbackFunc - Sets callback function
func SetCallbackFunc(callback func(unsafe.Pointer)) { func SetCallbackFunc(callback func(unsafe.Pointer)) {
callbackHolder = callback callbackHolder = callback
} }
@ -48,47 +48,47 @@ func androidMain(app *C.struct_android_app) {
} }
} }
// Shows cursor // ShowCursor - Shows cursor
func ShowCursor() { func ShowCursor() {
return return
} }
// Hides cursor // HideCursor - Hides cursor
func HideCursor() { func HideCursor() {
return return
} }
// Returns true if cursor is not visible // IsCursorHidden - Returns true if cursor is not visible
func IsCursorHidden() bool { func IsCursorHidden() bool {
return false return false
} }
// Enables cursor // EnableCursor - Enables cursor
func EnableCursor() { func EnableCursor() {
return return
} }
// Disables cursor // DisableCursor - Disables cursor
func DisableCursor() { func DisableCursor() {
return return
} }
// Check if a file have been dropped into window // IsFileDropped - Check if a file have been dropped into window
func IsFileDropped() bool { func IsFileDropped() bool {
return false return false
} }
// Retrieve dropped files into window // GetDroppedFiles - Retrieve dropped files into window
func GetDroppedFiles(count *int32) (files []string) { func GetDroppedFiles(count *int32) (files []string) {
return return
} }
// Clear dropped files paths buffer // ClearDroppedFiles - Clear dropped files paths buffer
func ClearDroppedFiles() { func ClearDroppedFiles() {
return return
} }
// Open asset // OpenAsset - Open asset
func OpenAsset(name string) (Asset, error) { func OpenAsset(name string) (Asset, error) {
cname := C.CString(name) cname := C.CString(name)
defer C.free(unsafe.Pointer(cname)) defer C.free(unsafe.Pointer(cname))

View file

@ -13,7 +13,7 @@ import (
"unsafe" "unsafe"
) )
// Initialize Window and OpenGL Graphics // InitWindow - Initialize Window and OpenGL Graphics
func InitWindow(width int32, height int32, t interface{}) { func InitWindow(width int32, height int32, t interface{}) {
cwidth := (C.int)(width) cwidth := (C.int)(width)
cheight := (C.int)(height) cheight := (C.int)(height)
@ -26,54 +26,54 @@ func InitWindow(width int32, height int32, t interface{}) {
} }
} }
// Sets callback function // SetCallbackFunc - Sets callback function
func SetCallbackFunc(func(unsafe.Pointer)) { func SetCallbackFunc(func(unsafe.Pointer)) {
return return
} }
// Shows cursor // ShowCursor - Shows cursor
func ShowCursor() { func ShowCursor() {
C.ShowCursor() C.ShowCursor()
} }
// Hides cursor // HideCursor - Hides cursor
func HideCursor() { func HideCursor() {
C.HideCursor() C.HideCursor()
} }
// Returns true if cursor is not visible // IsCursorHidden - Returns true if cursor is not visible
func IsCursorHidden() bool { func IsCursorHidden() bool {
ret := C.IsCursorHidden() ret := C.IsCursorHidden()
v := bool(int(ret) == 1) v := bool(int(ret) == 1)
return v return v
} }
// Enables cursor // EnableCursor - Enables cursor
func EnableCursor() { func EnableCursor() {
C.EnableCursor() C.EnableCursor()
} }
// Disables cursor // DisableCursor - Disables cursor
func DisableCursor() { func DisableCursor() {
C.DisableCursor() C.DisableCursor()
} }
// Check if a file have been dropped into window // IsFileDropped - Check if a file have been dropped into window
func IsFileDropped() bool { func IsFileDropped() bool {
return false return false
} }
// Retrieve dropped files into window // GetDroppedFiles - Retrieve dropped files into window
func GetDroppedFiles(count *int32) (files []string) { func GetDroppedFiles(count *int32) (files []string) {
return return
} }
// Clear dropped files paths buffer // ClearDroppedFiles - Clear dropped files paths buffer
func ClearDroppedFiles() { func ClearDroppedFiles() {
return return
} }
// Open asset // OpenAsset - Open asset
func OpenAsset(name string) (Asset, error) { func OpenAsset(name string) (Asset, error) {
f, err := os.Open(name) f, err := os.Open(name)
if err != nil { if err != nil {

View file

@ -13,7 +13,7 @@ import (
"unsafe" "unsafe"
) )
// Initialize Window and OpenGL Graphics // InitWindow - Initialize Window and OpenGL Graphics
func InitWindow(width int32, height int32, t interface{}) { func InitWindow(width int32, height int32, t interface{}) {
cwidth := (C.int)(width) cwidth := (C.int)(width)
cheight := (C.int)(height) cheight := (C.int)(height)
@ -26,46 +26,46 @@ func InitWindow(width int32, height int32, t interface{}) {
} }
} }
// Sets callback function // SetCallbackFunc - Sets callback function
func SetCallbackFunc(func(unsafe.Pointer)) { func SetCallbackFunc(func(unsafe.Pointer)) {
return return
} }
// Shows cursor // ShowCursor - Shows cursor
func ShowCursor() { func ShowCursor() {
C.ShowCursor() C.ShowCursor()
} }
// Hides cursor // HideCursor - Hides cursor
func HideCursor() { func HideCursor() {
C.HideCursor() C.HideCursor()
} }
// Returns true if cursor is not visible // IsCursorHidden - Returns true if cursor is not visible
func IsCursorHidden() bool { func IsCursorHidden() bool {
ret := C.IsCursorHidden() ret := C.IsCursorHidden()
v := bool(int(ret) == 1) v := bool(int(ret) == 1)
return v return v
} }
// Enables cursor // EnableCursor - Enables cursor
func EnableCursor() { func EnableCursor() {
C.EnableCursor() C.EnableCursor()
} }
// Disables cursor // DisableCursor - Disables cursor
func DisableCursor() { func DisableCursor() {
C.DisableCursor() C.DisableCursor()
} }
// Check if a file have been dropped into window // IsFileDropped - Check if a file have been dropped into window
func IsFileDropped() bool { func IsFileDropped() bool {
ret := C.IsFileDropped() ret := C.IsFileDropped()
v := bool(int(ret) == 1) v := bool(int(ret) == 1)
return v return v
} }
// Retrieve dropped files into window // GetDroppedFiles - Retrieve dropped files into window
func GetDroppedFiles(count *int32) []string { func GetDroppedFiles(count *int32) []string {
ccount := (*C.int)(unsafe.Pointer(count)) ccount := (*C.int)(unsafe.Pointer(count))
ret := C.GetDroppedFiles(ccount) ret := C.GetDroppedFiles(ccount)
@ -79,12 +79,12 @@ func GetDroppedFiles(count *int32) []string {
return gostrings return gostrings
} }
// Clear dropped files paths buffer // ClearDroppedFiles - Clear dropped files paths buffer
func ClearDroppedFiles() { func ClearDroppedFiles() {
C.ClearDroppedFiles() C.ClearDroppedFiles()
} }
// Open asset // OpenAsset - Open asset
func OpenAsset(name string) (Asset, error) { func OpenAsset(name string) (Asset, error) {
f, err := os.Open(name) f, err := os.Open(name)
if err != nil { if err != nil {

View file

@ -133,13 +133,13 @@ const (
RRESVertFloat RRESVertFloat
) )
// Load resource from file (only one) // LoadResource - Load resource from file (only one)
// NOTE: Returns uncompressed data with parameters, only first resource found // NOTE: Returns uncompressed data with parameters, only first resource found
func LoadResource(fileName string) []byte { func LoadResource(fileName string) []byte {
return LoadResourceByID(fileName, 0) return LoadResourceByID(fileName, 0)
} }
// Load resource from file by id // LoadResourceByID - Load resource from file by id
// NOTE: Returns uncompressed data with parameters, search resource by id // NOTE: Returns uncompressed data with parameters, search resource by id
func LoadResourceByID(fileName string, rresID int) (data []byte) { func LoadResourceByID(fileName string, rresID int) (data []byte) {
file, err := OpenAsset(fileName) file, err := OpenAsset(fileName)

View file

@ -70,17 +70,17 @@ func (s *Shader) cptr() *C.Shader {
return (*C.Shader)(unsafe.Pointer(s)) return (*C.Shader)(unsafe.Pointer(s))
} }
// Returns new Shader // NewShader - Returns new Shader
func NewShader(id uint32, vertexLoc, texcoordLoc, texcoord2Loc, normalLoc, tangentLoc, colorLoc, mvpLoc, colDiffuseLoc, colAmbientLoc, colSpecularLoc, mapTexture0Loc, mapTexture1Loc, mapTexture2Loc int32) Shader { func NewShader(id uint32, vertexLoc, texcoordLoc, texcoord2Loc, normalLoc, tangentLoc, colorLoc, mvpLoc, colDiffuseLoc, colAmbientLoc, colSpecularLoc, mapTexture0Loc, mapTexture1Loc, mapTexture2Loc int32) Shader {
return Shader{id, vertexLoc, texcoordLoc, texcoord2Loc, normalLoc, tangentLoc, colorLoc, mvpLoc, colDiffuseLoc, colAmbientLoc, colSpecularLoc, mapTexture0Loc, mapTexture1Loc, mapTexture2Loc} return Shader{id, vertexLoc, texcoordLoc, texcoord2Loc, normalLoc, tangentLoc, colorLoc, mvpLoc, colDiffuseLoc, colAmbientLoc, colSpecularLoc, mapTexture0Loc, mapTexture1Loc, mapTexture2Loc}
} }
// Returns new Shader from pointer // NewShaderFromPointer - Returns new Shader from pointer
func NewShaderFromPointer(ptr unsafe.Pointer) Shader { func NewShaderFromPointer(ptr unsafe.Pointer) Shader {
return *(*Shader)(ptr) return *(*Shader)(ptr)
} }
// Load a custom shader and bind default locations // LoadShader - Load a custom shader and bind default locations
func LoadShader(vsFileName string, fsFileName string) Shader { func LoadShader(vsFileName string, fsFileName string) Shader {
cvsFileName := C.CString(vsFileName) cvsFileName := C.CString(vsFileName)
cfsFileName := C.CString(fsFileName) cfsFileName := C.CString(fsFileName)
@ -92,27 +92,27 @@ func LoadShader(vsFileName string, fsFileName string) Shader {
return v return v
} }
// Unload a custom shader from memory // UnloadShader - Unload a custom shader from memory
func UnloadShader(shader Shader) { func UnloadShader(shader Shader) {
cshader := shader.cptr() cshader := shader.cptr()
C.UnloadShader(*cshader) C.UnloadShader(*cshader)
} }
// Get default shader // GetDefaultShader - Get default shader
func GetDefaultShader() Shader { func GetDefaultShader() Shader {
ret := C.GetDefaultShader() ret := C.GetDefaultShader()
v := NewShaderFromPointer(unsafe.Pointer(&ret)) v := NewShaderFromPointer(unsafe.Pointer(&ret))
return v return v
} }
// Get default texture // GetDefaultTexture - Get default texture
func GetDefaultTexture() *Texture2D { func GetDefaultTexture() *Texture2D {
ret := C.GetDefaultTexture() ret := C.GetDefaultTexture()
v := NewTexture2DFromPointer(unsafe.Pointer(&ret)) v := NewTexture2DFromPointer(unsafe.Pointer(&ret))
return &v return &v
} }
// Get shader uniform location // GetShaderLocation - Get shader uniform location
func GetShaderLocation(shader Shader, uniformName string) int32 { func GetShaderLocation(shader Shader, uniformName string) int32 {
cshader := shader.cptr() cshader := shader.cptr()
cuniformName := C.CString(uniformName) cuniformName := C.CString(uniformName)
@ -122,7 +122,7 @@ func GetShaderLocation(shader Shader, uniformName string) int32 {
return v return v
} }
// Set shader uniform value (float) // SetShaderValue - Set shader uniform value (float)
func SetShaderValue(shader Shader, uniformLoc int32, value []float32, size int32) { func SetShaderValue(shader Shader, uniformLoc int32, value []float32, size int32) {
cshader := shader.cptr() cshader := shader.cptr()
cuniformLoc := (C.int)(uniformLoc) cuniformLoc := (C.int)(uniformLoc)
@ -131,7 +131,7 @@ func SetShaderValue(shader Shader, uniformLoc int32, value []float32, size int32
C.SetShaderValue(*cshader, cuniformLoc, cvalue, csize) C.SetShaderValue(*cshader, cuniformLoc, cvalue, csize)
} }
// Set shader uniform value (int) // SetShaderValuei - Set shader uniform value (int)
func SetShaderValuei(shader Shader, uniformLoc int32, value []int32, size int32) { func SetShaderValuei(shader Shader, uniformLoc int32, value []int32, size int32) {
cshader := shader.cptr() cshader := shader.cptr()
cuniformLoc := (C.int)(uniformLoc) cuniformLoc := (C.int)(uniformLoc)
@ -140,7 +140,7 @@ func SetShaderValuei(shader Shader, uniformLoc int32, value []int32, size int32)
C.SetShaderValuei(*cshader, cuniformLoc, cvalue, csize) C.SetShaderValuei(*cshader, cuniformLoc, cvalue, csize)
} }
// Set shader uniform value (matrix 4x4) // SetShaderValueMatrix - Set shader uniform value (matrix 4x4)
func SetShaderValueMatrix(shader Shader, uniformLoc int32, mat Matrix) { func SetShaderValueMatrix(shader Shader, uniformLoc int32, mat Matrix) {
cshader := shader.cptr() cshader := shader.cptr()
cuniformLoc := (C.int)(uniformLoc) cuniformLoc := (C.int)(uniformLoc)
@ -148,72 +148,72 @@ func SetShaderValueMatrix(shader Shader, uniformLoc int32, mat Matrix) {
C.SetShaderValueMatrix(*cshader, cuniformLoc, *cmat) C.SetShaderValueMatrix(*cshader, cuniformLoc, *cmat)
} }
// Set a custom projection matrix (replaces internal projection matrix) // SetMatrixProjection - Set a custom projection matrix (replaces internal projection matrix)
func SetMatrixProjection(proj Matrix) { func SetMatrixProjection(proj Matrix) {
cproj := proj.cptr() cproj := proj.cptr()
C.SetMatrixProjection(*cproj) C.SetMatrixProjection(*cproj)
} }
// Set a custom modelview matrix (replaces internal modelview matrix) // SetMatrixModelview - Set a custom modelview matrix (replaces internal modelview matrix)
func SetMatrixModelview(view Matrix) { func SetMatrixModelview(view Matrix) {
cview := view.cptr() cview := view.cptr()
C.SetMatrixModelview(*cview) C.SetMatrixModelview(*cview)
} }
// Begin custom shader drawing // BeginShaderMode - Begin custom shader drawing
func BeginShaderMode(shader Shader) { func BeginShaderMode(shader Shader) {
cshader := shader.cptr() cshader := shader.cptr()
C.BeginShaderMode(*cshader) C.BeginShaderMode(*cshader)
} }
// End custom shader drawing (use default shader) // EndShaderMode - End custom shader drawing (use default shader)
func EndShaderMode() { func EndShaderMode() {
C.EndShaderMode() C.EndShaderMode()
} }
// Begin blending mode (alpha, additive, multiplied) // BeginBlendMode - Begin blending mode (alpha, additive, multiplied)
func BeginBlendMode(mode BlendMode) { func BeginBlendMode(mode BlendMode) {
cmode := (C.int)(mode) cmode := (C.int)(mode)
C.BeginBlendMode(cmode) C.BeginBlendMode(cmode)
} }
// End blending mode (reset to default: alpha blending) // EndBlendMode - End blending mode (reset to default: alpha blending)
func EndBlendMode() { func EndBlendMode() {
C.EndBlendMode() C.EndBlendMode()
} }
// Init VR device // InitVrDevice - Init VR device
func InitVrDevice(vdDevice VrDevice) { func InitVrDevice(vdDevice VrDevice) {
cvdDevice := (C.int)(vdDevice) cvdDevice := (C.int)(vdDevice)
C.InitVrDevice(cvdDevice) C.InitVrDevice(cvdDevice)
} }
// Close VR device // CloseVrDevice - Close VR device
func CloseVrDevice() { func CloseVrDevice() {
C.CloseVrDevice() C.CloseVrDevice()
} }
// Detect if VR device is ready // IsVrDeviceReady - Detect if VR device is ready
func IsVrDeviceReady() bool { func IsVrDeviceReady() bool {
ret := C.IsVrDeviceReady() ret := C.IsVrDeviceReady()
v := bool(int(ret) == 1) v := bool(int(ret) == 1)
return v return v
} }
// Detect if VR simulator is running // IsVrSimulator - Detect if VR simulator is running
func IsVrSimulator() bool { func IsVrSimulator() bool {
ret := C.IsVrSimulator() ret := C.IsVrSimulator()
v := bool(int(ret) == 1) v := bool(int(ret) == 1)
return v return v
} }
// Update VR tracking (position and orientation) and camera // UpdateVrTracking - Update VR tracking (position and orientation) and camera
func UpdateVrTracking(camera *Camera) { func UpdateVrTracking(camera *Camera) {
ccamera := camera.cptr() ccamera := camera.cptr()
C.UpdateVrTracking(ccamera) C.UpdateVrTracking(ccamera)
} }
// Enable/Disable VR experience (device or simulator) // ToggleVrMode - Enable/Disable VR experience (device or simulator)
func ToggleVrMode() { func ToggleVrMode() {
C.ToggleVrMode() C.ToggleVrMode()
} }

View file

@ -7,7 +7,7 @@ package raylib
import "C" import "C"
import "unsafe" import "unsafe"
// Draw a pixel // DrawPixel - Draw a pixel
func DrawPixel(posX int32, posY int32, color Color) { func DrawPixel(posX int32, posY int32, color Color) {
cposX := (C.int)(posX) cposX := (C.int)(posX)
cposY := (C.int)(posY) cposY := (C.int)(posY)
@ -15,14 +15,14 @@ func DrawPixel(posX int32, posY int32, color Color) {
C.DrawPixel(cposX, cposY, *ccolor) C.DrawPixel(cposX, cposY, *ccolor)
} }
// Draw a pixel (Vector version) // DrawPixelV - Draw a pixel (Vector version)
func DrawPixelV(position Vector2, color Color) { func DrawPixelV(position Vector2, color Color) {
cposition := position.cptr() cposition := position.cptr()
ccolor := color.cptr() ccolor := color.cptr()
C.DrawPixelV(*cposition, *ccolor) C.DrawPixelV(*cposition, *ccolor)
} }
// Draw a line // DrawLine - Draw a line
func DrawLine(startPosX int32, startPosY int32, endPosX int32, endPosY int32, color Color) { func DrawLine(startPosX int32, startPosY int32, endPosX int32, endPosY int32, color Color) {
cstartPosX := (C.int)(startPosX) cstartPosX := (C.int)(startPosX)
cstartPosY := (C.int)(startPosY) cstartPosY := (C.int)(startPosY)
@ -32,7 +32,7 @@ func DrawLine(startPosX int32, startPosY int32, endPosX int32, endPosY int32, co
C.DrawLine(cstartPosX, cstartPosY, cendPosX, cendPosY, *ccolor) C.DrawLine(cstartPosX, cstartPosY, cendPosX, cendPosY, *ccolor)
} }
// Draw a line (Vector version) // DrawLineV - Draw a line (Vector version)
func DrawLineV(startPos Vector2, endPos Vector2, color Color) { func DrawLineV(startPos Vector2, endPos Vector2, color Color) {
cstartPos := startPos.cptr() cstartPos := startPos.cptr()
cendPos := endPos.cptr() cendPos := endPos.cptr()
@ -40,7 +40,7 @@ func DrawLineV(startPos Vector2, endPos Vector2, color Color) {
C.DrawLineV(*cstartPos, *cendPos, *ccolor) C.DrawLineV(*cstartPos, *cendPos, *ccolor)
} }
// Draw a color-filled circle // DrawCircle - Draw a color-filled circle
func DrawCircle(centerX int32, centerY int32, radius float32, color Color) { func DrawCircle(centerX int32, centerY int32, radius float32, color Color) {
ccenterX := (C.int)(centerX) ccenterX := (C.int)(centerX)
ccenterY := (C.int)(centerY) ccenterY := (C.int)(centerY)
@ -49,7 +49,7 @@ func DrawCircle(centerX int32, centerY int32, radius float32, color Color) {
C.DrawCircle(ccenterX, ccenterY, cradius, *ccolor) C.DrawCircle(ccenterX, ccenterY, cradius, *ccolor)
} }
// Draw a gradient-filled circle // DrawCircleGradient - Draw a gradient-filled circle
func DrawCircleGradient(centerX int32, centerY int32, radius float32, color1 Color, color2 Color) { func DrawCircleGradient(centerX int32, centerY int32, radius float32, color1 Color, color2 Color) {
ccenterX := (C.int)(centerX) ccenterX := (C.int)(centerX)
ccenterY := (C.int)(centerY) ccenterY := (C.int)(centerY)
@ -59,7 +59,7 @@ func DrawCircleGradient(centerX int32, centerY int32, radius float32, color1 Col
C.DrawCircleGradient(ccenterX, ccenterY, cradius, *ccolor1, *ccolor2) C.DrawCircleGradient(ccenterX, ccenterY, cradius, *ccolor1, *ccolor2)
} }
// Draw a color-filled circle (Vector version) // DrawCircleV - Draw a color-filled circle (Vector version)
func DrawCircleV(center Vector2, radius float32, color Color) { func DrawCircleV(center Vector2, radius float32, color Color) {
ccenter := center.cptr() ccenter := center.cptr()
cradius := (C.float)(radius) cradius := (C.float)(radius)
@ -67,7 +67,7 @@ func DrawCircleV(center Vector2, radius float32, color Color) {
C.DrawCircleV(*ccenter, cradius, *ccolor) C.DrawCircleV(*ccenter, cradius, *ccolor)
} }
// Draw circle outline // DrawCircleLines - Draw circle outline
func DrawCircleLines(centerX int32, centerY int32, radius float32, color Color) { func DrawCircleLines(centerX int32, centerY int32, radius float32, color Color) {
ccenterX := (C.int)(centerX) ccenterX := (C.int)(centerX)
ccenterY := (C.int)(centerY) ccenterY := (C.int)(centerY)
@ -76,7 +76,7 @@ func DrawCircleLines(centerX int32, centerY int32, radius float32, color Color)
C.DrawCircleLines(ccenterX, ccenterY, cradius, *ccolor) C.DrawCircleLines(ccenterX, ccenterY, cradius, *ccolor)
} }
// Draw a color-filled rectangle // DrawRectangle - Draw a color-filled rectangle
func DrawRectangle(posX int32, posY int32, width int32, height int32, color Color) { func DrawRectangle(posX int32, posY int32, width int32, height int32, color Color) {
cposX := (C.int)(posX) cposX := (C.int)(posX)
cposY := (C.int)(posY) cposY := (C.int)(posY)
@ -86,14 +86,14 @@ func DrawRectangle(posX int32, posY int32, width int32, height int32, color Colo
C.DrawRectangle(cposX, cposY, cwidth, cheight, *ccolor) C.DrawRectangle(cposX, cposY, cwidth, cheight, *ccolor)
} }
// Draw a color-filled rectangle // DrawRectangleRec - Draw a color-filled rectangle
func DrawRectangleRec(rec Rectangle, color Color) { func DrawRectangleRec(rec Rectangle, color Color) {
crec := rec.cptr() crec := rec.cptr()
ccolor := color.cptr() ccolor := color.cptr()
C.DrawRectangleRec(*crec, *ccolor) C.DrawRectangleRec(*crec, *ccolor)
} }
// Draw a gradient-filled rectangle // DrawRectangleGradient - Draw a gradient-filled rectangle
func DrawRectangleGradient(posX int32, posY int32, width int32, height int32, color1 Color, color2 Color) { func DrawRectangleGradient(posX int32, posY int32, width int32, height int32, color1 Color, color2 Color) {
cposX := (C.int)(posX) cposX := (C.int)(posX)
cposY := (C.int)(posY) cposY := (C.int)(posY)
@ -104,7 +104,7 @@ func DrawRectangleGradient(posX int32, posY int32, width int32, height int32, co
C.DrawRectangleGradient(cposX, cposY, cwidth, cheight, *ccolor1, *ccolor2) C.DrawRectangleGradient(cposX, cposY, cwidth, cheight, *ccolor1, *ccolor2)
} }
// Draw a color-filled rectangle (Vector version) // DrawRectangleV - Draw a color-filled rectangle (Vector version)
func DrawRectangleV(position Vector2, size Vector2, color Color) { func DrawRectangleV(position Vector2, size Vector2, color Color) {
cposition := position.cptr() cposition := position.cptr()
csize := size.cptr() csize := size.cptr()
@ -112,7 +112,7 @@ func DrawRectangleV(position Vector2, size Vector2, color Color) {
C.DrawRectangleV(*cposition, *csize, *ccolor) C.DrawRectangleV(*cposition, *csize, *ccolor)
} }
// Draw rectangle outline // DrawRectangleLines - Draw rectangle outline
func DrawRectangleLines(posX int32, posY int32, width int32, height int32, color Color) { func DrawRectangleLines(posX int32, posY int32, width int32, height int32, color Color) {
cposX := (C.int)(posX) cposX := (C.int)(posX)
cposY := (C.int)(posY) cposY := (C.int)(posY)
@ -122,7 +122,7 @@ func DrawRectangleLines(posX int32, posY int32, width int32, height int32, color
C.DrawRectangleLines(cposX, cposY, cwidth, cheight, *ccolor) C.DrawRectangleLines(cposX, cposY, cwidth, cheight, *ccolor)
} }
// Draw a color-filled triangle // DrawTriangle - Draw a color-filled triangle
func DrawTriangle(v1 Vector2, v2 Vector2, v3 Vector2, color Color) { func DrawTriangle(v1 Vector2, v2 Vector2, v3 Vector2, color Color) {
cv1 := v1.cptr() cv1 := v1.cptr()
cv2 := v2.cptr() cv2 := v2.cptr()
@ -131,7 +131,7 @@ func DrawTriangle(v1 Vector2, v2 Vector2, v3 Vector2, color Color) {
C.DrawTriangle(*cv1, *cv2, *cv3, *ccolor) C.DrawTriangle(*cv1, *cv2, *cv3, *ccolor)
} }
// Draw triangle outline // DrawTriangleLines - Draw triangle outline
func DrawTriangleLines(v1 Vector2, v2 Vector2, v3 Vector2, color Color) { func DrawTriangleLines(v1 Vector2, v2 Vector2, v3 Vector2, color Color) {
cv1 := v1.cptr() cv1 := v1.cptr()
cv2 := v2.cptr() cv2 := v2.cptr()
@ -140,7 +140,7 @@ func DrawTriangleLines(v1 Vector2, v2 Vector2, v3 Vector2, color Color) {
C.DrawTriangleLines(*cv1, *cv2, *cv3, *ccolor) C.DrawTriangleLines(*cv1, *cv2, *cv3, *ccolor)
} }
// Draw a regular polygon (Vector version) // DrawPoly - Draw a regular polygon (Vector version)
func DrawPoly(center Vector2, sides int32, radius float32, rotation float32, color Color) { func DrawPoly(center Vector2, sides int32, radius float32, rotation float32, color Color) {
ccenter := center.cptr() ccenter := center.cptr()
csides := (C.int)(sides) csides := (C.int)(sides)
@ -150,7 +150,7 @@ func DrawPoly(center Vector2, sides int32, radius float32, rotation float32, col
C.DrawPoly(*ccenter, csides, cradius, crotation, *ccolor) C.DrawPoly(*ccenter, csides, cradius, crotation, *ccolor)
} }
// Draw a closed polygon defined by points // DrawPolyEx - Draw a closed polygon defined by points
func DrawPolyEx(points []Vector2, numPoints int32, color Color) { func DrawPolyEx(points []Vector2, numPoints int32, color Color) {
cpoints := points[0].cptr() cpoints := points[0].cptr()
cnumPoints := (C.int)(numPoints) cnumPoints := (C.int)(numPoints)
@ -158,7 +158,7 @@ func DrawPolyEx(points []Vector2, numPoints int32, color Color) {
C.DrawPolyEx(cpoints, cnumPoints, *ccolor) C.DrawPolyEx(cpoints, cnumPoints, *ccolor)
} }
// Draw polygon lines // DrawPolyExLines - Draw polygon lines
func DrawPolyExLines(points []Vector2, numPoints int32, color Color) { func DrawPolyExLines(points []Vector2, numPoints int32, color Color) {
cpoints := points[0].cptr() cpoints := points[0].cptr()
cnumPoints := (C.int)(numPoints) cnumPoints := (C.int)(numPoints)
@ -166,7 +166,7 @@ func DrawPolyExLines(points []Vector2, numPoints int32, color Color) {
C.DrawPolyExLines(cpoints, cnumPoints, *ccolor) C.DrawPolyExLines(cpoints, cnumPoints, *ccolor)
} }
// Check collision between two rectangles // CheckCollisionRecs - Check collision between two rectangles
func CheckCollisionRecs(rec1 Rectangle, rec2 Rectangle) bool { func CheckCollisionRecs(rec1 Rectangle, rec2 Rectangle) bool {
crec1 := rec1.cptr() crec1 := rec1.cptr()
crec2 := rec2.cptr() crec2 := rec2.cptr()
@ -175,7 +175,7 @@ func CheckCollisionRecs(rec1 Rectangle, rec2 Rectangle) bool {
return v return v
} }
// Check collision between two circles // CheckCollisionCircles - Check collision between two circles
func CheckCollisionCircles(center1 Vector2, radius1 float32, center2 Vector2, radius2 float32) bool { func CheckCollisionCircles(center1 Vector2, radius1 float32, center2 Vector2, radius2 float32) bool {
ccenter1 := center1.cptr() ccenter1 := center1.cptr()
cradius1 := (C.float)(radius1) cradius1 := (C.float)(radius1)
@ -186,7 +186,7 @@ func CheckCollisionCircles(center1 Vector2, radius1 float32, center2 Vector2, ra
return v return v
} }
// Check collision between circle and rectangle // CheckCollisionCircleRec - Check collision between circle and rectangle
func CheckCollisionCircleRec(center Vector2, radius float32, rec Rectangle) bool { func CheckCollisionCircleRec(center Vector2, radius float32, rec Rectangle) bool {
ccenter := center.cptr() ccenter := center.cptr()
cradius := (C.float)(radius) cradius := (C.float)(radius)
@ -196,7 +196,7 @@ func CheckCollisionCircleRec(center Vector2, radius float32, rec Rectangle) bool
return v return v
} }
// Get collision rectangle for two rectangles collision // GetCollisionRec - Get collision rectangle for two rectangles collision
func GetCollisionRec(rec1 Rectangle, rec2 Rectangle) Rectangle { func GetCollisionRec(rec1 Rectangle, rec2 Rectangle) Rectangle {
crec1 := rec1.cptr() crec1 := rec1.cptr()
crec2 := rec2.cptr() crec2 := rec2.cptr()
@ -205,7 +205,7 @@ func GetCollisionRec(rec1 Rectangle, rec2 Rectangle) Rectangle {
return v return v
} }
// 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()
crec := rec.cptr() crec := rec.cptr()
@ -214,7 +214,7 @@ func CheckCollisionPointRec(point Vector2, rec Rectangle) bool {
return v return v
} }
// Check if point is inside circle // CheckCollisionPointCircle - Check if point is inside circle
func CheckCollisionPointCircle(point Vector2, center Vector2, radius float32) bool { func CheckCollisionPointCircle(point Vector2, center Vector2, radius float32) bool {
cpoint := point.cptr() cpoint := point.cptr()
ccenter := center.cptr() ccenter := center.cptr()
@ -224,7 +224,7 @@ func CheckCollisionPointCircle(point Vector2, center Vector2, radius float32) bo
return v return v
} }
// Check if point is inside a triangle // CheckCollisionPointTriangle - Check if point is inside a triangle
func CheckCollisionPointTriangle(point Vector2, p1 Vector2, p2 Vector2, p3 Vector2) bool { func CheckCollisionPointTriangle(point Vector2, p1 Vector2, p2 Vector2, p3 Vector2) bool {
cpoint := point.cptr() cpoint := point.cptr()
cp1 := p1.cptr() cp1 := p1.cptr()

View file

@ -25,12 +25,12 @@ func (c *CharInfo) cptr() *C.CharInfo {
return (*C.CharInfo)(unsafe.Pointer(c)) return (*C.CharInfo)(unsafe.Pointer(c))
} }
// Returns new SpriteFont // NewCharInfo - Returns new SpriteFont
func NewCharInfo(value int32, rec Rectangle, offsetX, offsetY, advanceX int32) CharInfo { func NewCharInfo(value int32, rec Rectangle, offsetX, offsetY, advanceX int32) CharInfo {
return CharInfo{value, rec, offsetX, offsetY, advanceX} return CharInfo{value, rec, offsetX, offsetY, advanceX}
} }
// Returns new SpriteFont from pointer // NewCharInfoFromPointer - Returns new SpriteFont from pointer
func NewCharInfoFromPointer(ptr unsafe.Pointer) CharInfo { func NewCharInfoFromPointer(ptr unsafe.Pointer) CharInfo {
return *(*CharInfo)(ptr) return *(*CharInfo)(ptr)
} }
@ -51,24 +51,24 @@ func (s *SpriteFont) cptr() *C.SpriteFont {
return (*C.SpriteFont)(unsafe.Pointer(s)) return (*C.SpriteFont)(unsafe.Pointer(s))
} }
// Returns new SpriteFont // NewSpriteFont - Returns new SpriteFont
func NewSpriteFont(texture Texture2D, baseSize, charsCount int32, chars *CharInfo) SpriteFont { func NewSpriteFont(texture Texture2D, baseSize, charsCount int32, chars *CharInfo) SpriteFont {
return SpriteFont{texture, baseSize, charsCount, chars} return SpriteFont{texture, baseSize, charsCount, chars}
} }
// Returns new SpriteFont from pointer // NewSpriteFontFromPointer - Returns new SpriteFont from pointer
func NewSpriteFontFromPointer(ptr unsafe.Pointer) SpriteFont { func NewSpriteFontFromPointer(ptr unsafe.Pointer) SpriteFont {
return *(*SpriteFont)(ptr) return *(*SpriteFont)(ptr)
} }
// Get the default SpriteFont // GetDefaultFont - Get the default SpriteFont
func GetDefaultFont() SpriteFont { func GetDefaultFont() SpriteFont {
ret := C.GetDefaultFont() ret := C.GetDefaultFont()
v := NewSpriteFontFromPointer(unsafe.Pointer(&ret)) v := NewSpriteFontFromPointer(unsafe.Pointer(&ret))
return v return v
} }
// Load a SpriteFont image into GPU memory // LoadSpriteFont - Load a SpriteFont image into GPU memory
func LoadSpriteFont(fileName string) SpriteFont { func LoadSpriteFont(fileName string) SpriteFont {
cfileName := C.CString(fileName) cfileName := C.CString(fileName)
defer C.free(unsafe.Pointer(cfileName)) defer C.free(unsafe.Pointer(cfileName))
@ -77,7 +77,7 @@ func LoadSpriteFont(fileName string) SpriteFont {
return v return v
} }
// Load a SpriteFont from TTF font with parameters // LoadSpriteFontTTF - Load a SpriteFont from TTF font with parameters
func LoadSpriteFontTTF(fileName string, fontSize int32, charsCount int32, fontChars *int32) SpriteFont { func LoadSpriteFontTTF(fileName string, fontSize int32, charsCount int32, fontChars *int32) SpriteFont {
cfileName := C.CString(fileName) cfileName := C.CString(fileName)
defer C.free(unsafe.Pointer(cfileName)) defer C.free(unsafe.Pointer(cfileName))
@ -89,13 +89,13 @@ func LoadSpriteFontTTF(fileName string, fontSize int32, charsCount int32, fontCh
return v return v
} }
// Unload SpriteFont from GPU memory // UnloadSpriteFont - Unload SpriteFont from GPU memory
func UnloadSpriteFont(spriteFont SpriteFont) { func UnloadSpriteFont(spriteFont SpriteFont) {
cspriteFont := spriteFont.cptr() cspriteFont := spriteFont.cptr()
C.UnloadSpriteFont(*cspriteFont) C.UnloadSpriteFont(*cspriteFont)
} }
// Draw text (using default font) // DrawText - Draw text (using default font)
func DrawText(text string, posX int32, posY int32, fontSize int32, color Color) { func DrawText(text string, posX int32, posY int32, fontSize int32, color Color) {
ctext := C.CString(text) ctext := C.CString(text)
defer C.free(unsafe.Pointer(ctext)) defer C.free(unsafe.Pointer(ctext))
@ -106,7 +106,7 @@ func DrawText(text string, posX int32, posY int32, fontSize int32, color Color)
C.DrawText(ctext, cposX, cposY, cfontSize, *ccolor) C.DrawText(ctext, cposX, cposY, cfontSize, *ccolor)
} }
// Draw text using SpriteFont and additional parameters // DrawTextEx - Draw text using SpriteFont and additional parameters
func DrawTextEx(spriteFont SpriteFont, text string, position Vector2, fontSize float32, spacing int32, tint Color) { func DrawTextEx(spriteFont SpriteFont, text string, position Vector2, fontSize float32, spacing int32, tint Color) {
cspriteFont := spriteFont.cptr() cspriteFont := spriteFont.cptr()
ctext := C.CString(text) ctext := C.CString(text)
@ -118,7 +118,7 @@ func DrawTextEx(spriteFont SpriteFont, text string, position Vector2, fontSize f
C.DrawTextEx(*cspriteFont, ctext, *cposition, cfontSize, cspacing, *ctint) C.DrawTextEx(*cspriteFont, ctext, *cposition, cfontSize, cspacing, *ctint)
} }
// Measure string width for default font // MeasureText - Measure string width for default font
func MeasureText(text string, fontSize int32) int32 { func MeasureText(text string, fontSize int32) int32 {
ctext := C.CString(text) ctext := C.CString(text)
defer C.free(unsafe.Pointer(ctext)) defer C.free(unsafe.Pointer(ctext))
@ -128,7 +128,7 @@ func MeasureText(text string, fontSize int32) int32 {
return v return v
} }
// Measure string size for SpriteFont // MeasureTextEx - Measure string size for SpriteFont
func MeasureTextEx(spriteFont SpriteFont, text string, fontSize float32, spacing int32) Vector2 { func MeasureTextEx(spriteFont SpriteFont, text string, fontSize float32, spacing int32) Vector2 {
cspriteFont := spriteFont.cptr() cspriteFont := spriteFont.cptr()
ctext := C.CString(text) ctext := C.CString(text)
@ -140,7 +140,7 @@ func MeasureTextEx(spriteFont SpriteFont, text string, fontSize float32, spacing
return v return v
} }
// Shows current FPS // DrawFPS - Shows current FPS
func DrawFPS(posX int32, posY int32) { func DrawFPS(posX int32, posY int32) {
cposX := (C.int)(posX) cposX := (C.int)(posX)
cposY := (C.int)(posY) cposY := (C.int)(posY)

View file

@ -101,12 +101,12 @@ func (i *Image) cptr() *C.Image {
return (*C.Image)(unsafe.Pointer(i)) return (*C.Image)(unsafe.Pointer(i))
} }
// Returns new Image // NewImage - Returns new Image
func NewImage(data unsafe.Pointer, width, height, mipmaps int32, format TextureFormat) *Image { func NewImage(data unsafe.Pointer, width, height, mipmaps int32, format TextureFormat) *Image {
return &Image{data, width, height, mipmaps, format} return &Image{data, width, height, mipmaps, format}
} }
// Returns new Image from pointer // NewImageFromPointer - Returns new Image from pointer
func NewImageFromPointer(ptr unsafe.Pointer) *Image { func NewImageFromPointer(ptr unsafe.Pointer) *Image {
return (*Image)(ptr) return (*Image)(ptr)
} }
@ -130,12 +130,12 @@ func (t *Texture2D) cptr() *C.Texture2D {
return (*C.Texture2D)(unsafe.Pointer(t)) return (*C.Texture2D)(unsafe.Pointer(t))
} }
// Returns new Texture2D // NewTexture2D - Returns new Texture2D
func NewTexture2D(id uint32, width, height, mipmaps int32, format TextureFormat) Texture2D { func NewTexture2D(id uint32, width, height, mipmaps int32, format TextureFormat) Texture2D {
return Texture2D{id, width, height, mipmaps, format} return Texture2D{id, width, height, mipmaps, format}
} }
// Returns new Texture2D from pointer // NewTexture2DFromPointer - Returns new Texture2D from pointer
func NewTexture2DFromPointer(ptr unsafe.Pointer) Texture2D { func NewTexture2DFromPointer(ptr unsafe.Pointer) Texture2D {
return *(*Texture2D)(ptr) return *(*Texture2D)(ptr)
} }
@ -154,17 +154,17 @@ func (r *RenderTexture2D) cptr() *C.RenderTexture2D {
return (*C.RenderTexture2D)(unsafe.Pointer(r)) return (*C.RenderTexture2D)(unsafe.Pointer(r))
} }
// Returns new RenderTexture2D // NewRenderTexture2D - Returns new RenderTexture2D
func NewRenderTexture2D(id uint32, texture, depth Texture2D) RenderTexture2D { func NewRenderTexture2D(id uint32, texture, depth Texture2D) RenderTexture2D {
return RenderTexture2D{id, texture, depth} return RenderTexture2D{id, texture, depth}
} }
// Returns new RenderTexture2D from pointer // NewRenderTexture2DFromPointer - Returns new RenderTexture2D from pointer
func NewRenderTexture2DFromPointer(ptr unsafe.Pointer) RenderTexture2D { func NewRenderTexture2DFromPointer(ptr unsafe.Pointer) RenderTexture2D {
return *(*RenderTexture2D)(ptr) return *(*RenderTexture2D)(ptr)
} }
// Load an image into CPU memory (RAM) // LoadImage - Load an image into CPU memory (RAM)
func LoadImage(fileName string) *Image { func LoadImage(fileName string) *Image {
cfileName := C.CString(fileName) cfileName := C.CString(fileName)
defer C.free(unsafe.Pointer(cfileName)) defer C.free(unsafe.Pointer(cfileName))
@ -173,7 +173,7 @@ func LoadImage(fileName string) *Image {
return v return v
} }
// Load image data from Color array data (RGBA - 32bit) // LoadImageEx - Load image data from Color array data (RGBA - 32bit)
func LoadImageEx(pixels []Color, width int32, height int32) *Image { func LoadImageEx(pixels []Color, width int32, height int32) *Image {
cpixels := pixels[0].cptr() cpixels := pixels[0].cptr()
cwidth := (C.int)(width) cwidth := (C.int)(width)
@ -183,7 +183,7 @@ func LoadImageEx(pixels []Color, width int32, height int32) *Image {
return v return v
} }
// Load image from raw data with parameters // LoadImagePro - Load image from raw data with parameters
func LoadImagePro(data []byte, width int32, height int32, format TextureFormat) *Image { func LoadImagePro(data []byte, width int32, height int32, format TextureFormat) *Image {
cdata := unsafe.Pointer(&data[0]) cdata := unsafe.Pointer(&data[0])
cwidth := (C.int)(width) cwidth := (C.int)(width)
@ -194,7 +194,7 @@ func LoadImagePro(data []byte, width int32, height int32, format TextureFormat)
return v return v
} }
// Load image data from RAW file // LoadImageRaw - Load image data from RAW file
func LoadImageRaw(fileName string, width int32, height int32, format TextureFormat, headerSize int32) *Image { func LoadImageRaw(fileName string, width int32, height int32, format TextureFormat, headerSize int32) *Image {
cfileName := C.CString(fileName) cfileName := C.CString(fileName)
defer C.free(unsafe.Pointer(cfileName)) defer C.free(unsafe.Pointer(cfileName))
@ -207,7 +207,7 @@ func LoadImageRaw(fileName string, width int32, height int32, format TextureForm
return v return v
} }
// 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)
defer C.free(unsafe.Pointer(cfileName)) defer C.free(unsafe.Pointer(cfileName))
@ -216,7 +216,7 @@ func LoadTexture(fileName string) Texture2D {
return v return v
} }
// Load a texture from image data // LoadTextureFromImage - Load a texture from image data
func LoadTextureFromImage(image *Image) Texture2D { func LoadTextureFromImage(image *Image) Texture2D {
cimage := image.cptr() cimage := image.cptr()
ret := C.LoadTextureFromImage(*cimage) ret := C.LoadTextureFromImage(*cimage)
@ -224,7 +224,7 @@ func LoadTextureFromImage(image *Image) Texture2D {
return v return v
} }
// Load a texture to be used for rendering // LoadRenderTexture - Load a texture to be used for rendering
func LoadRenderTexture(width int32, height int32) RenderTexture2D { func LoadRenderTexture(width int32, height int32) RenderTexture2D {
cwidth := (C.int)(width) cwidth := (C.int)(width)
cheight := (C.int)(height) cheight := (C.int)(height)
@ -233,32 +233,32 @@ func LoadRenderTexture(width int32, height int32) RenderTexture2D {
return v return v
} }
// Unload image from CPU memory (RAM) // UnloadImage - Unload image from CPU memory (RAM)
func UnloadImage(image *Image) { func UnloadImage(image *Image) {
cimage := image.cptr() cimage := image.cptr()
C.UnloadImage(*cimage) C.UnloadImage(*cimage)
} }
// Unload texture from GPU memory // UnloadTexture - Unload texture from GPU memory
func UnloadTexture(texture Texture2D) { func UnloadTexture(texture Texture2D) {
ctexture := texture.cptr() ctexture := texture.cptr()
C.UnloadTexture(*ctexture) C.UnloadTexture(*ctexture)
} }
// Unload render texture from GPU memory // UnloadRenderTexture - Unload render texture from GPU memory
func UnloadRenderTexture(target RenderTexture2D) { func UnloadRenderTexture(target RenderTexture2D) {
ctarget := target.cptr() ctarget := target.cptr()
C.UnloadRenderTexture(*ctarget) C.UnloadRenderTexture(*ctarget)
} }
// Get pixel data from image // GetImageData - Get pixel data from image
func GetImageData(image *Image) unsafe.Pointer { func GetImageData(image *Image) unsafe.Pointer {
cimage := image.cptr() cimage := image.cptr()
ret := C.GetImageData(*cimage) ret := C.GetImageData(*cimage)
return unsafe.Pointer(ret) return unsafe.Pointer(ret)
} }
// Get pixel data from GPU texture and return an Image // GetTextureData - Get pixel data from GPU texture and return an Image
func GetTextureData(texture Texture2D) *Image { func GetTextureData(texture Texture2D) *Image {
ctexture := texture.cptr() ctexture := texture.cptr()
ret := C.GetTextureData(*ctexture) ret := C.GetTextureData(*ctexture)
@ -266,35 +266,35 @@ func GetTextureData(texture Texture2D) *Image {
return v return v
} }
// Update GPU texture with new data // UpdateTexture - Update GPU texture with new data
func UpdateTexture(texture Texture2D, pixels unsafe.Pointer) { func UpdateTexture(texture Texture2D, pixels unsafe.Pointer) {
ctexture := texture.cptr() ctexture := texture.cptr()
cpixels := (unsafe.Pointer)(unsafe.Pointer(pixels)) cpixels := (unsafe.Pointer)(unsafe.Pointer(pixels))
C.UpdateTexture(*ctexture, cpixels) C.UpdateTexture(*ctexture, cpixels)
} }
// Convert image to POT (power-of-two) // ImageToPOT - Convert image to POT (power-of-two)
func ImageToPOT(image *Image, fillColor Color) { func ImageToPOT(image *Image, fillColor Color) {
cimage := image.cptr() cimage := image.cptr()
cfillColor := fillColor.cptr() cfillColor := fillColor.cptr()
C.ImageToPOT(cimage, *cfillColor) C.ImageToPOT(cimage, *cfillColor)
} }
// Convert image data to desired format // ImageFormat - Convert image data to desired format
func ImageFormat(image *Image, newFormat int32) { func ImageFormat(image *Image, newFormat int32) {
cimage := image.cptr() cimage := image.cptr()
cnewFormat := (C.int)(newFormat) cnewFormat := (C.int)(newFormat)
C.ImageFormat(cimage, cnewFormat) C.ImageFormat(cimage, cnewFormat)
} }
// Apply alpha mask to image // ImageAlphaMask - Apply alpha mask to image
func ImageAlphaMask(image *Image, alphaMask *Image) { func ImageAlphaMask(image *Image, alphaMask *Image) {
cimage := image.cptr() cimage := image.cptr()
calphaMask := alphaMask.cptr() calphaMask := alphaMask.cptr()
C.ImageAlphaMask(cimage, *calphaMask) C.ImageAlphaMask(cimage, *calphaMask)
} }
// Dither image data to 16bpp or lower (Floyd-Steinberg dithering) // ImageDither - Dither image data to 16bpp or lower (Floyd-Steinberg dithering)
func ImageDither(image *Image, rBpp int32, gBpp int32, bBpp int32, aBpp int32) { func ImageDither(image *Image, rBpp int32, gBpp int32, bBpp int32, aBpp int32) {
cimage := image.cptr() cimage := image.cptr()
crBpp := (C.int)(rBpp) crBpp := (C.int)(rBpp)
@ -304,7 +304,7 @@ func ImageDither(image *Image, rBpp int32, gBpp int32, bBpp int32, aBpp int32) {
C.ImageDither(cimage, crBpp, cgBpp, cbBpp, caBpp) C.ImageDither(cimage, crBpp, cgBpp, cbBpp, caBpp)
} }
// Create an image duplicate (useful for transformations) // ImageCopy - Create an image duplicate (useful for transformations)
func ImageCopy(image *Image) *Image { func ImageCopy(image *Image) *Image {
cimage := image.cptr() cimage := image.cptr()
ret := C.ImageCopy(*cimage) ret := C.ImageCopy(*cimage)
@ -312,14 +312,14 @@ func ImageCopy(image *Image) *Image {
return v return v
} }
// Crop an image to a defined rectangle // ImageCrop - Crop an image to a defined rectangle
func ImageCrop(image *Image, crop Rectangle) { func ImageCrop(image *Image, crop Rectangle) {
cimage := image.cptr() cimage := image.cptr()
ccrop := crop.cptr() ccrop := crop.cptr()
C.ImageCrop(cimage, *ccrop) C.ImageCrop(cimage, *ccrop)
} }
// Resize an image (bilinear filtering) // ImageResize - Resize an image (bilinear filtering)
func ImageResize(image *Image, newWidth int32, newHeight int32) { func ImageResize(image *Image, newWidth int32, newHeight int32) {
cimage := image.cptr() cimage := image.cptr()
cnewWidth := (C.int)(newWidth) cnewWidth := (C.int)(newWidth)
@ -327,7 +327,7 @@ func ImageResize(image *Image, newWidth int32, newHeight int32) {
C.ImageResize(cimage, cnewWidth, cnewHeight) C.ImageResize(cimage, cnewWidth, cnewHeight)
} }
// Resize an image (Nearest-Neighbor scaling algorithm) // ImageResizeNN - Resize an image (Nearest-Neighbor scaling algorithm)
func ImageResizeNN(image *Image, newWidth int32, newHeight int32) { func ImageResizeNN(image *Image, newWidth int32, newHeight int32) {
cimage := image.cptr() cimage := image.cptr()
cnewWidth := (C.int)(newWidth) cnewWidth := (C.int)(newWidth)
@ -335,7 +335,7 @@ func ImageResizeNN(image *Image, newWidth int32, newHeight int32) {
C.ImageResizeNN(cimage, cnewWidth, cnewHeight) C.ImageResizeNN(cimage, cnewWidth, cnewHeight)
} }
// Create an image from text (default font) // ImageText - Create an image from text (default font)
func ImageText(text string, fontSize int32, color Color) *Image { func ImageText(text string, fontSize int32, color Color) *Image {
ctext := C.CString(text) ctext := C.CString(text)
defer C.free(unsafe.Pointer(ctext)) defer C.free(unsafe.Pointer(ctext))
@ -346,7 +346,7 @@ func ImageText(text string, fontSize int32, color Color) *Image {
return v return v
} }
// Create an image from text (custom sprite font) // ImageTextEx - Create an image from text (custom sprite font)
func ImageTextEx(font SpriteFont, text string, fontSize float32, spacing int32, tint Color) *Image { func ImageTextEx(font SpriteFont, text string, fontSize float32, spacing int32, tint Color) *Image {
cfont := font.cptr() cfont := font.cptr()
ctext := C.CString(text) ctext := C.CString(text)
@ -359,7 +359,7 @@ func ImageTextEx(font SpriteFont, text string, fontSize float32, spacing int32,
return v return v
} }
// Draw a source image within a destination image // ImageDraw - Draw a source image within a destination image
func ImageDraw(dst *Image, src *Image, srcRec Rectangle, dstRec Rectangle) { func ImageDraw(dst *Image, src *Image, srcRec Rectangle, dstRec Rectangle) {
cdst := dst.cptr() cdst := dst.cptr()
csrc := src.cptr() csrc := src.cptr()
@ -368,7 +368,7 @@ func ImageDraw(dst *Image, src *Image, srcRec Rectangle, dstRec Rectangle) {
C.ImageDraw(cdst, *csrc, *csrcRec, *cdstRec) C.ImageDraw(cdst, *csrc, *csrcRec, *cdstRec)
} }
// Draw text (default font) within an image (destination) // ImageDrawText - Draw text (default font) within an image (destination)
func ImageDrawText(dst *Image, position Vector2, text string, fontSize int32, color Color) { func ImageDrawText(dst *Image, position Vector2, text string, fontSize int32, color Color) {
cdst := dst.cptr() cdst := dst.cptr()
cposition := position.cptr() cposition := position.cptr()
@ -379,7 +379,7 @@ func ImageDrawText(dst *Image, position Vector2, text string, fontSize int32, co
C.ImageDrawText(cdst, *cposition, ctext, cfontSize, *ccolor) C.ImageDrawText(cdst, *cposition, ctext, cfontSize, *ccolor)
} }
// Draw text (custom sprite font) within an image (destination) // ImageDrawTextEx - Draw text (custom sprite font) within an image (destination)
func ImageDrawTextEx(dst *Image, position Vector2, font SpriteFont, text string, fontSize float32, spacing int32, color Color) { func ImageDrawTextEx(dst *Image, position Vector2, font SpriteFont, text string, fontSize float32, spacing int32, color Color) {
cdst := dst.cptr() cdst := dst.cptr()
cposition := position.cptr() cposition := position.cptr()
@ -392,72 +392,72 @@ func ImageDrawTextEx(dst *Image, position Vector2, font SpriteFont, text string,
C.ImageDrawTextEx(cdst, *cposition, *cfont, ctext, cfontSize, cspacing, *ccolor) C.ImageDrawTextEx(cdst, *cposition, *cfont, ctext, cfontSize, cspacing, *ccolor)
} }
// Flip image vertically // ImageFlipVertical - Flip image vertically
func ImageFlipVertical(image *Image) { func ImageFlipVertical(image *Image) {
cimage := image.cptr() cimage := image.cptr()
C.ImageFlipVertical(cimage) C.ImageFlipVertical(cimage)
} }
// Flip image horizontally // ImageFlipHorizontal - Flip image horizontally
func ImageFlipHorizontal(image *Image) { func ImageFlipHorizontal(image *Image) {
cimage := image.cptr() cimage := image.cptr()
C.ImageFlipHorizontal(cimage) C.ImageFlipHorizontal(cimage)
} }
// Modify image color: tint // ImageColorTint - Modify image color: tint
func ImageColorTint(image *Image, color Color) { func ImageColorTint(image *Image, color Color) {
cimage := image.cptr() cimage := image.cptr()
ccolor := color.cptr() ccolor := color.cptr()
C.ImageColorTint(cimage, *ccolor) C.ImageColorTint(cimage, *ccolor)
} }
// Modify image color: invert // ImageColorInvert - Modify image color: invert
func ImageColorInvert(image *Image) { func ImageColorInvert(image *Image) {
cimage := image.cptr() cimage := image.cptr()
C.ImageColorInvert(cimage) C.ImageColorInvert(cimage)
} }
// Modify image color: grayscale // ImageColorGrayscale - Modify image color: grayscale
func ImageColorGrayscale(image *Image) { func ImageColorGrayscale(image *Image) {
cimage := image.cptr() cimage := image.cptr()
C.ImageColorGrayscale(cimage) C.ImageColorGrayscale(cimage)
} }
// Modify image color: contrast (-100 to 100) // ImageColorContrast - Modify image color: contrast (-100 to 100)
func ImageColorContrast(image *Image, contrast float32) { func ImageColorContrast(image *Image, contrast float32) {
cimage := image.cptr() cimage := image.cptr()
ccontrast := (C.float)(contrast) ccontrast := (C.float)(contrast)
C.ImageColorContrast(cimage, ccontrast) C.ImageColorContrast(cimage, ccontrast)
} }
// Modify image color: brightness (-255 to 255) // ImageColorBrightness - Modify image color: brightness (-255 to 255)
func ImageColorBrightness(image *Image, brightness int32) { func ImageColorBrightness(image *Image, brightness int32) {
cimage := image.cptr() cimage := image.cptr()
cbrightness := (C.int)(brightness) cbrightness := (C.int)(brightness)
C.ImageColorBrightness(cimage, cbrightness) C.ImageColorBrightness(cimage, cbrightness)
} }
// Generate GPU mipmaps for a texture // GenTextureMipmaps - Generate GPU mipmaps for a texture
func GenTextureMipmaps(texture *Texture2D) { func GenTextureMipmaps(texture *Texture2D) {
ctexture := texture.cptr() ctexture := texture.cptr()
C.GenTextureMipmaps(ctexture) C.GenTextureMipmaps(ctexture)
} }
// Set texture scaling filter mode // SetTextureFilter - Set texture scaling filter mode
func SetTextureFilter(texture Texture2D, filterMode TextureFilterMode) { func SetTextureFilter(texture Texture2D, filterMode TextureFilterMode) {
ctexture := texture.cptr() ctexture := texture.cptr()
cfilterMode := (C.int)(filterMode) cfilterMode := (C.int)(filterMode)
C.SetTextureFilter(*ctexture, cfilterMode) C.SetTextureFilter(*ctexture, cfilterMode)
} }
// Set texture wrapping mode // SetTextureWrap - Set texture wrapping mode
func SetTextureWrap(texture Texture2D, wrapMode TextureWrapMode) { func SetTextureWrap(texture Texture2D, wrapMode TextureWrapMode) {
ctexture := texture.cptr() ctexture := texture.cptr()
cwrapMode := (C.int)(wrapMode) cwrapMode := (C.int)(wrapMode)
C.SetTextureWrap(*ctexture, cwrapMode) C.SetTextureWrap(*ctexture, cwrapMode)
} }
// Draw a Texture2D // DrawTexture - Draw a Texture2D
func DrawTexture(texture Texture2D, posX int32, posY int32, tint Color) { func DrawTexture(texture Texture2D, posX int32, posY int32, tint Color) {
ctexture := texture.cptr() ctexture := texture.cptr()
cposX := (C.int)(posX) cposX := (C.int)(posX)
@ -466,7 +466,7 @@ func DrawTexture(texture Texture2D, posX int32, posY int32, tint Color) {
C.DrawTexture(*ctexture, cposX, cposY, *ctint) C.DrawTexture(*ctexture, cposX, cposY, *ctint)
} }
// Draw a Texture2D with position defined as Vector2 // DrawTextureV - Draw a Texture2D with position defined as Vector2
func DrawTextureV(texture Texture2D, position Vector2, tint Color) { func DrawTextureV(texture Texture2D, position Vector2, tint Color) {
ctexture := texture.cptr() ctexture := texture.cptr()
cposition := position.cptr() cposition := position.cptr()
@ -474,7 +474,7 @@ func DrawTextureV(texture Texture2D, position Vector2, tint Color) {
C.DrawTextureV(*ctexture, *cposition, *ctint) C.DrawTextureV(*ctexture, *cposition, *ctint)
} }
// Draw a Texture2D with extended parameters // DrawTextureEx - Draw a Texture2D with extended parameters
func DrawTextureEx(texture Texture2D, position Vector2, rotation float32, scale float32, tint Color) { func DrawTextureEx(texture Texture2D, position Vector2, rotation float32, scale float32, tint Color) {
ctexture := texture.cptr() ctexture := texture.cptr()
cposition := position.cptr() cposition := position.cptr()
@ -484,7 +484,7 @@ func DrawTextureEx(texture Texture2D, position Vector2, rotation float32, scale
C.DrawTextureEx(*ctexture, *cposition, crotation, cscale, *ctint) C.DrawTextureEx(*ctexture, *cposition, crotation, cscale, *ctint)
} }
// Draw a part of a texture defined by a rectangle // DrawTextureRec - Draw a part of a texture defined by a rectangle
func DrawTextureRec(texture Texture2D, sourceRec Rectangle, position Vector2, tint Color) { func DrawTextureRec(texture Texture2D, sourceRec Rectangle, position Vector2, tint Color) {
ctexture := texture.cptr() ctexture := texture.cptr()
csourceRec := sourceRec.cptr() csourceRec := sourceRec.cptr()
@ -493,7 +493,7 @@ func DrawTextureRec(texture Texture2D, sourceRec Rectangle, position Vector2, ti
C.DrawTextureRec(*ctexture, *csourceRec, *cposition, *ctint) C.DrawTextureRec(*ctexture, *csourceRec, *cposition, *ctint)
} }
// Draw a part of a texture defined by a rectangle with 'pro' parameters // DrawTexturePro - Draw a part of a texture defined by a rectangle with 'pro' parameters
func DrawTexturePro(texture Texture2D, sourceRec Rectangle, destRec Rectangle, origin Vector2, rotation float32, tint Color) { func DrawTexturePro(texture Texture2D, sourceRec Rectangle, destRec Rectangle, origin Vector2, rotation float32, tint Color) {
ctexture := texture.cptr() ctexture := texture.cptr()
csourceRec := sourceRec.cptr() csourceRec := sourceRec.cptr()

View file

@ -17,12 +17,12 @@ const (
var traceDebugMsgs = false var traceDebugMsgs = false
// Set debug messages // SetDebug - Set debug messages
func SetDebug(enabled bool) { func SetDebug(enabled bool) {
traceDebugMsgs = enabled traceDebugMsgs = enabled
} }
// Trace log // TraceLog - Trace log
func TraceLog(msgType int, text string, v ...interface{}) { func TraceLog(msgType int, text string, v ...interface{}) {
switch msgType { switch msgType {
case LogInfo: case LogInfo:
@ -39,7 +39,7 @@ func TraceLog(msgType int, text string, v ...interface{}) {
} }
} }
// HomeDir returns user home directory // HomeDir - Returns user home directory
func HomeDir() string { func HomeDir() string {
return os.Getenv("HOME") return os.Getenv("HOME")
} }

View file

@ -30,12 +30,12 @@ const (
var traceDebugMsgs = false var traceDebugMsgs = false
// Set debug messages // SetDebug - Set debug messages
func SetDebug(enabled bool) { func SetDebug(enabled bool) {
traceDebugMsgs = enabled traceDebugMsgs = enabled
} }
// Trace log // TraceLog - Trace log
func TraceLog(msgType int, text string, v ...interface{}) { func TraceLog(msgType int, text string, v ...interface{}) {
switch msgType { switch msgType {
case LogInfo: case LogInfo:
@ -60,7 +60,7 @@ func TraceLog(msgType int, text string, v ...interface{}) {
} }
} }
// HomeDir returns user home directory // HomeDir - Returns user home directory
// NOTE: On Android this returns internal data path and must be called after InitWindow // NOTE: On Android this returns internal data path and must be called after InitWindow
func HomeDir() string { func HomeDir() string {
return C.GoString(C.get_internal_storage_path()) return C.GoString(C.get_internal_storage_path())

View file

@ -17,12 +17,12 @@ const (
var traceDebugMsgs = false var traceDebugMsgs = false
// Set debug messages // SetDebug - Set debug messages
func SetDebug(enabled bool) { func SetDebug(enabled bool) {
traceDebugMsgs = enabled traceDebugMsgs = enabled
} }
// Trace log // TraceLog - Trace log
func TraceLog(msgType int, text string, v ...interface{}) { func TraceLog(msgType int, text string, v ...interface{}) {
switch msgType { switch msgType {
case LogInfo: case LogInfo:
@ -39,7 +39,7 @@ func TraceLog(msgType int, text string, v ...interface{}) {
} }
} }
// HomeDir returns user home directory // HomeDir - Returns user home directory
func HomeDir() string { func HomeDir() string {
home := os.Getenv("HOMEDRIVE") + os.Getenv("HOMEPATH") home := os.Getenv("HOMEDRIVE") + os.Getenv("HOMEPATH")
if home == "" { if home == "" {

View file

@ -7,7 +7,7 @@ import (
"github.com/gen2brain/raylib-go/raylib" "github.com/gen2brain/raylib-go/raylib"
) )
// Add two vectors // VectorAdd - Add two vectors
func VectorAdd(v1, v2 raylib.Vector3) raylib.Vector3 { func VectorAdd(v1, v2 raylib.Vector3) raylib.Vector3 {
result := raylib.Vector3{} result := raylib.Vector3{}
@ -18,7 +18,7 @@ func VectorAdd(v1, v2 raylib.Vector3) raylib.Vector3 {
return result return result
} }
// Subtract two vectors // VectorSubtract - Subtract two vectors
func VectorSubtract(v1, v2 raylib.Vector3) raylib.Vector3 { func VectorSubtract(v1, v2 raylib.Vector3) raylib.Vector3 {
result := raylib.Vector3{} result := raylib.Vector3{}
@ -29,7 +29,7 @@ func VectorSubtract(v1, v2 raylib.Vector3) raylib.Vector3 {
return result return result
} }
// Calculate two vectors cross product // VectorCrossProduct - Calculate two vectors cross product
func VectorCrossProduct(v1, v2 raylib.Vector3) raylib.Vector3 { func VectorCrossProduct(v1, v2 raylib.Vector3) raylib.Vector3 {
result := raylib.Vector3{} result := raylib.Vector3{}
@ -40,7 +40,7 @@ func VectorCrossProduct(v1, v2 raylib.Vector3) raylib.Vector3 {
return result return result
} }
// Calculate one vector perpendicular vector // VectorPerpendicular - Calculate one vector perpendicular vector
func VectorPerpendicular(v raylib.Vector3) raylib.Vector3 { func VectorPerpendicular(v raylib.Vector3) raylib.Vector3 {
result := raylib.Vector3{} result := raylib.Vector3{}
@ -61,31 +61,31 @@ func VectorPerpendicular(v raylib.Vector3) raylib.Vector3 {
return result return result
} }
// Calculate two vectors dot product // VectorDotProduct - Calculate two vectors dot product
func VectorDotProduct(v1, v2 raylib.Vector3) float32 { func VectorDotProduct(v1, v2 raylib.Vector3) float32 {
return v1.X*v2.X + v1.Y*v2.Y + v1.Z*v2.Z return v1.X*v2.X + v1.Y*v2.Y + v1.Z*v2.Z
} }
// Calculate vector length // VectorLength - Calculate vector length
func VectorLength(v raylib.Vector3) float32 { func VectorLength(v raylib.Vector3) float32 {
return float32(math.Sqrt(float64(v.X*v.X + v.Y*v.Y + v.Z*v.Z))) return float32(math.Sqrt(float64(v.X*v.X + v.Y*v.Y + v.Z*v.Z)))
} }
// Scale provided vector // VectorScale - Scale provided vector
func VectorScale(v *raylib.Vector3, scale float32) { func VectorScale(v *raylib.Vector3, scale float32) {
v.X *= scale v.X *= scale
v.Y *= scale v.Y *= scale
v.Z *= scale v.Z *= scale
} }
// Negate provided vector (invert direction) // VectorNegate - Negate provided vector (invert direction)
func VectorNegate(v *raylib.Vector3) { func VectorNegate(v *raylib.Vector3) {
v.X = -v.X v.X = -v.X
v.Y = -v.Y v.Y = -v.Y
v.Z = -v.Z v.Z = -v.Z
} }
// Normalize provided vector // VectorNormalize - Normalize provided vector
func VectorNormalize(v *raylib.Vector3) { func VectorNormalize(v *raylib.Vector3) {
var length, ilength float32 var length, ilength float32
@ -102,7 +102,7 @@ func VectorNormalize(v *raylib.Vector3) {
v.Z *= ilength v.Z *= ilength
} }
// Calculate distance between two points // VectorDistance - Calculate distance between two points
func VectorDistance(v1, v2 raylib.Vector3) float32 { func VectorDistance(v1, v2 raylib.Vector3) float32 {
var result float32 var result float32
@ -115,7 +115,7 @@ func VectorDistance(v1, v2 raylib.Vector3) float32 {
return result return result
} }
// Calculate linear interpolation between two vectors // VectorLerp - Calculate linear interpolation between two vectors
func VectorLerp(v1, v2 raylib.Vector3, amount float32) raylib.Vector3 { func VectorLerp(v1, v2 raylib.Vector3, amount float32) raylib.Vector3 {
result := raylib.Vector3{} result := raylib.Vector3{}
@ -126,7 +126,7 @@ func VectorLerp(v1, v2 raylib.Vector3, amount float32) raylib.Vector3 {
return result return result
} }
// Calculate reflected vector to normal // VectorReflect - Calculate reflected vector to normal
func VectorReflect(vector, normal raylib.Vector3) raylib.Vector3 { func VectorReflect(vector, normal raylib.Vector3) raylib.Vector3 {
// I is the original vector // I is the original vector
// N is the normal of the incident plane // N is the normal of the incident plane
@ -143,7 +143,7 @@ func VectorReflect(vector, normal raylib.Vector3) raylib.Vector3 {
return result return result
} }
// Transforms a Vector3 by a given Matrix // VectorTransform - Transforms a Vector3 by a given Matrix
func VectorTransform(v *raylib.Vector3, mat raylib.Matrix) { func VectorTransform(v *raylib.Vector3, mat raylib.Matrix) {
x := v.X x := v.X
y := v.Y y := v.Y
@ -154,12 +154,12 @@ func VectorTransform(v *raylib.Vector3, mat raylib.Matrix) {
v.Z = mat.M2*x + mat.M6*y + mat.M10*z + mat.M14 v.Z = mat.M2*x + mat.M6*y + mat.M10*z + mat.M14
} }
// Return a Vector3 init to zero // VectorZero - Return a Vector3 init to zero
func VectorZero() raylib.Vector3 { func VectorZero() raylib.Vector3 {
return raylib.NewVector3(0.0, 0.0, 0.0) return raylib.NewVector3(0.0, 0.0, 0.0)
} }
// Return min value for each pair of components // VectorMin - Return min value for each pair of components
func VectorMin(vec1, vec2 raylib.Vector3) raylib.Vector3 { func VectorMin(vec1, vec2 raylib.Vector3) raylib.Vector3 {
result := raylib.Vector3{} result := raylib.Vector3{}
@ -170,7 +170,7 @@ func VectorMin(vec1, vec2 raylib.Vector3) raylib.Vector3 {
return result return result
} }
// Return max value for each pair of components // VectorMax - Return max value for each pair of components
func VectorMax(vec1, vec2 raylib.Vector3) raylib.Vector3 { func VectorMax(vec1, vec2 raylib.Vector3) raylib.Vector3 {
result := raylib.Vector3{} result := raylib.Vector3{}
@ -181,7 +181,7 @@ func VectorMax(vec1, vec2 raylib.Vector3) raylib.Vector3 {
return result return result
} }
// Compute matrix determinant // MatrixDeterminant - Compute matrix determinant
func MatrixDeterminant(mat raylib.Matrix) float32 { func MatrixDeterminant(mat raylib.Matrix) float32 {
var result float32 var result float32
@ -212,12 +212,12 @@ func MatrixDeterminant(mat raylib.Matrix) float32 {
return result return result
} }
// Returns the trace of the matrix (sum of the values along the diagonal) // MatrixTrace - Returns the trace of the matrix (sum of the values along the diagonal)
func MatrixTrace(mat raylib.Matrix) float32 { func MatrixTrace(mat raylib.Matrix) float32 {
return mat.M0 + mat.M5 + mat.M10 + mat.M15 return mat.M0 + mat.M5 + mat.M10 + mat.M15
} }
// Transposes provided matrix // MatrixTranspose - Transposes provided matrix
func MatrixTranspose(mat *raylib.Matrix) { func MatrixTranspose(mat *raylib.Matrix) {
var temp raylib.Matrix var temp raylib.Matrix
@ -241,7 +241,7 @@ func MatrixTranspose(mat *raylib.Matrix) {
mat = &temp mat = &temp
} }
// Invert provided matrix // MatrixInvert - Invert provided matrix
func MatrixInvert(mat *raylib.Matrix) { func MatrixInvert(mat *raylib.Matrix) {
var temp raylib.Matrix var temp raylib.Matrix
@ -298,7 +298,7 @@ func MatrixInvert(mat *raylib.Matrix) {
mat = &temp mat = &temp
} }
// Normalize provided matrix // MatrixNormalize - Normalize provided matrix
func MatrixNormalize(mat *raylib.Matrix) { func MatrixNormalize(mat *raylib.Matrix) {
det := MatrixDeterminant(*mat) det := MatrixDeterminant(*mat)
@ -320,7 +320,7 @@ func MatrixNormalize(mat *raylib.Matrix) {
mat.M15 /= det mat.M15 /= det
} }
// Returns identity matrix // MatrixIdentity - Returns identity matrix
func MatrixIdentity() raylib.Matrix { func MatrixIdentity() raylib.Matrix {
return raylib.NewMatrix( return raylib.NewMatrix(
1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0,
@ -329,7 +329,7 @@ func MatrixIdentity() raylib.Matrix {
0.0, 0.0, 0.0, 1.0) 0.0, 0.0, 0.0, 1.0)
} }
// Add two matrices // MatrixAdd - Add two matrices
func MatrixAdd(left, right raylib.Matrix) raylib.Matrix { func MatrixAdd(left, right raylib.Matrix) raylib.Matrix {
result := MatrixIdentity() result := MatrixIdentity()
@ -353,7 +353,7 @@ func MatrixAdd(left, right raylib.Matrix) raylib.Matrix {
return result return result
} }
// Subtract two matrices (left - right) // MatrixSubtract - Subtract two matrices (left - right)
func MatrixSubtract(left, right raylib.Matrix) raylib.Matrix { func MatrixSubtract(left, right raylib.Matrix) raylib.Matrix {
result := MatrixIdentity() result := MatrixIdentity()
@ -377,7 +377,7 @@ func MatrixSubtract(left, right raylib.Matrix) raylib.Matrix {
return result return result
} }
// Returns translation matrix // MatrixTranslate - Returns translation matrix
func MatrixTranslate(x, y, z float32) raylib.Matrix { func MatrixTranslate(x, y, z float32) raylib.Matrix {
return raylib.NewMatrix( return raylib.NewMatrix(
1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0,
@ -386,7 +386,7 @@ func MatrixTranslate(x, y, z float32) raylib.Matrix {
x, y, z, 1.0) x, y, z, 1.0)
} }
// Returns rotation matrix for an angle around an specified axis (angle in radians) // MatrixRotate - Returns rotation matrix for an angle around an specified axis (angle in radians)
func MatrixRotate(axis raylib.Vector3, angle float32) raylib.Matrix { func MatrixRotate(axis raylib.Vector3, angle float32) raylib.Matrix {
var result raylib.Matrix var result raylib.Matrix
@ -455,7 +455,7 @@ func MatrixRotate(axis raylib.Vector3, angle float32) raylib.Matrix {
return result return result
} }
// Returns x-rotation matrix (angle in radians) // MatrixRotateX - Returns x-rotation matrix (angle in radians)
func MatrixRotateX(angle float32) raylib.Matrix { func MatrixRotateX(angle float32) raylib.Matrix {
result := MatrixIdentity() result := MatrixIdentity()
@ -470,7 +470,7 @@ func MatrixRotateX(angle float32) raylib.Matrix {
return result return result
} }
// Returns y-rotation matrix (angle in radians) // MatrixRotateY - Returns y-rotation matrix (angle in radians)
func MatrixRotateY(angle float32) raylib.Matrix { func MatrixRotateY(angle float32) raylib.Matrix {
result := MatrixIdentity() result := MatrixIdentity()
@ -485,7 +485,7 @@ func MatrixRotateY(angle float32) raylib.Matrix {
return result return result
} }
// Returns z-rotation matrix (angle in radians) // MatrixRotateZ - Returns z-rotation matrix (angle in radians)
func MatrixRotateZ(angle float32) raylib.Matrix { func MatrixRotateZ(angle float32) raylib.Matrix {
result := MatrixIdentity() result := MatrixIdentity()
@ -500,7 +500,7 @@ func MatrixRotateZ(angle float32) raylib.Matrix {
return result return result
} }
// Returns scaling matrix // MatrixScale - Returns scaling matrix
func MatrixScale(x, y, z float32) raylib.Matrix { func MatrixScale(x, y, z float32) raylib.Matrix {
result := raylib.NewMatrix( result := raylib.NewMatrix(
x, 0.0, 0.0, 0.0, x, 0.0, 0.0, 0.0,
@ -511,7 +511,7 @@ func MatrixScale(x, y, z float32) raylib.Matrix {
return result return result
} }
// Returns two matrix multiplication // MatrixMultiply - Returns two matrix multiplication
func MatrixMultiply(left, right raylib.Matrix) raylib.Matrix { func MatrixMultiply(left, right raylib.Matrix) raylib.Matrix {
var result raylib.Matrix var result raylib.Matrix
@ -535,7 +535,7 @@ func MatrixMultiply(left, right raylib.Matrix) raylib.Matrix {
return result return result
} }
// Returns perspective projection matrix // MatrixFrustum - Returns perspective projection matrix
func MatrixFrustum(left, right, bottom, top, near, far float32) raylib.Matrix { func MatrixFrustum(left, right, bottom, top, near, far float32) raylib.Matrix {
var result raylib.Matrix var result raylib.Matrix
@ -566,7 +566,7 @@ func MatrixFrustum(left, right, bottom, top, near, far float32) raylib.Matrix {
return result return result
} }
// Returns perspective projection matrix // MatrixPerspective - Returns perspective projection matrix
func MatrixPerspective(fovy, aspect, near, far float32) raylib.Matrix { func MatrixPerspective(fovy, aspect, near, far float32) raylib.Matrix {
top := near * float32(math.Tan(float64(fovy*raylib.Pi)/360.0)) top := near * float32(math.Tan(float64(fovy*raylib.Pi)/360.0))
right := top * aspect right := top * aspect
@ -574,7 +574,7 @@ func MatrixPerspective(fovy, aspect, near, far float32) raylib.Matrix {
return MatrixFrustum(-right, right, -top, top, near, far) return MatrixFrustum(-right, right, -top, top, near, far)
} }
// Returns orthographic projection matrix // MatrixOrtho - Returns orthographic projection matrix
func MatrixOrtho(left, right, bottom, top, near, far float32) raylib.Matrix { func MatrixOrtho(left, right, bottom, top, near, far float32) raylib.Matrix {
var result raylib.Matrix var result raylib.Matrix
@ -602,7 +602,7 @@ func MatrixOrtho(left, right, bottom, top, near, far float32) raylib.Matrix {
return result return result
} }
// Returns camera look-at matrix (view matrix) // MatrixLookAt - Returns camera look-at matrix (view matrix)
func MatrixLookAt(eye, target, up raylib.Vector3) raylib.Matrix { func MatrixLookAt(eye, target, up raylib.Vector3) raylib.Matrix {
var result raylib.Matrix var result raylib.Matrix
@ -633,12 +633,12 @@ func MatrixLookAt(eye, target, up raylib.Vector3) raylib.Matrix {
return result return result
} }
// Compute the length of a quaternion // QuaternionLength - Compute the length of a quaternion
func QuaternionLength(quat raylib.Quaternion) float32 { func QuaternionLength(quat raylib.Quaternion) float32 {
return float32(math.Sqrt(float64(quat.X*quat.X + quat.Y*quat.Y + quat.Z*quat.Z + quat.W*quat.W))) return float32(math.Sqrt(float64(quat.X*quat.X + quat.Y*quat.Y + quat.Z*quat.Z + quat.W*quat.W)))
} }
// Normalize provided quaternion // QuaternionNormalize - Normalize provided quaternion
func QuaternionNormalize(q *raylib.Quaternion) { func QuaternionNormalize(q *raylib.Quaternion) {
var length, ilength float32 var length, ilength float32
@ -656,7 +656,7 @@ func QuaternionNormalize(q *raylib.Quaternion) {
q.W *= ilength q.W *= ilength
} }
// Invert provided quaternion // QuaternionInvert - Invert provided quaternion
func QuaternionInvert(quat *raylib.Quaternion) { func QuaternionInvert(quat *raylib.Quaternion) {
length := QuaternionLength(*quat) length := QuaternionLength(*quat)
lengthSq := length * length lengthSq := length * length
@ -671,7 +671,7 @@ func QuaternionInvert(quat *raylib.Quaternion) {
} }
} }
// Calculate two quaternion multiplication // QuaternionMultiply - Calculate two quaternion multiplication
func QuaternionMultiply(q1, q2 raylib.Quaternion) raylib.Quaternion { func QuaternionMultiply(q1, q2 raylib.Quaternion) raylib.Quaternion {
var result raylib.Quaternion var result raylib.Quaternion
@ -692,7 +692,7 @@ func QuaternionMultiply(q1, q2 raylib.Quaternion) raylib.Quaternion {
return result return result
} }
// Calculates spherical linear interpolation between two quaternions // QuaternionSlerp - Calculates spherical linear interpolation between two quaternions
func QuaternionSlerp(q1, q2 raylib.Quaternion, amount float32) raylib.Quaternion { func QuaternionSlerp(q1, q2 raylib.Quaternion, amount float32) raylib.Quaternion {
var result raylib.Quaternion var result raylib.Quaternion
@ -723,7 +723,7 @@ func QuaternionSlerp(q1, q2 raylib.Quaternion, amount float32) raylib.Quaternion
return result return result
} }
// Returns a quaternion for a given rotation matrix // QuaternionFromMatrix - Returns a quaternion for a given rotation matrix
func QuaternionFromMatrix(matrix raylib.Matrix) raylib.Quaternion { func QuaternionFromMatrix(matrix raylib.Matrix) raylib.Quaternion {
var result raylib.Quaternion var result raylib.Quaternion
@ -772,7 +772,7 @@ func QuaternionFromMatrix(matrix raylib.Matrix) raylib.Quaternion {
return result return result
} }
// Returns a matrix for a given quaternion // QuaternionToMatrix - Returns a matrix for a given quaternion
func QuaternionToMatrix(q raylib.Quaternion) raylib.Matrix { func QuaternionToMatrix(q raylib.Quaternion) raylib.Matrix {
var result raylib.Matrix var result raylib.Matrix
@ -817,7 +817,7 @@ func QuaternionToMatrix(q raylib.Quaternion) raylib.Matrix {
return result return result
} }
// Returns rotation quaternion for an angle and axis // QuaternionFromAxisAngle - Returns rotation quaternion for an angle and axis
func QuaternionFromAxisAngle(axis raylib.Vector3, angle float32) raylib.Quaternion { func QuaternionFromAxisAngle(axis raylib.Vector3, angle float32) raylib.Quaternion {
result := raylib.NewQuaternion(0.0, 0.0, 0.0, 1.0) result := raylib.NewQuaternion(0.0, 0.0, 0.0, 1.0)
@ -840,7 +840,7 @@ func QuaternionFromAxisAngle(axis raylib.Vector3, angle float32) raylib.Quaterni
return result return result
} }
// Returns the rotation angle and axis for a given quaternion // QuaternionToAxisAngle - Returns the rotation angle and axis for a given quaternion
func QuaternionToAxisAngle(q raylib.Quaternion, outAxis *raylib.Vector3, outAngle *float32) { func QuaternionToAxisAngle(q raylib.Quaternion, outAxis *raylib.Vector3, outAngle *float32) {
if math.Abs(float64(q.W)) > 1.0 { if math.Abs(float64(q.W)) > 1.0 {
QuaternionNormalize(&q) QuaternionNormalize(&q)
@ -865,7 +865,7 @@ func QuaternionToAxisAngle(q raylib.Quaternion, outAxis *raylib.Vector3, outAngl
*outAngle = resAngle *outAngle = resAngle
} }
// Transform a quaternion given a transformation matrix // QuaternionTransform - Transform a quaternion given a transformation matrix
func QuaternionTransform(q *raylib.Quaternion, mat raylib.Matrix) { func QuaternionTransform(q *raylib.Quaternion, mat raylib.Matrix) {
x := q.X x := q.X
y := q.Y y := q.Y