2019-11-10 08:51:02 -05:00
|
|
|
package d2ui
|
2019-10-25 18:40:27 -04:00
|
|
|
|
2019-10-25 22:20:36 -04:00
|
|
|
import (
|
2019-10-25 23:41:54 -04:00
|
|
|
"image"
|
2019-10-25 22:20:36 -04:00
|
|
|
|
2020-06-30 09:58:53 -04:00
|
|
|
"github.com/OpenDiablo2/OpenDiablo2/d2common/d2enum"
|
2020-06-29 00:41:58 -04:00
|
|
|
"github.com/OpenDiablo2/OpenDiablo2/d2common/d2interface"
|
2020-01-31 23:18:11 -05:00
|
|
|
"github.com/OpenDiablo2/OpenDiablo2/d2common/d2resource"
|
2020-09-12 16:25:09 -04:00
|
|
|
"github.com/OpenDiablo2/OpenDiablo2/d2common/d2util"
|
2019-10-25 22:20:36 -04:00
|
|
|
)
|
|
|
|
|
2019-10-25 23:41:54 -04:00
|
|
|
// ButtonType defines the type of button
|
|
|
|
type ButtonType int
|
|
|
|
|
2020-07-23 12:56:50 -04:00
|
|
|
// ButtonType constants
|
2019-10-25 23:41:54 -04:00
|
|
|
const (
|
2019-11-11 23:48:55 -05:00
|
|
|
ButtonTypeWide ButtonType = 1
|
|
|
|
ButtonTypeMedium ButtonType = 2
|
|
|
|
ButtonTypeNarrow ButtonType = 3
|
|
|
|
ButtonTypeCancel ButtonType = 4
|
|
|
|
ButtonTypeTall ButtonType = 5
|
|
|
|
ButtonTypeShort ButtonType = 6
|
|
|
|
ButtonTypeOkCancel ButtonType = 7
|
2019-10-25 23:41:54 -04:00
|
|
|
|
|
|
|
// Game UI
|
|
|
|
|
|
|
|
ButtonTypeSkill ButtonType = 7
|
|
|
|
ButtonTypeRun ButtonType = 8
|
|
|
|
ButtonTypeMenu ButtonType = 9
|
|
|
|
ButtonTypeGoldCoin ButtonType = 10
|
|
|
|
ButtonTypeClose ButtonType = 11
|
|
|
|
ButtonTypeSecondaryInvHand ButtonType = 12
|
|
|
|
ButtonTypeMinipanelCharacter ButtonType = 13
|
|
|
|
ButtonTypeMinipanelInventory ButtonType = 14
|
|
|
|
ButtonTypeMinipanelSkill ButtonType = 15
|
|
|
|
ButtonTypeMinipanelAutomap ButtonType = 16
|
|
|
|
ButtonTypeMinipanelMessage ButtonType = 17
|
|
|
|
ButtonTypeMinipanelQuest ButtonType = 18
|
|
|
|
ButtonTypeMinipanelMen ButtonType = 19
|
2020-09-20 02:54:24 -04:00
|
|
|
ButtonTypeSquareClose ButtonType = 20
|
2020-11-22 17:53:33 -05:00
|
|
|
ButtonTypeSquareOk ButtonType = 21
|
|
|
|
ButtonTypeSkillTreeTab ButtonType = 22
|
2020-12-07 13:54:17 -05:00
|
|
|
ButtonTypeQuestDescr ButtonType = 23
|
2020-12-02 02:19:15 -05:00
|
|
|
ButtonTypeMinipanelOpenClose ButtonType = 24
|
|
|
|
ButtonTypeMinipanelParty ButtonType = 25
|
|
|
|
ButtonTypeBuy ButtonType = 26
|
|
|
|
ButtonTypeSell ButtonType = 27
|
|
|
|
ButtonTypeRepair ButtonType = 28
|
|
|
|
ButtonTypeRepairAll ButtonType = 29
|
2020-12-12 04:39:26 -05:00
|
|
|
ButtonTypeUpArrow ButtonType = 30
|
|
|
|
ButtonTypeDownArrow ButtonType = 31
|
|
|
|
ButtonTypeLeftArrow ButtonType = 32
|
|
|
|
ButtonTypeRightArrow ButtonType = 33
|
|
|
|
ButtonTypeQuery ButtonType = 34
|
|
|
|
ButtonTypeSquelchChat ButtonType = 35
|
|
|
|
ButtonTypeTabBlank ButtonType = 36
|
|
|
|
ButtonTypeBlankQuestBtn ButtonType = 37
|
2020-12-15 05:32:34 -05:00
|
|
|
ButtonTypeAddSkill ButtonType = 38
|
2020-10-22 12:54:45 -04:00
|
|
|
|
2020-10-23 09:00:51 -04:00
|
|
|
ButtonNoFixedWidth int = -1
|
|
|
|
ButtonNoFixedHeight int = -1
|
2019-10-25 23:41:54 -04:00
|
|
|
)
|
|
|
|
|
2020-10-26 18:55:13 -04:00
|
|
|
const (
|
|
|
|
buttonStatePressed = iota + 1
|
|
|
|
buttonStateToggled
|
|
|
|
buttonStatePressedToggled
|
|
|
|
)
|
|
|
|
|
2020-10-22 10:02:32 -04:00
|
|
|
const (
|
2020-11-23 12:28:11 -05:00
|
|
|
buyButtonBaseFrame = 2 // base frame offset of the "buy" button dc6
|
|
|
|
sellButtonBaseFrame = 4 // base frame offset of the "sell" button dc6
|
|
|
|
repairButtonBaseFrame = 6 // base frame offset of the "repair" button dc6
|
|
|
|
queryButtonBaseFrame = 8 // base frame offset of the "query" button dc6
|
|
|
|
closeButtonBaseFrame = 10 // base frame offset of the "close" button dc6
|
|
|
|
leftArrowButtonBaseFrame = 12 // base frame offset of the "leftArrow" button dc6
|
|
|
|
rightArrowButtonBaseFrame = 14 // base frame offset of the "rightArrow" button dc6
|
|
|
|
okButtonBaseFrame = 16 // base frame offset of the "ok" button dc6
|
|
|
|
repairAllButtonBaseFrame = 18 // base frame offset of the "repair all" button dc6
|
|
|
|
squelchChatButtonBaseFrame = 20 // base frame offset of the "?" button dc6
|
2020-10-22 10:02:32 -04:00
|
|
|
)
|
|
|
|
|
2020-08-06 10:30:23 -04:00
|
|
|
const (
|
2020-09-20 02:54:24 -04:00
|
|
|
greyAlpha100 = 0x646464ff
|
|
|
|
lightGreyAlpha75 = 0x808080c3
|
2020-10-22 12:54:45 -04:00
|
|
|
whiteAlpha100 = 0xffffffff
|
2020-08-06 10:30:23 -04:00
|
|
|
)
|
|
|
|
|
2019-10-25 23:41:54 -04:00
|
|
|
// ButtonLayout defines the type of buttons
|
|
|
|
type ButtonLayout struct {
|
2020-07-23 12:56:50 -04:00
|
|
|
ResourceName string
|
|
|
|
PaletteName string
|
|
|
|
FontPath string
|
2020-10-25 19:50:13 -04:00
|
|
|
ClickableRect *image.Rectangle
|
2020-07-23 12:56:50 -04:00
|
|
|
XSegments int
|
|
|
|
YSegments int
|
|
|
|
BaseFrame int
|
|
|
|
DisabledFrame int
|
2020-11-16 04:41:01 -05:00
|
|
|
DisabledColor uint32
|
2020-07-23 12:56:50 -04:00
|
|
|
TextOffset int
|
2020-10-22 12:54:45 -04:00
|
|
|
FixedWidth int
|
|
|
|
FixedHeight int
|
|
|
|
LabelColor uint32
|
2020-10-25 19:50:13 -04:00
|
|
|
Toggleable bool
|
|
|
|
AllowFrameChange bool
|
|
|
|
HasImage bool
|
2020-11-16 04:41:01 -05:00
|
|
|
Tooltip int
|
|
|
|
TooltipXOffset int
|
|
|
|
TooltipYOffset int
|
2019-10-25 23:41:54 -04:00
|
|
|
}
|
|
|
|
|
2020-11-16 04:41:01 -05:00
|
|
|
const (
|
|
|
|
buttonTooltipNone int = iota
|
|
|
|
buttonTooltipClose
|
2020-11-22 17:53:33 -05:00
|
|
|
buttonTooltipOk
|
2020-11-23 09:35:10 -05:00
|
|
|
buttonTooltipBuy
|
|
|
|
buttonTooltipSell
|
|
|
|
buttonTooltipRepair
|
|
|
|
buttonTooltipRepairAll
|
|
|
|
buttonTooltipLeftArrow
|
|
|
|
buttonTooltipRightArrow
|
2020-11-23 11:43:24 -05:00
|
|
|
buttonTooltipQuery
|
2020-11-23 12:28:11 -05:00
|
|
|
buttonTooltipSquelchChat
|
2020-11-16 04:41:01 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
2020-11-23 09:35:10 -05:00
|
|
|
buttonBuySellTooltipXOffset = 15
|
|
|
|
buttonBuySellTooltipYOffset = -2
|
2020-11-16 04:41:01 -05:00
|
|
|
)
|
|
|
|
|
2020-08-06 10:30:23 -04:00
|
|
|
const (
|
|
|
|
buttonWideSegmentsX = 2
|
|
|
|
buttonWideSegmentsY = 1
|
|
|
|
buttonWideDisabledFrame = -1
|
|
|
|
buttonWideTextOffset = 1
|
|
|
|
|
|
|
|
buttonShortSegmentsX = 1
|
|
|
|
buttonShortSegmentsY = 1
|
|
|
|
buttonShortDisabledFrame = -1
|
|
|
|
buttonShortTextOffset = -1
|
|
|
|
|
|
|
|
buttonMediumSegmentsX = 1
|
|
|
|
buttonMediumSegmentsY = 1
|
|
|
|
|
|
|
|
buttonTallSegmentsX = 1
|
|
|
|
buttonTallSegmentsY = 1
|
|
|
|
buttonTallTextOffset = 5
|
|
|
|
|
2020-11-23 11:41:01 -05:00
|
|
|
buttonCancelSegmentsX = 1
|
|
|
|
buttonCancelSegmentsY = 1
|
|
|
|
buttonCancelTextOffset = 1
|
|
|
|
|
2020-08-06 10:30:23 -04:00
|
|
|
buttonOkCancelSegmentsX = 1
|
|
|
|
buttonOkCancelSegmentsY = 1
|
|
|
|
buttonOkCancelDisabledFrame = -1
|
|
|
|
|
2020-12-12 04:39:26 -05:00
|
|
|
buttonUpDownArrowSegmentsX = 1
|
|
|
|
buttonUpDownArrowSegmentsY = 1
|
|
|
|
buttonUpDownArrowDisabledFrame = -1
|
|
|
|
buttonUpArrowBaseFrame = 0
|
|
|
|
buttonDownArrowBaseFrame = 2
|
|
|
|
|
2020-09-20 02:54:24 -04:00
|
|
|
buttonBuySellSegmentsX = 1
|
|
|
|
buttonBuySellSegmentsY = 1
|
|
|
|
buttonBuySellDisabledFrame = 1
|
2020-09-15 23:37:08 -04:00
|
|
|
|
2020-11-16 04:41:01 -05:00
|
|
|
buttonSkillTreeTabXSegments = 1
|
|
|
|
buttonSkillTreeTabYSegments = 1
|
|
|
|
|
2020-10-23 09:00:51 -04:00
|
|
|
buttonSkillTreeTabDisabledFrame = 7
|
|
|
|
buttonSkillTreeTabBaseFrame = 7
|
|
|
|
buttonSkillTreeTabFixedWidth = 93
|
|
|
|
buttonSkillTreeTabFixedHeight = 107
|
|
|
|
|
2020-12-02 02:19:15 -05:00
|
|
|
buttonTabXSegments = 1
|
|
|
|
buttonTabYSegments = 1
|
|
|
|
|
2020-11-16 04:41:01 -05:00
|
|
|
buttonMinipanelOpenCloseBaseFrame = 0
|
|
|
|
buttonMinipanelXSegments = 1
|
|
|
|
buttonMinipanelYSegments = 1
|
|
|
|
|
2020-12-02 02:19:15 -05:00
|
|
|
blankQuestButtonXSegments = 1
|
|
|
|
blankQuestButtonYSegments = 1
|
2020-12-14 05:25:37 -05:00
|
|
|
blankQuestButtonDisabledFrames = 0
|
2020-12-02 02:19:15 -05:00
|
|
|
|
2020-11-16 04:41:01 -05:00
|
|
|
buttonMinipanelCharacterBaseFrame = 0
|
|
|
|
buttonMinipanelInventoryBaseFrame = 2
|
|
|
|
buttonMinipanelSkilltreeBaseFrame = 4
|
|
|
|
buttonMinipanelPartyBaseFrame = 6
|
|
|
|
buttonMinipanelAutomapBaseFrame = 8
|
|
|
|
buttonMinipanelMessageBaseFrame = 10
|
|
|
|
buttonMinipanelQuestBaseFrame = 12
|
|
|
|
buttonMinipanelMenBaseFrame = 14
|
|
|
|
|
2020-08-06 10:30:23 -04:00
|
|
|
buttonRunSegmentsX = 1
|
|
|
|
buttonRunSegmentsY = 1
|
|
|
|
buttonRunDisabledFrame = -1
|
|
|
|
|
2020-11-22 17:53:33 -05:00
|
|
|
buttonGoldCoinSegmentsX = 1
|
|
|
|
buttonGoldCoinSegmentsY = 1
|
|
|
|
buttonGoldCoinDisabledFrame = -1
|
|
|
|
|
2020-12-15 12:02:52 -05:00
|
|
|
buttonAddSkillSegmentsX = 1
|
|
|
|
buttonAddSkillSegmentsY = 1
|
|
|
|
buttonAddSkillDisabledFrame = 2
|
|
|
|
|
2020-08-06 10:30:23 -04:00
|
|
|
pressedButtonOffset = 2
|
|
|
|
)
|
|
|
|
|
2020-10-26 07:39:10 -04:00
|
|
|
// nolint:funlen // cant reduce
|
2020-07-23 12:56:50 -04:00
|
|
|
func getButtonLayouts() map[ButtonType]ButtonLayout {
|
|
|
|
return map[ButtonType]ButtonLayout{
|
|
|
|
ButtonTypeWide: {
|
2020-08-06 10:30:23 -04:00
|
|
|
XSegments: buttonWideSegmentsX,
|
|
|
|
YSegments: buttonWideSegmentsY,
|
|
|
|
DisabledFrame: buttonWideDisabledFrame,
|
2020-11-16 04:41:01 -05:00
|
|
|
DisabledColor: lightGreyAlpha75,
|
2020-08-06 10:30:23 -04:00
|
|
|
TextOffset: buttonWideTextOffset,
|
|
|
|
ResourceName: d2resource.WideButtonBlank,
|
|
|
|
PaletteName: d2resource.PaletteUnits,
|
|
|
|
FontPath: d2resource.FontExocet10,
|
|
|
|
AllowFrameChange: true,
|
2020-10-22 12:54:45 -04:00
|
|
|
HasImage: true,
|
|
|
|
FixedWidth: ButtonNoFixedWidth,
|
|
|
|
FixedHeight: ButtonNoFixedHeight,
|
|
|
|
LabelColor: greyAlpha100,
|
2020-08-06 10:30:23 -04:00
|
|
|
},
|
2020-11-23 11:41:01 -05:00
|
|
|
ButtonTypeCancel: {
|
|
|
|
XSegments: buttonCancelSegmentsX,
|
|
|
|
YSegments: buttonCancelSegmentsY,
|
|
|
|
DisabledFrame: 0,
|
|
|
|
DisabledColor: lightGreyAlpha75,
|
|
|
|
TextOffset: buttonCancelTextOffset,
|
|
|
|
ResourceName: d2resource.CancelButton,
|
|
|
|
PaletteName: d2resource.PaletteUnits,
|
|
|
|
FontPath: d2resource.FontExocet10,
|
|
|
|
AllowFrameChange: true,
|
|
|
|
HasImage: true,
|
|
|
|
FixedWidth: ButtonNoFixedWidth,
|
|
|
|
FixedHeight: ButtonNoFixedHeight,
|
|
|
|
LabelColor: greyAlpha100,
|
|
|
|
},
|
2020-07-23 12:56:50 -04:00
|
|
|
ButtonTypeShort: {
|
2020-08-06 10:30:23 -04:00
|
|
|
XSegments: buttonShortSegmentsX,
|
|
|
|
YSegments: buttonShortSegmentsY,
|
|
|
|
DisabledFrame: buttonShortDisabledFrame,
|
2020-11-16 04:41:01 -05:00
|
|
|
DisabledColor: lightGreyAlpha75,
|
2020-08-06 10:30:23 -04:00
|
|
|
TextOffset: buttonShortTextOffset,
|
|
|
|
ResourceName: d2resource.ShortButtonBlank,
|
|
|
|
PaletteName: d2resource.PaletteUnits,
|
|
|
|
FontPath: d2resource.FontRediculous,
|
|
|
|
AllowFrameChange: true,
|
2020-10-22 12:54:45 -04:00
|
|
|
HasImage: true,
|
|
|
|
FixedWidth: ButtonNoFixedWidth,
|
|
|
|
FixedHeight: ButtonNoFixedHeight,
|
|
|
|
LabelColor: greyAlpha100,
|
2020-08-06 10:30:23 -04:00
|
|
|
},
|
2020-07-23 12:56:50 -04:00
|
|
|
ButtonTypeMedium: {
|
2020-08-06 10:30:23 -04:00
|
|
|
XSegments: buttonMediumSegmentsX,
|
|
|
|
YSegments: buttonMediumSegmentsY,
|
2020-11-16 04:41:01 -05:00
|
|
|
DisabledColor: lightGreyAlpha75,
|
2020-08-06 10:30:23 -04:00
|
|
|
ResourceName: d2resource.MediumButtonBlank,
|
|
|
|
PaletteName: d2resource.PaletteUnits,
|
|
|
|
FontPath: d2resource.FontExocet10,
|
|
|
|
AllowFrameChange: true,
|
2020-10-22 12:54:45 -04:00
|
|
|
HasImage: true,
|
|
|
|
FixedWidth: ButtonNoFixedWidth,
|
|
|
|
FixedHeight: ButtonNoFixedHeight,
|
|
|
|
LabelColor: greyAlpha100,
|
2020-08-06 10:30:23 -04:00
|
|
|
},
|
2020-07-23 12:56:50 -04:00
|
|
|
ButtonTypeTall: {
|
2020-08-06 10:30:23 -04:00
|
|
|
XSegments: buttonTallSegmentsX,
|
|
|
|
YSegments: buttonTallSegmentsY,
|
|
|
|
TextOffset: buttonTallTextOffset,
|
2020-11-16 04:41:01 -05:00
|
|
|
DisabledColor: lightGreyAlpha75,
|
2020-08-06 10:30:23 -04:00
|
|
|
ResourceName: d2resource.TallButtonBlank,
|
|
|
|
PaletteName: d2resource.PaletteUnits,
|
|
|
|
FontPath: d2resource.FontExocet10,
|
|
|
|
AllowFrameChange: true,
|
2020-10-22 12:54:45 -04:00
|
|
|
HasImage: true,
|
|
|
|
FixedWidth: ButtonNoFixedWidth,
|
|
|
|
FixedHeight: ButtonNoFixedHeight,
|
|
|
|
LabelColor: greyAlpha100,
|
2020-08-06 10:30:23 -04:00
|
|
|
},
|
2020-07-23 12:56:50 -04:00
|
|
|
ButtonTypeOkCancel: {
|
2020-08-06 10:30:23 -04:00
|
|
|
XSegments: buttonOkCancelSegmentsX,
|
|
|
|
YSegments: buttonOkCancelSegmentsY,
|
|
|
|
DisabledFrame: buttonOkCancelDisabledFrame,
|
2020-11-16 04:41:01 -05:00
|
|
|
DisabledColor: lightGreyAlpha75,
|
2020-08-06 10:30:23 -04:00
|
|
|
ResourceName: d2resource.CancelButton,
|
|
|
|
PaletteName: d2resource.PaletteUnits,
|
|
|
|
FontPath: d2resource.FontRediculous,
|
|
|
|
AllowFrameChange: true,
|
2020-10-22 12:54:45 -04:00
|
|
|
HasImage: true,
|
|
|
|
FixedWidth: ButtonNoFixedWidth,
|
|
|
|
FixedHeight: ButtonNoFixedHeight,
|
|
|
|
LabelColor: greyAlpha100,
|
2020-08-06 10:30:23 -04:00
|
|
|
},
|
2020-07-23 12:56:50 -04:00
|
|
|
ButtonTypeRun: {
|
2020-08-06 10:30:23 -04:00
|
|
|
XSegments: buttonRunSegmentsX,
|
|
|
|
YSegments: buttonRunSegmentsY,
|
|
|
|
DisabledFrame: buttonRunDisabledFrame,
|
2020-11-16 04:41:01 -05:00
|
|
|
DisabledColor: lightGreyAlpha75,
|
2020-08-06 10:30:23 -04:00
|
|
|
ResourceName: d2resource.RunButton,
|
|
|
|
PaletteName: d2resource.PaletteSky,
|
|
|
|
Toggleable: true,
|
|
|
|
FontPath: d2resource.FontRediculous,
|
|
|
|
AllowFrameChange: true,
|
2020-10-22 12:54:45 -04:00
|
|
|
HasImage: true,
|
|
|
|
FixedWidth: ButtonNoFixedWidth,
|
|
|
|
FixedHeight: ButtonNoFixedHeight,
|
|
|
|
LabelColor: greyAlpha100,
|
2020-08-06 10:30:23 -04:00
|
|
|
},
|
2020-11-22 17:53:33 -05:00
|
|
|
ButtonTypeGoldCoin: {
|
|
|
|
XSegments: buttonGoldCoinSegmentsX,
|
|
|
|
YSegments: buttonGoldCoinSegmentsY,
|
|
|
|
DisabledFrame: buttonGoldCoinDisabledFrame,
|
|
|
|
DisabledColor: lightGreyAlpha75,
|
|
|
|
ResourceName: d2resource.GoldCoinButton,
|
|
|
|
PaletteName: d2resource.PaletteSky,
|
|
|
|
Toggleable: true,
|
|
|
|
FontPath: d2resource.FontRediculous,
|
|
|
|
AllowFrameChange: true,
|
|
|
|
HasImage: true,
|
|
|
|
FixedWidth: ButtonNoFixedWidth,
|
|
|
|
FixedHeight: ButtonNoFixedHeight,
|
|
|
|
LabelColor: greyAlpha100,
|
|
|
|
},
|
2020-09-20 02:54:24 -04:00
|
|
|
ButtonTypeSquareClose: {
|
|
|
|
XSegments: buttonBuySellSegmentsX,
|
|
|
|
YSegments: buttonBuySellSegmentsY,
|
|
|
|
DisabledFrame: buttonBuySellDisabledFrame,
|
2020-11-16 04:41:01 -05:00
|
|
|
DisabledColor: lightGreyAlpha75,
|
2020-09-20 02:54:24 -04:00
|
|
|
ResourceName: d2resource.BuySellButton,
|
|
|
|
PaletteName: d2resource.PaletteUnits,
|
|
|
|
Toggleable: true,
|
|
|
|
FontPath: d2resource.Font30,
|
2020-09-15 23:37:08 -04:00
|
|
|
AllowFrameChange: true,
|
2020-10-22 10:02:32 -04:00
|
|
|
BaseFrame: closeButtonBaseFrame,
|
2020-10-22 12:54:45 -04:00
|
|
|
HasImage: true,
|
|
|
|
FixedWidth: ButtonNoFixedWidth,
|
|
|
|
FixedHeight: ButtonNoFixedHeight,
|
|
|
|
LabelColor: greyAlpha100,
|
2020-11-16 04:41:01 -05:00
|
|
|
Tooltip: buttonTooltipClose,
|
2020-11-23 09:35:10 -05:00
|
|
|
TooltipXOffset: buttonBuySellTooltipXOffset,
|
|
|
|
TooltipYOffset: buttonBuySellTooltipYOffset,
|
2020-10-22 12:54:45 -04:00
|
|
|
},
|
2020-11-22 17:53:33 -05:00
|
|
|
ButtonTypeSquareOk: {
|
|
|
|
XSegments: buttonBuySellSegmentsX,
|
|
|
|
YSegments: buttonBuySellSegmentsY,
|
|
|
|
DisabledFrame: buttonBuySellDisabledFrame,
|
|
|
|
DisabledColor: lightGreyAlpha75,
|
|
|
|
ResourceName: d2resource.BuySellButton,
|
|
|
|
PaletteName: d2resource.PaletteUnits,
|
|
|
|
Toggleable: true,
|
|
|
|
FontPath: d2resource.Font30,
|
|
|
|
AllowFrameChange: true,
|
|
|
|
BaseFrame: okButtonBaseFrame,
|
|
|
|
HasImage: true,
|
|
|
|
FixedWidth: ButtonNoFixedWidth,
|
|
|
|
FixedHeight: ButtonNoFixedHeight,
|
|
|
|
LabelColor: greyAlpha100,
|
|
|
|
Tooltip: buttonTooltipOk,
|
2020-11-23 09:35:10 -05:00
|
|
|
TooltipXOffset: buttonBuySellTooltipXOffset,
|
|
|
|
TooltipYOffset: buttonBuySellTooltipYOffset,
|
|
|
|
},
|
|
|
|
ButtonTypeBuy: {
|
|
|
|
XSegments: buttonBuySellSegmentsX,
|
|
|
|
YSegments: buttonBuySellSegmentsY,
|
|
|
|
DisabledFrame: buttonBuySellDisabledFrame,
|
|
|
|
DisabledColor: lightGreyAlpha75,
|
|
|
|
ResourceName: d2resource.BuySellButton,
|
|
|
|
PaletteName: d2resource.PaletteUnits,
|
|
|
|
Toggleable: true,
|
|
|
|
FontPath: d2resource.Font30,
|
|
|
|
AllowFrameChange: true,
|
|
|
|
BaseFrame: buyButtonBaseFrame,
|
|
|
|
HasImage: true,
|
|
|
|
FixedWidth: ButtonNoFixedWidth,
|
|
|
|
FixedHeight: ButtonNoFixedHeight,
|
|
|
|
LabelColor: greyAlpha100,
|
|
|
|
Tooltip: buttonTooltipBuy,
|
|
|
|
TooltipXOffset: buttonBuySellTooltipXOffset,
|
|
|
|
TooltipYOffset: buttonBuySellTooltipYOffset,
|
|
|
|
},
|
|
|
|
ButtonTypeSell: {
|
|
|
|
XSegments: buttonBuySellSegmentsX,
|
|
|
|
YSegments: buttonBuySellSegmentsY,
|
|
|
|
DisabledFrame: buttonBuySellDisabledFrame,
|
|
|
|
DisabledColor: lightGreyAlpha75,
|
|
|
|
ResourceName: d2resource.BuySellButton,
|
|
|
|
PaletteName: d2resource.PaletteUnits,
|
|
|
|
Toggleable: true,
|
|
|
|
FontPath: d2resource.Font30,
|
|
|
|
AllowFrameChange: true,
|
|
|
|
BaseFrame: sellButtonBaseFrame,
|
|
|
|
HasImage: true,
|
|
|
|
FixedWidth: ButtonNoFixedWidth,
|
|
|
|
FixedHeight: ButtonNoFixedHeight,
|
|
|
|
LabelColor: greyAlpha100,
|
|
|
|
Tooltip: buttonTooltipSell,
|
|
|
|
TooltipXOffset: buttonBuySellTooltipXOffset,
|
|
|
|
TooltipYOffset: buttonBuySellTooltipYOffset,
|
|
|
|
},
|
|
|
|
ButtonTypeRepair: {
|
|
|
|
XSegments: buttonBuySellSegmentsX,
|
|
|
|
YSegments: buttonBuySellSegmentsY,
|
|
|
|
DisabledFrame: buttonBuySellDisabledFrame,
|
|
|
|
DisabledColor: lightGreyAlpha75,
|
|
|
|
ResourceName: d2resource.BuySellButton,
|
|
|
|
PaletteName: d2resource.PaletteUnits,
|
|
|
|
Toggleable: true,
|
|
|
|
FontPath: d2resource.Font30,
|
|
|
|
AllowFrameChange: true,
|
|
|
|
BaseFrame: repairButtonBaseFrame,
|
|
|
|
HasImage: true,
|
|
|
|
FixedWidth: ButtonNoFixedWidth,
|
|
|
|
FixedHeight: ButtonNoFixedHeight,
|
|
|
|
LabelColor: greyAlpha100,
|
|
|
|
Tooltip: buttonTooltipRepair,
|
|
|
|
TooltipXOffset: buttonBuySellTooltipXOffset,
|
|
|
|
TooltipYOffset: buttonBuySellTooltipYOffset,
|
|
|
|
},
|
|
|
|
ButtonTypeRepairAll: {
|
|
|
|
XSegments: buttonBuySellSegmentsX,
|
|
|
|
YSegments: buttonBuySellSegmentsY,
|
|
|
|
DisabledFrame: buttonBuySellDisabledFrame,
|
|
|
|
DisabledColor: lightGreyAlpha75,
|
|
|
|
ResourceName: d2resource.BuySellButton,
|
|
|
|
PaletteName: d2resource.PaletteUnits,
|
|
|
|
Toggleable: true,
|
|
|
|
FontPath: d2resource.Font30,
|
|
|
|
AllowFrameChange: true,
|
|
|
|
BaseFrame: repairAllButtonBaseFrame,
|
|
|
|
HasImage: true,
|
|
|
|
FixedWidth: ButtonNoFixedWidth,
|
|
|
|
FixedHeight: ButtonNoFixedHeight,
|
|
|
|
LabelColor: greyAlpha100,
|
|
|
|
Tooltip: buttonTooltipRepairAll,
|
|
|
|
TooltipXOffset: buttonBuySellTooltipXOffset,
|
|
|
|
TooltipYOffset: buttonBuySellTooltipYOffset,
|
|
|
|
},
|
2020-12-12 04:39:26 -05:00
|
|
|
ButtonTypeUpArrow: {
|
|
|
|
XSegments: buttonUpDownArrowSegmentsX,
|
|
|
|
YSegments: buttonUpDownArrowSegmentsY,
|
|
|
|
DisabledFrame: buttonUpDownArrowDisabledFrame,
|
|
|
|
DisabledColor: whiteAlpha100,
|
|
|
|
BaseFrame: buttonUpArrowBaseFrame,
|
|
|
|
ResourceName: d2resource.UpDownArrows,
|
|
|
|
PaletteName: d2resource.PaletteSky,
|
|
|
|
Toggleable: false,
|
|
|
|
FontPath: d2resource.Font16,
|
|
|
|
AllowFrameChange: true,
|
|
|
|
HasImage: true,
|
|
|
|
FixedWidth: ButtonNoFixedWidth,
|
|
|
|
FixedHeight: ButtonNoFixedHeight,
|
|
|
|
},
|
|
|
|
ButtonTypeDownArrow: {
|
|
|
|
XSegments: buttonUpDownArrowSegmentsX,
|
|
|
|
YSegments: buttonUpDownArrowSegmentsY,
|
|
|
|
DisabledFrame: buttonUpDownArrowDisabledFrame,
|
|
|
|
DisabledColor: whiteAlpha100,
|
|
|
|
BaseFrame: buttonDownArrowBaseFrame,
|
|
|
|
ResourceName: d2resource.UpDownArrows,
|
|
|
|
PaletteName: d2resource.PaletteSky,
|
|
|
|
Toggleable: false,
|
|
|
|
FontPath: d2resource.Font16,
|
|
|
|
AllowFrameChange: true,
|
|
|
|
HasImage: true,
|
|
|
|
FixedWidth: ButtonNoFixedWidth,
|
|
|
|
FixedHeight: ButtonNoFixedHeight,
|
|
|
|
},
|
2020-11-23 09:35:10 -05:00
|
|
|
ButtonTypeLeftArrow: {
|
|
|
|
XSegments: buttonBuySellSegmentsX,
|
|
|
|
YSegments: buttonBuySellSegmentsY,
|
|
|
|
DisabledFrame: buttonBuySellDisabledFrame,
|
|
|
|
DisabledColor: lightGreyAlpha75,
|
|
|
|
ResourceName: d2resource.BuySellButton,
|
|
|
|
PaletteName: d2resource.PaletteUnits,
|
|
|
|
Toggleable: true,
|
|
|
|
FontPath: d2resource.Font30,
|
|
|
|
AllowFrameChange: true,
|
|
|
|
BaseFrame: leftArrowButtonBaseFrame,
|
|
|
|
HasImage: true,
|
|
|
|
FixedWidth: ButtonNoFixedWidth,
|
|
|
|
FixedHeight: ButtonNoFixedHeight,
|
|
|
|
LabelColor: greyAlpha100,
|
|
|
|
Tooltip: buttonTooltipLeftArrow,
|
|
|
|
TooltipXOffset: buttonBuySellTooltipXOffset,
|
|
|
|
TooltipYOffset: buttonBuySellTooltipYOffset,
|
|
|
|
},
|
|
|
|
ButtonTypeRightArrow: {
|
|
|
|
XSegments: buttonBuySellSegmentsX,
|
|
|
|
YSegments: buttonBuySellSegmentsY,
|
|
|
|
DisabledFrame: buttonBuySellDisabledFrame,
|
|
|
|
DisabledColor: lightGreyAlpha75,
|
|
|
|
ResourceName: d2resource.BuySellButton,
|
|
|
|
PaletteName: d2resource.PaletteUnits,
|
|
|
|
Toggleable: true,
|
|
|
|
FontPath: d2resource.Font30,
|
|
|
|
AllowFrameChange: true,
|
|
|
|
BaseFrame: rightArrowButtonBaseFrame,
|
|
|
|
HasImage: true,
|
|
|
|
FixedWidth: ButtonNoFixedWidth,
|
|
|
|
FixedHeight: ButtonNoFixedHeight,
|
|
|
|
LabelColor: greyAlpha100,
|
|
|
|
Tooltip: buttonTooltipRightArrow,
|
|
|
|
TooltipXOffset: buttonBuySellTooltipXOffset,
|
|
|
|
TooltipYOffset: buttonBuySellTooltipYOffset,
|
|
|
|
},
|
2020-11-23 11:43:24 -05:00
|
|
|
ButtonTypeQuery: {
|
2020-11-23 09:35:10 -05:00
|
|
|
XSegments: buttonBuySellSegmentsX,
|
|
|
|
YSegments: buttonBuySellSegmentsY,
|
|
|
|
DisabledFrame: buttonBuySellDisabledFrame,
|
|
|
|
DisabledColor: lightGreyAlpha75,
|
|
|
|
ResourceName: d2resource.BuySellButton,
|
|
|
|
PaletteName: d2resource.PaletteUnits,
|
|
|
|
Toggleable: true,
|
|
|
|
FontPath: d2resource.Font30,
|
|
|
|
AllowFrameChange: true,
|
2020-11-23 11:43:24 -05:00
|
|
|
BaseFrame: queryButtonBaseFrame,
|
2020-11-23 09:35:10 -05:00
|
|
|
HasImage: true,
|
|
|
|
FixedWidth: ButtonNoFixedWidth,
|
|
|
|
FixedHeight: ButtonNoFixedHeight,
|
|
|
|
LabelColor: greyAlpha100,
|
2020-11-23 11:43:24 -05:00
|
|
|
Tooltip: buttonTooltipQuery,
|
2020-11-23 09:35:10 -05:00
|
|
|
TooltipXOffset: buttonBuySellTooltipXOffset,
|
|
|
|
TooltipYOffset: buttonBuySellTooltipYOffset,
|
2020-11-22 17:53:33 -05:00
|
|
|
},
|
2020-11-23 12:28:11 -05:00
|
|
|
ButtonTypeSquelchChat: {
|
|
|
|
XSegments: buttonBuySellSegmentsX,
|
|
|
|
YSegments: buttonBuySellSegmentsY,
|
|
|
|
DisabledFrame: buttonBuySellDisabledFrame,
|
|
|
|
DisabledColor: lightGreyAlpha75,
|
|
|
|
ResourceName: d2resource.BuySellButton,
|
|
|
|
PaletteName: d2resource.PaletteUnits,
|
|
|
|
Toggleable: true,
|
|
|
|
FontPath: d2resource.Font30,
|
|
|
|
AllowFrameChange: true,
|
|
|
|
BaseFrame: squelchChatButtonBaseFrame,
|
|
|
|
HasImage: true,
|
|
|
|
FixedWidth: ButtonNoFixedWidth,
|
|
|
|
FixedHeight: ButtonNoFixedHeight,
|
|
|
|
LabelColor: greyAlpha100,
|
|
|
|
Tooltip: buttonTooltipSquelchChat,
|
|
|
|
TooltipXOffset: buttonBuySellTooltipXOffset,
|
|
|
|
TooltipYOffset: buttonBuySellTooltipYOffset,
|
|
|
|
},
|
2020-12-02 02:19:15 -05:00
|
|
|
ButtonTypeQuestDescr: {
|
|
|
|
XSegments: buttonBuySellSegmentsX,
|
|
|
|
YSegments: buttonBuySellSegmentsY,
|
|
|
|
DisabledFrame: buttonBuySellDisabledFrame,
|
|
|
|
DisabledColor: lightGreyAlpha75,
|
|
|
|
ResourceName: d2resource.QuestLogQDescrBtn,
|
|
|
|
PaletteName: d2resource.PaletteUnits,
|
|
|
|
Toggleable: true,
|
|
|
|
FontPath: d2resource.Font30,
|
|
|
|
AllowFrameChange: true,
|
|
|
|
HasImage: true,
|
|
|
|
FixedWidth: ButtonNoFixedWidth,
|
|
|
|
FixedHeight: ButtonNoFixedHeight,
|
|
|
|
LabelColor: greyAlpha100,
|
|
|
|
},
|
|
|
|
ButtonTypeTabBlank: {
|
|
|
|
XSegments: buttonTabXSegments,
|
|
|
|
YSegments: buttonTabYSegments,
|
|
|
|
DisabledFrame: 0,
|
|
|
|
DisabledColor: lightGreyAlpha75,
|
|
|
|
ResourceName: d2resource.WPTabs,
|
|
|
|
PaletteName: d2resource.PaletteUnits,
|
|
|
|
Toggleable: true,
|
|
|
|
FontPath: d2resource.Font30,
|
|
|
|
AllowFrameChange: false,
|
|
|
|
HasImage: false,
|
|
|
|
FixedWidth: ButtonNoFixedWidth,
|
|
|
|
FixedHeight: ButtonNoFixedHeight,
|
|
|
|
LabelColor: greyAlpha100,
|
|
|
|
},
|
|
|
|
ButtonTypeBlankQuestBtn: {
|
|
|
|
XSegments: blankQuestButtonXSegments,
|
|
|
|
YSegments: blankQuestButtonYSegments,
|
|
|
|
DisabledFrame: blankQuestButtonDisabledFrames,
|
|
|
|
DisabledColor: lightGreyAlpha75,
|
|
|
|
ResourceName: d2resource.QuestLogDone,
|
|
|
|
PaletteName: d2resource.PaletteUnits,
|
|
|
|
Toggleable: true,
|
|
|
|
FontPath: d2resource.Font30,
|
|
|
|
AllowFrameChange: false,
|
|
|
|
HasImage: false,
|
|
|
|
FixedWidth: ButtonNoFixedWidth,
|
|
|
|
FixedHeight: ButtonNoFixedHeight,
|
|
|
|
LabelColor: greyAlpha100,
|
|
|
|
},
|
2020-10-22 12:54:45 -04:00
|
|
|
ButtonTypeSkillTreeTab: {
|
2020-10-23 09:00:51 -04:00
|
|
|
XSegments: buttonSkillTreeTabXSegments,
|
|
|
|
YSegments: buttonSkillTreeTabYSegments,
|
|
|
|
DisabledFrame: buttonSkillTreeTabDisabledFrame,
|
2020-11-16 04:41:01 -05:00
|
|
|
DisabledColor: lightGreyAlpha75,
|
2020-10-23 09:00:51 -04:00
|
|
|
BaseFrame: buttonSkillTreeTabBaseFrame,
|
2020-10-22 12:54:45 -04:00
|
|
|
ResourceName: d2resource.SkillsPanelAmazon,
|
|
|
|
PaletteName: d2resource.PaletteSky,
|
|
|
|
Toggleable: false,
|
|
|
|
FontPath: d2resource.Font16,
|
|
|
|
AllowFrameChange: false,
|
|
|
|
HasImage: false,
|
2020-10-23 09:00:51 -04:00
|
|
|
FixedWidth: buttonSkillTreeTabFixedWidth,
|
|
|
|
FixedHeight: buttonSkillTreeTabFixedHeight,
|
2020-10-22 12:54:45 -04:00
|
|
|
LabelColor: whiteAlpha100,
|
2020-09-15 23:37:08 -04:00
|
|
|
},
|
2020-11-16 04:41:01 -05:00
|
|
|
ButtonTypeMinipanelOpenClose: {
|
|
|
|
XSegments: buttonMinipanelXSegments,
|
|
|
|
YSegments: buttonMinipanelYSegments,
|
2020-11-21 05:35:32 -05:00
|
|
|
DisabledFrame: buttonMinipanelOpenCloseBaseFrame,
|
2020-11-16 04:41:01 -05:00
|
|
|
DisabledColor: whiteAlpha100,
|
|
|
|
BaseFrame: buttonMinipanelOpenCloseBaseFrame,
|
|
|
|
ResourceName: d2resource.MenuButton,
|
|
|
|
PaletteName: d2resource.PaletteSky,
|
|
|
|
Toggleable: true,
|
|
|
|
FontPath: d2resource.Font16,
|
|
|
|
AllowFrameChange: true,
|
|
|
|
HasImage: true,
|
|
|
|
FixedWidth: ButtonNoFixedWidth,
|
|
|
|
FixedHeight: ButtonNoFixedHeight,
|
|
|
|
LabelColor: whiteAlpha100,
|
|
|
|
},
|
|
|
|
ButtonTypeMinipanelCharacter: {
|
|
|
|
XSegments: buttonMinipanelXSegments,
|
|
|
|
YSegments: buttonMinipanelYSegments,
|
2020-11-21 05:35:32 -05:00
|
|
|
DisabledFrame: buttonMinipanelCharacterBaseFrame,
|
|
|
|
DisabledColor: whiteAlpha100,
|
2020-11-16 04:41:01 -05:00
|
|
|
BaseFrame: buttonMinipanelCharacterBaseFrame,
|
|
|
|
ResourceName: d2resource.MinipanelButton,
|
|
|
|
PaletteName: d2resource.PaletteSky,
|
|
|
|
Toggleable: false,
|
|
|
|
FontPath: d2resource.Font16,
|
|
|
|
AllowFrameChange: true,
|
|
|
|
HasImage: true,
|
|
|
|
FixedWidth: ButtonNoFixedWidth,
|
|
|
|
FixedHeight: ButtonNoFixedHeight,
|
|
|
|
LabelColor: whiteAlpha100,
|
|
|
|
},
|
|
|
|
ButtonTypeMinipanelInventory: {
|
|
|
|
XSegments: buttonMinipanelXSegments,
|
|
|
|
YSegments: buttonMinipanelYSegments,
|
2020-11-21 05:35:32 -05:00
|
|
|
DisabledFrame: buttonMinipanelInventoryBaseFrame,
|
|
|
|
DisabledColor: whiteAlpha100,
|
2020-11-16 04:41:01 -05:00
|
|
|
BaseFrame: buttonMinipanelInventoryBaseFrame,
|
|
|
|
ResourceName: d2resource.MinipanelButton,
|
|
|
|
PaletteName: d2resource.PaletteSky,
|
|
|
|
Toggleable: false,
|
|
|
|
FontPath: d2resource.Font16,
|
|
|
|
AllowFrameChange: true,
|
|
|
|
HasImage: true,
|
|
|
|
FixedWidth: ButtonNoFixedWidth,
|
|
|
|
FixedHeight: ButtonNoFixedHeight,
|
|
|
|
LabelColor: whiteAlpha100,
|
|
|
|
},
|
|
|
|
ButtonTypeMinipanelSkill: {
|
|
|
|
XSegments: buttonMinipanelXSegments,
|
|
|
|
YSegments: buttonMinipanelYSegments,
|
2020-11-21 05:35:32 -05:00
|
|
|
DisabledFrame: buttonMinipanelSkilltreeBaseFrame,
|
|
|
|
DisabledColor: whiteAlpha100,
|
2020-11-16 04:41:01 -05:00
|
|
|
BaseFrame: buttonMinipanelSkilltreeBaseFrame,
|
|
|
|
ResourceName: d2resource.MinipanelButton,
|
|
|
|
PaletteName: d2resource.PaletteSky,
|
|
|
|
Toggleable: false,
|
|
|
|
FontPath: d2resource.Font16,
|
|
|
|
AllowFrameChange: true,
|
|
|
|
HasImage: true,
|
|
|
|
FixedWidth: ButtonNoFixedWidth,
|
|
|
|
FixedHeight: ButtonNoFixedHeight,
|
|
|
|
LabelColor: whiteAlpha100,
|
|
|
|
},
|
|
|
|
ButtonTypeMinipanelParty: {
|
|
|
|
XSegments: buttonMinipanelXSegments,
|
|
|
|
YSegments: buttonMinipanelYSegments,
|
2020-11-21 05:35:32 -05:00
|
|
|
DisabledFrame: buttonMinipanelPartyBaseFrame,
|
|
|
|
DisabledColor: whiteAlpha100,
|
2020-11-16 04:41:01 -05:00
|
|
|
BaseFrame: buttonMinipanelPartyBaseFrame,
|
|
|
|
ResourceName: d2resource.MinipanelButton,
|
|
|
|
PaletteName: d2resource.PaletteSky,
|
|
|
|
Toggleable: false,
|
|
|
|
FontPath: d2resource.Font16,
|
|
|
|
AllowFrameChange: true,
|
|
|
|
HasImage: true,
|
|
|
|
FixedWidth: ButtonNoFixedWidth,
|
|
|
|
FixedHeight: ButtonNoFixedHeight,
|
|
|
|
LabelColor: whiteAlpha100,
|
|
|
|
},
|
|
|
|
ButtonTypeMinipanelAutomap: {
|
|
|
|
XSegments: buttonMinipanelXSegments,
|
|
|
|
YSegments: buttonMinipanelYSegments,
|
2020-11-21 05:35:32 -05:00
|
|
|
DisabledFrame: buttonMinipanelAutomapBaseFrame,
|
|
|
|
DisabledColor: whiteAlpha100,
|
2020-11-16 04:41:01 -05:00
|
|
|
BaseFrame: buttonMinipanelAutomapBaseFrame,
|
|
|
|
ResourceName: d2resource.MinipanelButton,
|
|
|
|
PaletteName: d2resource.PaletteSky,
|
|
|
|
Toggleable: false,
|
|
|
|
FontPath: d2resource.Font16,
|
|
|
|
AllowFrameChange: true,
|
|
|
|
HasImage: true,
|
|
|
|
FixedWidth: ButtonNoFixedWidth,
|
|
|
|
FixedHeight: ButtonNoFixedHeight,
|
|
|
|
LabelColor: whiteAlpha100,
|
|
|
|
},
|
|
|
|
ButtonTypeMinipanelMessage: {
|
|
|
|
XSegments: buttonMinipanelXSegments,
|
|
|
|
YSegments: buttonMinipanelYSegments,
|
2020-11-21 05:35:32 -05:00
|
|
|
DisabledFrame: buttonMinipanelMessageBaseFrame,
|
|
|
|
DisabledColor: whiteAlpha100,
|
2020-11-16 04:41:01 -05:00
|
|
|
BaseFrame: buttonMinipanelMessageBaseFrame,
|
|
|
|
ResourceName: d2resource.MinipanelButton,
|
|
|
|
PaletteName: d2resource.PaletteSky,
|
|
|
|
Toggleable: false,
|
|
|
|
FontPath: d2resource.Font16,
|
|
|
|
AllowFrameChange: true,
|
|
|
|
HasImage: true,
|
|
|
|
FixedWidth: ButtonNoFixedWidth,
|
|
|
|
FixedHeight: ButtonNoFixedHeight,
|
|
|
|
LabelColor: whiteAlpha100,
|
|
|
|
},
|
|
|
|
ButtonTypeMinipanelQuest: {
|
|
|
|
XSegments: buttonMinipanelXSegments,
|
|
|
|
YSegments: buttonMinipanelYSegments,
|
2020-11-21 05:35:32 -05:00
|
|
|
DisabledFrame: buttonMinipanelQuestBaseFrame,
|
|
|
|
DisabledColor: whiteAlpha100,
|
2020-11-16 04:41:01 -05:00
|
|
|
BaseFrame: buttonMinipanelQuestBaseFrame,
|
|
|
|
ResourceName: d2resource.MinipanelButton,
|
|
|
|
PaletteName: d2resource.PaletteSky,
|
|
|
|
Toggleable: false,
|
|
|
|
FontPath: d2resource.Font16,
|
|
|
|
AllowFrameChange: true,
|
|
|
|
HasImage: true,
|
|
|
|
FixedWidth: ButtonNoFixedWidth,
|
|
|
|
FixedHeight: ButtonNoFixedHeight,
|
|
|
|
LabelColor: whiteAlpha100,
|
|
|
|
},
|
|
|
|
ButtonTypeMinipanelMen: {
|
|
|
|
XSegments: buttonMinipanelXSegments,
|
|
|
|
YSegments: buttonMinipanelYSegments,
|
2020-11-21 05:35:32 -05:00
|
|
|
DisabledFrame: buttonMinipanelMenBaseFrame,
|
|
|
|
DisabledColor: whiteAlpha100,
|
2020-11-16 04:41:01 -05:00
|
|
|
BaseFrame: buttonMinipanelMenBaseFrame,
|
|
|
|
ResourceName: d2resource.MinipanelButton,
|
|
|
|
PaletteName: d2resource.PaletteSky,
|
|
|
|
Toggleable: false,
|
|
|
|
FontPath: d2resource.Font16,
|
|
|
|
AllowFrameChange: true,
|
|
|
|
HasImage: true,
|
|
|
|
FixedWidth: ButtonNoFixedWidth,
|
|
|
|
FixedHeight: ButtonNoFixedHeight,
|
|
|
|
LabelColor: whiteAlpha100,
|
|
|
|
},
|
2020-12-15 05:32:34 -05:00
|
|
|
ButtonTypeAddSkill: {
|
2020-12-15 12:02:52 -05:00
|
|
|
XSegments: buttonAddSkillSegmentsX,
|
|
|
|
YSegments: buttonAddSkillSegmentsY,
|
|
|
|
DisabledFrame: buttonAddSkillDisabledFrame,
|
2020-12-15 05:32:34 -05:00
|
|
|
DisabledColor: whiteAlpha100,
|
|
|
|
ResourceName: d2resource.AddSkillButton,
|
|
|
|
PaletteName: d2resource.PaletteSky,
|
|
|
|
Toggleable: true,
|
|
|
|
FontPath: d2resource.Font16,
|
|
|
|
AllowFrameChange: true,
|
|
|
|
HasImage: true,
|
|
|
|
FixedWidth: ButtonNoFixedWidth,
|
|
|
|
FixedHeight: ButtonNoFixedHeight,
|
|
|
|
},
|
2020-07-23 12:56:50 -04:00
|
|
|
}
|
2019-10-25 23:41:54 -04:00
|
|
|
}
|
|
|
|
|
2020-08-06 10:30:23 -04:00
|
|
|
var _ Widget = &Button{} // static check to ensure button implements widget
|
|
|
|
|
2019-10-25 22:20:36 -04:00
|
|
|
// Button defines a standard wide UI button
|
|
|
|
type Button struct {
|
2020-11-06 06:38:20 -05:00
|
|
|
*BaseWidget
|
2020-07-23 12:56:50 -04:00
|
|
|
buttonLayout ButtonLayout
|
2020-06-29 00:41:58 -04:00
|
|
|
normalSurface d2interface.Surface
|
|
|
|
pressedSurface d2interface.Surface
|
|
|
|
toggledSurface d2interface.Surface
|
|
|
|
pressedToggledSurface d2interface.Surface
|
|
|
|
disabledSurface d2interface.Surface
|
2020-01-31 23:18:11 -05:00
|
|
|
onClick func()
|
2020-07-23 12:56:50 -04:00
|
|
|
enabled bool
|
|
|
|
pressed bool
|
|
|
|
toggled bool
|
2020-11-16 04:41:01 -05:00
|
|
|
tooltip *Tooltip
|
2019-10-25 22:20:36 -04:00
|
|
|
}
|
|
|
|
|
2020-08-06 10:30:23 -04:00
|
|
|
// NewButton creates an instance of Button
|
|
|
|
func (ui *UIManager) NewButton(buttonType ButtonType, text string) *Button {
|
2020-11-06 06:38:20 -05:00
|
|
|
base := NewBaseWidget(ui)
|
|
|
|
base.SetVisible(true)
|
|
|
|
|
2020-08-06 10:30:23 -04:00
|
|
|
btn := &Button{
|
2020-11-06 06:38:20 -05:00
|
|
|
BaseWidget: base,
|
|
|
|
enabled: true,
|
|
|
|
pressed: false,
|
2019-10-25 22:20:36 -04:00
|
|
|
}
|
2020-08-02 21:26:07 -04:00
|
|
|
|
2020-08-06 10:30:23 -04:00
|
|
|
buttonLayout := getButtonLayouts()[buttonType]
|
|
|
|
btn.buttonLayout = buttonLayout
|
|
|
|
lbl := ui.NewLabel(buttonLayout.FontPath, d2resource.PaletteUnits)
|
2020-08-02 21:26:07 -04:00
|
|
|
|
2020-07-07 20:16:22 -04:00
|
|
|
lbl.SetText(text)
|
2020-10-22 12:54:45 -04:00
|
|
|
lbl.Color[0] = d2util.Color(buttonLayout.LabelColor)
|
2020-11-13 15:03:30 -05:00
|
|
|
lbl.Alignment = HorizontalAlignCenter
|
2019-11-10 03:36:53 -05:00
|
|
|
|
2020-09-23 13:30:54 -04:00
|
|
|
buttonSprite, err := ui.NewSprite(buttonLayout.ResourceName, buttonLayout.PaletteName)
|
|
|
|
if err != nil {
|
2020-11-21 05:33:22 -05:00
|
|
|
ui.Error(err.Error())
|
2020-09-23 13:30:54 -04:00
|
|
|
return nil
|
|
|
|
}
|
2020-10-25 19:50:13 -04:00
|
|
|
|
2020-10-22 12:54:45 -04:00
|
|
|
if buttonLayout.FixedWidth > 0 {
|
|
|
|
btn.width = buttonLayout.FixedWidth
|
|
|
|
} else {
|
2020-10-23 09:00:51 -04:00
|
|
|
for i := 0; i < buttonLayout.XSegments; i++ {
|
2020-10-25 19:50:13 -04:00
|
|
|
w, _, frameSizeErr := buttonSprite.GetFrameSize(i)
|
|
|
|
if frameSizeErr != nil {
|
2020-11-21 05:33:22 -05:00
|
|
|
ui.Error(frameSizeErr.Error())
|
2020-10-23 09:00:51 -04:00
|
|
|
return nil
|
|
|
|
}
|
2020-10-22 12:54:45 -04:00
|
|
|
|
2020-10-23 09:00:51 -04:00
|
|
|
btn.width += w
|
|
|
|
}
|
2019-10-25 23:41:54 -04:00
|
|
|
}
|
2020-07-23 12:56:50 -04:00
|
|
|
|
2020-10-22 12:54:45 -04:00
|
|
|
if buttonLayout.FixedHeight > 0 {
|
|
|
|
btn.height = buttonLayout.FixedHeight
|
|
|
|
} else {
|
|
|
|
for i := 0; i < buttonLayout.YSegments; i++ {
|
2020-10-25 19:50:13 -04:00
|
|
|
_, h, frameSizeErr := buttonSprite.GetFrameSize(i * buttonLayout.YSegments)
|
|
|
|
if frameSizeErr != nil {
|
2020-11-21 05:33:22 -05:00
|
|
|
ui.Error(frameSizeErr.Error())
|
2020-10-22 12:54:45 -04:00
|
|
|
return nil
|
|
|
|
}
|
2020-09-23 13:30:54 -04:00
|
|
|
|
2020-10-22 12:54:45 -04:00
|
|
|
btn.height += h
|
|
|
|
}
|
2019-10-25 23:41:54 -04:00
|
|
|
}
|
|
|
|
|
2020-10-28 14:17:42 -04:00
|
|
|
btn.normalSurface = ui.renderer.NewSurface(btn.width, btn.height)
|
2019-10-27 02:58:37 -04:00
|
|
|
|
2019-12-21 20:53:18 -05:00
|
|
|
buttonSprite.SetPosition(0, 0)
|
2020-07-08 21:57:35 -04:00
|
|
|
buttonSprite.SetEffect(d2enum.DrawEffectModulate)
|
2020-07-07 20:16:22 -04:00
|
|
|
|
2020-11-16 04:41:01 -05:00
|
|
|
btn.createTooltip()
|
|
|
|
|
2020-10-26 18:55:13 -04:00
|
|
|
ui.addWidget(btn) // important that this comes before prerenderStates!
|
2020-08-06 10:30:23 -04:00
|
|
|
|
2020-10-26 18:55:13 -04:00
|
|
|
btn.prerenderStates(buttonSprite, &buttonLayout, lbl)
|
2020-07-23 12:56:50 -04:00
|
|
|
|
2020-08-06 10:30:23 -04:00
|
|
|
return btn
|
2020-07-23 12:56:50 -04:00
|
|
|
}
|
|
|
|
|
2020-10-26 18:55:13 -04:00
|
|
|
type buttonStateDescriptor struct {
|
|
|
|
baseFrame int
|
|
|
|
offsetX, offsetY int
|
|
|
|
prerenderdestination *d2interface.Surface
|
|
|
|
fmtErr string
|
|
|
|
}
|
|
|
|
|
2020-11-16 04:41:01 -05:00
|
|
|
func (v *Button) createTooltip() {
|
|
|
|
var t *Tooltip
|
2020-11-23 09:35:10 -05:00
|
|
|
// this is also related with https://github.com/OpenDiablo2/OpenDiablo2/issues/944
|
|
|
|
// all strings starting with "#" could be wrong translated to another locales
|
2020-11-16 04:41:01 -05:00
|
|
|
switch v.buttonLayout.Tooltip {
|
|
|
|
case buttonTooltipNone:
|
|
|
|
return
|
|
|
|
case buttonTooltipClose:
|
|
|
|
t = v.manager.NewTooltip(d2resource.Font16, d2resource.PaletteSky, TooltipXCenter, TooltipYBottom)
|
|
|
|
t.SetText(v.manager.asset.TranslateString("strClose"))
|
2020-11-22 17:53:33 -05:00
|
|
|
case buttonTooltipOk:
|
|
|
|
t = v.manager.NewTooltip(d2resource.Font16, d2resource.PaletteSky, TooltipXCenter, TooltipYBottom)
|
2020-12-12 04:39:26 -05:00
|
|
|
t.SetText(v.manager.asset.TranslateLabel(d2enum.OKLabel))
|
2020-11-23 09:35:10 -05:00
|
|
|
case buttonTooltipBuy:
|
|
|
|
t = v.manager.NewTooltip(d2resource.Font16, d2resource.PaletteSky, TooltipXCenter, TooltipYBottom)
|
|
|
|
t.SetText(v.manager.asset.TranslateString("NPCPurchaseItems"))
|
|
|
|
case buttonTooltipSell:
|
|
|
|
t = v.manager.NewTooltip(d2resource.Font16, d2resource.PaletteSky, TooltipXCenter, TooltipYBottom)
|
|
|
|
t.SetText(v.manager.asset.TranslateString("NPCSellItems"))
|
|
|
|
case buttonTooltipRepair:
|
|
|
|
t = v.manager.NewTooltip(d2resource.Font16, d2resource.PaletteSky, TooltipXCenter, TooltipYBottom)
|
|
|
|
t.SetText(v.manager.asset.TranslateString("NPCRepairItems"))
|
|
|
|
case buttonTooltipRepairAll:
|
|
|
|
t = v.manager.NewTooltip(d2resource.Font16, d2resource.PaletteSky, TooltipXCenter, TooltipYBottom)
|
|
|
|
t.SetText(v.manager.asset.TranslateString("#128"))
|
|
|
|
case buttonTooltipLeftArrow:
|
|
|
|
t = v.manager.NewTooltip(d2resource.Font16, d2resource.PaletteSky, TooltipXCenter, TooltipYBottom)
|
|
|
|
t.SetText(v.manager.asset.TranslateString("KeyLeft"))
|
|
|
|
case buttonTooltipRightArrow:
|
|
|
|
t = v.manager.NewTooltip(d2resource.Font16, d2resource.PaletteSky, TooltipXCenter, TooltipYBottom)
|
|
|
|
t.SetText(v.manager.asset.TranslateString("KeyRight"))
|
2020-11-23 11:43:24 -05:00
|
|
|
case buttonTooltipQuery:
|
2020-11-23 09:35:10 -05:00
|
|
|
t = v.manager.NewTooltip(d2resource.Font16, d2resource.PaletteSky, TooltipXCenter, TooltipYBottom)
|
|
|
|
t.SetText(v.manager.asset.TranslateString("")) // need to be set up
|
2020-11-23 12:28:11 -05:00
|
|
|
case buttonTooltipSquelchChat:
|
|
|
|
t = v.manager.NewTooltip(d2resource.Font16, d2resource.PaletteSky, TooltipXCenter, TooltipYBottom)
|
|
|
|
t.SetText(v.manager.asset.TranslateString("strParty19")) // need to be verivied
|
2020-11-16 04:41:01 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
t.SetVisible(false)
|
|
|
|
v.SetTooltip(t)
|
|
|
|
}
|
|
|
|
|
2020-10-26 18:55:13 -04:00
|
|
|
func (v *Button) prerenderStates(btnSprite *Sprite, btnLayout *ButtonLayout, label *Label) {
|
|
|
|
numButtonStates := btnSprite.GetFrameCount() / (btnLayout.XSegments * btnLayout.YSegments)
|
2020-07-23 12:56:50 -04:00
|
|
|
|
2020-10-26 18:55:13 -04:00
|
|
|
// buttons always have a base image
|
2020-10-22 12:54:45 -04:00
|
|
|
if v.buttonLayout.HasImage {
|
2020-11-11 08:55:59 -05:00
|
|
|
btnSprite.RenderSegmented(v.normalSurface, btnLayout.XSegments,
|
2020-10-28 14:17:42 -04:00
|
|
|
btnLayout.YSegments, btnLayout.BaseFrame)
|
2020-07-23 12:56:50 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
_, labelHeight := label.GetSize()
|
2020-08-06 10:30:23 -04:00
|
|
|
textY := half(v.height - labelHeight)
|
|
|
|
xOffset := half(v.width)
|
2020-07-23 12:56:50 -04:00
|
|
|
|
|
|
|
label.SetPosition(xOffset, textY)
|
2020-11-11 09:01:36 -05:00
|
|
|
label.Render(v.normalSurface)
|
2020-07-23 12:56:50 -04:00
|
|
|
|
2020-12-14 05:25:37 -05:00
|
|
|
if !btnLayout.AllowFrameChange {
|
2020-10-26 18:55:13 -04:00
|
|
|
return
|
|
|
|
}
|
2020-08-06 10:30:23 -04:00
|
|
|
|
2020-10-26 18:55:13 -04:00
|
|
|
xSeg, ySeg, baseFrame := btnLayout.XSegments, btnLayout.YSegments, btnLayout.BaseFrame
|
2020-07-23 12:56:50 -04:00
|
|
|
|
2020-10-26 18:55:13 -04:00
|
|
|
buttonStateConfigs := make([]*buttonStateDescriptor, 0)
|
2020-07-07 20:16:22 -04:00
|
|
|
|
2020-10-26 18:55:13 -04:00
|
|
|
// pressed button
|
2020-10-28 14:17:42 -04:00
|
|
|
if numButtonStates > buttonStatePressed {
|
2020-10-26 18:55:13 -04:00
|
|
|
state := &buttonStateDescriptor{
|
|
|
|
baseFrame + buttonStatePressed,
|
|
|
|
xOffset - pressedButtonOffset, textY + pressedButtonOffset,
|
|
|
|
&v.pressedSurface,
|
|
|
|
"failed to render button pressedSurface, err: %v\n",
|
2019-10-25 23:41:54 -04:00
|
|
|
}
|
2020-07-23 12:56:50 -04:00
|
|
|
|
2020-10-26 18:55:13 -04:00
|
|
|
buttonStateConfigs = append(buttonStateConfigs, state)
|
|
|
|
}
|
2020-08-06 10:30:23 -04:00
|
|
|
|
2020-10-26 18:55:13 -04:00
|
|
|
// toggle button
|
2020-10-28 14:17:42 -04:00
|
|
|
if numButtonStates > buttonStateToggled {
|
2020-10-26 18:55:13 -04:00
|
|
|
buttonStateConfigs = append(buttonStateConfigs, &buttonStateDescriptor{
|
|
|
|
baseFrame + buttonStateToggled,
|
|
|
|
xOffset, textY,
|
|
|
|
&v.toggledSurface,
|
|
|
|
"failed to render button toggledSurface, err: %v\n",
|
|
|
|
})
|
|
|
|
}
|
2020-07-23 12:56:50 -04:00
|
|
|
|
2020-10-26 18:55:13 -04:00
|
|
|
// pressed+toggled
|
2020-10-28 14:17:42 -04:00
|
|
|
if numButtonStates > buttonStatePressedToggled {
|
2020-10-26 18:55:13 -04:00
|
|
|
buttonStateConfigs = append(buttonStateConfigs, &buttonStateDescriptor{
|
|
|
|
baseFrame + buttonStatePressedToggled,
|
|
|
|
xOffset, textY,
|
|
|
|
&v.pressedToggledSurface,
|
|
|
|
"failed to render button pressedToggledSurface, err: %v\n",
|
|
|
|
})
|
|
|
|
}
|
2020-07-07 20:16:22 -04:00
|
|
|
|
2020-10-26 18:55:13 -04:00
|
|
|
// disabled button
|
|
|
|
if btnLayout.DisabledFrame != -1 {
|
|
|
|
disabledState := &buttonStateDescriptor{
|
|
|
|
btnLayout.DisabledFrame,
|
|
|
|
xOffset, textY,
|
|
|
|
&v.disabledSurface,
|
|
|
|
"failed to render button disabledSurface, err: %v\n",
|
2019-10-25 23:41:54 -04:00
|
|
|
}
|
2020-07-23 12:56:50 -04:00
|
|
|
|
2020-10-26 18:55:13 -04:00
|
|
|
buttonStateConfigs = append(buttonStateConfigs, disabledState)
|
|
|
|
}
|
2020-07-23 12:56:50 -04:00
|
|
|
|
2020-10-26 18:55:13 -04:00
|
|
|
for stateIdx, w, h := 0, v.width, v.height; stateIdx < len(buttonStateConfigs); stateIdx++ {
|
|
|
|
state := buttonStateConfigs[stateIdx]
|
2020-07-07 20:16:22 -04:00
|
|
|
|
2020-10-28 14:17:42 -04:00
|
|
|
if stateIdx > 1 && btnLayout.ResourceName == d2resource.BuySellButton {
|
2020-10-26 18:55:13 -04:00
|
|
|
// Without returning early, the button UI gets all subsequent (unrelated) frames
|
|
|
|
// stacked on top. Only 2 frames from this sprite are applicable to the button
|
|
|
|
// in question. The presentation is incorrect without this hack!
|
|
|
|
continue
|
2019-10-25 23:41:54 -04:00
|
|
|
}
|
2020-07-23 12:56:50 -04:00
|
|
|
|
2020-10-28 14:17:42 -04:00
|
|
|
surface := v.manager.renderer.NewSurface(w, h)
|
2020-07-07 20:16:22 -04:00
|
|
|
|
2020-10-26 18:55:13 -04:00
|
|
|
*state.prerenderdestination = surface
|
2020-07-23 12:56:50 -04:00
|
|
|
|
2020-11-11 08:55:59 -05:00
|
|
|
btnSprite.RenderSegmented(*state.prerenderdestination, xSeg, ySeg, state.baseFrame)
|
2020-10-26 18:55:13 -04:00
|
|
|
|
|
|
|
label.SetPosition(state.offsetX, state.offsetY)
|
2020-11-11 09:01:36 -05:00
|
|
|
label.Render(*state.prerenderdestination)
|
2019-10-25 23:41:54 -04:00
|
|
|
}
|
2019-10-25 22:20:36 -04:00
|
|
|
}
|
|
|
|
|
2019-10-25 23:41:54 -04:00
|
|
|
// OnActivated defines the callback handler for the activate event
|
|
|
|
func (v *Button) OnActivated(callback func()) {
|
|
|
|
v.onClick = callback
|
|
|
|
}
|
|
|
|
|
|
|
|
// Activate calls the on activated callback handler, if any
|
2019-11-11 23:48:55 -05:00
|
|
|
func (v *Button) Activate() {
|
2019-10-25 23:41:54 -04:00
|
|
|
if v.onClick == nil {
|
|
|
|
return
|
|
|
|
}
|
2020-07-23 12:56:50 -04:00
|
|
|
|
2019-10-25 23:41:54 -04:00
|
|
|
v.onClick()
|
|
|
|
}
|
|
|
|
|
2019-12-21 20:53:18 -05:00
|
|
|
// Render renders the button
|
2020-11-11 08:55:59 -05:00
|
|
|
func (v *Button) Render(target d2interface.Surface) {
|
2020-07-06 21:26:08 -04:00
|
|
|
target.PushFilter(d2enum.FilterNearest)
|
2020-08-06 10:30:23 -04:00
|
|
|
defer target.Pop()
|
2020-07-23 12:56:50 -04:00
|
|
|
|
2020-08-06 10:30:23 -04:00
|
|
|
target.PushTranslation(v.x, v.y)
|
|
|
|
defer target.Pop()
|
2019-10-25 23:41:54 -04:00
|
|
|
|
2020-07-23 12:56:50 -04:00
|
|
|
switch {
|
|
|
|
case !v.enabled:
|
2020-11-16 04:41:01 -05:00
|
|
|
target.PushColor(d2util.Color(v.buttonLayout.DisabledColor))
|
2019-12-28 16:46:08 -05:00
|
|
|
defer target.Pop()
|
2020-11-21 05:35:32 -05:00
|
|
|
|
|
|
|
if v.toggled {
|
|
|
|
target.Render(v.toggledSurface)
|
2020-12-14 07:45:06 -05:00
|
|
|
} else if v.buttonLayout.HasImage { // it allows to use SetEnabled(false) for non-image budons
|
|
|
|
target.Render(v.disabledSurface)
|
2020-11-21 05:35:32 -05:00
|
|
|
}
|
2020-07-23 12:56:50 -04:00
|
|
|
case v.toggled && v.pressed:
|
2020-10-28 14:17:42 -04:00
|
|
|
target.Render(v.pressedToggledSurface)
|
2020-07-23 12:56:50 -04:00
|
|
|
case v.pressed:
|
2020-10-22 12:54:45 -04:00
|
|
|
if v.buttonLayout.AllowFrameChange {
|
2020-10-28 14:17:42 -04:00
|
|
|
target.Render(v.pressedSurface)
|
2020-10-22 12:54:45 -04:00
|
|
|
} else {
|
2020-10-28 14:17:42 -04:00
|
|
|
target.Render(v.normalSurface)
|
2020-10-22 12:54:45 -04:00
|
|
|
}
|
2020-07-23 12:56:50 -04:00
|
|
|
case v.toggled:
|
2020-10-28 14:17:42 -04:00
|
|
|
target.Render(v.toggledSurface)
|
2020-07-23 12:56:50 -04:00
|
|
|
default:
|
2020-10-28 14:17:42 -04:00
|
|
|
target.Render(v.normalSurface)
|
2019-10-25 22:20:36 -04:00
|
|
|
}
|
|
|
|
}
|
2020-06-24 15:23:38 -04:00
|
|
|
|
2020-07-23 12:56:50 -04:00
|
|
|
// Toggle negates the toggled state of the button
|
2020-06-24 15:23:38 -04:00
|
|
|
func (v *Button) Toggle() {
|
|
|
|
v.toggled = !v.toggled
|
|
|
|
}
|
2019-10-25 22:20:36 -04:00
|
|
|
|
2020-11-21 05:35:32 -05:00
|
|
|
// GetToggled returns the toggled state of the button
|
|
|
|
func (v *Button) GetToggled() bool {
|
|
|
|
return v.toggled
|
|
|
|
}
|
|
|
|
|
2020-07-23 12:56:50 -04:00
|
|
|
// Advance advances the button state
|
2020-08-06 10:30:23 -04:00
|
|
|
func (v *Button) Advance(_ float64) error {
|
|
|
|
return nil
|
2019-12-28 23:32:24 -05:00
|
|
|
}
|
|
|
|
|
2019-10-25 22:20:36 -04:00
|
|
|
// GetEnabled returns the enabled state
|
2019-12-28 23:32:24 -05:00
|
|
|
func (v *Button) GetEnabled() bool {
|
2019-10-25 22:20:36 -04:00
|
|
|
return v.enabled
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetEnabled sets the enabled state
|
|
|
|
func (v *Button) SetEnabled(enabled bool) {
|
|
|
|
v.enabled = enabled
|
|
|
|
}
|
|
|
|
|
2019-10-25 23:41:54 -04:00
|
|
|
// GetPressed returns the pressed state of the button
|
2019-12-28 23:32:24 -05:00
|
|
|
func (v *Button) GetPressed() bool {
|
2019-10-25 23:41:54 -04:00
|
|
|
return v.pressed
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetPressed sets the pressed state of the button
|
|
|
|
func (v *Button) SetPressed(pressed bool) {
|
|
|
|
v.pressed = pressed
|
|
|
|
}
|
2020-08-06 10:30:23 -04:00
|
|
|
|
2020-11-16 04:41:01 -05:00
|
|
|
// SetVisible sets the pressed state of the button
|
|
|
|
func (v *Button) SetVisible(visible bool) {
|
|
|
|
v.BaseWidget.SetVisible(visible)
|
|
|
|
|
|
|
|
if v.isHovered() && !visible {
|
|
|
|
v.hoverEnd()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetPosition sets the position of the widget
|
|
|
|
func (v *Button) SetPosition(x, y int) {
|
|
|
|
v.BaseWidget.SetPosition(x, y)
|
|
|
|
|
|
|
|
if v.buttonLayout.Tooltip != buttonTooltipNone {
|
|
|
|
v.tooltip.SetPosition(x+v.buttonLayout.TooltipXOffset, y+v.buttonLayout.TooltipYOffset)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetTooltip adds a tooltip to the button
|
|
|
|
func (v *Button) SetTooltip(t *Tooltip) {
|
|
|
|
v.tooltip = t
|
2020-11-21 05:35:32 -05:00
|
|
|
v.OnHoverStart(func() { v.tooltip.SetVisible(true) })
|
2020-11-16 04:41:01 -05:00
|
|
|
v.OnHoverEnd(func() { v.tooltip.SetVisible(false) })
|
|
|
|
}
|
|
|
|
|
2020-08-06 10:30:23 -04:00
|
|
|
func half(n int) int {
|
|
|
|
return n / 2
|
|
|
|
}
|