This commit is contained in:
Milan Nikolic 2017-02-21 15:19:22 +01:00
parent 29546140b9
commit 7e1cf349aa
13 changed files with 48 additions and 48 deletions

View file

@ -9,57 +9,57 @@ import (
// Linear Easing functions // Linear Easing functions
// LinearNone // LinearNone easing
func LinearNone(t, b, c, d float32) float32 { func LinearNone(t, b, c, d float32) float32 {
return c*t/d + b return c*t/d + b
} }
// LinearIn // LinearIn easing
func LinearIn(t, b, c, d float32) float32 { func LinearIn(t, b, c, d float32) float32 {
return c*t/d + b return c*t/d + b
} }
// LinearOut // LinearOut easing
func LinearOut(t, b, c, d float32) float32 { func LinearOut(t, b, c, d float32) float32 {
return c*t/d + b return c*t/d + b
} }
// LinearInOut // LinearInOut easing
func LinearInOut(t, b, c, d float32) float32 { func LinearInOut(t, b, c, d float32) float32 {
return c*t/d + b return c*t/d + b
} }
// Sine Easing functions // Sine Easing functions
// SineIn // SineIn easing
func SineIn(t, b, c, d float32) float32 { func SineIn(t, b, c, d float32) float32 {
return -c*float32(math.Cos(float64(t/d)*(math.Pi/2))) + c + b return -c*float32(math.Cos(float64(t/d)*(math.Pi/2))) + c + b
} }
// SineOut // SineOut easing
func SineOut(t, b, c, d float32) float32 { func SineOut(t, b, c, d float32) float32 {
return c*float32(math.Sin(float64(t/d)*(math.Pi/2))) + b return c*float32(math.Sin(float64(t/d)*(math.Pi/2))) + b
} }
// SineInOut // SineInOut easing
func SineInOut(t, b, c, d float32) float32 { func SineInOut(t, b, c, d float32) float32 {
return -c/2*(float32(math.Cos(math.Pi*float64(t/d)))-1) + b return -c/2*(float32(math.Cos(math.Pi*float64(t/d)))-1) + b
} }
// Circular Easing functions // Circular Easing functions
// CircIn // CircIn easing
func CircIn(t, b, c, d float32) float32 { func CircIn(t, b, c, d float32) float32 {
t = t / d t = t / d
return -c*(float32(math.Sqrt(float64(1-t*t)))-1) + b return -c*(float32(math.Sqrt(float64(1-t*t)))-1) + b
} }
// CircOut // CircOut easing
func CircOut(t, b, c, d float32) float32 { func CircOut(t, b, c, d float32) float32 {
return c*float32(math.Sqrt(1-float64((t/d-1)*t))) + b return c*float32(math.Sqrt(1-float64((t/d-1)*t))) + b
} }
// CircInOut // CircInOut easing
func CircInOut(t, b, c, d float32) float32 { func CircInOut(t, b, c, d float32) float32 {
t = t / d * 2 t = t / d * 2
@ -73,19 +73,19 @@ func CircInOut(t, b, c, d float32) float32 {
// Cubic Easing functions // Cubic Easing functions
// CubicIn // CubicIn easing
func CubicIn(t, b, c, d float32) float32 { func CubicIn(t, b, c, d float32) float32 {
t = t / d t = t / d
return c*t*t*t + b return c*t*t*t + b
} }
// CubicOut // CubicOut easing
func CubicOut(t, b, c, d float32) float32 { func CubicOut(t, b, c, d float32) float32 {
t = t/d - 1 t = t/d - 1
return c*(t*t*t+1) + b return c*(t*t*t+1) + b
} }
// CubicInOut // CubicInOut easing
func CubicInOut(t, b, c, d float32) float32 { func CubicInOut(t, b, c, d float32) float32 {
t = t / d * 2 t = t / d * 2
if t < 1 { if t < 1 {
@ -98,19 +98,19 @@ func CubicInOut(t, b, c, d float32) float32 {
// Quadratic Easing functions // Quadratic Easing functions
// QuadIn // QuadIn easing
func QuadIn(t, b, c, d float32) float32 { func QuadIn(t, b, c, d float32) float32 {
t = t / d t = t / d
return c*t*t + b return c*t*t + b
} }
// QuadOut // QuadOut easing
func QuadOut(t, b, c, d float32) float32 { func QuadOut(t, b, c, d float32) float32 {
t = t / d t = t / d
return (-c*t*(t-2) + b) return (-c*t*(t-2) + b)
} }
// QuadInOut // QuadInOut easing
func QuadInOut(t, b, c, d float32) float32 { func QuadInOut(t, b, c, d float32) float32 {
t = t / d * 2 t = t / d * 2
if t < 1 { if t < 1 {
@ -122,7 +122,7 @@ func QuadInOut(t, b, c, d float32) float32 {
// Exponential Easing functions // Exponential Easing functions
// ExpoIn // ExpoIn easing
func ExpoIn(t, b, c, d float32) float32 { func ExpoIn(t, b, c, d float32) float32 {
if t == 0 { if t == 0 {
return b 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) return (c*float32(math.Pow(2, 10*float64(t/d-1))) + b)
} }
// ExpoOut // ExpoOut easing
func ExpoOut(t, b, c, d float32) float32 { func ExpoOut(t, b, c, d float32) float32 {
if t == d { if t == d {
return (b + c) 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 return c*(-float32(math.Pow(2, -10*float64(t/d)))+1) + b
} }
// ExpoInOut // ExpoInOut easing
func ExpoInOut(t, b, c, d float32) float32 { func ExpoInOut(t, b, c, d float32) float32 {
if t == 0 { if t == 0 {
return b return b
@ -161,21 +161,21 @@ func ExpoInOut(t, b, c, d float32) float32 {
// Back Easing functions // Back Easing functions
// BackIn // BackIn easing
func BackIn(t, b, c, d float32) float32 { func BackIn(t, b, c, d float32) float32 {
s := float32(1.70158) s := float32(1.70158)
t = t / d t = t / d
return c*t*t*((s+1)*t-s) + b return c*t*t*((s+1)*t-s) + b
} }
// BackOut // BackOut easing
func BackOut(t, b, c, d float32) float32 { func BackOut(t, b, c, d float32) float32 {
s := float32(1.70158) s := float32(1.70158)
t = t/d - 1 t = t/d - 1
return c*(t*t*((s+1)*t+s)+1) + b return c*(t*t*((s+1)*t+s)+1) + b
} }
// BackInOut // BackInOut easing
func BackInOut(t, b, c, d float32) float32 { func BackInOut(t, b, c, d float32) float32 {
s := float32(1.70158) s := float32(1.70158)
s = s * 1.525 s = s * 1.525
@ -191,12 +191,12 @@ func BackInOut(t, b, c, d float32) float32 {
// Bounce Easing functions // Bounce Easing functions
// BounceIn // BounceIn easing
func BounceIn(t, b, c, d float32) float32 { func BounceIn(t, b, c, d float32) float32 {
return (c - BounceOut(d-t, 0, c, d) + b) return (c - BounceOut(d-t, 0, c, d) + b)
} }
// BounceOut // BounceOut easing
func BounceOut(t, b, c, d float32) float32 { func BounceOut(t, b, c, d float32) float32 {
t = t / d t = t / d
if t < (1 / 2.75) { 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 return c*(7.5625*t*t+0.984375) + b
} }
// BounceInOut // BounceInOut easing
func BounceInOut(t, b, c, d float32) float32 { func BounceInOut(t, b, c, d float32) float32 {
if t < d/2 { if t < d/2 {
return BounceIn(t*2, 0, c, d)*0.5 + b 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 Easing functions
// ElasticIn // ElasticIn easing
func ElasticIn(t, b, c, d float32) float32 { func ElasticIn(t, b, c, d float32) float32 {
if t == 0 { if t == 0 {
return b 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 return -(postFix * float32(math.Sin(float64(t*d-s)*(2*math.Pi)/float64(p)))) + b
} }
// ElasticOut // ElasticOut easing
func ElasticOut(t, b, c, d float32) float32 { func ElasticOut(t, b, c, d float32) float32 {
if t == 0 { if t == 0 {
return b 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 return a*float32(math.Pow(2, -10*float64(t)))*float32(math.Sin(float64(t*d-s)*(2*math.Pi)/float64(p))) + c + b
} }
// ElasticInOut // ElasticInOut easing
func ElasticInOut(t, b, c, d float32) float32 { func ElasticInOut(t, b, c, d float32) float32 {
if t == 0 { if t == 0 {
return b return b

View file

@ -1,4 +1,4 @@
// raygui is simple and easy-to-use IMGUI (immediate mode GUI API) library. // Package raygui - Simple and easy-to-use IMGUI (immediate mode GUI API) library
package raygui package raygui
import ( import (
@ -11,7 +11,7 @@ import (
"github.com/gen2brain/raylib-go/raylib" "github.com/gen2brain/raylib-go/raylib"
) )
// GUI property // Property - GUI property
type Property int32 type Property int32
// GUI properties enumeration // GUI properties enumeration

View file

@ -64,7 +64,7 @@ func NewSoundFromPointer(ptr unsafe.Pointer) Sound {
// NOTE: Anything longer than ~10 seconds should be streamed // NOTE: Anything longer than ~10 seconds should be streamed
type Music C.Music type Music C.Music
// Audio stream type // AudioStream type
// NOTE: Useful to create custom audio streams not bound to a specific file // NOTE: Useful to create custom audio streams not bound to a specific file
type AudioStream struct { type AudioStream struct {
// Frequency (samples per second) // Frequency (samples per second)
@ -327,8 +327,8 @@ func SetMusicPitch(music Music, pitch float32) {
C.SetMusicPitch(cmusic, cpitch) C.SetMusicPitch(cmusic, cpitch)
} }
// Set music loop count (loop repeats) // SetMusicLoopCount - Set music loop count (loop repeats)
// SetMusicLoopCount - NOTE: If set to -1, means infinite loop // NOTE: If set to -1, means infinite loop
func SetMusicLoopCount(music Music, count float32) { func SetMusicLoopCount(music Music, count float32) {
cmusic := *(*C.Music)(unsafe.Pointer(&music)) cmusic := *(*C.Music)(unsafe.Pointer(&music))
ccount := (C.float)(count) ccount := (C.float)(count)

View file

@ -60,7 +60,7 @@ func NewCamera2DFromPointer(ptr unsafe.Pointer) Camera2D {
return *(*Camera2D)(ptr) return *(*Camera2D)(ptr)
} }
// Camera mode // CameraMode type
type CameraMode int32 type CameraMode int32
// Camera system modes // Camera system modes

View file

@ -349,7 +349,7 @@ func NewRectangleFromPointer(ptr unsafe.Pointer) Rectangle {
return *(*Rectangle)(ptr) return *(*Rectangle)(ptr)
} }
// Bounding box // BoundingBox type
type BoundingBox struct { type BoundingBox struct {
// Minimum vertex box-corner // Minimum vertex box-corner
Min Vector3 Min Vector3

View file

@ -1,2 +1,2 @@
// Go bindings for raylib, a simple and easy-to-use library to learn videogames programming. // Package raylib - Go bindings for raylib, a simple and easy-to-use library to learn videogames programming
package raylib package raylib

View file

@ -6,10 +6,10 @@ package raylib
import "C" import "C"
import "unsafe" import "unsafe"
// Gestures // Gestures type
type Gestures int32 type Gestures int32
// Gestures type // Gestures types
// NOTE: It could be used as flags to enable only some gestures // NOTE: It could be used as flags to enable only some gestures
const ( const (
GestureNone Gestures = C.GESTURE_NONE GestureNone Gestures = C.GESTURE_NONE

View file

@ -8,7 +8,7 @@ import "C"
import "unsafe" import "unsafe"
import "reflect" import "reflect"
// Vertex data definning a mesh // Mesh - Vertex data definning a mesh
type Mesh struct { type Mesh struct {
// Number of vertices stored in arrays // Number of vertices stored in arrays
VertexCount int32 VertexCount int32

View file

@ -9,7 +9,7 @@ import (
"unsafe" "unsafe"
) )
// rRES file header (8 byte) // RRESFileHeader - rRES file header (8 byte)
type RRESFileHeader struct { type RRESFileHeader struct {
// File identifier: rRES (4 byte) // File identifier: rRES (4 byte)
ID [4]int8 ID [4]int8
@ -19,7 +19,7 @@ type RRESFileHeader struct {
Count uint16 Count uint16
} }
// rRES info header, every resource includes this header (16 byte + 16 byte) // RRESInfoHeader - rRES info header, every resource includes this header (16 byte + 16 byte)
type RRESInfoHeader struct { type RRESInfoHeader struct {
// Resource unique identifier (4 byte) // Resource unique identifier (4 byte)
ID uint32 ID uint32

View file

@ -8,7 +8,7 @@ import "C"
import "unsafe" import "unsafe"
import "reflect" import "reflect"
// Vr device // VrDevice type
type VrDevice int32 type VrDevice int32
// Head Mounted Display devices // Head Mounted Display devices
@ -24,7 +24,7 @@ const (
HmdFoveVr VrDevice = C.HMD_FOVE_VR HmdFoveVr VrDevice = C.HMD_FOVE_VR
) )
// Blend mode // BlendMode type
type BlendMode int32 type BlendMode int32
// Color blending modes (pre-defined) // Color blending modes (pre-defined)

View file

@ -7,7 +7,7 @@ package raylib
import "C" import "C"
import "unsafe" import "unsafe"
// SpriteFont character info // CharInfo - SpriteFont character info
type CharInfo struct { type CharInfo struct {
// Character value (Unicode) // Character value (Unicode)
Value int32 Value int32

View file

@ -7,7 +7,7 @@ package raylib
import "C" import "C"
import "unsafe" import "unsafe"
// Texture format // TextureFormat - Texture format
type TextureFormat int32 type TextureFormat int32
// Texture formats // Texture formats
@ -51,7 +51,7 @@ const (
CompressedAstc8x8Rgba TextureFormat = C.COMPRESSED_ASTC_8x8_RGBA CompressedAstc8x8Rgba TextureFormat = C.COMPRESSED_ASTC_8x8_RGBA
) )
// Texture filter mode // TextureFilterMode - Texture filter mode
type TextureFilterMode int32 type TextureFilterMode int32
// Texture parameters: filter mode // Texture parameters: filter mode
@ -72,7 +72,7 @@ const (
FilterAnisotropic16x TextureFilterMode = C.FILTER_ANISOTROPIC_16X FilterAnisotropic16x TextureFilterMode = C.FILTER_ANISOTROPIC_16X
) )
// Texture wrap mode // TextureWrapMode - Texture wrap mode
type TextureWrapMode int32 type TextureWrapMode int32
// Texture parameters: wrap mode // Texture parameters: wrap mode

View file

@ -1,4 +1,4 @@
// Some useful functions to work with Vector3, Matrix and Quaternions // Package raymath - Some useful functions to work with Vector3, Matrix and Quaternions
package raymath package raymath
import ( import (