Documentation ¶
Overview ¶
Package raylib - Go bindings for raylib, a simple and easy-to-use library to learn videogames programming
Index ¶
- Constants
- Variables
- func Begin2dMode(camera Camera2D)
- func Begin3dMode(camera Camera)
- func BeginBlendMode(mode BlendMode)
- func BeginDrawing()
- func BeginShaderMode(shader Shader)
- func BeginTextureMode(target RenderTexture2D)
- func BeginVrDrawing()
- func CheckCollisionBoxSphere(box BoundingBox, centerSphere Vector3, radiusSphere float32) bool
- func CheckCollisionBoxes(box1 BoundingBox, box2 BoundingBox) bool
- func CheckCollisionCircleRec(center Vector2, radius float32, rec Rectangle) bool
- func CheckCollisionCircles(center1 Vector2, radius1 float32, center2 Vector2, radius2 float32) bool
- func CheckCollisionPointCircle(point Vector2, center Vector2, radius float32) bool
- func CheckCollisionPointRec(point Vector2, rec Rectangle) bool
- func CheckCollisionPointTriangle(point Vector2, p1 Vector2, p2 Vector2, p3 Vector2) bool
- func CheckCollisionRayBox(ray Ray, box BoundingBox) bool
- func CheckCollisionRaySphere(ray Ray, spherePosition Vector3, sphereRadius float32) bool
- func CheckCollisionRaySphereEx(ray Ray, spherePosition Vector3, sphereRadius float32, collisionPoint Vector3) bool
- func CheckCollisionRecs(rec1 Rectangle, rec2 Rectangle) bool
- func CheckCollisionSpheres(centerA Vector3, radiusA float32, centerB Vector3, radiusB float32) bool
- func ClearBackground(color Color)
- func ClearDroppedFiles()
- func CloseAudioDevice()
- func CloseAudioStream(stream AudioStream)
- func CloseVrSimulator()
- func CloseWindow()
- func ColorToFloat(color Color) []float32
- func DisableCursor()
- func DrawBillboard(camera Camera, texture Texture2D, center Vector3, size float32, tint Color)
- func DrawBillboardRec(camera Camera, texture Texture2D, sourceRec Rectangle, center Vector3, ...)
- func DrawBoundingBox(box BoundingBox, color Color)
- func DrawCircle(centerX int32, centerY int32, radius float32, color Color)
- func DrawCircle3D(center Vector3, radius float32, rotationAxis Vector3, rotationAngle float32, ...)
- func DrawCircleGradient(centerX int32, centerY int32, radius float32, color1 Color, color2 Color)
- func DrawCircleLines(centerX int32, centerY int32, radius float32, color Color)
- func DrawCircleV(center Vector2, radius float32, color Color)
- func DrawCube(position Vector3, width float32, height float32, length float32, color Color)
- func DrawCubeTexture(texture Texture2D, position Vector3, width float32, height float32, ...)
- func DrawCubeV(position Vector3, size Vector3, color Color)
- func DrawCubeWires(position Vector3, width float32, height float32, length float32, color Color)
- func DrawCylinder(position Vector3, radiusTop float32, radiusBottom float32, height float32, ...)
- func DrawCylinderWires(position Vector3, radiusTop float32, radiusBottom float32, height float32, ...)
- func DrawFPS(posX int32, posY int32)
- func DrawGizmo(position Vector3)
- func DrawGrid(slices int32, spacing float32)
- func DrawLine(startPosX int32, startPosY int32, endPosX int32, endPosY int32, color Color)
- func DrawLine3D(startPos Vector3, endPos Vector3, color Color)
- func DrawLineBezier(startPos Vector2, endPos Vector2, thick float32, color Color)
- func DrawLineEx(startPos Vector2, endPos Vector2, thick float32, color Color)
- func DrawLineV(startPos Vector2, endPos Vector2, color Color)
- func DrawModel(model Model, position Vector3, scale float32, tint Color)
- func DrawModelEx(model Model, position Vector3, rotationAxis Vector3, rotationAngle float32, ...)
- func DrawModelWires(model Model, position Vector3, scale float32, tint Color)
- func DrawModelWiresEx(model Model, position Vector3, rotationAxis Vector3, rotationAngle float32, ...)
- func DrawPixel(posX int32, posY int32, color Color)
- func DrawPixelV(position Vector2, color Color)
- func DrawPlane(centerPos Vector3, size Vector2, color Color)
- func DrawPoly(center Vector2, sides int32, radius float32, rotation float32, color Color)
- func DrawPolyEx(points []Vector2, numPoints int32, color Color)
- func DrawPolyExLines(points []Vector2, numPoints int32, color Color)
- func DrawRay(ray Ray, color Color)
- func DrawRectangle(posX int32, posY int32, width int32, height int32, color Color)
- func DrawRectangleGradient(posX int32, posY int32, width int32, height int32, color1 Color, color2 Color)
- func DrawRectangleLines(posX int32, posY int32, width int32, height int32, color Color)
- func DrawRectanglePro(rec Rectangle, origin Vector2, rotation float32, color Color)
- func DrawRectangleRec(rec Rectangle, color Color)
- func DrawRectangleV(position Vector2, size Vector2, color Color)
- func DrawSphere(centerPos Vector3, radius float32, color Color)
- func DrawSphereEx(centerPos Vector3, radius float32, rings int32, slices int32, color Color)
- func DrawSphereWires(centerPos Vector3, radius float32, rings int32, slices int32, color Color)
- func DrawText(text string, posX int32, posY int32, fontSize int32, color Color)
- func DrawTextEx(spriteFont SpriteFont, text string, position Vector2, fontSize float32, ...)
- func DrawTexture(texture Texture2D, posX int32, posY int32, tint Color)
- func DrawTextureEx(texture Texture2D, position Vector2, rotation float32, scale float32, ...)
- func DrawTexturePro(texture Texture2D, sourceRec Rectangle, destRec Rectangle, origin Vector2, ...)
- func DrawTextureRec(texture Texture2D, sourceRec Rectangle, position Vector2, tint Color)
- func DrawTextureV(texture Texture2D, position Vector2, tint Color)
- func DrawTriangle(v1 Vector2, v2 Vector2, v3 Vector2, color Color)
- func DrawTriangleLines(v1 Vector2, v2 Vector2, v3 Vector2, color Color)
- func EnableCursor()
- func End2dMode()
- func End3dMode()
- func EndBlendMode()
- func EndDrawing()
- func EndShaderMode()
- func EndTextureMode()
- func EndVrDrawing()
- func GenTextureMipmaps(texture *Texture2D)
- func GetDroppedFiles(count *int32) []string
- func GetFPS() float32
- func GetFrameTime() float32
- func GetGamepadAxisCount(gamepad int32) int32
- func GetGamepadAxisMovement(gamepad int32, axis int32) float32
- func GetGamepadButtonPressed() int32
- func GetGamepadName(gamepad int32) string
- func GetGestureDragAngle() float32
- func GetGestureHoldDuration() float32
- func GetGesturePinchAngle() float32
- func GetHexValue(color Color) int32
- func GetImageData(image *Image) unsafe.Pointer
- func GetKeyPressed() int32
- func GetMouseWheelMove() int32
- func GetMouseX() int32
- func GetMouseY() int32
- func GetMusicTimeLength(music Music) float32
- func GetMusicTimePlayed(music Music) float32
- func GetRandomValue(min int32, max int32) int32
- func GetScreenHeight() int32
- func GetScreenWidth() int32
- func GetShaderLocation(shader Shader, uniformName string) int32
- func GetTouchPointsCount() int32
- func GetTouchX() int32
- func GetTouchY() int32
- func GetWaveData(wave Wave) []float32
- func HideCursor()
- func HomeDir() string
- func ImageAlphaMask(image *Image, alphaMask *Image)
- func ImageColorBrightness(image *Image, brightness int32)
- func ImageColorContrast(image *Image, contrast float32)
- func ImageColorGrayscale(image *Image)
- func ImageColorInvert(image *Image)
- func ImageColorTint(image *Image, color Color)
- func ImageCrop(image *Image, crop Rectangle)
- func ImageDither(image *Image, rBpp int32, gBpp int32, bBpp int32, aBpp int32)
- func ImageDraw(dst *Image, src *Image, srcRec Rectangle, dstRec Rectangle)
- func ImageDrawText(dst *Image, position Vector2, text string, fontSize int32, color Color)
- func ImageDrawTextEx(dst *Image, position Vector2, font SpriteFont, text string, fontSize float32, ...)
- func ImageFlipHorizontal(image *Image)
- func ImageFlipVertical(image *Image)
- func ImageFormat(image *Image, newFormat int32)
- func ImageResize(image *Image, newWidth int32, newHeight int32)
- func ImageResizeNN(image *Image, newWidth int32, newHeight int32)
- func ImageToPOT(image *Image, fillColor Color)
- func InitAudioDevice()
- func InitVrSimulator(vdDevice VrDevice)
- func InitWindow(width int32, height int32, t interface{})
- func IsAudioBufferProcessed(stream AudioStream) bool
- func IsAudioDeviceReady() bool
- func IsCursorHidden() bool
- func IsFileDropped() bool
- func IsGamepadAvailable(gamepad int32) bool
- func IsGamepadButtonDown(gamepad int32, button int32) bool
- func IsGamepadButtonPressed(gamepad int32, button int32) bool
- func IsGamepadButtonReleased(gamepad int32, button int32) bool
- func IsGamepadButtonUp(gamepad int32, button int32) bool
- func IsGamepadName(gamepad int32, name string) bool
- func IsGestureDetected(gesture Gestures) bool
- func IsKeyDown(key int32) bool
- func IsKeyPressed(key int32) bool
- func IsKeyReleased(key int32) bool
- func IsKeyUp(key int32) bool
- func IsMouseButtonDown(button int32) bool
- func IsMouseButtonPressed(button int32) bool
- func IsMouseButtonReleased(button int32) bool
- func IsMouseButtonUp(button int32) bool
- func IsMusicPlaying(music Music) bool
- func IsSoundPlaying(sound Sound) bool
- func IsVrSimulatorReady() bool
- func IsWindowMinimized() bool
- func LoadResource(fileName string) []byte
- func LoadResourceByID(fileName string, rresID int) (data []byte)
- func MatrixToFloat(mat Matrix) []float32
- func MeasureText(text string, fontSize int32) int32
- func PauseAudioStream(stream AudioStream)
- func PauseMusicStream(music Music)
- func PauseSound(sound Sound)
- func PlayAudioStream(stream AudioStream)
- func PlayMusicStream(music Music)
- func PlaySound(sound Sound)
- func ResumeAudioStream(stream AudioStream)
- func ResumeMusicStream(music Music)
- func ResumeSound(sound Sound)
- func SetCallbackFunc(func(unsafe.Pointer))
- func SetCameraAltControl(altKey int32)
- func SetCameraMode(camera Camera, mode CameraMode)
- func SetCameraMoveControls(frontKey int32, backKey int32, rightKey int32, leftKey int32, upKey int32, ...)
- func SetCameraPanControl(panKey int32)
- func SetCameraSmoothZoomControl(szKey int32)
- func SetConfigFlags(flags byte)
- func SetDebug(enabled bool)
- func SetExitKey(key int32)
- func SetGesturesEnabled(gestureFlags uint32)
- func SetMasterVolume(volume float32)
- func SetMatrixModelview(view Matrix)
- func SetMatrixProjection(proj Matrix)
- func SetMousePosition(position Vector2)
- func SetMusicLoopCount(music Music, count float32)
- func SetMusicPitch(music Music, pitch float32)
- func SetMusicVolume(music Music, volume float32)
- func SetShaderValue(shader Shader, uniformLoc int32, value []float32, size int32)
- func SetShaderValueMatrix(shader Shader, uniformLoc int32, mat Matrix)
- func SetShaderValuei(shader Shader, uniformLoc int32, value []int32, size int32)
- func SetSoundPitch(sound Sound, pitch float32)
- func SetSoundVolume(sound Sound, volume float32)
- func SetTargetFPS(fps int32)
- func SetTextureFilter(texture Texture2D, filterMode TextureFilterMode)
- func SetTextureWrap(texture Texture2D, wrapMode TextureWrapMode)
- func SetWindowIcon(image Image)
- func SetWindowMonitor(monitor int32)
- func SetWindowPosition(x, y int32)
- func ShowCursor()
- func ShowLogo()
- func StopAudioStream(stream AudioStream)
- func StopMusicStream(music Music)
- func StopSound(sound Sound)
- func StorageLoadValue(position int32) int32
- func StorageSaveValue(position int32, value int32)
- func TakeScreenshot()
- func ToggleFullscreen()
- func ToggleVrMode()
- func TraceLog(msgType int, text string, v ...interface{})
- func UnloadImage(image *Image)
- func UnloadMaterial(material Material)
- func UnloadMesh(mesh *Mesh)
- func UnloadModel(model Model)
- func UnloadMusicStream(music Music)
- func UnloadRenderTexture(target RenderTexture2D)
- func UnloadShader(shader Shader)
- func UnloadSound(sound Sound)
- func UnloadSpriteFont(spriteFont SpriteFont)
- func UnloadTexture(texture Texture2D)
- func UnloadWave(wave Wave)
- func UpdateAudioStream(stream AudioStream, data unsafe.Pointer, samplesCount int32)
- func UpdateCamera(camera *Camera)
- func UpdateMusicStream(music Music)
- func UpdateSound(sound Sound, data unsafe.Pointer, samplesCount int32)
- func UpdateTexture(texture Texture2D, pixels unsafe.Pointer)
- func UpdateVrTracking(camera *Camera)
- func VectorToFloat(vec Vector3) []float32
- func WaveCrop(wave Wave, initSample int32, finalSample int32)
- func WaveFormat(wave Wave, sampleRate int32, sampleSize int32, channels int32)
- func WindowShouldClose() bool
- type Asset
- type AudioStream
- type BlendMode
- type BoundingBox
- type Camera
- type Camera2D
- type CameraMode
- type CharInfo
- type Color
- type Gestures
- type Image
- func GetTextureData(texture Texture2D) *Image
- func ImageCopy(image *Image) *Image
- func ImageText(text string, fontSize int32, color Color) *Image
- func ImageTextEx(font SpriteFont, text string, fontSize float32, spacing int32, tint Color) *Image
- func LoadImage(fileName string) *Image
- func LoadImageEx(pixels []Color, width int32, height int32) *Image
- func LoadImagePro(data []byte, width int32, height int32, format TextureFormat) *Image
- func LoadImageRaw(fileName string, width int32, height int32, format TextureFormat, ...) *Image
- func NewImage(data unsafe.Pointer, width, height, mipmaps int32, format TextureFormat) *Image
- func NewImageFromPointer(ptr unsafe.Pointer) *Image
- type Mat2
- type Material
- type Matrix
- type Mesh
- type Model
- func LoadCubicmap(cubicmap *Image) Model
- func LoadHeightmap(heightmap *Image, size Vector3) Model
- func LoadModel(fileName string) Model
- func LoadModelFromMesh(data Mesh, dynamic bool) Model
- func NewModel(mesh Mesh, transform Matrix, material Material) Model
- func NewModelFromPointer(ptr unsafe.Pointer) Model
- type Music
- type Quaternion
- type RRESFileHeader
- type RRESInfoHeader
- type Ray
- type Rectangle
- type RenderTexture2D
- type Shader
- type Sound
- type SpriteFont
- func GetDefaultFont() SpriteFont
- func LoadSpriteFont(fileName string) SpriteFont
- func LoadSpriteFontEx(fileName string, fontSize int32, charsCount int32, fontChars *int32) SpriteFont
- func NewSpriteFont(texture Texture2D, baseSize, charsCount int32, chars *CharInfo) SpriteFont
- func NewSpriteFontFromPointer(ptr unsafe.Pointer) SpriteFont
- type Texture2D
- type TextureFilterMode
- type TextureFormat
- type TextureWrapMode
- type Vector2
- func GetGestureDragVector() Vector2
- func GetGesturePinchVector() Vector2
- func GetMousePosition() Vector2
- func GetTouchPosition(index int32) Vector2
- func GetWorldToScreen(position Vector3, camera Camera) Vector2
- func MeasureTextEx(spriteFont SpriteFont, text string, fontSize float32, spacing int32) Vector2
- func NewVector2(x, y float32) Vector2
- func NewVector2FromPointer(ptr unsafe.Pointer) Vector2
- type Vector3
- type VrDevice
- type Wave
- func LoadWave(fileName string) Wave
- func LoadWaveEx(data unsafe.Pointer, sampleCount int32, sampleRate int32, sampleSize int32, ...) Wave
- func NewWave(sampleCount, sampleRate, sampleSize, channels uint32, data unsafe.Pointer) Wave
- func NewWaveFromPointer(ptr unsafe.Pointer) Wave
- func WaveCopy(wave Wave) Wave
Constants ¶
const ( Pi = 3.1415927 Deg2rad = 0.017453292 Rad2deg = 57.295776 // Set to show raylib logo at startup FlagShowLogo = 1 // Set to run program in fullscreen FlagFullscreenMode = 2 // Set to allow resizable window FlagWindowResizable = 4 // Set to show window decoration (frame and buttons) FlagWindowDecorated = 8 // Set to allow transparent window FlagWindowTransparent = 16 // Set to try enabling MSAA 4X FlagMsaa4xHint = 32 // Set to try enabling V-Sync on GPU FlagVsyncHint = 64 // Keyboard Function Keys KeySpace = 32 KeyEscape = 256 KeyEnter = 257 KeyBackspace = 259 KeyRight = 262 KeyLeft = 263 KeyDown = 264 KeyUp = 265 KeyF1 = 290 KeyF2 = 291 KeyF3 = 292 KeyF4 = 293 KeyF5 = 294 KeyF6 = 295 KeyF7 = 296 KeyF8 = 297 KeyF9 = 298 KeyF10 = 299 KeyF11 = 300 KeyF12 = 301 KeyLeftShift = 340 KeyLeftControl = 341 KeyLeftAlt = 342 KeyRightShift = 344 KeyRightControl = 345 KeyRightAlt = 346 // Keyboard Alpha Numeric Keys KeyZero = 48 KeyOne = 49 KeyTwo = 50 KeyThree = 51 KeyFour = 52 KeyFive = 53 KeySix = 54 KeySeven = 55 KeyEight = 56 KeyNine = 57 KeyA = 65 KeyB = 66 KeyC = 67 KeyD = 68 KeyE = 69 KeyF = 70 KeyG = 71 KeyH = 72 KeyI = 73 KeyJ = 74 KeyK = 75 KeyL = 76 KeyM = 77 KeyN = 78 KeyO = 79 KeyP = 80 KeyQ = 81 KeyR = 82 KeyS = 83 KeyT = 84 KeyU = 85 KeyV = 86 KeyW = 87 KeyX = 88 KeyY = 89 KeyZ = 90 // Android keys KeyBack = 4 KeyMenu = 82 KeyVolumeUp = 24 KeyVolumeDown = 25 // Mouse Buttons MouseLeftButton = 0 MouseRightButton = 1 MouseMiddleButton = 2 // Touch points registered MaxTouchPoints = 2 // Gamepad Number GamepadPlayer1 = 0 GamepadPlayer2 = 1 GamepadPlayer3 = 2 GamepadPlayer4 = 3 // PS3 USB Controller Buttons GamepadPs3ButtonTriangle = 0 GamepadPs3ButtonCircle = 1 GamepadPs3ButtonCross = 2 GamepadPs3ButtonSquare = 3 GamepadPs3ButtonL1 = 6 GamepadPs3ButtonR1 = 7 GamepadPs3ButtonL2 = 4 GamepadPs3ButtonR2 = 5 GamepadPs3ButtonStart = 8 GamepadPs3ButtonSelect = 9 GamepadPs3ButtonUp = 24 GamepadPs3ButtonRight = 25 GamepadPs3ButtonDown = 26 GamepadPs3ButtonLeft = 27 GamepadPs3ButtonPs = 12 // PS3 USB Controller Axis GamepadPs3AxisLeftX = 0 GamepadPs3AxisLeftY = 1 GamepadPs3AxisRightX = 2 GamepadPs3AxisRightY = 5 // [1..-1] (pressure-level) GamepadPs3AxisL2 = 3 // [1..-1] (pressure-level) GamepadPs3AxisR2 = 4 // Xbox360 USB Controller Buttons GamepadXboxButtonA = 0 GamepadXboxButtonB = 1 GamepadXboxButtonX = 2 GamepadXboxButtonY = 3 GamepadXboxButtonLb = 4 GamepadXboxButtonRb = 5 GamepadXboxButtonSelect = 6 GamepadXboxButtonStart = 7 GamepadXboxButtonUp = 10 GamepadXboxButtonRight = 11 GamepadXboxButtonDown = 12 GamepadXboxButtonLeft = 13 GamepadXboxButtonHome = 8 // Xbox360 USB Controller Axis // [-1..1] (left->right) GamepadXboxAxisLeftX = 0 // [1..-1] (up->down) GamepadXboxAxisLeftY = 1 // [-1..1] (left->right) GamepadXboxAxisRightX = 2 // [1..-1] (up->down) GamepadXboxAxisRightY = 3 // [-1..1] (pressure-level) GamepadXboxAxisLt = 4 // [-1..1] (pressure-level) GamepadXboxAxisRt = 5 )
Some basic Defines
const ( RRESTypeRaw = iota RRESTypeImage RRESTypeWave RRESTypeVertex RRESTypeText RRESTypeFontImage RRESTypeFontData RRESTypeDirectory )
rRES data types
const ( // No data compression RRESCompNone = iota // DEFLATE compression RRESCompDeflate // LZ4 compression RRESCompLz4 // LZMA compression RRESCompLzma // BROTLI compression RRESCompBrotli )
Compression types
const ( // 8 bit per pixel (no alpha) RRESImUncompGrayscale = iota + 1 // 16 bpp (2 channels) RRESImUncompGrayAlpha // 16 bpp RRESImUncompR5g6b5 // 24 bpp RRESImUncompR8g8b8 // 16 bpp (1 bit alpha) RRESImUncompR5g5b5a1 // 16 bpp (4 bit alpha) RRESImUncompR4g4b4a4 // 32 bpp RRESImUncompR8g8b8a8 // 4 bpp (no alpha) RRESImCompDxt1Rgb // 4 bpp (1 bit alpha) RRESImCompDxt1Rgba // 8 bpp RRESImCompDxt3Rgba // 8 bpp RRESImCompDxt5Rgba // 4 bpp RRESImCompEtc1Rgb // 4 bpp RRESImCompEtc2Rgb // 8 bpp RRESImCompEtc2EacRgba // 4 bpp RRESImCompPvrtRgb // 4 bpp RRESImCompPvrtRgba // 8 bpp RRESImCompAstc4x4Rgba // 2 bpp RRESImCompAstc8x8Rgba )
Image formats
const ( RRESVertPosition = iota RRESVertTexcoord1 RRESVertTexcoord2 RRESVertTexcoord3 RRESVertTexcoord4 RRESVertNormal RRESVertTangent RRESVertColor RRESVertIndex )
RRESVert
const ( RRESVertByte = iota RRESVertShort RRESVertInt RRESVertHfloat RRESVertFloat )
RRESVert
const ( LogInfo = iota LogWarning LogError LogDebug )
Log message types
Variables ¶
var ( // Light Gray LightGray = NewColor(200, 200, 200, 255) // Gray Gray = NewColor(130, 130, 130, 255) // Dark Gray DarkGray = NewColor(80, 80, 80, 255) // Yellow Yellow = NewColor(253, 249, 0, 255) // Gold Gold = NewColor(255, 203, 0, 255) // Orange Orange = NewColor(255, 161, 0, 255) // Pink Pink = NewColor(255, 109, 194, 255) // Red Red = NewColor(230, 41, 55, 255) // Maroon Maroon = NewColor(190, 33, 55, 255) // Green Green = NewColor(0, 228, 48, 255) // Lime Lime = NewColor(0, 158, 47, 255) // Dark Green DarkGreen = NewColor(0, 117, 44, 255) // Sky Blue SkyBlue = NewColor(102, 191, 255, 255) // Blue Blue = NewColor(0, 121, 241, 255) // Dark Blue DarkBlue = NewColor(0, 82, 172, 255) // Purple Purple = NewColor(200, 122, 255, 255) // Violet Violet = NewColor(135, 60, 190, 255) // Dark Purple DarkPurple = NewColor(112, 31, 126, 255) // Beige Beige = NewColor(211, 176, 131, 255) // Brown Brown = NewColor(127, 106, 79, 255) // Dark Brown DarkBrown = NewColor(76, 63, 47, 255) // White White = NewColor(255, 255, 255, 255) // Black Black = NewColor(0, 0, 0, 255) // Blank (Transparent) Blank = NewColor(0, 0, 0, 0) // Magenta Magenta = NewColor(255, 0, 255, 255) // Ray White (RayLib Logo White) RayWhite = NewColor(245, 245, 245, 255) )
Some Basic Colors NOTE: Custom raylib color palette for amazing visuals on WHITE background
Functions ¶
func Begin2dMode ¶
func Begin2dMode(camera Camera2D)
Begin2dMode - Initialize 2D mode with custom camera
func Begin3dMode ¶
func Begin3dMode(camera Camera)
Begin3dMode - Initializes 3D mode for drawing (Camera setup)
func BeginBlendMode ¶
func BeginBlendMode(mode BlendMode)
BeginBlendMode - Begin blending mode (alpha, additive, multiplied)
func BeginShaderMode ¶
func BeginShaderMode(shader Shader)
BeginShaderMode - Begin custom shader drawing
func BeginTextureMode ¶
func BeginTextureMode(target RenderTexture2D)
BeginTextureMode - Initializes render texture for drawing
func CheckCollisionBoxSphere ¶
func CheckCollisionBoxSphere(box BoundingBox, centerSphere Vector3, radiusSphere float32) bool
CheckCollisionBoxSphere - Detect collision between box and sphere
func CheckCollisionBoxes ¶
func CheckCollisionBoxes(box1 BoundingBox, box2 BoundingBox) bool
CheckCollisionBoxes - Detect collision between two bounding boxes
func CheckCollisionCircleRec ¶
CheckCollisionCircleRec - Check collision between circle and rectangle
func CheckCollisionCircles ¶
CheckCollisionCircles - Check collision between two circles
func CheckCollisionPointCircle ¶
CheckCollisionPointCircle - Check if point is inside circle
func CheckCollisionPointRec ¶
CheckCollisionPointRec - Check if point is inside rectangle
func CheckCollisionPointTriangle ¶
CheckCollisionPointTriangle - Check if point is inside a triangle
func CheckCollisionRayBox ¶
func CheckCollisionRayBox(ray Ray, box BoundingBox) bool
CheckCollisionRayBox - Detect collision between ray and box
func CheckCollisionRaySphere ¶
CheckCollisionRaySphere - Detect collision between ray and sphere
func CheckCollisionRaySphereEx ¶
func CheckCollisionRaySphereEx(ray Ray, spherePosition Vector3, sphereRadius float32, collisionPoint Vector3) bool
CheckCollisionRaySphereEx - Detect collision between ray and sphere with extended parameters and collision point detection
func CheckCollisionRecs ¶
CheckCollisionRecs - Check collision between two rectangles
func CheckCollisionSpheres ¶
CheckCollisionSpheres - Detect collision between two spheres
func ClearDroppedFiles ¶
func ClearDroppedFiles()
ClearDroppedFiles - Clear dropped files paths buffer
func CloseAudioDevice ¶
func CloseAudioDevice()
CloseAudioDevice - Close the audio device and context
func CloseAudioStream ¶
func CloseAudioStream(stream AudioStream)
CloseAudioStream - Close audio stream and free memory
func CloseVrSimulator ¶
func CloseVrSimulator()
CloseVrSimulator - Close VR simulator for current device
func ColorToFloat ¶
ColorToFloat - Converts Color to float array and normalizes
func DrawBillboard ¶
DrawBillboard - Draw a billboard texture
func DrawBillboardRec ¶
func DrawBillboardRec(camera Camera, texture Texture2D, sourceRec Rectangle, center Vector3, size float32, tint Color)
DrawBillboardRec - Draw a billboard texture defined by sourceRec
func DrawBoundingBox ¶
func DrawBoundingBox(box BoundingBox, color Color)
DrawBoundingBox - Draw bounding box (wires)
func DrawCircle ¶
DrawCircle - Draw a color-filled circle
func DrawCircle3D ¶
func DrawCircle3D(center Vector3, radius float32, rotationAxis Vector3, rotationAngle float32, color Color)
DrawCircle3D - Draw a circle in 3D world space
func DrawCircleGradient ¶
DrawCircleGradient - Draw a gradient-filled circle
func DrawCircleLines ¶
DrawCircleLines - Draw circle outline
func DrawCircleV ¶
DrawCircleV - Draw a color-filled circle (Vector version)
func DrawCubeTexture ¶
func DrawCubeTexture(texture Texture2D, position Vector3, width float32, height float32, length float32, color Color)
DrawCubeTexture - Draw cube textured
func DrawCubeWires ¶
DrawCubeWires - Draw cube wires
func DrawCylinder ¶
func DrawCylinder(position Vector3, radiusTop float32, radiusBottom float32, height float32, slices int32, color Color)
DrawCylinder - Draw a cylinder/cone
func DrawCylinderWires ¶
func DrawCylinderWires(position Vector3, radiusTop float32, radiusBottom float32, height float32, slices int32, color Color)
DrawCylinderWires - Draw a cylinder/cone wires
func DrawLine3D ¶
DrawLine3D - Draw a line in 3D world space
func DrawLineBezier ¶
DrawLineBezier - Draw a line using cubic-bezier curves in-out
func DrawLineEx ¶
DrawLineEx - Draw a line defining thickness
func DrawModelEx ¶
func DrawModelEx(model Model, position Vector3, rotationAxis Vector3, rotationAngle float32, scale Vector3, tint Color)
DrawModelEx - Draw a model with extended parameters
func DrawModelWires ¶
DrawModelWires - Draw a model wires (with texture if set)
func DrawModelWiresEx ¶
func DrawModelWiresEx(model Model, position Vector3, rotationAxis Vector3, rotationAngle float32, scale Vector3, tint Color)
DrawModelWiresEx - Draw a model wires (with texture if set) with extended parameters
func DrawPixelV ¶
DrawPixelV - Draw a pixel (Vector version)
func DrawPolyEx ¶
DrawPolyEx - Draw a closed polygon defined by points
func DrawPolyExLines ¶
DrawPolyExLines - Draw polygon lines
func DrawRectangle ¶
DrawRectangle - Draw a color-filled rectangle
func DrawRectangleGradient ¶
func DrawRectangleGradient(posX int32, posY int32, width int32, height int32, color1 Color, color2 Color)
DrawRectangleGradient - Draw a gradient-filled rectangle
func DrawRectangleLines ¶
DrawRectangleLines - Draw rectangle outline
func DrawRectanglePro ¶
DrawRectanglePro - Draw a color-filled rectangle with pro parameters
func DrawRectangleRec ¶
DrawRectangleRec - Draw a color-filled rectangle
func DrawRectangleV ¶
DrawRectangleV - Draw a color-filled rectangle (Vector version)
func DrawSphere ¶
DrawSphere - Draw sphere
func DrawSphereEx ¶
DrawSphereEx - Draw sphere with extended parameters
func DrawSphereWires ¶
DrawSphereWires - Draw sphere wires
func DrawTextEx ¶
func DrawTextEx(spriteFont SpriteFont, text string, position Vector2, fontSize float32, spacing int32, tint Color)
DrawTextEx - Draw text using SpriteFont and additional parameters
func DrawTexture ¶
DrawTexture - Draw a Texture2D
func DrawTextureEx ¶
func DrawTextureEx(texture Texture2D, position Vector2, rotation float32, scale float32, tint Color)
DrawTextureEx - Draw a Texture2D with extended parameters
func DrawTexturePro ¶
func DrawTexturePro(texture Texture2D, sourceRec Rectangle, destRec Rectangle, origin Vector2, rotation float32, tint Color)
DrawTexturePro - Draw a part of a texture defined by a rectangle with 'pro' parameters
func DrawTextureRec ¶
DrawTextureRec - Draw a part of a texture defined by a rectangle
func DrawTextureV ¶
DrawTextureV - Draw a Texture2D with position defined as Vector2
func DrawTriangle ¶
DrawTriangle - Draw a color-filled triangle
func DrawTriangleLines ¶
DrawTriangleLines - Draw triangle outline
func End3dMode ¶
func End3dMode()
End3dMode - Ends 3D mode and returns to default 2D orthographic mode
func EndBlendMode ¶
func EndBlendMode()
EndBlendMode - End blending mode (reset to default: alpha blending)
func EndDrawing ¶
func EndDrawing()
EndDrawing - End canvas drawing and Swap Buffers (Double Buffering)
func EndShaderMode ¶
func EndShaderMode()
EndShaderMode - End custom shader drawing (use default shader)
func GenTextureMipmaps ¶
func GenTextureMipmaps(texture *Texture2D)
GenTextureMipmaps - Generate GPU mipmaps for a texture
func GetDroppedFiles ¶
GetDroppedFiles - Retrieve dropped files into window
func GetFrameTime ¶
func GetFrameTime() float32
GetFrameTime - Returns time in seconds for one frame
func GetGamepadAxisCount ¶
GetGamepadAxisCount - Return gamepad axis count for a gamepad
func GetGamepadAxisMovement ¶
GetGamepadAxisMovement - Return axis movement value for a gamepad axis
func GetGamepadButtonPressed ¶
func GetGamepadButtonPressed() int32
GetGamepadButtonPressed - Get the last gamepad button pressed
func GetGamepadName ¶
GetGamepadName - Return gamepad internal name id
func GetGestureDragAngle ¶
func GetGestureDragAngle() float32
GetGestureDragAngle - Get gesture drag angle
func GetGestureHoldDuration ¶
func GetGestureHoldDuration() float32
GetGestureHoldDuration - Get gesture hold time in milliseconds
func GetGesturePinchAngle ¶
func GetGesturePinchAngle() float32
GetGesturePinchAngle - Get gesture pinch angle
func GetHexValue ¶
GetHexValue - Returns hexadecimal value for a Color
func GetImageData ¶
GetImageData - Get pixel data from image
func GetMouseWheelMove ¶
func GetMouseWheelMove() int32
GetMouseWheelMove - Returns mouse wheel movement Y
func GetMusicTimeLength ¶
GetMusicTimeLength - Get music time length (in seconds)
func GetMusicTimePlayed ¶
GetMusicTimePlayed - Get current music time played (in seconds)
func GetRandomValue ¶
GetRandomValue - Returns a random value between min and max (both included)
func GetShaderLocation ¶
GetShaderLocation - Get shader uniform location
func GetTouchPointsCount ¶
func GetTouchPointsCount() int32
GetTouchPointsCount - Get touch points count
func GetTouchX ¶
func GetTouchX() int32
GetTouchX - Returns touch position X for touch point 0 (relative to screen size)
func GetTouchY ¶
func GetTouchY() int32
GetTouchY - Returns touch position Y for touch point 0 (relative to screen size)
func GetWaveData ¶
GetWaveData - Get samples data from wave as a floats array
func ImageAlphaMask ¶
ImageAlphaMask - Apply alpha mask to image
func ImageColorBrightness ¶
ImageColorBrightness - Modify image color: brightness (-255 to 255)
func ImageColorContrast ¶
ImageColorContrast - Modify image color: contrast (-100 to 100)
func ImageColorGrayscale ¶
func ImageColorGrayscale(image *Image)
ImageColorGrayscale - Modify image color: grayscale
func ImageColorInvert ¶
func ImageColorInvert(image *Image)
ImageColorInvert - Modify image color: invert
func ImageColorTint ¶
ImageColorTint - Modify image color: tint
func ImageDither ¶
ImageDither - Dither image data to 16bpp or lower (Floyd-Steinberg dithering)
func ImageDrawText ¶
ImageDrawText - Draw text (default font) within an image (destination)
func ImageDrawTextEx ¶
func ImageDrawTextEx(dst *Image, position Vector2, font SpriteFont, text string, fontSize float32, spacing int32, color Color)
ImageDrawTextEx - Draw text (custom sprite font) within an image (destination)
func ImageFlipHorizontal ¶
func ImageFlipHorizontal(image *Image)
ImageFlipHorizontal - Flip image horizontally
func ImageFlipVertical ¶
func ImageFlipVertical(image *Image)
ImageFlipVertical - Flip image vertically
func ImageFormat ¶
ImageFormat - Convert image data to desired format
func ImageResize ¶
ImageResize - Resize an image (bilinear filtering)
func ImageResizeNN ¶
ImageResizeNN - Resize an image (Nearest-Neighbor scaling algorithm)
func ImageToPOT ¶
ImageToPOT - Convert image to POT (power-of-two)
func InitVrSimulator ¶
func InitVrSimulator(vdDevice VrDevice)
InitVrSimulator - Init VR simulator for selected device
func InitWindow ¶
InitWindow - Initialize Window and OpenGL Graphics
func IsAudioBufferProcessed ¶
func IsAudioBufferProcessed(stream AudioStream) bool
IsAudioBufferProcessed - Check if any audio stream buffers requires refill
func IsAudioDeviceReady ¶
func IsAudioDeviceReady() bool
IsAudioDeviceReady - Check if audio device has been initialized successfully
func IsCursorHidden ¶
func IsCursorHidden() bool
IsCursorHidden - Returns true if cursor is not visible
func IsFileDropped ¶
func IsFileDropped() bool
IsFileDropped - Check if a file have been dropped into window
func IsGamepadAvailable ¶
IsGamepadAvailable - Detect if a gamepad is available
func IsGamepadButtonDown ¶
IsGamepadButtonDown - Detect if a gamepad button is being pressed
func IsGamepadButtonPressed ¶
IsGamepadButtonPressed - Detect if a gamepad button has been pressed once
func IsGamepadButtonReleased ¶
IsGamepadButtonReleased - Detect if a gamepad button has been released once
func IsGamepadButtonUp ¶
IsGamepadButtonUp - Detect if a gamepad button is NOT being pressed
func IsGamepadName ¶
IsGamepadName - Check gamepad name (if available)
func IsGestureDetected ¶
IsGestureDetected - Check if a gesture have been detected
func IsKeyPressed ¶
IsKeyPressed - Detect if a key has been pressed once
func IsKeyReleased ¶
IsKeyReleased - Detect if a key has been released once
func IsMouseButtonDown ¶
IsMouseButtonDown - Detect if a mouse button is being pressed
func IsMouseButtonPressed ¶
IsMouseButtonPressed - Detect if a mouse button has been pressed once
func IsMouseButtonReleased ¶
IsMouseButtonReleased - Detect if a mouse button has been released once
func IsMouseButtonUp ¶
IsMouseButtonUp - Detect if a mouse button is NOT being pressed
func IsMusicPlaying ¶
IsMusicPlaying - Check if music is playing
func IsSoundPlaying ¶
IsSoundPlaying - Check if a sound is currently playing
func IsVrSimulatorReady ¶
func IsVrSimulatorReady() bool
IsVrSimulatorReady - Detect if VR simulator is ready
func IsWindowMinimized ¶
func IsWindowMinimized() bool
IsWindowMinimized - Detect if window has been minimized (or lost focus)
func LoadResource ¶
LoadResource - Load resource from file (only one) NOTE: Returns uncompressed data with parameters, only first resource found
func LoadResourceByID ¶
LoadResourceByID - Load resource from file by id NOTE: Returns uncompressed data with parameters, search resource by id
func MatrixToFloat ¶
MatrixToFloat - Converts Matrix to float array
func MeasureText ¶
MeasureText - Measure string width for default font
func PauseAudioStream ¶
func PauseAudioStream(stream AudioStream)
PauseAudioStream - Pause audio stream
func ResumeAudioStream ¶
func ResumeAudioStream(stream AudioStream)
ResumeAudioStream - Resume audio stream
func ResumeMusicStream ¶
func ResumeMusicStream(music Music)
ResumeMusicStream - Resume playing paused music
func SetCallbackFunc ¶
SetCallbackFunc - Sets callback function
func SetCameraAltControl ¶
func SetCameraAltControl(altKey int32)
SetCameraAltControl - Set camera alt key to combine with mouse movement (free camera)
func SetCameraMode ¶
func SetCameraMode(camera Camera, mode CameraMode)
SetCameraMode - Set camera mode (multiple camera modes available)
func SetCameraMoveControls ¶
func SetCameraMoveControls(frontKey int32, backKey int32, rightKey int32, leftKey int32, upKey int32, downKey int32)
SetCameraMoveControls - Set camera move controls (1st person and 3rd person cameras)
func SetCameraPanControl ¶
func SetCameraPanControl(panKey int32)
SetCameraPanControl - Set camera pan key to combine with mouse movement (free camera)
func SetCameraSmoothZoomControl ¶
func SetCameraSmoothZoomControl(szKey int32)
SetCameraSmoothZoomControl - Set camera smooth zoom key to combine with mouse (free camera)
func SetConfigFlags ¶
func SetConfigFlags(flags byte)
SetConfigFlags - Setup some window configuration flags
func SetExitKey ¶
func SetExitKey(key int32)
SetExitKey - Set a custom key to exit program (default is ESC)
func SetGesturesEnabled ¶
func SetGesturesEnabled(gestureFlags uint32)
SetGesturesEnabled - Enable a set of gestures using flags
func SetMasterVolume ¶
func SetMasterVolume(volume float32)
SetMasterVolume - Set master volume (listener)
func SetMatrixModelview ¶
func SetMatrixModelview(view Matrix)
SetMatrixModelview - Set a custom modelview matrix (replaces internal modelview matrix)
func SetMatrixProjection ¶
func SetMatrixProjection(proj Matrix)
SetMatrixProjection - Set a custom projection matrix (replaces internal projection matrix)
func SetMousePosition ¶
func SetMousePosition(position Vector2)
SetMousePosition - Set mouse position XY
func SetMusicLoopCount ¶
SetMusicLoopCount - Set music loop count (loop repeats) NOTE: If set to -1, means infinite loop
func SetMusicPitch ¶
SetMusicPitch - Set pitch for a music (1.0 is base level)
func SetMusicVolume ¶
SetMusicVolume - Set volume for music (1.0 is max level)
func SetShaderValue ¶
SetShaderValue - Set shader uniform value (float)
func SetShaderValueMatrix ¶
SetShaderValueMatrix - Set shader uniform value (matrix 4x4)
func SetShaderValuei ¶
SetShaderValuei - Set shader uniform value (int)
func SetSoundPitch ¶
SetSoundPitch - Set pitch for a sound (1.0 is base level)
func SetSoundVolume ¶
SetSoundVolume - Set volume for a sound (1.0 is max level)
func SetTextureFilter ¶
func SetTextureFilter(texture Texture2D, filterMode TextureFilterMode)
SetTextureFilter - Set texture scaling filter mode
func SetTextureWrap ¶
func SetTextureWrap(texture Texture2D, wrapMode TextureWrapMode)
SetTextureWrap - Set texture wrapping mode
func SetWindowIcon ¶
func SetWindowIcon(image Image)
SetWindowIcon - Set icon for window (only PLATFORM_DESKTOP)
func SetWindowMonitor ¶
func SetWindowMonitor(monitor int32)
SetWindowMonitor - Set monitor for the current window (fullscreen mode)
func SetWindowPosition ¶
func SetWindowPosition(x, y int32)
SetWindowPosition - Set window position on screen (only PLATFORM_DESKTOP)
func ShowLogo ¶
func ShowLogo()
ShowLogo - Activates raylib logo at startup (can be done with flags)
func StorageLoadValue ¶
StorageLoadValue - Storage load integer value (from defined position)
func StorageSaveValue ¶
StorageSaveValue - Storage save integer value (to defined position)
func TakeScreenshot ¶
func TakeScreenshot()
TakeScreenshot - Takes a screenshot and saves it in the same folder as executable
func ToggleFullscreen ¶
func ToggleFullscreen()
ToggleFullscreen - Fullscreen toggle (only PLATFORM_DESKTOP)
func ToggleVrMode ¶
func ToggleVrMode()
ToggleVrMode - Enable/Disable VR experience (device or simulator)
func UnloadMaterial ¶
func UnloadMaterial(material Material)
UnloadMaterial - Unload material textures from VRAM
func UnloadMesh ¶
func UnloadMesh(mesh *Mesh)
UnloadMesh - Unload mesh from memory (RAM and/or VRAM)
func UnloadModel ¶
func UnloadModel(model Model)
UnloadModel - Unload model from memory (RAM and/or VRAM)
func UnloadMusicStream ¶
func UnloadMusicStream(music Music)
UnloadMusicStream - Unload music stream
func UnloadRenderTexture ¶
func UnloadRenderTexture(target RenderTexture2D)
UnloadRenderTexture - Unload render texture from GPU memory
func UnloadShader ¶
func UnloadShader(shader Shader)
UnloadShader - Unload a custom shader from memory
func UnloadSpriteFont ¶
func UnloadSpriteFont(spriteFont SpriteFont)
UnloadSpriteFont - Unload SpriteFont from GPU memory (VRAM)
func UnloadTexture ¶
func UnloadTexture(texture Texture2D)
UnloadTexture - Unload texture from GPU memory
func UpdateAudioStream ¶
func UpdateAudioStream(stream AudioStream, data unsafe.Pointer, samplesCount int32)
UpdateAudioStream - Update audio stream buffers with data
func UpdateCamera ¶
func UpdateCamera(camera *Camera)
UpdateCamera - Update camera position for selected mode
func UpdateMusicStream ¶
func UpdateMusicStream(music Music)
UpdateMusicStream - Updates buffers for music streaming
func UpdateSound ¶
UpdateSound - Update sound buffer with new data
func UpdateTexture ¶
UpdateTexture - Update GPU texture with new data
func UpdateVrTracking ¶
func UpdateVrTracking(camera *Camera)
UpdateVrTracking - Update VR tracking (position and orientation) and camera
func VectorToFloat ¶
VectorToFloat - Converts Vector3 to float array
func WaveFormat ¶
WaveFormat - Convert wave data to desired format
func WindowShouldClose ¶
func WindowShouldClose() bool
WindowShouldClose - Detect if KEY_ESCAPE pressed or Close icon pressed
Types ¶
type AudioStream ¶
type AudioStream struct { // Frequency (samples per second) SampleRate uint32 // Bit depth (bits per sample): 8, 16, 32 (24 not supported) SampleSize uint32 // Number of channels (1-mono, 2-stereo) Channels uint32 // OpenAL audio format specifier Format int32 // OpenAL audio source id Source uint32 // OpenAL audio buffers (double buffering) Buffers [2]uint32 }
AudioStream type NOTE: Useful to create custom audio streams not bound to a specific file
func InitAudioStream ¶
func InitAudioStream(sampleRate uint32, sampleSize uint32, channels uint32) AudioStream
InitAudioStream - Init audio stream (to stream raw audio pcm data)
func NewAudioStream ¶
func NewAudioStream(sampleRate, sampleSize, channels uint32, format int32, source uint32, buffers [2]uint32) AudioStream
NewAudioStream - Returns new AudioStream
func NewAudioStreamFromPointer ¶
func NewAudioStreamFromPointer(ptr unsafe.Pointer) AudioStream
NewAudioStreamFromPointer - Returns new AudioStream from pointer
type BlendMode ¶
type BlendMode int32
BlendMode type
const ( BlendAlpha BlendMode = C.BLEND_ALPHA BlendAdditive BlendMode = C.BLEND_ADDITIVE BlendMultiplied BlendMode = C.BLEND_MULTIPLIED )
Color blending modes (pre-defined)
type BoundingBox ¶
type BoundingBox struct { // Minimum vertex box-corner Min Vector3 // Maximum vertex box-corner Max Vector3 }
BoundingBox type
func CalculateBoundingBox ¶
func CalculateBoundingBox(mesh Mesh) BoundingBox
CalculateBoundingBox - Calculate mesh bounding box limits
func NewBoundingBox ¶
func NewBoundingBox(min, max Vector3) BoundingBox
NewBoundingBox - Returns new BoundingBox
func NewBoundingBoxFromPointer ¶
func NewBoundingBoxFromPointer(ptr unsafe.Pointer) BoundingBox
NewBoundingBoxFromPointer - Returns new BoundingBox from pointer
type Camera ¶
type Camera struct { // Camera position Position Vector3 // Camera target it looks-at Target Vector3 // Camera up vector (rotation over its axis) Up Vector3 // Camera field-of-view apperture in Y (degrees) Fovy float32 }
Camera type, defines a camera position/orientation in 3d space
func NewCameraFromPointer ¶
NewCameraFromPointer - Returns new Camera from pointer
type Camera2D ¶
type Camera2D struct { // Camera offset (displacement from target) Offset Vector2 // Camera target (rotation and zoom origin) Target Vector2 // Camera rotation in degrees Rotation float32 // Camera zoom (scaling), should be 1.0f by default Zoom float32 }
Camera2D type, defines a 2d camera
func NewCamera2D ¶
NewCamera2D - Returns new Camera2D
func NewCamera2DFromPointer ¶
NewCamera2DFromPointer - Returns new Camera2D from pointer
type CameraMode ¶
type CameraMode int32
CameraMode type
const ( CameraCustom CameraMode = C.CAMERA_CUSTOM CameraFree CameraMode = C.CAMERA_FREE CameraOrbital CameraMode = C.CAMERA_ORBITAL CameraFirstPerson CameraMode = C.CAMERA_FIRST_PERSON CameraThirdPerson CameraMode = C.CAMERA_THIRD_PERSON )
Camera system modes
type CharInfo ¶
type CharInfo struct { // Character value (Unicode) Value int32 // Character rectangle in sprite font Rec Rectangle // Character offset X when drawing OffsetX int32 // Character offset Y when drawing OffsetY int32 // Character advance position X AdvanceX int32 }
CharInfo - SpriteFont character info
func NewCharInfo ¶
NewCharInfo - Returns new SpriteFont
func NewCharInfoFromPointer ¶
NewCharInfoFromPointer - Returns new SpriteFont from pointer
type Color ¶
Color type, RGBA (32bit)
func NewColorFromPointer ¶
NewColorFromPointer - Returns new Color from pointer
type Gestures ¶
type Gestures int32
Gestures type
const ( GestureNone Gestures = C.GESTURE_NONE GestureTap Gestures = C.GESTURE_TAP GestureDoubletap Gestures = C.GESTURE_DOUBLETAP GestureHold Gestures = C.GESTURE_HOLD GestureDrag Gestures = C.GESTURE_DRAG GestureSwipeRight Gestures = C.GESTURE_SWIPE_RIGHT GestureSwipeLeft Gestures = C.GESTURE_SWIPE_LEFT GestureSwipeUp Gestures = C.GESTURE_SWIPE_UP GestureSwipeDown Gestures = C.GESTURE_SWIPE_DOWN GesturePinchIn Gestures = C.GESTURE_PINCH_IN GesturePinchOut Gestures = C.GESTURE_PINCH_OUT )
Gestures types NOTE: It could be used as flags to enable only some gestures
func GetGestureDetected ¶
func GetGestureDetected() Gestures
GetGestureDetected - Get latest detected gesture
type Image ¶
type Image struct { // Image raw data Data unsafe.Pointer // Image base width Width int32 // Image base height Height int32 // Mipmap levels, 1 by default Mipmaps int32 // Data format (TextureFormat) Format TextureFormat }
Image type, bpp always RGBA (32bit) NOTE: Data stored in CPU memory (RAM)
func GetTextureData ¶
GetTextureData - Get pixel data from GPU texture and return an Image
func ImageTextEx ¶
ImageTextEx - Create an image from text (custom sprite font)
func LoadImageEx ¶
LoadImageEx - Load image data from Color array data (RGBA - 32bit)
func LoadImagePro ¶
func LoadImagePro(data []byte, width int32, height int32, format TextureFormat) *Image
LoadImagePro - Load image from raw data with parameters
func LoadImageRaw ¶
func LoadImageRaw(fileName string, width int32, height int32, format TextureFormat, headerSize int32) *Image
LoadImageRaw - Load image data from RAW file
func NewImage ¶
func NewImage(data unsafe.Pointer, width, height, mipmaps int32, format TextureFormat) *Image
NewImage - Returns new Image
func NewImageFromPointer ¶
NewImageFromPointer - Returns new Image from pointer
type Material ¶
type Material struct { // Standard shader (supports 3 map textures) Shader Shader // Diffuse texture (binded to shader mapTexture0Loc) TexDiffuse Texture2D // Normal texture (binded to shader mapTexture1Loc) TexNormal Texture2D // Specular texture (binded to shader mapTexture2Loc) TexSpecular Texture2D // Diffuse color ColDiffuse Color // Ambient color ColAmbient Color // Specular color ColSpecular Color // Glossiness level (Ranges from 0 to 1000) Glossiness float32 }
Material type
func LoadDefaultMaterial ¶
func LoadDefaultMaterial() Material
LoadDefaultMaterial - Load default material (uses default models shader)
func LoadMaterial ¶
LoadMaterial - Load material data (.MTL)
func NewMaterial ¶
func NewMaterial(shader Shader, texDiffuse, texNormal, texSpecular Texture2D, colDiffuse, colAmbient, colSpecular Color, glossiness float32) Material
NewMaterial - Returns new Material
func NewMaterialFromPointer ¶
NewMaterialFromPointer - Returns new Material from pointer
type Matrix ¶
type Matrix struct {
M0, M4, M8, M12 float32
M1, M5, M9, M13 float32
M2, M6, M10, M14 float32
M3, M7, M11, M15 float32
}
Matrix type (OpenGL style 4x4 - right handed, column major)
func GetCameraMatrix ¶
GetCameraMatrix - Returns camera transform matrix (view matrix)
func NewMatrixFromPointer ¶
NewMatrixFromPointer - Returns new Matrix from pointer
type Mesh ¶
type Mesh struct { // Number of vertices stored in arrays VertexCount int32 // Number of triangles stored (indexed or not) TriangleCount int32 // Vertex position (XYZ - 3 components per vertex) (shader-location = 0) Vertices *[]float32 // Vertex texture coordinates (UV - 2 components per vertex) (shader-location = 1) Texcoords *[]float32 // Vertex second texture coordinates (useful for lightmaps) (shader-location = 5) Texcoords2 *[]float32 // Vertex normals (XYZ - 3 components per vertex) (shader-location = 2) Normals *[]float32 // Vertex tangents (XYZ - 3 components per vertex) (shader-location = 4) Tangents *[]float32 // Vertex colors (RGBA - 4 components per vertex) (shader-location = 3) Colors *[]uint8 // Vertex indices (in case vertex data comes indexed) Indices *[]uint16 // OpenGL Vertex Array Object id VaoID uint32 // OpenGL Vertex Buffer Objects id (7 types of vertex data) VboID [7]uint32 }
Mesh - Vertex data definning a mesh
func LoadMeshEx ¶
func LoadMeshEx(numVertex int32, vData []float32, vtData []float32, vnData []float32, cData []Color) Mesh
LoadMeshEx - Load mesh from vertex data
func NewMesh ¶
func NewMesh(vertexCount, triangleCount int32, vertices, texcoords, texcoords2, normals, tangents *[]float32, colors *[]uint8, indices *[]uint16, vaoID uint32, vboID [7]uint32) Mesh
NewMesh - Returns new Mesh
func NewMeshFromPointer ¶
NewMeshFromPointer - Returns new Mesh from pointer
type Model ¶
type Model struct { // Vertex data buffers (RAM and VRAM) Mesh Mesh // Local transform matrix Transform Matrix // Shader and textures data Material Material // contains filtered or unexported fields }
Model type
func LoadCubicmap ¶
LoadCubicmap - Load cubes-based map model from image data
func LoadHeightmap ¶
LoadHeightmap - Load heightmap model from image data
func LoadModelFromMesh ¶
LoadModelFromMesh - Load model from mesh data
func NewModelFromPointer ¶
NewModelFromPointer - Returns new Model from pointer
type Music ¶
Music type (file streaming from memory) NOTE: Anything longer than ~10 seconds should be streamed
func LoadMusicStream ¶
LoadMusicStream - Load music stream from file
type Quaternion ¶
Quaternion type
func NewQuaternion ¶
func NewQuaternion(x, y, z, w float32) Quaternion
NewQuaternion - Returns new Quaternion
type RRESFileHeader ¶
type RRESFileHeader struct { // File identifier: rRES (4 byte) ID [4]int8 // File version and subversion (2 byte) Version uint16 // Number of resources in this file (2 byte) Count uint16 }
RRESFileHeader - rRES file header (8 byte)
type RRESInfoHeader ¶
type RRESInfoHeader struct { // Resource unique identifier (4 byte) ID uint32 // Resource data type (1 byte) DataType uint8 // Resource data compression type (1 byte) CompType uint8 // Resource data encryption type (1 byte) CryptoType uint8 // Resource data parts count, used for splitted data (1 byte) PartsCount uint8 // Resource data size (compressed or not, only DATA) (4 byte) DataSize uint32 // Resource data size (uncompressed, only DATA) (4 byte) UncompSize uint32 // Resouce parameter 1 (4 byte) Param1 uint32 // Resouce parameter 2 (4 byte) Param2 uint32 // Resouce parameter 3 (4 byte) Param3 uint32 // Resouce parameter 4 (4 byte) Param4 uint32 }
RRESInfoHeader - rRES info header, every resource includes this header (16 byte + 16 byte)
type Ray ¶
Ray type (useful for raycast)
func GetMouseRay ¶
GetMouseRay - Returns a ray trace from mouse position
func NewRayFromPointer ¶
NewRayFromPointer - Returns new Ray from pointer
type Rectangle ¶
Rectangle type
func GetCollisionRec ¶
GetCollisionRec - Get collision rectangle for two rectangles collision
func NewRectangle ¶
NewRectangle - Returns new Rectangle
func NewRectangleFromPointer ¶
NewRectangleFromPointer - Returns new Rectangle from pointer
type RenderTexture2D ¶
type RenderTexture2D struct { // Render texture (fbo) id ID uint32 // Color buffer attachment texture Texture Texture2D // Depth buffer attachment texture Depth Texture2D }
RenderTexture2D type, for texture rendering
func LoadRenderTexture ¶
func LoadRenderTexture(width int32, height int32) RenderTexture2D
LoadRenderTexture - Load a texture to be used for rendering
func NewRenderTexture2D ¶
func NewRenderTexture2D(id uint32, texture, depth Texture2D) RenderTexture2D
NewRenderTexture2D - Returns new RenderTexture2D
func NewRenderTexture2DFromPointer ¶
func NewRenderTexture2DFromPointer(ptr unsafe.Pointer) RenderTexture2D
NewRenderTexture2DFromPointer - Returns new RenderTexture2D from pointer
type Shader ¶
type Shader struct { // Shader program id ID uint32 // Vertex attribute location point (default-location = 0) VertexLoc int32 // Texcoord attribute location point (default-location = 1) TexcoordLoc int32 // Texcoord2 attribute location point (default-location = 5) Texcoord2Loc int32 // Normal attribute location point (default-location = 2) NormalLoc int32 // Tangent attribute location point (default-location = 4) TangentLoc int32 // Color attibute location point (default-location = 3) ColorLoc int32 // ModelView-Projection matrix uniform location point (vertex shader) MvpLoc int32 // Diffuse color uniform location point (fragment shader) ColDiffuseLoc int32 // Ambient color uniform location point (fragment shader) ColAmbientLoc int32 // Specular color uniform location point (fragment shader) ColSpecularLoc int32 // Map texture uniform location point (default-texture-unit = 0) MapTexture0Loc int32 // Map texture uniform location point (default-texture-unit = 1) MapTexture1Loc int32 // Map texture uniform location point (default-texture-unit = 2) MapTexture2Loc int32 }
Shader type (generic shader)
func LoadShader ¶
LoadShader - Load a custom shader and bind default locations
func NewShader ¶
func NewShader(id uint32, vertexLoc, texcoordLoc, texcoord2Loc, normalLoc, tangentLoc, colorLoc, mvpLoc, colDiffuseLoc, colAmbientLoc, colSpecularLoc, mapTexture0Loc, mapTexture1Loc, mapTexture2Loc int32) Shader
NewShader - Returns new Shader
func NewShaderFromPointer ¶
NewShaderFromPointer - Returns new Shader from pointer
type Sound ¶
type Sound struct { // OpenAL audio source id Source uint32 // OpenAL audio buffer id Buffer uint32 // OpenAL audio format specifier Format int32 }
Sound source type
func LoadSoundFromWave ¶
LoadSoundFromWave - Load sound to memory from wave data
func NewSoundFromPointer ¶
NewSoundFromPointer - Returns new Sound from pointer
type SpriteFont ¶
type SpriteFont struct { // Font texture Texture Texture2D // Base size (default chars height) BaseSize int32 // Number of characters CharsCount int32 // Characters info data Chars *CharInfo }
SpriteFont type, includes texture and charSet array data
func LoadSpriteFont ¶
func LoadSpriteFont(fileName string) SpriteFont
LoadSpriteFont - Load a SpriteFont image into GPU memory (VRAM)
func LoadSpriteFontEx ¶
func LoadSpriteFontEx(fileName string, fontSize int32, charsCount int32, fontChars *int32) SpriteFont
LoadSpriteFontEx - Load SpriteFont from file with extended parameters
func NewSpriteFont ¶
func NewSpriteFont(texture Texture2D, baseSize, charsCount int32, chars *CharInfo) SpriteFont
NewSpriteFont - Returns new SpriteFont
func NewSpriteFontFromPointer ¶
func NewSpriteFontFromPointer(ptr unsafe.Pointer) SpriteFont
NewSpriteFontFromPointer - Returns new SpriteFont from pointer
type Texture2D ¶
type Texture2D struct { // OpenGL texture id ID uint32 // Texture base width Width int32 // Texture base height Height int32 // Mipmap levels, 1 by default Mipmaps int32 // Data format (TextureFormat) Format TextureFormat }
Texture2D type, bpp always RGBA (32bit) NOTE: Data stored in GPU memory
func GetDefaultTexture ¶
func GetDefaultTexture() *Texture2D
GetDefaultTexture - Get default texture
func LoadTexture ¶
LoadTexture - Load an image as texture into GPU memory
func LoadTextureFromImage ¶
LoadTextureFromImage - Load a texture from image data
func NewTexture2D ¶
func NewTexture2D(id uint32, width, height, mipmaps int32, format TextureFormat) Texture2D
NewTexture2D - Returns new Texture2D
func NewTexture2DFromPointer ¶
NewTexture2DFromPointer - Returns new Texture2D from pointer
type TextureFilterMode ¶
type TextureFilterMode int32
TextureFilterMode - Texture filter mode
const ( // No filter, just pixel aproximation FilterPoint TextureFilterMode = C.FILTER_POINT // Linear filtering FilterBilinear TextureFilterMode = C.FILTER_BILINEAR // Trilinear filtering (linear with mipmaps) FilterTrilinear TextureFilterMode = C.FILTER_TRILINEAR // Anisotropic filtering 4x FilterAnisotropic4x TextureFilterMode = C.FILTER_ANISOTROPIC_4X // Anisotropic filtering 8x FilterAnisotropic8x TextureFilterMode = C.FILTER_ANISOTROPIC_8X // Anisotropic filtering 16x FilterAnisotropic16x TextureFilterMode = C.FILTER_ANISOTROPIC_16X )
Texture parameters: filter mode NOTE 1: Filtering considers mipmaps if available in the texture NOTE 2: Filter is accordingly set for minification and magnification
type TextureFormat ¶
type TextureFormat int32
TextureFormat - Texture format
const ( // 8 bit per pixel (no alpha) UncompressedGrayscale TextureFormat = C.UNCOMPRESSED_GRAYSCALE // 16 bpp (2 channels) UncompressedGrayAlpha TextureFormat = C.UNCOMPRESSED_GRAY_ALPHA // 16 bpp UncompressedR5g6b5 TextureFormat = C.UNCOMPRESSED_R5G6B5 // 24 bpp UncompressedR8g8b8 TextureFormat = C.UNCOMPRESSED_R8G8B8 // 16 bpp (1 bit alpha) UncompressedR5g5b5a1 TextureFormat = C.UNCOMPRESSED_R5G5B5A1 // 16 bpp (4 bit alpha) UncompressedR4g4b4a4 TextureFormat = C.UNCOMPRESSED_R4G4B4A4 // 32 bpp UncompressedR8g8b8a8 TextureFormat = C.UNCOMPRESSED_R8G8B8A8 // 4 bpp (no alpha) CompressedDxt1Rgb TextureFormat = C.COMPRESSED_DXT1_RGB // 4 bpp (1 bit alpha) CompressedDxt1Rgba TextureFormat = C.COMPRESSED_DXT1_RGBA // 8 bpp CompressedDxt3Rgba TextureFormat = C.COMPRESSED_DXT3_RGBA // 8 bpp CompressedDxt5Rgba TextureFormat = C.COMPRESSED_DXT5_RGBA // 4 bpp CompressedEtc1Rgb TextureFormat = C.COMPRESSED_ETC1_RGB // 4 bpp CompressedEtc2Rgb TextureFormat = C.COMPRESSED_ETC2_RGB // 8 bpp CompressedEtc2EacRgba TextureFormat = C.COMPRESSED_ETC2_EAC_RGBA // 4 bpp CompressedPvrtRgb TextureFormat = C.COMPRESSED_PVRT_RGB // 4 bpp CompressedPvrtRgba TextureFormat = C.COMPRESSED_PVRT_RGBA // 8 bpp CompressedAstc4x4Rgba TextureFormat = C.COMPRESSED_ASTC_4x4_RGBA // 2 bpp CompressedAstc8x8Rgba TextureFormat = C.COMPRESSED_ASTC_8x8_RGBA )
Texture formats NOTE: Support depends on OpenGL version and platform
type TextureWrapMode ¶
type TextureWrapMode int32
TextureWrapMode - Texture wrap mode
const ( WrapRepeat TextureWrapMode = C.WRAP_REPEAT WrapClamp TextureWrapMode = C.WRAP_CLAMP WrapMirror TextureWrapMode = C.WRAP_MIRROR )
Texture parameters: wrap mode
type Vector2 ¶
Vector2 type
func GetGestureDragVector ¶
func GetGestureDragVector() Vector2
GetGestureDragVector - Get gesture drag vector
func GetGesturePinchVector ¶
func GetGesturePinchVector() Vector2
GetGesturePinchVector - Get gesture pinch delta
func GetMousePosition ¶
func GetMousePosition() Vector2
GetMousePosition - Returns mouse position XY
func GetTouchPosition ¶
GetTouchPosition - Returns touch position XY for a touch point index (relative to screen size)
func GetWorldToScreen ¶
GetWorldToScreen - Returns the screen space position from a 3d world space position
func MeasureTextEx ¶
func MeasureTextEx(spriteFont SpriteFont, text string, fontSize float32, spacing int32) Vector2
MeasureTextEx - Measure string size for SpriteFont
func NewVector2FromPointer ¶
NewVector2FromPointer - Returns new Vector2 from pointer
type Vector3 ¶
Vector3 type
func NewVector3FromPointer ¶
NewVector3FromPointer - Returns new Vector3 from pointer
type VrDevice ¶
type VrDevice int32
VrDevice type
const ( HmdDefaultDevice VrDevice = C.HMD_DEFAULT_DEVICE HmdOculusRiftDk2 VrDevice = C.HMD_OCULUS_RIFT_DK2 HmdOculusRiftCv1 VrDevice = C.HMD_OCULUS_RIFT_CV1 HmdValveHtcVive VrDevice = C.HMD_VALVE_HTC_VIVE HmdSamsungGearVr VrDevice = C.HMD_SAMSUNG_GEAR_VR HmdGoogleCardboard VrDevice = C.HMD_GOOGLE_CARDBOARD HmdSonyPlaystationVr VrDevice = C.HMD_SONY_PLAYSTATION_VR HmdRazerOsvr VrDevice = C.HMD_RAZER_OSVR HmdFoveVr VrDevice = C.HMD_FOVE_VR )
Head Mounted Display devices
type Wave ¶
type Wave struct { // Number of samples SampleCount uint32 // Frequency (samples per second) SampleRate uint32 // Bit depth (bits per sample): 8, 16, 32 (24 not supported) SampleSize uint32 // Number of channels (1-mono, 2-stereo) Channels uint32 // Buffer data pointer Data unsafe.Pointer }
Wave type, defines audio wave data
func LoadWaveEx ¶
func LoadWaveEx(data unsafe.Pointer, sampleCount int32, sampleRate int32, sampleSize int32, channels int32) Wave
LoadWaveEx - Load wave data from float array data (32bit)
func NewWaveFromPointer ¶
NewWaveFromPointer - Returns new Wave from pointer