From 29546140b9f1e29c484e6bd74665f5484b45133a Mon Sep 17 00:00:00 2001 From: Milan Nikolic Date: Tue, 21 Feb 2017 15:06:11 +0100 Subject: [PATCH] Golint --- easings/easings.go | 56 +++++++------- raygui/raygui.go | 36 ++++----- raylib/audio.go | 98 ++++++++++++------------ raylib/camera.go | 20 ++--- raylib/core.go | 148 ++++++++++++++++++------------------- raylib/gestures.go | 18 ++--- raylib/models.go | 96 ++++++++++++------------ raylib/platform_android.go | 22 +++--- raylib/platform_arm.go | 22 +++--- raylib/platform_desktop.go | 22 +++--- raylib/rres.go | 4 +- raylib/shaders.go | 44 +++++------ raylib/shapes.go | 50 ++++++------- raylib/text.go | 26 +++---- raylib/textures.go | 94 +++++++++++------------ raylib/utils.go | 6 +- raylib/utils_android.go | 6 +- raylib/utils_windows.go | 6 +- raymath/raymath.go | 90 +++++++++++----------- 19 files changed, 432 insertions(+), 432 deletions(-) diff --git a/easings/easings.go b/easings/easings.go index b36602f..3545cde 100644 --- a/easings/easings.go +++ b/easings/easings.go @@ -9,57 +9,57 @@ import ( // Linear Easing functions -// Linear None +// LinearNone func LinearNone(t, b, c, d float32) float32 { return c*t/d + b } -// Linear In +// LinearIn func LinearIn(t, b, c, d float32) float32 { return c*t/d + b } -// Linear Out +// LinearOut func LinearOut(t, b, c, d float32) float32 { return c*t/d + b } -// Linear In Out +// LinearInOut func LinearInOut(t, b, c, d float32) float32 { return c*t/d + b } // Sine Easing functions -// Sine In +// SineIn func SineIn(t, b, c, d float32) float32 { return -c*float32(math.Cos(float64(t/d)*(math.Pi/2))) + c + b } -// Sine Out +// SineOut func SineOut(t, b, c, d float32) float32 { return c*float32(math.Sin(float64(t/d)*(math.Pi/2))) + b } -// Sine In Out +// SineInOut func SineInOut(t, b, c, d float32) float32 { return -c/2*(float32(math.Cos(math.Pi*float64(t/d)))-1) + b } // Circular Easing functions -// Circ In +// CircIn func CircIn(t, b, c, d float32) float32 { t = t / d return -c*(float32(math.Sqrt(float64(1-t*t)))-1) + b } -// Circ Out +// CircOut func CircOut(t, b, c, d float32) float32 { return c*float32(math.Sqrt(1-float64((t/d-1)*t))) + b } -// Circ In Out +// CircInOut func CircInOut(t, b, c, d float32) float32 { t = t / d * 2 @@ -73,19 +73,19 @@ func CircInOut(t, b, c, d float32) float32 { // Cubic Easing functions -// Cubic In +// CubicIn func CubicIn(t, b, c, d float32) float32 { t = t / d return c*t*t*t + b } -// Cubic Out +// CubicOut func CubicOut(t, b, c, d float32) float32 { t = t/d - 1 return c*(t*t*t+1) + b } -// Cubic In Out +// CubicInOut func CubicInOut(t, b, c, d float32) float32 { t = t / d * 2 if t < 1 { @@ -98,19 +98,19 @@ func CubicInOut(t, b, c, d float32) float32 { // Quadratic Easing functions -// Quad In +// QuadIn func QuadIn(t, b, c, d float32) float32 { t = t / d return c*t*t + b } -// Quad Out +// QuadOut func QuadOut(t, b, c, d float32) float32 { t = t / d return (-c*t*(t-2) + b) } -// Quad In Out +// QuadInOut func QuadInOut(t, b, c, d float32) float32 { t = t / d * 2 if t < 1 { @@ -122,7 +122,7 @@ func QuadInOut(t, b, c, d float32) float32 { // Exponential Easing functions -// Expo In +// ExpoIn func ExpoIn(t, b, c, d float32) float32 { if t == 0 { return b @@ -131,7 +131,7 @@ func ExpoIn(t, b, c, d float32) float32 { return (c*float32(math.Pow(2, 10*float64(t/d-1))) + b) } -// Expo Out +// ExpoOut func ExpoOut(t, b, c, d float32) float32 { if t == d { return (b + c) @@ -140,7 +140,7 @@ func ExpoOut(t, b, c, d float32) float32 { return c*(-float32(math.Pow(2, -10*float64(t/d)))+1) + b } -// Expo In Out +// ExpoInOut func ExpoInOut(t, b, c, d float32) float32 { if t == 0 { return b @@ -161,21 +161,21 @@ func ExpoInOut(t, b, c, d float32) float32 { // Back Easing functions -// Back In +// BackIn func BackIn(t, b, c, d float32) float32 { s := float32(1.70158) t = t / d return c*t*t*((s+1)*t-s) + b } -// Back Out +// BackOut func BackOut(t, b, c, d float32) float32 { s := float32(1.70158) t = t/d - 1 return c*(t*t*((s+1)*t+s)+1) + b } -// Back In Out +// BackInOut func BackInOut(t, b, c, d float32) float32 { s := float32(1.70158) s = s * 1.525 @@ -191,12 +191,12 @@ func BackInOut(t, b, c, d float32) float32 { // Bounce Easing functions -// Bounce In +// BounceIn func BounceIn(t, b, c, d float32) float32 { return (c - BounceOut(d-t, 0, c, d) + b) } -// Bounce Out +// BounceOut func BounceOut(t, b, c, d float32) float32 { t = t / d if t < (1 / 2.75) { @@ -213,7 +213,7 @@ func BounceOut(t, b, c, d float32) float32 { return c*(7.5625*t*t+0.984375) + b } -// Bounce In Out +// BounceInOut func BounceInOut(t, b, c, d float32) float32 { if t < d/2 { return BounceIn(t*2, 0, c, d)*0.5 + b @@ -224,7 +224,7 @@ func BounceInOut(t, b, c, d float32) float32 { // Elastic Easing functions -// Elastic In +// ElasticIn func ElasticIn(t, b, c, d float32) float32 { if t == 0 { return b @@ -244,7 +244,7 @@ func ElasticIn(t, b, c, d float32) float32 { return -(postFix * float32(math.Sin(float64(t*d-s)*(2*math.Pi)/float64(p)))) + b } -// Elastic Out +// ElasticOut func ElasticOut(t, b, c, d float32) float32 { if t == 0 { return b @@ -263,7 +263,7 @@ func ElasticOut(t, b, c, d float32) float32 { return a*float32(math.Pow(2, -10*float64(t)))*float32(math.Sin(float64(t*d-s)*(2*math.Pi)/float64(p))) + c + b } -// Elastic In Out +// ElasticInOut func ElasticInOut(t, b, c, d float32) float32 { if t == 0 { return b diff --git a/raygui/raygui.go b/raygui/raygui.go index 87b519e..5d80b60 100644 --- a/raygui/raygui.go +++ b/raygui/raygui.go @@ -368,22 +368,22 @@ var propertyName = []string{ "TEXTBOX_TEXT_FONTSIZE", } -// Get background color +// BackgroundColor - Get background color func BackgroundColor() raylib.Color { return raylib.GetColor(int32(style[GlobalBackgroundColor])) } -// Get lines color +// LinesColor - Get lines color func LinesColor() raylib.Color { return raylib.GetColor(int32(style[GlobalLinesColor])) } -// Label element, show text +// Label - Label element, show text 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)) } -// Label element extended, configurable colors +// LabelEx - Label element extended, configurable colors func LabelEx(bounds raylib.Rectangle, text string, textColor, border, inner raylib.Color) { // Update control 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) } -// Button element, returns true when clicked +// Button - Button element, returns true when clicked func Button(bounds raylib.Rectangle, text string) bool { buttonState := ButtonDefault mousePoint := raylib.GetMousePosition() @@ -465,7 +465,7 @@ func Button(bounds raylib.Rectangle, text string) bool { 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 { toggleState := ToggleUnactive toggleButton := bounds @@ -533,7 +533,7 @@ func ToggleButton(bounds raylib.Rectangle, text string, toggle bool) bool { 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 { for i := 0; i < len(toggleText); i++ { if i == toggleActive { @@ -546,7 +546,7 @@ func ToggleGroup(bounds raylib.Rectangle, toggleText []string, toggleActive int) 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 { comboBoxState := ComboboxUnactive comboBoxButton := bounds @@ -637,7 +637,7 @@ func ComboBox(bounds raylib.Rectangle, comboText []string, comboActive int) int 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 { checkBoxState := CheckboxStatus mousePoint := raylib.GetMousePosition() @@ -683,7 +683,7 @@ func CheckBox(bounds raylib.Rectangle, text string, checked bool) bool { return checked } -// Slider element, returns selected value +// Slider - Slider element, returns selected value func Slider(bounds raylib.Rectangle, value, minValue, maxValue float32) float32 { sliderPos := float32(0) sliderState := SliderDefault @@ -755,7 +755,7 @@ func Slider(bounds raylib.Rectangle, value, minValue, maxValue float32) float32 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 { sliderState := SliderDefault mousePoint := raylib.GetMousePosition() @@ -826,7 +826,7 @@ func SliderBar(bounds raylib.Rectangle, value, minValue, maxValue float32) float 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) { if 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]))) } -// Spinner element, returns selected value +// Spinner - Spinner element, returns selected value func Spinner(bounds raylib.Rectangle, value, minValue, maxValue int) int { spinnerState := SpinnerDefault 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 } -// Text Box element, returns input text +// TextBox - Text Box element, returns input text func TextBox(bounds raylib.Rectangle, text string) string { keyBackspaceText := int32(259) // GLFW BACKSPACE: 3 + 256 @@ -1056,7 +1056,7 @@ func TextBox(bounds raylib.Rectangle, text string) string { return text } -// Save GUI style file +// SaveGuiStyle - Save GUI style file func SaveGuiStyle(fileName string) { var styleFile string for i := 0; i < len(propertyName); i++ { @@ -1066,7 +1066,7 @@ func SaveGuiStyle(fileName string) { ioutil.WriteFile(fileName, []byte(styleFile), 0644) } -// Load GUI style file +// LoadGuiStyle - Load GUI style file func LoadGuiStyle(fileName string) { file, err := raylib.OpenAsset(fileName) 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) { 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 { return style[int(guiProperty)] } diff --git a/raylib/audio.go b/raylib/audio.go index 93b0ede..34de2d1 100644 --- a/raylib/audio.go +++ b/raylib/audio.go @@ -26,12 +26,12 @@ func (w *Wave) cptr() *C.Wave { return (*C.Wave)(unsafe.Pointer(w)) } -// Returns new Wave +// NewWave - Returns new Wave func NewWave(sampleCount, sampleRate, sampleSize, channels uint32, data unsafe.Pointer) Wave { return Wave{sampleCount, sampleRate, sampleSize, channels, data} } -// Returns new Wave from pointer +// NewWaveFromPointer - Returns new Wave from pointer func NewWaveFromPointer(ptr unsafe.Pointer) Wave { return *(*Wave)(ptr) } @@ -50,12 +50,12 @@ func (s *Sound) cptr() *C.Sound { return (*C.Sound)(unsafe.Pointer(s)) } -// Returns new Sound +// NewSound - Returns new Sound func NewSound(source, buffer uint32, format int32) Sound { return Sound{source, buffer, format} } -// Returns new Sound from pointer +// NewSoundFromPointer - Returns new Sound from pointer func NewSoundFromPointer(ptr unsafe.Pointer) Sound { return *(*Sound)(ptr) } @@ -85,40 +85,40 @@ func (a *AudioStream) cptr() *C.AudioStream { 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 { 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 { return *(*AudioStream)(ptr) } -// Initialize audio device and context +// InitAudioDevice - Initialize audio device and context func InitAudioDevice() { C.InitAudioDevice() } -// Close the audio device and context +// CloseAudioDevice - Close the audio device and context func CloseAudioDevice() { C.CloseAudioDevice() } -// Check if audio device has been initialized successfully +// IsAudioDeviceReady - Check if audio device has been initialized successfully func IsAudioDeviceReady() bool { ret := C.IsAudioDeviceReady() v := bool(int(ret) == 1) return v } -// Set master volume (listener) +// SetMasterVolume - Set master volume (listener) func SetMasterVolume(volume float32) { cvolume := (C.float)(volume) C.SetMasterVolume(cvolume) } -// Load wave data from file into RAM +// LoadWave - Load wave data from file into RAM func LoadWave(fileName string) Wave { cfileName := C.CString(fileName) defer C.free(unsafe.Pointer(cfileName)) @@ -127,7 +127,7 @@ func LoadWave(fileName string) Wave { 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 { csampleCount := (C.int)(sampleCount) csampleRate := (C.int)(sampleRate) @@ -138,7 +138,7 @@ func LoadWaveEx(data unsafe.Pointer, sampleCount int32, sampleRate int32, sample return v } -// Load sound to memory +// LoadSound - Load sound to memory func LoadSound(fileName string) Sound { cfileName := C.CString(fileName) defer C.free(unsafe.Pointer(cfileName)) @@ -147,7 +147,7 @@ func LoadSound(fileName string) Sound { return v } -// Load sound to memory from wave data +// LoadSoundFromWave - Load sound to memory from wave data func LoadSoundFromWave(wave Wave) Sound { cwave := wave.cptr() ret := C.LoadSoundFromWave(*cwave) @@ -155,7 +155,7 @@ func LoadSoundFromWave(wave Wave) Sound { return v } -// Update sound buffer with new data +// UpdateSound - Update sound buffer with new data func UpdateSound(sound Sound, data unsafe.Pointer, samplesCount int32) { csound := sound.cptr() cdata := (unsafe.Pointer)(unsafe.Pointer(data)) @@ -163,43 +163,43 @@ func UpdateSound(sound Sound, data unsafe.Pointer, samplesCount int32) { C.UpdateSound(*csound, cdata, csamplesCount) } -// Unload wave data +// UnloadWave - Unload wave data func UnloadWave(wave Wave) { cwave := wave.cptr() C.UnloadWave(*cwave) } -// Unload sound +// UnloadSound - Unload sound func UnloadSound(sound Sound) { csound := sound.cptr() C.UnloadSound(*csound) } -// Play a sound +// PlaySound - Play a sound func PlaySound(sound Sound) { csound := sound.cptr() C.PlaySound(*csound) } -// Pause a sound +// PauseSound - Pause a sound func PauseSound(sound Sound) { csound := sound.cptr() C.PauseSound(*csound) } -// Resume a paused sound +// ResumeSound - Resume a paused sound func ResumeSound(sound Sound) { csound := sound.cptr() C.ResumeSound(*csound) } -// Stop playing a sound +// StopSound - Stop playing a sound func StopSound(sound Sound) { csound := sound.cptr() C.StopSound(*csound) } -// Check if a sound is currently playing +// IsSoundPlaying - Check if a sound is currently playing func IsSoundPlaying(sound Sound) bool { csound := sound.cptr() ret := C.IsSoundPlaying(*csound) @@ -207,21 +207,21 @@ func IsSoundPlaying(sound Sound) bool { 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) { csound := sound.cptr() cvolume := (C.float)(volume) 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) { csound := sound.cptr() cpitch := (C.float)(pitch) 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) { cwave := wave.cptr() csampleRate := (C.int)(sampleRate) @@ -230,7 +230,7 @@ func WaveFormat(wave Wave, sampleRate int32, sampleSize int32, channels int32) { 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 { cwave := wave.cptr() ret := C.WaveCopy(*cwave) @@ -238,7 +238,7 @@ func WaveCopy(wave Wave) Wave { 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) { cwave := wave.cptr() cinitSample := (C.int)(initSample) @@ -246,7 +246,7 @@ func WaveCrop(wave Wave, initSample int32, finalSample int32) { 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 { var data []float32 cwave := wave.cptr() @@ -260,7 +260,7 @@ func GetWaveData(wave Wave) []float32 { return data } -// Load music stream from file +// LoadMusicStream - Load music stream from file func LoadMusicStream(fileName string) Music { cfileName := C.CString(fileName) defer C.free(unsafe.Pointer(cfileName)) @@ -269,43 +269,43 @@ func LoadMusicStream(fileName string) Music { return v } -// Unload music stream +// UnloadMusicStream - Unload music stream func UnloadMusicStream(music Music) { cmusic := *(*C.Music)(unsafe.Pointer(&music)) C.UnloadMusicStream(cmusic) } -// Start music playing +// PlayMusicStream - Start music playing func PlayMusicStream(music Music) { cmusic := *(*C.Music)(unsafe.Pointer(&music)) C.PlayMusicStream(cmusic) } -// Updates buffers for music streaming +// UpdateMusicStream - Updates buffers for music streaming func UpdateMusicStream(music Music) { cmusic := *(*C.Music)(unsafe.Pointer(&music)) C.UpdateMusicStream(cmusic) } -// Stop music playing +// StopMusicStream - Stop music playing func StopMusicStream(music Music) { cmusic := *(*C.Music)(unsafe.Pointer(&music)) C.StopMusicStream(cmusic) } -// Pause music playing +// PauseMusicStream - Pause music playing func PauseMusicStream(music Music) { cmusic := *(*C.Music)(unsafe.Pointer(&music)) C.PauseMusicStream(cmusic) } -// Resume playing paused music +// ResumeMusicStream - Resume playing paused music func ResumeMusicStream(music Music) { cmusic := *(*C.Music)(unsafe.Pointer(&music)) C.ResumeMusicStream(cmusic) } -// Check if music is playing +// IsMusicPlaying - Check if music is playing func IsMusicPlaying(music Music) bool { cmusic := *(*C.Music)(unsafe.Pointer(&music)) ret := C.IsMusicPlaying(cmusic) @@ -313,14 +313,14 @@ func IsMusicPlaying(music Music) bool { 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) { cmusic := *(*C.Music)(unsafe.Pointer(&music)) cvolume := (C.float)(volume) 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) { cmusic := *(*C.Music)(unsafe.Pointer(&music)) cpitch := (C.float)(pitch) @@ -328,14 +328,14 @@ func SetMusicPitch(music Music, pitch float32) { } // 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) { cmusic := *(*C.Music)(unsafe.Pointer(&music)) ccount := (C.float)(count) C.SetMusicLoopCount(cmusic, ccount) } -// Get music time length (in seconds) +// GetMusicTimeLength - Get music time length (in seconds) func GetMusicTimeLength(music Music) float32 { cmusic := *(*C.Music)(unsafe.Pointer(&music)) ret := C.GetMusicTimeLength(cmusic) @@ -343,7 +343,7 @@ func GetMusicTimeLength(music Music) float32 { return v } -// Get current music time played (in seconds) +// GetMusicTimePlayed - Get current music time played (in seconds) func GetMusicTimePlayed(music Music) float32 { cmusic := *(*C.Music)(unsafe.Pointer(&music)) ret := C.GetMusicTimePlayed(cmusic) @@ -351,7 +351,7 @@ func GetMusicTimePlayed(music Music) float32 { 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 { csampleRate := (C.uint)(sampleRate) csampleSize := (C.uint)(sampleSize) @@ -361,7 +361,7 @@ func InitAudioStream(sampleRate uint32, sampleSize uint32, channels uint32) Audi return v } -// Update audio stream buffers with data +// UpdateAudioStream - Update audio stream buffers with data func UpdateAudioStream(stream AudioStream, data unsafe.Pointer, samplesCount int32) { cstream := stream.cptr() cdata := (unsafe.Pointer)(unsafe.Pointer(data)) @@ -369,13 +369,13 @@ func UpdateAudioStream(stream AudioStream, data unsafe.Pointer, samplesCount int C.UpdateAudioStream(*cstream, cdata, csamplesCount) } -// Close audio stream and free memory +// CloseAudioStream - Close audio stream and free memory func CloseAudioStream(stream AudioStream) { cstream := stream.cptr() 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 { cstream := stream.cptr() ret := C.IsAudioBufferProcessed(*cstream) @@ -383,25 +383,25 @@ func IsAudioBufferProcessed(stream AudioStream) bool { return v } -// Play audio stream +// PlayAudioStream - Play audio stream func PlayAudioStream(stream AudioStream) { cstream := stream.cptr() C.PlayAudioStream(*cstream) } -// Pause audio stream +// PauseAudioStream - Pause audio stream func PauseAudioStream(stream AudioStream) { cstream := stream.cptr() C.PauseAudioStream(*cstream) } -// Resume audio stream +// ResumeAudioStream - Resume audio stream func ResumeAudioStream(stream AudioStream) { cstream := stream.cptr() C.ResumeAudioStream(*cstream) } -// Stop audio stream +// StopAudioStream - Stop audio stream func StopAudioStream(stream AudioStream) { cstream := stream.cptr() C.StopAudioStream(*cstream) diff --git a/raylib/camera.go b/raylib/camera.go index e955f86..4144d3a 100644 --- a/raylib/camera.go +++ b/raylib/camera.go @@ -24,12 +24,12 @@ func (c *Camera) cptr() *C.Camera { return (*C.Camera)(unsafe.Pointer(c)) } -// Returns new Camera +// NewCamera - Returns new Camera func NewCamera(pos, target, up Vector3, fovy float32) Camera { return Camera{pos, target, up, fovy} } -// Returns new Camera from pointer +// NewCameraFromPointer - Returns new Camera from pointer func NewCameraFromPointer(ptr unsafe.Pointer) Camera { return *(*Camera)(ptr) } @@ -50,12 +50,12 @@ func (c *Camera2D) cptr() *C.Camera2D { return (*C.Camera2D)(unsafe.Pointer(c)) } -// Returns new Camera2D +// NewCamera2D - Returns new Camera2D func NewCamera2D(offset, target Vector2, rotation, zoom float32) Camera2D { return Camera2D{offset, target, rotation, zoom} } -// Returns new Camera2D from pointer +// NewCamera2DFromPointer - Returns new Camera2D from pointer func NewCamera2DFromPointer(ptr unsafe.Pointer) Camera2D { return *(*Camera2D)(ptr) } @@ -72,38 +72,38 @@ const ( 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) { ccamera := camera.cptr() cmode := (C.int)(mode) C.SetCameraMode(*ccamera, cmode) } -// Update camera position for selected mode +// UpdateCamera - Update camera position for selected mode func UpdateCamera(camera *Camera) { ccamera := camera.cptr() 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) { cpanKey := (C.int)(panKey) 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) { caltKey := (C.int)(altKey) 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) { cszKey := (C.int)(szKey) 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) { cfrontKey := (C.int)(frontKey) cbackKey := (C.int)(backKey) diff --git a/raylib/core.go b/raylib/core.go index 18608d7..c464802 100644 --- a/raylib/core.go +++ b/raylib/core.go @@ -239,12 +239,12 @@ func (v *Vector2) cptr() *C.Vector2 { return (*C.Vector2)(unsafe.Pointer(v)) } -// Returns new Vector2 +// NewVector2 - Returns new Vector2 func NewVector2(x, y float32) Vector2 { return Vector2{x, y} } -// Returns new Vector2 from pointer +// NewVector2FromPointer - Returns new Vector2 from pointer func NewVector2FromPointer(ptr unsafe.Pointer) Vector2 { return *(*Vector2)(ptr) } @@ -260,12 +260,12 @@ func (v *Vector3) cptr() *C.Vector3 { return (*C.Vector3)(unsafe.Pointer(v)) } -// Returns new Vector3 +// NewVector3 - Returns new Vector3 func NewVector3(X, Y, Z float32) Vector3 { return Vector3{X, Y, Z} } -// Returns new Vector3 from pointer +// NewVector3FromPointer - Returns new Vector3 from pointer func NewVector3FromPointer(ptr unsafe.Pointer) Vector3 { return *(*Vector3)(ptr) } @@ -282,12 +282,12 @@ func (m *Matrix) cptr() *C.Matrix { 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 { 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 { return *(*Matrix)(ptr) } @@ -300,7 +300,7 @@ type Quaternion struct { W float32 } -// Returns new Quaternion +// NewQuaternion - Returns new Quaternion func NewQuaternion(x, y, z, w float32) Quaternion { return Quaternion{x, y, z, w} } @@ -317,12 +317,12 @@ func (color *Color) cptr() *C.Color { return (*C.Color)(unsafe.Pointer(color)) } -// Returns new Color +// NewColor - Returns new Color func NewColor(r, g, b, a uint8) Color { return Color{r, g, b, a} } -// Returns new Color from pointer +// NewColorFromPointer - Returns new Color from pointer func NewColorFromPointer(ptr unsafe.Pointer) Color { return *(*Color)(ptr) } @@ -339,12 +339,12 @@ func (r *Rectangle) cptr() *C.Rectangle { return (*C.Rectangle)(unsafe.Pointer(r)) } -// Returns new Rectangle +// NewRectangle - Returns new Rectangle func NewRectangle(x, y, width, height int32) Rectangle { return Rectangle{x, y, width, height} } -// Returns new Rectangle from pointer +// NewRectangleFromPointer - Returns new Rectangle from pointer func NewRectangleFromPointer(ptr unsafe.Pointer) Rectangle { return *(*Rectangle)(ptr) } @@ -361,12 +361,12 @@ func (b *BoundingBox) cptr() *C.BoundingBox { return (*C.BoundingBox)(unsafe.Pointer(b)) } -// Returns new BoundingBox +// NewBoundingBox - Returns new BoundingBox func NewBoundingBox(min, max Vector3) BoundingBox { return BoundingBox{min, max} } -// Returns new BoundingBox from pointer +// NewBoundingBoxFromPointer - Returns new BoundingBox from pointer func NewBoundingBoxFromPointer(ptr unsafe.Pointer) BoundingBox { return *(*BoundingBox)(ptr) } @@ -377,100 +377,100 @@ type Asset interface { io.Closer } -// Close Window and Terminate Context +// CloseWindow - Close Window and Terminate Context func 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 { ret := C.WindowShouldClose() v := bool(int(ret) == 1) return v } -// Detect if window has been minimized (or lost focus) +// IsWindowMinimized - Detect if window has been minimized (or lost focus) func IsWindowMinimized() bool { ret := C.IsWindowMinimized() v := bool(int(ret) == 1) return v } -// Fullscreen toggle (only PLATFORM_DESKTOP) +// ToggleFullscreen - Fullscreen toggle (only PLATFORM_DESKTOP) func ToggleFullscreen() { C.ToggleFullscreen() } -// Set icon for window (only PLATFORM_DESKTOP) +// SetWindowIcon - Set icon for window (only PLATFORM_DESKTOP) func SetWindowIcon(image Image) { cimage := image.cptr() C.SetWindowIcon(*cimage) } -// Get current screen width +// GetScreenWidth - Get current screen width func GetScreenWidth() int32 { ret := C.GetScreenWidth() v := (int32)(ret) return v } -// Get current screen height +// GetScreenHeight - Get current screen height func GetScreenHeight() int32 { ret := C.GetScreenHeight() v := (int32)(ret) return v } -// Sets Background Color +// ClearBackground - Sets Background Color func ClearBackground(color Color) { ccolor := color.cptr() C.ClearBackground(*ccolor) } -// Setup drawing canvas to start drawing +// BeginDrawing - Setup drawing canvas to start drawing func BeginDrawing() { C.BeginDrawing() } -// End canvas drawing and Swap Buffers (Double Buffering) +// EndDrawing - End canvas drawing and Swap Buffers (Double Buffering) func EndDrawing() { C.EndDrawing() } -// Initialize 2D mode with custom camera +// Begin2dMode - Initialize 2D mode with custom camera func Begin2dMode(camera Camera2D) { ccamera := camera.cptr() C.Begin2dMode(*ccamera) } -// Ends 2D mode custom camera usage +// End2dMode - Ends 2D mode custom camera usage func End2dMode() { C.End2dMode() } -// Initializes 3D mode for drawing (Camera setup) +// Begin3dMode - Initializes 3D mode for drawing (Camera setup) func Begin3dMode(camera Camera) { ccamera := camera.cptr() 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() { C.End3dMode() } -// Initializes render texture for drawing +// BeginTextureMode - Initializes render texture for drawing func BeginTextureMode(target RenderTexture2D) { ctarget := target.cptr() C.BeginTextureMode(*ctarget) } -// Ends drawing to render texture +// EndTextureMode - Ends drawing to render texture func 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 { cmousePosition := mousePosition.cptr() ccamera := camera.cptr() @@ -479,7 +479,7 @@ func GetMouseRay(mousePosition Vector2, camera Camera) Ray { 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 { cposition := position.cptr() ccamera := camera.cptr() @@ -488,7 +488,7 @@ func GetWorldToScreen(position Vector3, camera Camera) Vector2 { return v } -// Returns camera transform matrix (view matrix) +// GetCameraMatrix - Returns camera transform matrix (view matrix) func GetCameraMatrix(camera Camera) Matrix { ccamera := camera.cptr() ret := C.GetCameraMatrix(*ccamera) @@ -496,27 +496,27 @@ func GetCameraMatrix(camera Camera) Matrix { return v } -// Set target FPS (maximum) +// SetTargetFPS - Set target FPS (maximum) func SetTargetFPS(fps int32) { cfps := (C.int)(fps) C.SetTargetFPS(cfps) } -// Returns current FPS +// GetFPS - Returns current FPS func GetFPS() float32 { ret := C.GetFPS() v := (float32)(ret) return v } -// Returns time in seconds for one frame +// GetFrameTime - Returns time in seconds for one frame func GetFrameTime() float32 { ret := C.GetFrameTime() v := (float32)(ret) return v } -// Returns a Color struct from hexadecimal value +// GetColor - Returns a Color struct from hexadecimal value func GetColor(hexValue int32) Color { chexValue := (C.int)(hexValue) ret := C.GetColor(chexValue) @@ -524,7 +524,7 @@ func GetColor(hexValue int32) Color { return v } -// Returns hexadecimal value for a Color +// GetHexValue - Returns hexadecimal value for a Color func GetHexValue(color Color) int32 { ccolor := color.cptr() ret := C.GetHexValue(*ccolor) @@ -532,7 +532,7 @@ func GetHexValue(color Color) int32 { return v } -// Converts Color to float array and normalizes +// ColorToFloat - Converts Color to float array and normalizes func ColorToFloat(color Color) []float32 { ccolor := color.cptr() ret := C.ColorToFloat(*ccolor) @@ -546,7 +546,7 @@ func ColorToFloat(color Color) []float32 { return data } -// Converts Vector3 to float array +// VectorToFloat - Converts Vector3 to float array func VectorToFloat(vec Vector3) []float32 { cvec := vec.cptr() ret := C.VectorToFloat(*cvec) @@ -560,7 +560,7 @@ func VectorToFloat(vec Vector3) []float32 { return data } -// Converts Matrix to float array +// MatrixToFloat - Converts Matrix to float array func MatrixToFloat(mat Matrix) []float32 { cmat := mat.cptr() ret := C.MatrixToFloat(*cmat) @@ -574,7 +574,7 @@ func MatrixToFloat(mat Matrix) []float32 { 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 { cmin := (C.int)(min) cmax := (C.int)(max) @@ -583,7 +583,7 @@ func GetRandomValue(min int32, max int32) int32 { 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 { ccolor := color.cptr() calpha := (C.float)(alpha) @@ -592,25 +592,25 @@ func Fade(color Color, alpha float32) Color { return v } -// Setup some window configuration flags +// SetConfigFlags - Setup some window configuration flags func SetConfigFlags(flags byte) { cflags := (C.char)(flags) 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() { C.ShowLogo() } -// Storage save integer value (to defined position) +// StorageSaveValue - Storage save integer value (to defined position) func StorageSaveValue(position int32, value int32) { cposition := (C.int)(position) cvalue := (C.int)(value) C.StorageSaveValue(cposition, cvalue) } -// Storage load integer value (from defined position) +// StorageLoadValue - Storage load integer value (from defined position) func StorageLoadValue(position int32) int32 { cposition := (C.int)(position) ret := C.StorageLoadValue(cposition) @@ -618,7 +618,7 @@ func StorageLoadValue(position int32) int32 { return v } -// Detect if a key has been pressed once +// IsKeyPressed - Detect if a key has been pressed once func IsKeyPressed(key int32) bool { ckey := (C.int)(key) ret := C.IsKeyPressed(ckey) @@ -626,7 +626,7 @@ func IsKeyPressed(key int32) bool { return v } -// Detect if a key is being pressed +// IsKeyDown - Detect if a key is being pressed func IsKeyDown(key int32) bool { ckey := (C.int)(key) ret := C.IsKeyDown(ckey) @@ -634,7 +634,7 @@ func IsKeyDown(key int32) bool { return v } -// Detect if a key has been released once +// IsKeyReleased - Detect if a key has been released once func IsKeyReleased(key int32) bool { ckey := (C.int)(key) ret := C.IsKeyReleased(ckey) @@ -642,7 +642,7 @@ func IsKeyReleased(key int32) bool { return v } -// Detect if a key is NOT being pressed +// IsKeyUp - Detect if a key is NOT being pressed func IsKeyUp(key int32) bool { ckey := (C.int)(key) ret := C.IsKeyUp(ckey) @@ -650,20 +650,20 @@ func IsKeyUp(key int32) bool { return v } -// Get latest key pressed +// GetKeyPressed - Get latest key pressed func GetKeyPressed() int32 { ret := C.GetKeyPressed() v := (int32)(ret) 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) { ckey := (C.int)(key) C.SetExitKey(ckey) } -// Detect if a gamepad is available +// IsGamepadAvailable - Detect if a gamepad is available func IsGamepadAvailable(gamepad int32) bool { cgamepad := (C.int)(gamepad) ret := C.IsGamepadAvailable(cgamepad) @@ -671,7 +671,7 @@ func IsGamepadAvailable(gamepad int32) bool { return v } -// Check gamepad name (if available) +// IsGamepadName - Check gamepad name (if available) func IsGamepadName(gamepad int32, name string) bool { cgamepad := (C.int)(gamepad) cname := C.CString(name) @@ -681,7 +681,7 @@ func IsGamepadName(gamepad int32, name string) bool { return v } -// Return gamepad internal name id +// GetGamepadName - Return gamepad internal name id func GetGamepadName(gamepad int32) string { cgamepad := (C.int)(gamepad) ret := C.GetGamepadName(cgamepad) @@ -689,7 +689,7 @@ func GetGamepadName(gamepad int32) string { 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 { cgamepad := (C.int)(gamepad) cbutton := (C.int)(button) @@ -698,7 +698,7 @@ func IsGamepadButtonPressed(gamepad int32, button int32) bool { 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 { cgamepad := (C.int)(gamepad) cbutton := (C.int)(button) @@ -707,7 +707,7 @@ func IsGamepadButtonDown(gamepad int32, button int32) bool { 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 { cgamepad := (C.int)(gamepad) cbutton := (C.int)(button) @@ -716,7 +716,7 @@ func IsGamepadButtonReleased(gamepad int32, button int32) bool { 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 { cgamepad := (C.int)(gamepad) cbutton := (C.int)(button) @@ -725,14 +725,14 @@ func IsGamepadButtonUp(gamepad int32, button int32) bool { return v } -// Get the last gamepad button pressed +// GetGamepadButtonPressed - Get the last gamepad button pressed func GetGamepadButtonPressed() int32 { ret := C.GetGamepadButtonPressed() v := (int32)(ret) return v } -// Return gamepad axis count for a gamepad +// GetGamepadAxisCount - Return gamepad axis count for a gamepad func GetGamepadAxisCount(gamepad int32) int32 { cgamepad := (C.int)(gamepad) ret := C.GetGamepadAxisCount(cgamepad) @@ -740,7 +740,7 @@ func GetGamepadAxisCount(gamepad int32) int32 { 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 { cgamepad := (C.int)(gamepad) caxis := (C.int)(axis) @@ -749,7 +749,7 @@ func GetGamepadAxisMovement(gamepad int32, axis int32) float32 { 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 { cbutton := (C.int)(button) ret := C.IsMouseButtonPressed(cbutton) @@ -757,7 +757,7 @@ func IsMouseButtonPressed(button int32) bool { return v } -// Detect if a mouse button is being pressed +// IsMouseButtonDown - Detect if a mouse button is being pressed func IsMouseButtonDown(button int32) bool { cbutton := (C.int)(button) ret := C.IsMouseButtonDown(cbutton) @@ -765,7 +765,7 @@ func IsMouseButtonDown(button int32) bool { 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 { cbutton := (C.int)(button) ret := C.IsMouseButtonReleased(cbutton) @@ -773,7 +773,7 @@ func IsMouseButtonReleased(button int32) bool { 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 { cbutton := (C.int)(button) ret := C.IsMouseButtonUp(cbutton) @@ -781,55 +781,55 @@ func IsMouseButtonUp(button int32) bool { return v } -// Returns mouse position X +// GetMouseX - Returns mouse position X func GetMouseX() int32 { ret := C.GetMouseX() v := (int32)(ret) return v } -// Returns mouse position Y +// GetMouseY - Returns mouse position Y func GetMouseY() int32 { ret := C.GetMouseY() v := (int32)(ret) return v } -// Returns mouse position XY +// GetMousePosition - Returns mouse position XY func GetMousePosition() Vector2 { ret := C.GetMousePosition() v := NewVector2FromPointer(unsafe.Pointer(&ret)) return v } -// Set mouse position XY +// SetMousePosition - Set mouse position XY func SetMousePosition(position Vector2) { cposition := position.cptr() C.SetMousePosition(*cposition) } -// Returns mouse wheel movement Y +// GetMouseWheelMove - Returns mouse wheel movement Y func GetMouseWheelMove() int32 { ret := C.GetMouseWheelMove() v := (int32)(ret) 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 { ret := C.GetTouchX() v := (int32)(ret) 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 { ret := C.GetTouchY() v := (int32)(ret) 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 { cindex := (C.int)(index) ret := C.GetTouchPosition(cindex) diff --git a/raylib/gestures.go b/raylib/gestures.go index 93ab127..1e16da7 100644 --- a/raylib/gestures.go +++ b/raylib/gestures.go @@ -25,13 +25,13 @@ const ( 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) { cgestureFlags := (C.uint)(gestureFlags) C.SetGesturesEnabled(cgestureFlags) } -// Check if a gesture have been detected +// IsGestureDetected - Check if a gesture have been detected func IsGestureDetected(gesture Gestures) bool { cgesture := (C.int)(gesture) ret := C.IsGestureDetected(cgesture) @@ -39,49 +39,49 @@ func IsGestureDetected(gesture Gestures) bool { return v } -// Get latest detected gesture +// GetGestureDetected - Get latest detected gesture func GetGestureDetected() Gestures { ret := C.GetGestureDetected() v := (Gestures)(ret) return v } -// Get touch points count +// GetTouchPointsCount - Get touch points count func GetTouchPointsCount() int32 { ret := C.GetTouchPointsCount() v := (int32)(ret) return v } -// Get gesture hold time in milliseconds +// GetGestureHoldDuration - Get gesture hold time in milliseconds func GetGestureHoldDuration() float32 { ret := C.GetGestureHoldDuration() v := (float32)(ret) return v } -// Get gesture drag vector +// GetGestureDragVector - Get gesture drag vector func GetGestureDragVector() Vector2 { ret := C.GetGestureDragVector() v := NewVector2FromPointer(unsafe.Pointer(&ret)) return v } -// Get gesture drag angle +// GetGestureDragAngle - Get gesture drag angle func GetGestureDragAngle() float32 { ret := C.GetGestureDragAngle() v := (float32)(ret) return v } -// Get gesture pinch delta +// GetGesturePinchVector - Get gesture pinch delta func GetGesturePinchVector() Vector2 { ret := C.GetGesturePinchVector() v := NewVector2FromPointer(unsafe.Pointer(&ret)) return v } -// Get gesture pinch angle +// GetGesturePinchAngle - Get gesture pinch angle func GetGesturePinchAngle() float32 { ret := C.GetGesturePinchAngle() v := (float32)(ret) diff --git a/raylib/models.go b/raylib/models.go index 3f1006d..f0fae46 100644 --- a/raylib/models.go +++ b/raylib/models.go @@ -38,12 +38,12 @@ func (m *Mesh) cptr() *C.Mesh { 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 { 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 { return *(*Mesh)(ptr) } @@ -72,12 +72,12 @@ func (m *Material) cptr() *C.Material { 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 { 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 { return *(*Material)(ptr) } @@ -98,12 +98,12 @@ func (m *Model) cptr() *C.Model { return (*C.Model)(unsafe.Pointer(m)) } -// Returns new Model +// NewModel - Returns new Model func NewModel(mesh Mesh, transform Matrix, material Material) Model { return Model{mesh, transform, material, [4]byte{}} } -// Returns new Model from pointer +// NewModelFromPointer - Returns new Model from pointer func NewModelFromPointer(ptr unsafe.Pointer) Model { return *(*Model)(ptr) } @@ -120,17 +120,17 @@ func (r *Ray) cptr() *C.Ray { return (*C.Ray)(unsafe.Pointer(r)) } -// Returns new Ray +// NewRay - Returns new Ray func NewRay(position, direction Vector3) Ray { return Ray{position, direction} } -// Returns new Ray from pointer +// NewRayFromPointer - Returns new Ray from pointer func NewRayFromPointer(ptr unsafe.Pointer) Ray { 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) { cstartPos := startPos.cptr() cendPos := endPos.cptr() @@ -138,7 +138,7 @@ func DrawLine3D(startPos Vector3, endPos Vector3, color Color) { 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) { ccenter := center.cptr() cradius := (C.float)(radius) @@ -148,7 +148,7 @@ func DrawCircle3D(center Vector3, radius float32, rotationAxis Vector3, rotation C.DrawCircle3D(*ccenter, cradius, *crotationAxis, crotationAngle, *ccolor) } -// Draw cube +// DrawCube - Draw cube func DrawCube(position Vector3, width float32, height float32, length float32, color Color) { cposition := position.cptr() 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) } -// Draw cube (Vector version) +// DrawCubeV - Draw cube (Vector version) func DrawCubeV(position Vector3, size Vector3, color Color) { cposition := position.cptr() csize := size.cptr() @@ -166,7 +166,7 @@ func DrawCubeV(position Vector3, size Vector3, color Color) { C.DrawCubeV(*cposition, *csize, *ccolor) } -// Draw cube wires +// DrawCubeWires - Draw cube wires func DrawCubeWires(position Vector3, width float32, height float32, length float32, color Color) { cposition := position.cptr() 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) } -// Draw cube textured +// DrawCubeTexture - Draw cube textured func DrawCubeTexture(texture Texture2D, position Vector3, width float32, height float32, length float32, color Color) { ctexture := texture.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) } -// Draw sphere +// DrawSphere - Draw sphere func DrawSphere(centerPos Vector3, radius float32, color Color) { ccenterPos := centerPos.cptr() cradius := (C.float)(radius) @@ -195,7 +195,7 @@ func DrawSphere(centerPos Vector3, radius float32, color Color) { 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) { ccenterPos := centerPos.cptr() 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) } -// Draw sphere wires +// DrawSphereWires - Draw sphere wires func DrawSphereWires(centerPos Vector3, radius float32, rings int32, slices int32, color Color) { ccenterPos := centerPos.cptr() 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) } -// Draw a cylinder/cone +// DrawCylinder - Draw a cylinder/cone func DrawCylinder(position Vector3, radiusTop float32, radiusBottom float32, height float32, slices int32, color Color) { cposition := position.cptr() 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) } -// 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) { cposition := position.cptr() cradiusTop := (C.float)(radiusTop) @@ -237,7 +237,7 @@ func DrawCylinderWires(position Vector3, radiusTop float32, radiusBottom float32 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) { ccenterPos := centerPos.cptr() csize := size.cptr() @@ -245,27 +245,27 @@ func DrawPlane(centerPos Vector3, size Vector2, color Color) { C.DrawPlane(*ccenterPos, *csize, *ccolor) } -// Draw a ray line +// DrawRay - Draw a ray line func DrawRay(ray Ray, color Color) { cray := ray.cptr() ccolor := color.cptr() 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) { cslices := (C.int)(slices) cspacing := (C.float)(spacing) C.DrawGrid(cslices, cspacing) } -// Draw simple gizmo +// DrawGizmo - Draw simple gizmo func DrawGizmo(position Vector3) { cposition := position.cptr() C.DrawGizmo(*cposition) } -// Load mesh from file +// LoadMesh - Load mesh from file func LoadMesh(fileName string) Mesh { cfileName := C.CString(fileName) defer C.free(unsafe.Pointer(cfileName)) @@ -274,7 +274,7 @@ func LoadMesh(fileName string) Mesh { 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 { cnumVertex := (C.int)(numVertex) 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 } -// Load model from file +// LoadModel - Load model from file func LoadModel(fileName string) Model { cfileName := C.CString(fileName) defer C.free(unsafe.Pointer(cfileName)) @@ -295,7 +295,7 @@ func LoadModel(fileName string) Model { return v } -// Load model from mesh data +// LoadModelFromMesh - Load model from mesh data func LoadModelFromMesh(data Mesh, dynamic bool) Model { cdata := data.cptr() cdynamic := 0 @@ -307,7 +307,7 @@ func LoadModelFromMesh(data Mesh, dynamic bool) Model { return v } -// Load heightmap model from image data +// LoadHeightmap - Load heightmap model from image data func LoadHeightmap(heightmap *Image, size Vector3) Model { cheightmap := heightmap.cptr() csize := size.cptr() @@ -316,7 +316,7 @@ func LoadHeightmap(heightmap *Image, size Vector3) Model { return v } -// Load cubes-based map model from image data +// LoadCubicmap - Load cubes-based map model from image data func LoadCubicmap(cubicmap *Image) Model { ccubicmap := cubicmap.cptr() ret := C.LoadCubicmap(*ccubicmap) @@ -324,19 +324,19 @@ func LoadCubicmap(cubicmap *Image) Model { return v } -// Unload mesh from memory (RAM and/or VRAM) +// UnloadMesh - Unload mesh from memory (RAM and/or VRAM) func UnloadMesh(mesh *Mesh) { cmesh := mesh.cptr() C.UnloadMesh(cmesh) } -// Unload model from memory (RAM and/or VRAM) +// UnloadModel - Unload model from memory (RAM and/or VRAM) func UnloadModel(model Model) { cmodel := model.cptr() C.UnloadModel(*cmodel) } -// Load material data (.MTL) +// LoadMaterial - Load material data (.MTL) func LoadMaterial(fileName string) Material { cfileName := C.CString(fileName) defer C.free(unsafe.Pointer(cfileName)) @@ -345,20 +345,20 @@ func LoadMaterial(fileName string) Material { return v } -// Load default material (uses default models shader) +// LoadDefaultMaterial - Load default material (uses default models shader) func LoadDefaultMaterial() Material { ret := C.LoadDefaultMaterial() v := NewMaterialFromPointer(unsafe.Pointer(&ret)) return v } -// Unload material textures from VRAM +// UnloadMaterial - Unload material textures from VRAM func UnloadMaterial(material Material) { cmaterial := material.cptr() 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) { cmodel := model.cptr() cposition := position.cptr() @@ -367,7 +367,7 @@ func DrawModel(model Model, position Vector3, scale float32, tint Color) { 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) { cmodel := model.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) } -// 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) { cmodel := model.cptr() cposition := position.cptr() @@ -387,7 +387,7 @@ func DrawModelWires(model Model, position Vector3, scale float32, tint Color) { 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) { cmodel := model.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) } -// Draw bounding box (wires) +// DrawBoundingBox - Draw bounding box (wires) func DrawBoundingBox(box BoundingBox, color Color) { cbox := box.cptr() ccolor := color.cptr() 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) { ccamera := camera.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) } -// 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) { ccamera := camera.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) } -// Calculate mesh bounding box limits +// CalculateBoundingBox - Calculate mesh bounding box limits func CalculateBoundingBox(mesh Mesh) BoundingBox { cmesh := mesh.cptr() ret := C.CalculateBoundingBox(*cmesh) @@ -434,7 +434,7 @@ func CalculateBoundingBox(mesh Mesh) BoundingBox { return v } -// Detect collision between two spheres +// CheckCollisionSpheres - Detect collision between two spheres func CheckCollisionSpheres(centerA Vector3, radiusA float32, centerB Vector3, radiusB float32) bool { ccenterA := centerA.cptr() cradiusA := (C.float)(radiusA) @@ -445,7 +445,7 @@ func CheckCollisionSpheres(centerA Vector3, radiusA float32, centerB Vector3, ra return v } -// Detect collision between two bounding boxes +// CheckCollisionBoxes - Detect collision between two bounding boxes func CheckCollisionBoxes(box1 BoundingBox, box2 BoundingBox) bool { cbox1 := box1.cptr() cbox2 := box2.cptr() @@ -454,7 +454,7 @@ func CheckCollisionBoxes(box1 BoundingBox, box2 BoundingBox) bool { return v } -// Detect collision between box and sphere +// CheckCollisionBoxSphere - Detect collision between box and sphere func CheckCollisionBoxSphere(box BoundingBox, centerSphere Vector3, radiusSphere float32) bool { cbox := box.cptr() ccenterSphere := centerSphere.cptr() @@ -464,7 +464,7 @@ func CheckCollisionBoxSphere(box BoundingBox, centerSphere Vector3, radiusSphere return v } -// Detect collision between ray and sphere +// CheckCollisionRaySphere - Detect collision between ray and sphere func CheckCollisionRaySphere(ray Ray, spherePosition Vector3, sphereRadius float32) bool { cray := ray.cptr() cspherePosition := spherePosition.cptr() @@ -474,7 +474,7 @@ func CheckCollisionRaySphere(ray Ray, spherePosition Vector3, sphereRadius float 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 { cray := ray.cptr() cspherePosition := spherePosition.cptr() @@ -485,7 +485,7 @@ func CheckCollisionRaySphereEx(ray Ray, spherePosition Vector3, sphereRadius flo return v } -// Detect collision between ray and box +// CheckCollisionRayBox - Detect collision between ray and box func CheckCollisionRayBox(ray Ray, box BoundingBox) bool { cray := ray.cptr() cbox := box.cptr() diff --git a/raylib/platform_android.go b/raylib/platform_android.go index 3bde6ac..bba458f 100644 --- a/raylib/platform_android.go +++ b/raylib/platform_android.go @@ -24,7 +24,7 @@ import ( var callbackHolder func(unsafe.Pointer) -// Initialize Window and OpenGL Graphics +// InitWindow - Initialize Window and OpenGL Graphics func InitWindow(width int32, height int32, t interface{}) { cwidth := (C.int)(width) 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)) { callbackHolder = callback } @@ -48,47 +48,47 @@ func androidMain(app *C.struct_android_app) { } } -// Shows cursor +// ShowCursor - Shows cursor func ShowCursor() { return } -// Hides cursor +// HideCursor - Hides cursor func HideCursor() { return } -// Returns true if cursor is not visible +// IsCursorHidden - Returns true if cursor is not visible func IsCursorHidden() bool { return false } -// Enables cursor +// EnableCursor - Enables cursor func EnableCursor() { return } -// Disables cursor +// DisableCursor - Disables cursor func DisableCursor() { return } -// Check if a file have been dropped into window +// IsFileDropped - Check if a file have been dropped into window func IsFileDropped() bool { return false } -// Retrieve dropped files into window +// GetDroppedFiles - Retrieve dropped files into window func GetDroppedFiles(count *int32) (files []string) { return } -// Clear dropped files paths buffer +// ClearDroppedFiles - Clear dropped files paths buffer func ClearDroppedFiles() { return } -// Open asset +// OpenAsset - Open asset func OpenAsset(name string) (Asset, error) { cname := C.CString(name) defer C.free(unsafe.Pointer(cname)) diff --git a/raylib/platform_arm.go b/raylib/platform_arm.go index 0fe8c21..1cd8f8f 100644 --- a/raylib/platform_arm.go +++ b/raylib/platform_arm.go @@ -13,7 +13,7 @@ import ( "unsafe" ) -// Initialize Window and OpenGL Graphics +// InitWindow - Initialize Window and OpenGL Graphics func InitWindow(width int32, height int32, t interface{}) { cwidth := (C.int)(width) 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)) { return } -// Shows cursor +// ShowCursor - Shows cursor func ShowCursor() { C.ShowCursor() } -// Hides cursor +// HideCursor - Hides cursor func HideCursor() { C.HideCursor() } -// Returns true if cursor is not visible +// IsCursorHidden - Returns true if cursor is not visible func IsCursorHidden() bool { ret := C.IsCursorHidden() v := bool(int(ret) == 1) return v } -// Enables cursor +// EnableCursor - Enables cursor func EnableCursor() { C.EnableCursor() } -// Disables cursor +// DisableCursor - Disables cursor func 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 { return false } -// Retrieve dropped files into window +// GetDroppedFiles - Retrieve dropped files into window func GetDroppedFiles(count *int32) (files []string) { return } -// Clear dropped files paths buffer +// ClearDroppedFiles - Clear dropped files paths buffer func ClearDroppedFiles() { return } -// Open asset +// OpenAsset - Open asset func OpenAsset(name string) (Asset, error) { f, err := os.Open(name) if err != nil { diff --git a/raylib/platform_desktop.go b/raylib/platform_desktop.go index 2d5b0ec..867debe 100644 --- a/raylib/platform_desktop.go +++ b/raylib/platform_desktop.go @@ -13,7 +13,7 @@ import ( "unsafe" ) -// Initialize Window and OpenGL Graphics +// InitWindow - Initialize Window and OpenGL Graphics func InitWindow(width int32, height int32, t interface{}) { cwidth := (C.int)(width) 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)) { return } -// Shows cursor +// ShowCursor - Shows cursor func ShowCursor() { C.ShowCursor() } -// Hides cursor +// HideCursor - Hides cursor func HideCursor() { C.HideCursor() } -// Returns true if cursor is not visible +// IsCursorHidden - Returns true if cursor is not visible func IsCursorHidden() bool { ret := C.IsCursorHidden() v := bool(int(ret) == 1) return v } -// Enables cursor +// EnableCursor - Enables cursor func EnableCursor() { C.EnableCursor() } -// Disables cursor +// DisableCursor - Disables cursor func 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 { ret := C.IsFileDropped() v := bool(int(ret) == 1) return v } -// Retrieve dropped files into window +// GetDroppedFiles - Retrieve dropped files into window func GetDroppedFiles(count *int32) []string { ccount := (*C.int)(unsafe.Pointer(count)) ret := C.GetDroppedFiles(ccount) @@ -79,12 +79,12 @@ func GetDroppedFiles(count *int32) []string { return gostrings } -// Clear dropped files paths buffer +// ClearDroppedFiles - Clear dropped files paths buffer func ClearDroppedFiles() { C.ClearDroppedFiles() } -// Open asset +// OpenAsset - Open asset func OpenAsset(name string) (Asset, error) { f, err := os.Open(name) if err != nil { diff --git a/raylib/rres.go b/raylib/rres.go index ede42ad..e1f1e79 100644 --- a/raylib/rres.go +++ b/raylib/rres.go @@ -133,13 +133,13 @@ const ( RRESVertFloat ) -// Load resource from file (only one) +// LoadResource - Load resource from file (only one) // NOTE: Returns uncompressed data with parameters, only first resource found func LoadResource(fileName string) []byte { 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 func LoadResourceByID(fileName string, rresID int) (data []byte) { file, err := OpenAsset(fileName) diff --git a/raylib/shaders.go b/raylib/shaders.go index d086f61..d1df5e4 100644 --- a/raylib/shaders.go +++ b/raylib/shaders.go @@ -70,17 +70,17 @@ func (s *Shader) cptr() *C.Shader { 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 { 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 { 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 { cvsFileName := C.CString(vsFileName) cfsFileName := C.CString(fsFileName) @@ -92,27 +92,27 @@ func LoadShader(vsFileName string, fsFileName string) Shader { return v } -// Unload a custom shader from memory +// UnloadShader - Unload a custom shader from memory func UnloadShader(shader Shader) { cshader := shader.cptr() C.UnloadShader(*cshader) } -// Get default shader +// GetDefaultShader - Get default shader func GetDefaultShader() Shader { ret := C.GetDefaultShader() v := NewShaderFromPointer(unsafe.Pointer(&ret)) return v } -// Get default texture +// GetDefaultTexture - Get default texture func GetDefaultTexture() *Texture2D { ret := C.GetDefaultTexture() v := NewTexture2DFromPointer(unsafe.Pointer(&ret)) return &v } -// Get shader uniform location +// GetShaderLocation - Get shader uniform location func GetShaderLocation(shader Shader, uniformName string) int32 { cshader := shader.cptr() cuniformName := C.CString(uniformName) @@ -122,7 +122,7 @@ func GetShaderLocation(shader Shader, uniformName string) int32 { return v } -// Set shader uniform value (float) +// SetShaderValue - Set shader uniform value (float) func SetShaderValue(shader Shader, uniformLoc int32, value []float32, size int32) { cshader := shader.cptr() cuniformLoc := (C.int)(uniformLoc) @@ -131,7 +131,7 @@ func SetShaderValue(shader Shader, uniformLoc int32, value []float32, size int32 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) { cshader := shader.cptr() cuniformLoc := (C.int)(uniformLoc) @@ -140,7 +140,7 @@ func SetShaderValuei(shader Shader, uniformLoc int32, value []int32, size int32) 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) { cshader := shader.cptr() cuniformLoc := (C.int)(uniformLoc) @@ -148,72 +148,72 @@ func SetShaderValueMatrix(shader Shader, uniformLoc int32, mat Matrix) { 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) { cproj := proj.cptr() 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) { cview := view.cptr() C.SetMatrixModelview(*cview) } -// Begin custom shader drawing +// BeginShaderMode - Begin custom shader drawing func BeginShaderMode(shader Shader) { cshader := shader.cptr() C.BeginShaderMode(*cshader) } -// End custom shader drawing (use default shader) +// EndShaderMode - End custom shader drawing (use default shader) func EndShaderMode() { C.EndShaderMode() } -// Begin blending mode (alpha, additive, multiplied) +// BeginBlendMode - Begin blending mode (alpha, additive, multiplied) func BeginBlendMode(mode BlendMode) { cmode := (C.int)(mode) C.BeginBlendMode(cmode) } -// End blending mode (reset to default: alpha blending) +// EndBlendMode - End blending mode (reset to default: alpha blending) func EndBlendMode() { C.EndBlendMode() } -// Init VR device +// InitVrDevice - Init VR device func InitVrDevice(vdDevice VrDevice) { cvdDevice := (C.int)(vdDevice) C.InitVrDevice(cvdDevice) } -// Close VR device +// CloseVrDevice - Close VR device func CloseVrDevice() { C.CloseVrDevice() } -// Detect if VR device is ready +// IsVrDeviceReady - Detect if VR device is ready func IsVrDeviceReady() bool { ret := C.IsVrDeviceReady() v := bool(int(ret) == 1) return v } -// Detect if VR simulator is running +// IsVrSimulator - Detect if VR simulator is running func IsVrSimulator() bool { ret := C.IsVrSimulator() v := bool(int(ret) == 1) return v } -// Update VR tracking (position and orientation) and camera +// UpdateVrTracking - Update VR tracking (position and orientation) and camera func UpdateVrTracking(camera *Camera) { ccamera := camera.cptr() C.UpdateVrTracking(ccamera) } -// Enable/Disable VR experience (device or simulator) +// ToggleVrMode - Enable/Disable VR experience (device or simulator) func ToggleVrMode() { C.ToggleVrMode() } diff --git a/raylib/shapes.go b/raylib/shapes.go index a3c768e..f091468 100644 --- a/raylib/shapes.go +++ b/raylib/shapes.go @@ -7,7 +7,7 @@ package raylib import "C" import "unsafe" -// Draw a pixel +// DrawPixel - Draw a pixel func DrawPixel(posX int32, posY int32, color Color) { cposX := (C.int)(posX) cposY := (C.int)(posY) @@ -15,14 +15,14 @@ func DrawPixel(posX int32, posY int32, color Color) { C.DrawPixel(cposX, cposY, *ccolor) } -// Draw a pixel (Vector version) +// DrawPixelV - Draw a pixel (Vector version) func DrawPixelV(position Vector2, color Color) { cposition := position.cptr() ccolor := color.cptr() C.DrawPixelV(*cposition, *ccolor) } -// Draw a line +// DrawLine - Draw a line func DrawLine(startPosX int32, startPosY int32, endPosX int32, endPosY int32, color Color) { cstartPosX := (C.int)(startPosX) 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) } -// Draw a line (Vector version) +// DrawLineV - Draw a line (Vector version) func DrawLineV(startPos Vector2, endPos Vector2, color Color) { cstartPos := startPos.cptr() cendPos := endPos.cptr() @@ -40,7 +40,7 @@ func DrawLineV(startPos Vector2, endPos Vector2, color Color) { 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) { ccenterX := (C.int)(centerX) ccenterY := (C.int)(centerY) @@ -49,7 +49,7 @@ func DrawCircle(centerX int32, centerY int32, radius float32, color Color) { 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) { ccenterX := (C.int)(centerX) 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) } -// Draw a color-filled circle (Vector version) +// DrawCircleV - Draw a color-filled circle (Vector version) func DrawCircleV(center Vector2, radius float32, color Color) { ccenter := center.cptr() cradius := (C.float)(radius) @@ -67,7 +67,7 @@ func DrawCircleV(center Vector2, radius float32, color Color) { C.DrawCircleV(*ccenter, cradius, *ccolor) } -// Draw circle outline +// DrawCircleLines - Draw circle outline func DrawCircleLines(centerX int32, centerY int32, radius float32, color Color) { ccenterX := (C.int)(centerX) ccenterY := (C.int)(centerY) @@ -76,7 +76,7 @@ func DrawCircleLines(centerX int32, centerY int32, radius float32, color Color) 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) { cposX := (C.int)(posX) 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) } -// Draw a color-filled rectangle +// DrawRectangleRec - Draw a color-filled rectangle func DrawRectangleRec(rec Rectangle, color Color) { crec := rec.cptr() ccolor := color.cptr() 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) { cposX := (C.int)(posX) 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) } -// Draw a color-filled rectangle (Vector version) +// DrawRectangleV - Draw a color-filled rectangle (Vector version) func DrawRectangleV(position Vector2, size Vector2, color Color) { cposition := position.cptr() csize := size.cptr() @@ -112,7 +112,7 @@ func DrawRectangleV(position Vector2, size Vector2, color Color) { C.DrawRectangleV(*cposition, *csize, *ccolor) } -// Draw rectangle outline +// DrawRectangleLines - Draw rectangle outline func DrawRectangleLines(posX int32, posY int32, width int32, height int32, color Color) { cposX := (C.int)(posX) 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) } -// Draw a color-filled triangle +// DrawTriangle - Draw a color-filled triangle func DrawTriangle(v1 Vector2, v2 Vector2, v3 Vector2, color Color) { cv1 := v1.cptr() cv2 := v2.cptr() @@ -131,7 +131,7 @@ func DrawTriangle(v1 Vector2, v2 Vector2, v3 Vector2, color Color) { C.DrawTriangle(*cv1, *cv2, *cv3, *ccolor) } -// Draw triangle outline +// DrawTriangleLines - Draw triangle outline func DrawTriangleLines(v1 Vector2, v2 Vector2, v3 Vector2, color Color) { cv1 := v1.cptr() cv2 := v2.cptr() @@ -140,7 +140,7 @@ func DrawTriangleLines(v1 Vector2, v2 Vector2, v3 Vector2, color Color) { 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) { ccenter := center.cptr() 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) } -// Draw a closed polygon defined by points +// DrawPolyEx - Draw a closed polygon defined by points func DrawPolyEx(points []Vector2, numPoints int32, color Color) { cpoints := points[0].cptr() cnumPoints := (C.int)(numPoints) @@ -158,7 +158,7 @@ func DrawPolyEx(points []Vector2, numPoints int32, color Color) { C.DrawPolyEx(cpoints, cnumPoints, *ccolor) } -// Draw polygon lines +// DrawPolyExLines - Draw polygon lines func DrawPolyExLines(points []Vector2, numPoints int32, color Color) { cpoints := points[0].cptr() cnumPoints := (C.int)(numPoints) @@ -166,7 +166,7 @@ func DrawPolyExLines(points []Vector2, numPoints int32, color Color) { C.DrawPolyExLines(cpoints, cnumPoints, *ccolor) } -// Check collision between two rectangles +// CheckCollisionRecs - Check collision between two rectangles func CheckCollisionRecs(rec1 Rectangle, rec2 Rectangle) bool { crec1 := rec1.cptr() crec2 := rec2.cptr() @@ -175,7 +175,7 @@ func CheckCollisionRecs(rec1 Rectangle, rec2 Rectangle) bool { return v } -// Check collision between two circles +// CheckCollisionCircles - Check collision between two circles func CheckCollisionCircles(center1 Vector2, radius1 float32, center2 Vector2, radius2 float32) bool { ccenter1 := center1.cptr() cradius1 := (C.float)(radius1) @@ -186,7 +186,7 @@ func CheckCollisionCircles(center1 Vector2, radius1 float32, center2 Vector2, ra return v } -// Check collision between circle and rectangle +// CheckCollisionCircleRec - Check collision between circle and rectangle func CheckCollisionCircleRec(center Vector2, radius float32, rec Rectangle) bool { ccenter := center.cptr() cradius := (C.float)(radius) @@ -196,7 +196,7 @@ func CheckCollisionCircleRec(center Vector2, radius float32, rec Rectangle) bool return v } -// Get collision rectangle for two rectangles collision +// GetCollisionRec - Get collision rectangle for two rectangles collision func GetCollisionRec(rec1 Rectangle, rec2 Rectangle) Rectangle { crec1 := rec1.cptr() crec2 := rec2.cptr() @@ -205,7 +205,7 @@ func GetCollisionRec(rec1 Rectangle, rec2 Rectangle) Rectangle { return v } -// Check if point is inside rectangle +// CheckCollisionPointRec - Check if point is inside rectangle func CheckCollisionPointRec(point Vector2, rec Rectangle) bool { cpoint := point.cptr() crec := rec.cptr() @@ -214,7 +214,7 @@ func CheckCollisionPointRec(point Vector2, rec Rectangle) bool { return v } -// Check if point is inside circle +// CheckCollisionPointCircle - Check if point is inside circle func CheckCollisionPointCircle(point Vector2, center Vector2, radius float32) bool { cpoint := point.cptr() ccenter := center.cptr() @@ -224,7 +224,7 @@ func CheckCollisionPointCircle(point Vector2, center Vector2, radius float32) bo 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 { cpoint := point.cptr() cp1 := p1.cptr() diff --git a/raylib/text.go b/raylib/text.go index d8ec231..3085426 100644 --- a/raylib/text.go +++ b/raylib/text.go @@ -25,12 +25,12 @@ func (c *CharInfo) cptr() *C.CharInfo { return (*C.CharInfo)(unsafe.Pointer(c)) } -// Returns new SpriteFont +// NewCharInfo - Returns new SpriteFont func NewCharInfo(value int32, rec Rectangle, offsetX, offsetY, advanceX int32) CharInfo { return CharInfo{value, rec, offsetX, offsetY, advanceX} } -// Returns new SpriteFont from pointer +// NewCharInfoFromPointer - Returns new SpriteFont from pointer func NewCharInfoFromPointer(ptr unsafe.Pointer) CharInfo { return *(*CharInfo)(ptr) } @@ -51,24 +51,24 @@ func (s *SpriteFont) cptr() *C.SpriteFont { return (*C.SpriteFont)(unsafe.Pointer(s)) } -// Returns new SpriteFont +// NewSpriteFont - Returns new SpriteFont func NewSpriteFont(texture Texture2D, baseSize, charsCount int32, chars *CharInfo) SpriteFont { return SpriteFont{texture, baseSize, charsCount, chars} } -// Returns new SpriteFont from pointer +// NewSpriteFontFromPointer - Returns new SpriteFont from pointer func NewSpriteFontFromPointer(ptr unsafe.Pointer) SpriteFont { return *(*SpriteFont)(ptr) } -// Get the default SpriteFont +// GetDefaultFont - Get the default SpriteFont func GetDefaultFont() SpriteFont { ret := C.GetDefaultFont() v := NewSpriteFontFromPointer(unsafe.Pointer(&ret)) return v } -// Load a SpriteFont image into GPU memory +// LoadSpriteFont - Load a SpriteFont image into GPU memory func LoadSpriteFont(fileName string) SpriteFont { cfileName := C.CString(fileName) defer C.free(unsafe.Pointer(cfileName)) @@ -77,7 +77,7 @@ func LoadSpriteFont(fileName string) SpriteFont { 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 { cfileName := C.CString(fileName) defer C.free(unsafe.Pointer(cfileName)) @@ -89,13 +89,13 @@ func LoadSpriteFontTTF(fileName string, fontSize int32, charsCount int32, fontCh return v } -// Unload SpriteFont from GPU memory +// UnloadSpriteFont - Unload SpriteFont from GPU memory func UnloadSpriteFont(spriteFont SpriteFont) { cspriteFont := spriteFont.cptr() 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) { ctext := C.CString(text) 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) } -// 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) { cspriteFont := spriteFont.cptr() 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) } -// Measure string width for default font +// MeasureText - Measure string width for default font func MeasureText(text string, fontSize int32) int32 { ctext := C.CString(text) defer C.free(unsafe.Pointer(ctext)) @@ -128,7 +128,7 @@ func MeasureText(text string, fontSize int32) int32 { return v } -// Measure string size for SpriteFont +// MeasureTextEx - Measure string size for SpriteFont func MeasureTextEx(spriteFont SpriteFont, text string, fontSize float32, spacing int32) Vector2 { cspriteFont := spriteFont.cptr() ctext := C.CString(text) @@ -140,7 +140,7 @@ func MeasureTextEx(spriteFont SpriteFont, text string, fontSize float32, spacing return v } -// Shows current FPS +// DrawFPS - Shows current FPS func DrawFPS(posX int32, posY int32) { cposX := (C.int)(posX) cposY := (C.int)(posY) diff --git a/raylib/textures.go b/raylib/textures.go index c4b5b87..9653476 100644 --- a/raylib/textures.go +++ b/raylib/textures.go @@ -101,12 +101,12 @@ func (i *Image) cptr() *C.Image { 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 { return &Image{data, width, height, mipmaps, format} } -// Returns new Image from pointer +// NewImageFromPointer - Returns new Image from pointer func NewImageFromPointer(ptr unsafe.Pointer) *Image { return (*Image)(ptr) } @@ -130,12 +130,12 @@ func (t *Texture2D) cptr() *C.Texture2D { return (*C.Texture2D)(unsafe.Pointer(t)) } -// Returns new Texture2D +// NewTexture2D - Returns new Texture2D func NewTexture2D(id uint32, width, height, mipmaps int32, format TextureFormat) Texture2D { return Texture2D{id, width, height, mipmaps, format} } -// Returns new Texture2D from pointer +// NewTexture2DFromPointer - Returns new Texture2D from pointer func NewTexture2DFromPointer(ptr unsafe.Pointer) Texture2D { return *(*Texture2D)(ptr) } @@ -154,17 +154,17 @@ func (r *RenderTexture2D) cptr() *C.RenderTexture2D { return (*C.RenderTexture2D)(unsafe.Pointer(r)) } -// Returns new RenderTexture2D +// NewRenderTexture2D - Returns new RenderTexture2D func NewRenderTexture2D(id uint32, texture, depth Texture2D) RenderTexture2D { return RenderTexture2D{id, texture, depth} } -// Returns new RenderTexture2D from pointer +// NewRenderTexture2DFromPointer - Returns new RenderTexture2D from pointer func NewRenderTexture2DFromPointer(ptr unsafe.Pointer) RenderTexture2D { return *(*RenderTexture2D)(ptr) } -// Load an image into CPU memory (RAM) +// LoadImage - Load an image into CPU memory (RAM) func LoadImage(fileName string) *Image { cfileName := C.CString(fileName) defer C.free(unsafe.Pointer(cfileName)) @@ -173,7 +173,7 @@ func LoadImage(fileName string) *Image { 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 { cpixels := pixels[0].cptr() cwidth := (C.int)(width) @@ -183,7 +183,7 @@ func LoadImageEx(pixels []Color, width int32, height int32) *Image { 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 { cdata := unsafe.Pointer(&data[0]) cwidth := (C.int)(width) @@ -194,7 +194,7 @@ func LoadImagePro(data []byte, width int32, height int32, format TextureFormat) 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 { cfileName := C.CString(fileName) defer C.free(unsafe.Pointer(cfileName)) @@ -207,7 +207,7 @@ func LoadImageRaw(fileName string, width int32, height int32, format TextureForm return v } -// Load an image as texture into GPU memory +// LoadTexture - Load an image as texture into GPU memory func LoadTexture(fileName string) Texture2D { cfileName := C.CString(fileName) defer C.free(unsafe.Pointer(cfileName)) @@ -216,7 +216,7 @@ func LoadTexture(fileName string) Texture2D { return v } -// Load a texture from image data +// LoadTextureFromImage - Load a texture from image data func LoadTextureFromImage(image *Image) Texture2D { cimage := image.cptr() ret := C.LoadTextureFromImage(*cimage) @@ -224,7 +224,7 @@ func LoadTextureFromImage(image *Image) Texture2D { 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 { cwidth := (C.int)(width) cheight := (C.int)(height) @@ -233,32 +233,32 @@ func LoadRenderTexture(width int32, height int32) RenderTexture2D { return v } -// Unload image from CPU memory (RAM) +// UnloadImage - Unload image from CPU memory (RAM) func UnloadImage(image *Image) { cimage := image.cptr() C.UnloadImage(*cimage) } -// Unload texture from GPU memory +// UnloadTexture - Unload texture from GPU memory func UnloadTexture(texture Texture2D) { ctexture := texture.cptr() C.UnloadTexture(*ctexture) } -// Unload render texture from GPU memory +// UnloadRenderTexture - Unload render texture from GPU memory func UnloadRenderTexture(target RenderTexture2D) { ctarget := target.cptr() C.UnloadRenderTexture(*ctarget) } -// Get pixel data from image +// GetImageData - Get pixel data from image func GetImageData(image *Image) unsafe.Pointer { cimage := image.cptr() ret := C.GetImageData(*cimage) 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 { ctexture := texture.cptr() ret := C.GetTextureData(*ctexture) @@ -266,35 +266,35 @@ func GetTextureData(texture Texture2D) *Image { return v } -// Update GPU texture with new data +// UpdateTexture - Update GPU texture with new data func UpdateTexture(texture Texture2D, pixels unsafe.Pointer) { ctexture := texture.cptr() cpixels := (unsafe.Pointer)(unsafe.Pointer(pixels)) 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) { cimage := image.cptr() cfillColor := fillColor.cptr() C.ImageToPOT(cimage, *cfillColor) } -// Convert image data to desired format +// ImageFormat - Convert image data to desired format func ImageFormat(image *Image, newFormat int32) { cimage := image.cptr() cnewFormat := (C.int)(newFormat) C.ImageFormat(cimage, cnewFormat) } -// Apply alpha mask to image +// ImageAlphaMask - Apply alpha mask to image func ImageAlphaMask(image *Image, alphaMask *Image) { cimage := image.cptr() calphaMask := alphaMask.cptr() 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) { cimage := image.cptr() 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) } -// Create an image duplicate (useful for transformations) +// ImageCopy - Create an image duplicate (useful for transformations) func ImageCopy(image *Image) *Image { cimage := image.cptr() ret := C.ImageCopy(*cimage) @@ -312,14 +312,14 @@ func ImageCopy(image *Image) *Image { return v } -// Crop an image to a defined rectangle +// ImageCrop - Crop an image to a defined rectangle func ImageCrop(image *Image, crop Rectangle) { cimage := image.cptr() ccrop := crop.cptr() C.ImageCrop(cimage, *ccrop) } -// Resize an image (bilinear filtering) +// ImageResize - Resize an image (bilinear filtering) func ImageResize(image *Image, newWidth int32, newHeight int32) { cimage := image.cptr() cnewWidth := (C.int)(newWidth) @@ -327,7 +327,7 @@ func ImageResize(image *Image, newWidth int32, newHeight int32) { 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) { cimage := image.cptr() cnewWidth := (C.int)(newWidth) @@ -335,7 +335,7 @@ func ImageResizeNN(image *Image, newWidth int32, newHeight int32) { 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 { ctext := C.CString(text) defer C.free(unsafe.Pointer(ctext)) @@ -346,7 +346,7 @@ func ImageText(text string, fontSize int32, color Color) *Image { 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 { cfont := font.cptr() ctext := C.CString(text) @@ -359,7 +359,7 @@ func ImageTextEx(font SpriteFont, text string, fontSize float32, spacing int32, 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) { cdst := dst.cptr() csrc := src.cptr() @@ -368,7 +368,7 @@ func ImageDraw(dst *Image, src *Image, srcRec Rectangle, dstRec Rectangle) { 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) { cdst := dst.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) } -// 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) { cdst := dst.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) } -// Flip image vertically +// ImageFlipVertical - Flip image vertically func ImageFlipVertical(image *Image) { cimage := image.cptr() C.ImageFlipVertical(cimage) } -// Flip image horizontally +// ImageFlipHorizontal - Flip image horizontally func ImageFlipHorizontal(image *Image) { cimage := image.cptr() C.ImageFlipHorizontal(cimage) } -// Modify image color: tint +// ImageColorTint - Modify image color: tint func ImageColorTint(image *Image, color Color) { cimage := image.cptr() ccolor := color.cptr() C.ImageColorTint(cimage, *ccolor) } -// Modify image color: invert +// ImageColorInvert - Modify image color: invert func ImageColorInvert(image *Image) { cimage := image.cptr() C.ImageColorInvert(cimage) } -// Modify image color: grayscale +// ImageColorGrayscale - Modify image color: grayscale func ImageColorGrayscale(image *Image) { cimage := image.cptr() C.ImageColorGrayscale(cimage) } -// Modify image color: contrast (-100 to 100) +// ImageColorContrast - Modify image color: contrast (-100 to 100) func ImageColorContrast(image *Image, contrast float32) { cimage := image.cptr() ccontrast := (C.float)(contrast) 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) { cimage := image.cptr() cbrightness := (C.int)(brightness) C.ImageColorBrightness(cimage, cbrightness) } -// Generate GPU mipmaps for a texture +// GenTextureMipmaps - Generate GPU mipmaps for a texture func GenTextureMipmaps(texture *Texture2D) { ctexture := texture.cptr() C.GenTextureMipmaps(ctexture) } -// Set texture scaling filter mode +// SetTextureFilter - Set texture scaling filter mode func SetTextureFilter(texture Texture2D, filterMode TextureFilterMode) { ctexture := texture.cptr() cfilterMode := (C.int)(filterMode) C.SetTextureFilter(*ctexture, cfilterMode) } -// Set texture wrapping mode +// SetTextureWrap - Set texture wrapping mode func SetTextureWrap(texture Texture2D, wrapMode TextureWrapMode) { ctexture := texture.cptr() cwrapMode := (C.int)(wrapMode) C.SetTextureWrap(*ctexture, cwrapMode) } -// Draw a Texture2D +// DrawTexture - Draw a Texture2D func DrawTexture(texture Texture2D, posX int32, posY int32, tint Color) { ctexture := texture.cptr() cposX := (C.int)(posX) @@ -466,7 +466,7 @@ func DrawTexture(texture Texture2D, posX int32, posY int32, tint Color) { 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) { ctexture := texture.cptr() cposition := position.cptr() @@ -474,7 +474,7 @@ func DrawTextureV(texture Texture2D, position Vector2, tint Color) { 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) { ctexture := texture.cptr() cposition := position.cptr() @@ -484,7 +484,7 @@ func DrawTextureEx(texture Texture2D, position Vector2, rotation float32, scale 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) { ctexture := texture.cptr() csourceRec := sourceRec.cptr() @@ -493,7 +493,7 @@ func DrawTextureRec(texture Texture2D, sourceRec Rectangle, position Vector2, ti 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) { ctexture := texture.cptr() csourceRec := sourceRec.cptr() diff --git a/raylib/utils.go b/raylib/utils.go index c8959ec..44136a4 100644 --- a/raylib/utils.go +++ b/raylib/utils.go @@ -17,12 +17,12 @@ const ( var traceDebugMsgs = false -// Set debug messages +// SetDebug - Set debug messages func SetDebug(enabled bool) { traceDebugMsgs = enabled } -// Trace log +// TraceLog - Trace log func TraceLog(msgType int, text string, v ...interface{}) { switch msgType { 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 { return os.Getenv("HOME") } diff --git a/raylib/utils_android.go b/raylib/utils_android.go index 68f788b..c4a4747 100644 --- a/raylib/utils_android.go +++ b/raylib/utils_android.go @@ -30,12 +30,12 @@ const ( var traceDebugMsgs = false -// Set debug messages +// SetDebug - Set debug messages func SetDebug(enabled bool) { traceDebugMsgs = enabled } -// Trace log +// TraceLog - Trace log func TraceLog(msgType int, text string, v ...interface{}) { switch msgType { 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 func HomeDir() string { return C.GoString(C.get_internal_storage_path()) diff --git a/raylib/utils_windows.go b/raylib/utils_windows.go index 56a4154..ca91399 100644 --- a/raylib/utils_windows.go +++ b/raylib/utils_windows.go @@ -17,12 +17,12 @@ const ( var traceDebugMsgs = false -// Set debug messages +// SetDebug - Set debug messages func SetDebug(enabled bool) { traceDebugMsgs = enabled } -// Trace log +// TraceLog - Trace log func TraceLog(msgType int, text string, v ...interface{}) { switch msgType { 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 { home := os.Getenv("HOMEDRIVE") + os.Getenv("HOMEPATH") if home == "" { diff --git a/raymath/raymath.go b/raymath/raymath.go index 251bbf3..53e2cfa 100644 --- a/raymath/raymath.go +++ b/raymath/raymath.go @@ -7,7 +7,7 @@ import ( "github.com/gen2brain/raylib-go/raylib" ) -// Add two vectors +// VectorAdd - Add two vectors func VectorAdd(v1, v2 raylib.Vector3) raylib.Vector3 { result := raylib.Vector3{} @@ -18,7 +18,7 @@ func VectorAdd(v1, v2 raylib.Vector3) raylib.Vector3 { return result } -// Subtract two vectors +// VectorSubtract - Subtract two vectors func VectorSubtract(v1, v2 raylib.Vector3) raylib.Vector3 { result := raylib.Vector3{} @@ -29,7 +29,7 @@ func VectorSubtract(v1, v2 raylib.Vector3) raylib.Vector3 { return result } -// Calculate two vectors cross product +// VectorCrossProduct - Calculate two vectors cross product func VectorCrossProduct(v1, v2 raylib.Vector3) raylib.Vector3 { result := raylib.Vector3{} @@ -40,7 +40,7 @@ func VectorCrossProduct(v1, v2 raylib.Vector3) raylib.Vector3 { return result } -// Calculate one vector perpendicular vector +// VectorPerpendicular - Calculate one vector perpendicular vector func VectorPerpendicular(v raylib.Vector3) raylib.Vector3 { result := raylib.Vector3{} @@ -61,31 +61,31 @@ func VectorPerpendicular(v raylib.Vector3) raylib.Vector3 { return result } -// Calculate two vectors dot product +// VectorDotProduct - Calculate two vectors dot product func VectorDotProduct(v1, v2 raylib.Vector3) float32 { 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 { 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) { v.X *= scale v.Y *= scale v.Z *= scale } -// Negate provided vector (invert direction) +// VectorNegate - Negate provided vector (invert direction) func VectorNegate(v *raylib.Vector3) { v.X = -v.X v.Y = -v.Y v.Z = -v.Z } -// Normalize provided vector +// VectorNormalize - Normalize provided vector func VectorNormalize(v *raylib.Vector3) { var length, ilength float32 @@ -102,7 +102,7 @@ func VectorNormalize(v *raylib.Vector3) { v.Z *= ilength } -// Calculate distance between two points +// VectorDistance - Calculate distance between two points func VectorDistance(v1, v2 raylib.Vector3) float32 { var result float32 @@ -115,7 +115,7 @@ func VectorDistance(v1, v2 raylib.Vector3) float32 { 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 { result := raylib.Vector3{} @@ -126,7 +126,7 @@ func VectorLerp(v1, v2 raylib.Vector3, amount float32) raylib.Vector3 { return result } -// Calculate reflected vector to normal +// VectorReflect - Calculate reflected vector to normal func VectorReflect(vector, normal raylib.Vector3) raylib.Vector3 { // I is the original vector // N is the normal of the incident plane @@ -143,7 +143,7 @@ func VectorReflect(vector, normal raylib.Vector3) raylib.Vector3 { 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) { x := v.X 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 } -// Return a Vector3 init to zero +// VectorZero - Return a Vector3 init to zero func VectorZero() raylib.Vector3 { 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 { result := raylib.Vector3{} @@ -170,7 +170,7 @@ func VectorMin(vec1, vec2 raylib.Vector3) raylib.Vector3 { 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 { result := raylib.Vector3{} @@ -181,7 +181,7 @@ func VectorMax(vec1, vec2 raylib.Vector3) raylib.Vector3 { return result } -// Compute matrix determinant +// MatrixDeterminant - Compute matrix determinant func MatrixDeterminant(mat raylib.Matrix) float32 { var result float32 @@ -212,12 +212,12 @@ func MatrixDeterminant(mat raylib.Matrix) float32 { 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 { return mat.M0 + mat.M5 + mat.M10 + mat.M15 } -// Transposes provided matrix +// MatrixTranspose - Transposes provided matrix func MatrixTranspose(mat *raylib.Matrix) { var temp raylib.Matrix @@ -241,7 +241,7 @@ func MatrixTranspose(mat *raylib.Matrix) { mat = &temp } -// Invert provided matrix +// MatrixInvert - Invert provided matrix func MatrixInvert(mat *raylib.Matrix) { var temp raylib.Matrix @@ -298,7 +298,7 @@ func MatrixInvert(mat *raylib.Matrix) { mat = &temp } -// Normalize provided matrix +// MatrixNormalize - Normalize provided matrix func MatrixNormalize(mat *raylib.Matrix) { det := MatrixDeterminant(*mat) @@ -320,7 +320,7 @@ func MatrixNormalize(mat *raylib.Matrix) { mat.M15 /= det } -// Returns identity matrix +// MatrixIdentity - Returns identity matrix func MatrixIdentity() raylib.Matrix { return raylib.NewMatrix( 1.0, 0.0, 0.0, 0.0, @@ -329,7 +329,7 @@ func MatrixIdentity() raylib.Matrix { 0.0, 0.0, 0.0, 1.0) } -// Add two matrices +// MatrixAdd - Add two matrices func MatrixAdd(left, right raylib.Matrix) raylib.Matrix { result := MatrixIdentity() @@ -353,7 +353,7 @@ func MatrixAdd(left, right raylib.Matrix) raylib.Matrix { return result } -// Subtract two matrices (left - right) +// MatrixSubtract - Subtract two matrices (left - right) func MatrixSubtract(left, right raylib.Matrix) raylib.Matrix { result := MatrixIdentity() @@ -377,7 +377,7 @@ func MatrixSubtract(left, right raylib.Matrix) raylib.Matrix { return result } -// Returns translation matrix +// MatrixTranslate - Returns translation matrix func MatrixTranslate(x, y, z float32) raylib.Matrix { return raylib.NewMatrix( 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) } -// 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 { var result raylib.Matrix @@ -455,7 +455,7 @@ func MatrixRotate(axis raylib.Vector3, angle float32) raylib.Matrix { return result } -// Returns x-rotation matrix (angle in radians) +// MatrixRotateX - Returns x-rotation matrix (angle in radians) func MatrixRotateX(angle float32) raylib.Matrix { result := MatrixIdentity() @@ -470,7 +470,7 @@ func MatrixRotateX(angle float32) raylib.Matrix { return result } -// Returns y-rotation matrix (angle in radians) +// MatrixRotateY - Returns y-rotation matrix (angle in radians) func MatrixRotateY(angle float32) raylib.Matrix { result := MatrixIdentity() @@ -485,7 +485,7 @@ func MatrixRotateY(angle float32) raylib.Matrix { return result } -// Returns z-rotation matrix (angle in radians) +// MatrixRotateZ - Returns z-rotation matrix (angle in radians) func MatrixRotateZ(angle float32) raylib.Matrix { result := MatrixIdentity() @@ -500,7 +500,7 @@ func MatrixRotateZ(angle float32) raylib.Matrix { return result } -// Returns scaling matrix +// MatrixScale - Returns scaling matrix func MatrixScale(x, y, z float32) raylib.Matrix { result := raylib.NewMatrix( x, 0.0, 0.0, 0.0, @@ -511,7 +511,7 @@ func MatrixScale(x, y, z float32) raylib.Matrix { return result } -// Returns two matrix multiplication +// MatrixMultiply - Returns two matrix multiplication func MatrixMultiply(left, right raylib.Matrix) raylib.Matrix { var result raylib.Matrix @@ -535,7 +535,7 @@ func MatrixMultiply(left, right raylib.Matrix) raylib.Matrix { return result } -// Returns perspective projection matrix +// MatrixFrustum - Returns perspective projection matrix func MatrixFrustum(left, right, bottom, top, near, far float32) raylib.Matrix { var result raylib.Matrix @@ -566,7 +566,7 @@ func MatrixFrustum(left, right, bottom, top, near, far float32) raylib.Matrix { return result } -// Returns perspective projection matrix +// MatrixPerspective - Returns perspective projection matrix func MatrixPerspective(fovy, aspect, near, far float32) raylib.Matrix { top := near * float32(math.Tan(float64(fovy*raylib.Pi)/360.0)) right := top * aspect @@ -574,7 +574,7 @@ func MatrixPerspective(fovy, aspect, near, far float32) raylib.Matrix { 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 { var result raylib.Matrix @@ -602,7 +602,7 @@ func MatrixOrtho(left, right, bottom, top, near, far float32) raylib.Matrix { 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 { var result raylib.Matrix @@ -633,12 +633,12 @@ func MatrixLookAt(eye, target, up raylib.Vector3) raylib.Matrix { return result } -// Compute the length of a quaternion +// QuaternionLength - Compute the length of a quaternion 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))) } -// Normalize provided quaternion +// QuaternionNormalize - Normalize provided quaternion func QuaternionNormalize(q *raylib.Quaternion) { var length, ilength float32 @@ -656,7 +656,7 @@ func QuaternionNormalize(q *raylib.Quaternion) { q.W *= ilength } -// Invert provided quaternion +// QuaternionInvert - Invert provided quaternion func QuaternionInvert(quat *raylib.Quaternion) { length := QuaternionLength(*quat) 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 { var result raylib.Quaternion @@ -692,7 +692,7 @@ func QuaternionMultiply(q1, q2 raylib.Quaternion) raylib.Quaternion { 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 { var result raylib.Quaternion @@ -723,7 +723,7 @@ func QuaternionSlerp(q1, q2 raylib.Quaternion, amount float32) raylib.Quaternion 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 { var result raylib.Quaternion @@ -772,7 +772,7 @@ func QuaternionFromMatrix(matrix raylib.Matrix) raylib.Quaternion { return result } -// Returns a matrix for a given quaternion +// QuaternionToMatrix - Returns a matrix for a given quaternion func QuaternionToMatrix(q raylib.Quaternion) raylib.Matrix { var result raylib.Matrix @@ -817,7 +817,7 @@ func QuaternionToMatrix(q raylib.Quaternion) raylib.Matrix { 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 { 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 } -// 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) { if math.Abs(float64(q.W)) > 1.0 { QuaternionNormalize(&q) @@ -865,7 +865,7 @@ func QuaternionToAxisAngle(q raylib.Quaternion, outAxis *raylib.Vector3, outAngl *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) { x := q.X y := q.Y