forked from gen2brain/raylib-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
50 lines (36 loc) · 1.06 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package main
import (
"github.com/gen2brain/raylib-go/raylib"
)
func main() {
screenWidth := int32(800)
screenHeight := int32(450)
rl.InitWindow(screenWidth, screenHeight, "raylib [core] example - drop files")
rl.SetTargetFPS(60)
count := int32(0)
var droppedFiles []string
for !rl.WindowShouldClose() {
if rl.IsFileDropped() {
droppedFiles = rl.GetDroppedFiles(&count)
}
rl.BeginDrawing()
rl.ClearBackground(rl.RayWhite)
if count == 0 {
rl.DrawText("Drop your files to this window!", 100, 40, 20, rl.DarkGray)
} else {
rl.DrawText("Dropped files:", 100, 40, 20, rl.DarkGray)
for i := int32(0); i < count; i++ {
if i%2 == 0 {
rl.DrawRectangle(0, int32(85+40*i), screenWidth, 40, rl.Fade(rl.LightGray, 0.5))
} else {
rl.DrawRectangle(0, int32(85+40*i), screenWidth, 40, rl.Fade(rl.LightGray, 0.3))
}
rl.DrawText(droppedFiles[i], 120, int32(100+i*40), 10, rl.Gray)
}
rl.DrawText("Drop new files...", 100, int32(150+count*40), 20, rl.DarkGray)
}
rl.EndDrawing()
}
rl.ClearDroppedFiles()
rl.CloseWindow()
}