-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathprogress.go
More file actions
31 lines (25 loc) · 792 Bytes
/
Copy pathprogress.go
File metadata and controls
31 lines (25 loc) · 792 Bytes
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
package egui
import (
"image/color"
"github.com/pkg/errors"
"github.com/xackery/egui/common"
"github.com/xackery/egui/element/progress"
)
// NewProgress creates a new progress bar instance
func (u *UI) NewProgress(name string, scene string, text string, x float64, y float64, width int, height int, progressImageName string, fillImageName string) (*progress.Element, error) {
imageName := "ui"
img, err := u.Image(imageName)
if err != nil {
return nil, errors.Wrap(err, imageName)
}
s, err := u.Scene(scene)
if err != nil {
return nil, common.ErrSceneNotFound
}
e, err := progress.New(name, scene, text, x, y, width, height, u.defaultFont, color.White, img, progressImageName, fillImageName)
err = s.AddElement(e)
if err != nil {
return nil, err
}
return e, nil
}