Break raygui.go into separate files
- per-control .go file, - separate file for style/property stuff, - added NumProperties enum to the list of properties for constraint checking, - should be no code changes
This commit is contained in:
parent
f0e483d8d0
commit
8e6dcc45e1
13 changed files with 1145 additions and 1079 deletions
21
raygui/progressbar.go
Normal file
21
raygui/progressbar.go
Normal file
|
@ -0,0 +1,21 @@
|
|||
package raygui
|
||||
|
||||
import "github.com/gen2brain/raylib-go/raylib"
|
||||
|
||||
// ProgressBar - Progress Bar element, shows current progress value
|
||||
func ProgressBar(bounds rl.Rectangle, value float32) {
|
||||
b := bounds.ToInt32()
|
||||
if value > 1.0 {
|
||||
value = 1.0
|
||||
} else if value < 0.0 {
|
||||
value = 0.0
|
||||
}
|
||||
|
||||
progressBar := rl.RectangleInt32{b.X + int32(style[ProgressbarBorderWidth]), b.Y + int32(style[ProgressbarBorderWidth]), b.Width - (int32(style[ProgressbarBorderWidth]) * 2), b.Height - (int32(style[ProgressbarBorderWidth]) * 2)}
|
||||
progressValue := rl.RectangleInt32{b.X + int32(style[ProgressbarBorderWidth]), b.Y + int32(style[ProgressbarBorderWidth]), int32(value * float32(b.Width-int32(style[ProgressbarBorderWidth])*2)), b.Height - (int32(style[ProgressbarBorderWidth]) * 2)}
|
||||
|
||||
// Draw control
|
||||
rl.DrawRectangle(b.X, b.Y, b.Width, b.Height, rl.GetColor(int32(style[ProgressbarBorderColor])))
|
||||
rl.DrawRectangle(progressBar.X, progressBar.Y, progressBar.Width, progressBar.Height, rl.GetColor(int32(style[ProgressbarInsideColor])))
|
||||
rl.DrawRectangle(progressValue.X, progressValue.Y, progressValue.Width, progressValue.Height, rl.GetColor(int32(style[ProgressbarProgressColor])))
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue