Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/antosmichael07/raylib-cube-image
A library that makes it simple to draw cubes with an image.
https://github.com/antosmichael07/raylib-cube-image
cube go golang raylib raylib-go
Last synced: 6 days ago
JSON representation
A library that makes it simple to draw cubes with an image.
- Host: GitHub
- URL: https://github.com/antosmichael07/raylib-cube-image
- Owner: antosmichael07
- Created: 2024-06-03T17:43:27.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-06-08T06:54:20.000Z (5 months ago)
- Last Synced: 2024-06-19T03:13:29.079Z (5 months ago)
- Topics: cube, go, golang, raylib, raylib-go
- Language: Go
- Homepage:
- Size: 9.77 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Raylib Cube Image
Simple library that makes it possible to draw cubes with images.
Install with `go get github.com/antosmichael07/Raylib-Cube-Image`## Example
```go
package mainimport (
rl_ci "github.com/antosmichael07/Raylib-Cube-Image"
rl "github.com/gen2brain/raylib-go/raylib"
)func main() {
rl.InitWindow(int32(rl.GetMonitorWidth(rl.GetCurrentMonitor())), int32(rl.GetMonitorHeight(rl.GetCurrentMonitor())), "WTF is this?")
rl.ToggleFullscreen()
rl.DisableCursor()
rl.SetTargetFPS(int32(rl.GetMonitorRefreshRate(rl.GetCurrentMonitor())))
defer rl.CloseWindow()camera := rl.NewCamera3D(
rl.NewVector3(10.0, 10.0, 10.0),
rl.NewVector3(0.0, 0.0, 0.0),
rl.NewVector3(0.0, 1.0, 0.0),
70.0,
rl.CameraPerspective,
)// Here are the cubes initialized
image := rl.LoadImage("image.png")
cube_images := []rl_ci.CubeImage{
rl_ci.NewCubeImage(image, rl.NewVector3(0.0, 0.0, 0.0), rl.NewVector3(2.0, 5.0, 2.0), rl.Red),
rl_ci.NewCubeImage(image, rl.NewVector3(3.0, 0.0, 0.0), rl.NewVector3(2.0, 3.0, 2.0), rl.White),
rl_ci.NewCubeImage(image, rl.NewVector3(-3.0, 0.0, 0.0), rl.NewVector3(3.0, 1.0, 2.0), rl.White),
}for !rl.WindowShouldClose() {
rl.BeginDrawing()
rl.ClearBackground(rl.Black)
rl.UpdateCamera(&camera, rl.CameraFree)
rl.BeginMode3D(camera)// Here are the cubes drawn
for i := range cube_images {
cube_images[i].DrawCubeImage()
}rl.EndMode3D()
rl.EndDrawing()
}
}
```