Skip to content

Commit

Permalink
Merge remote-tracking branch 'bbrucee/311_dt1-widget-dropdown'
Browse files Browse the repository at this point in the history
This merges change from OpenDiablo2#313
  • Loading branch information
gucio321 committed Nov 26, 2024
2 parents d86e4a9 + 2289674 commit 285e3ac
Showing 1 changed file with 29 additions and 4 deletions.
33 changes: 29 additions & 4 deletions hswidget/dt1widget/widget.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const (
)

const (
comboW = 280
gridMaxWidth = 160
gridMaxHeight = 80
gridDivisionsXY = 5
Expand Down Expand Up @@ -575,18 +576,42 @@ func (p *widget) SetTileGroup(tileGroup int32) {
}

func (p *widget) makeSubtileFlags(state *widgetState, tile *d2dt1.Tile) giu.Layout {
subtileFlagList := make([]string, 0)

const numberSubtileFlagTypes = 8
for i := int32(0); i < numberSubtileFlagTypes; i++ {
subtileFlagList = append(subtileFlagList, subTileString(i))
}

if tile.Height < 0 {
tile.Height *= -1
}

const (
maxSubtileIndex = 7
spacerHeight = 4 // px
spacerHeight = 4 // px
)

return giu.Layout{
giu.SliderInt(&state.controls.SubtileFlag, 0, maxSubtileIndex).Label("Subtile Type"),
giu.Label(subTileString(state.controls.SubtileFlag)),
giu.Combo("", subtileFlagList[state.subtileFlag], subtileFlagList, &state.subtileFlag).Size(comboW).ID(
"##" + p.id + "SubtileList",
),
giu.Label("Edit:"),
giu.Custom(func() {
for y := 0; y < gridDivisionsXY; y++ {
layout := giu.Layout{}
for x := 0; x < gridDivisionsXY; x++ {
layout = append(layout,
giu.Checkbox("##"+strconv.Itoa(y*gridDivisionsXY+x),
p.getSubTileFieldToEdit(y+x*gridDivisionsXY),
),
)
}

giu.Row(layout...).Build()
}
}),
giu.Dummy(0, spacerHeight),
giu.Label("Preview:"),
p.makeSubTilePreview(tile, state),
giu.Dummy(gridMaxWidth, gridMaxHeight),
giu.Label("Click to Add/Remove flags"),
Expand Down

0 comments on commit 285e3ac

Please sign in to comment.