Initial commit
This commit is contained in:
commit
d7ff68b487
196 changed files with 286314 additions and 0 deletions
40
examples/core/mouse_wheel/main.go
Normal file
40
examples/core/mouse_wheel/main.go
Normal file
|
@ -0,0 +1,40 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/gen2brain/raylib-go/raylib"
|
||||
)
|
||||
|
||||
var (
|
||||
MaxBuildings int = 100
|
||||
)
|
||||
|
||||
func main() {
|
||||
screenWidth := int32(800)
|
||||
screenHeight := int32(450)
|
||||
|
||||
raylib.InitWindow(screenWidth, screenHeight, "raylib [core] example - mouse wheel")
|
||||
|
||||
boxPositionY := screenHeight/2 - 40
|
||||
scrollSpeed := int32(4) // Scrolling speed in pixels
|
||||
|
||||
raylib.SetTargetFPS(60)
|
||||
|
||||
for !raylib.WindowShouldClose() {
|
||||
boxPositionY -= raylib.GetMouseWheelMove() * scrollSpeed
|
||||
|
||||
raylib.BeginDrawing()
|
||||
|
||||
raylib.ClearBackground(raylib.RayWhite)
|
||||
|
||||
raylib.DrawRectangle(screenWidth/2-40, boxPositionY, 80, 80, raylib.Maroon)
|
||||
|
||||
raylib.DrawText("Use mouse wheel to move the cube up and down!", 10, 10, 20, raylib.Gray)
|
||||
raylib.DrawText(fmt.Sprintf("Box position Y: %d", boxPositionY), 10, 40, 20, raylib.LightGray)
|
||||
|
||||
raylib.EndDrawing()
|
||||
}
|
||||
|
||||
raylib.CloseWindow()
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue