raylib-go/examples/textures/logo_raylib/main.go
2017-01-27 09:35:30 +01:00

31 lines
771 B
Go

package main
import (
"github.com/gen2brain/raylib-go/raylib"
)
func main() {
screenWidth := int32(800)
screenHeight := int32(450)
raylib.InitWindow(screenWidth, screenHeight, "raylib [textures] example - texture loading and drawing")
// NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
texture := raylib.LoadTexture("raylib_logo.png")
raylib.SetTargetFPS(60)
for !raylib.WindowShouldClose() {
raylib.BeginDrawing()
raylib.ClearBackground(raylib.RayWhite)
raylib.DrawTexture(texture, screenWidth/2-texture.Width/2, screenHeight/2-texture.Height/2, raylib.White)
raylib.DrawText("this IS a texture!", 360, 370, 10, raylib.Gray)
raylib.EndDrawing()
}
raylib.UnloadTexture(texture)
raylib.CloseWindow()
}