GMS3 中图形斜面按钮应该如何部署?
How should one deploy graphic bevel buttons in GMS3?
这可能最终会变成一个错误报告,但由于我在 GMS3 中找到了一个类似的对话框图形问题的解决方法,我希望可能有一种方法可以让斜角按钮也能正确显示。以下示例脚本演示了该问题:
class ModelessDialogWithBevelButton : UIFrame
{
Object Init(Object self)
{
TagGroup dialogSpec = DLGCreateDialog("");
TagGroup dialogItems = dialogSpec.DLGGetItems();
Number size = 100;
Number factor = 4 * Pi() / size;
Image graphicImage := RGBImage("Graphic", 4, size, size);
graphicImage = RGB(255 * Sin(factor * iradius) ** 2, 255 * Cos(factor * iradius) ** 2, 0);
// Add labeled box with graphic
Number scaler = 1;
TagGroup graphicBoxSpec = DLGCreateBox("Graphic");
TagGroup graphicBoxItems = graphicBoxSpec.DLGGetItems();
TagGroup graphicSpec = DLGCreateGraphic(scaler * size, scaler * size);
graphicSpec.DLGAddBitMap(graphicImage);
graphicBoxItems.DLGAddElement(graphicSpec);
dialogItems.DLGAddElement(graphicBoxSpec, "Left", "West");
// Add labeled box with bevel button
TagGroup buttonBoxSpec = DLGCreateBox("Bevel Button");
TagGroup buttonBoxItems = buttonBoxSpec.DLGGetItems();
TagGroup buttonSpec = DLGCreateBevelButton(graphicImage, graphicImage, "DoButton");
buttonBoxItems.DLGAddElement(buttonSpec);
dialogItems.DLGAddElement(buttonBoxSpec, "Left", "West");
return self.super.Init(dialogSpec);
}
void DoButton(Object self)
{
OKDialog("Button clicked");
}
}
void main()
{
Object dialog = Alloc(ModelessDialogWithBevelButton).Init();
dialog.Display("Bevel Button Test");
}
main();
虽然图形元素的位图仅填充指定图形区域的左上四分之一,但斜角按钮位图最终仅填充斜角按钮区域的中央四分之一。在图形的情况下,我们可以通过将 scaler 变量设置为 0.5 来解决这种不匹配(至少在最新的 Win10 下的 GMS 3.4 运行ning 中)。但是,我还没有找到任何方法来缩小斜角按钮图形区域以匹配其位图。有其他人 运行 解决这个问题并找到解决方案吗?
这确实是与
相同问题的不同表现形式
但是,就修复而言,您可以使用带负值的命令DLGExternalPadding
来"shrink"斜角按钮。但是,此解决方案在 Windows10 的 dpi 设置方面与其他解决方案一样不稳定。
这可能最终会变成一个错误报告,但由于我在 GMS3 中找到了一个类似的对话框图形问题的解决方法,我希望可能有一种方法可以让斜角按钮也能正确显示。以下示例脚本演示了该问题:
class ModelessDialogWithBevelButton : UIFrame
{
Object Init(Object self)
{
TagGroup dialogSpec = DLGCreateDialog("");
TagGroup dialogItems = dialogSpec.DLGGetItems();
Number size = 100;
Number factor = 4 * Pi() / size;
Image graphicImage := RGBImage("Graphic", 4, size, size);
graphicImage = RGB(255 * Sin(factor * iradius) ** 2, 255 * Cos(factor * iradius) ** 2, 0);
// Add labeled box with graphic
Number scaler = 1;
TagGroup graphicBoxSpec = DLGCreateBox("Graphic");
TagGroup graphicBoxItems = graphicBoxSpec.DLGGetItems();
TagGroup graphicSpec = DLGCreateGraphic(scaler * size, scaler * size);
graphicSpec.DLGAddBitMap(graphicImage);
graphicBoxItems.DLGAddElement(graphicSpec);
dialogItems.DLGAddElement(graphicBoxSpec, "Left", "West");
// Add labeled box with bevel button
TagGroup buttonBoxSpec = DLGCreateBox("Bevel Button");
TagGroup buttonBoxItems = buttonBoxSpec.DLGGetItems();
TagGroup buttonSpec = DLGCreateBevelButton(graphicImage, graphicImage, "DoButton");
buttonBoxItems.DLGAddElement(buttonSpec);
dialogItems.DLGAddElement(buttonBoxSpec, "Left", "West");
return self.super.Init(dialogSpec);
}
void DoButton(Object self)
{
OKDialog("Button clicked");
}
}
void main()
{
Object dialog = Alloc(ModelessDialogWithBevelButton).Init();
dialog.Display("Bevel Button Test");
}
main();
虽然图形元素的位图仅填充指定图形区域的左上四分之一,但斜角按钮位图最终仅填充斜角按钮区域的中央四分之一。在图形的情况下,我们可以通过将 scaler 变量设置为 0.5 来解决这种不匹配(至少在最新的 Win10 下的 GMS 3.4 运行ning 中)。但是,我还没有找到任何方法来缩小斜角按钮图形区域以匹配其位图。有其他人 运行 解决这个问题并找到解决方案吗?
这确实是与
相同问题的不同表现形式但是,就修复而言,您可以使用带负值的命令DLGExternalPadding
来"shrink"斜角按钮。但是,此解决方案在 Windows10 的 dpi 设置方面与其他解决方案一样不稳定。