Skip to content

Commit

Permalink
all: add some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
gucio321 committed Sep 19, 2021
1 parent 0058b8c commit a7ce405
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
3 changes: 3 additions & 0 deletions Alignment.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,14 @@ func Align(at AlignmentType) *AlignmentSetter {
}
}

// To sets a layout, alignment should be applied to
func (a *AlignmentSetter) To(widgets ...Widget) *AlignmentSetter {
a.layout = Layout(widgets)
return a
}

// ID allows to manually set AlignmentSetter ID (it shouldn't be used
// in a normal conditions)
func (a *AlignmentSetter) ID(id string) *AlignmentSetter {
a.id = id
return a
Expand Down
2 changes: 2 additions & 0 deletions Flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ const (
ComboFlagNoPreview ComboFlags = 1 << 6
)

// SelectableFlags represents imgui.SelectableFlags
type SelectableFlags int

const (
Expand Down Expand Up @@ -224,6 +225,7 @@ const (
TreeNodeFlagsCollapsingHeader TreeNodeFlags = TreeNodeFlagsFramed | TreeNodeFlagsNoTreePushOnOpen | TreeNodeFlagsNoAutoOpenOnLog
)

// FocusedFlags represents imgui.FocusedFlags
type FocusedFlags int

const (
Expand Down
9 changes: 6 additions & 3 deletions FontAtlasProsessor.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ const (
preRegisterString = "\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
)

// FontInfo represents a the font.
//
type FontInfo struct {
fontName string
fontPath string
Expand Down Expand Up @@ -76,7 +78,7 @@ func init() {
}
}

// Change default font
// SetDefaultFont changes default font
func SetDefaultFont(fontName string, size float32) {
fontPath, err := findfont.Find(fontName)
if err != nil {
Expand All @@ -88,7 +90,7 @@ func SetDefaultFont(fontName string, size float32) {
defaultFonts = append([]FontInfo{fontInfo}, defaultFonts...)
}

// Change default font by bytes of the font file
// SetDefaultFontFromBytes changes default font by bytes of the font file.
func SetDefaultFontFromBytes(fontBytes []byte, size float32) {
defaultFonts = append([]FontInfo{
{
Expand All @@ -98,7 +100,7 @@ func SetDefaultFontFromBytes(fontBytes []byte, size float32) {
}, defaultFonts...)
}

// Add font by name, if the font is found, return *FontInfo, otherwise return nil.
// AddFont adds font by name, if the font is found, return *FontInfo, otherwise return nil.
// To use added font, use giu.Style().SetFont(...).
func AddFont(fontName string, size float32) *FontInfo {
fontPath, err := findfont.Find(fontName)
Expand All @@ -118,6 +120,7 @@ func AddFont(fontName string, size float32) *FontInfo {
return &fi
}

// AddFontFromBytes does similar to AddFont, but using data from memory
func AddFontFromBytes(fontName string, fontBytes []byte, size float32) *FontInfo {
fi := FontInfo{
fontName: fontName,
Expand Down
1 change: 1 addition & 0 deletions Style.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ const (
// StyleVarID identifies a style variable in the UI style.
type StyleVarID int

// Style IDs
const (
// StyleVarAlpha is a float
StyleVarAlpha StyleVarID = iota
Expand Down

0 comments on commit a7ce405

Please sign in to comment.