MCPcopy Create free account
hub / github.com/SolarLune/masterplan / NewMenu

Function NewMenu

menu.go:173–200  ·  view source on GitHub ↗
(name string, rect *sdl.FRect, closeMethod int)

Source from the content-addressed store, hash-verified

171}
172
173func NewMenu(name string, rect *sdl.FRect, closeMethod int) *Menu {
174
175 menu := &Menu{
176 Name: name,
177 Rect: &sdl.FRect{rect.X, rect.Y, 0, 0},
178 MinSize: Vector{32, 32},
179 Pages: map[string]*Container{},
180 CloseMethod: closeMethod,
181 ResizeShape: NewShape(8),
182 Spacing: MenuSpacingNone,
183 Draggable: false,
184 }
185
186 if menu.Name == "" {
187 menu.Name = strconv.Itoa(int(rand.Int31()))
188 }
189
190 menu.closeButtonButton = NewIconButton(0, 0, &sdl.FRect{176, 0, 32, 32}, globals.GUITexture, false, func() { menu.Close() })
191 menu.BackButton = NewIconButton(0, 0, &sdl.FRect{208, 0, 32, 32}, globals.GUITexture, false, func() { menu.SetPrevPage() })
192
193 menu.AddPage("root")
194 menu.SetPage("root")
195
196 menu.Recreate(rect.W, rect.H)
197
198 return menu
199
200}
201
202func (menu *Menu) Update() {
203

Callers 1

ConstructMenusFunction · 0.85

Calls 7

CloseMethod · 0.95
SetPrevPageMethod · 0.95
AddPageMethod · 0.95
SetPageMethod · 0.95
RecreateMethod · 0.95
NewShapeFunction · 0.85
NewIconButtonFunction · 0.85

Tested by

no test coverage detected