Sun Sep 05, 2021 1:39 am
Sun Sep 05, 2021 2:54 am
Sun Sep 05, 2021 3:05 am
Sun Sep 05, 2021 3:10 am
Sun Sep 05, 2021 3:25 am
Sun Sep 05, 2021 4:21 am
Jarewill wrote:I have encountered the same issue and the reason to it is that the version 1.0 of ZForms is broken with the current GZDoom.
If you want to use ZForms, you have to download the newest master here.
However all the code provided in the ZFormsExamples is valid and works with the newest master of ZForms, so it's still a good source of learning how to use it.
Another source of information that helped me a ton is the documentation.
Sun Sep 05, 2021 4:26 am
Sun Sep 05, 2021 6:16 am
class soaMenuHandler : soa_ZF_Handler {
soaMenu link;
override void buttonClickCommand(soa_ZF_Button caller, string command) {
if ( command == "soaButton01" ) {
//button action here
link.soaLabel.setTextColor = random [textColor] (Font.CR_BRICK, Font.CR_TEAL);
}
}
}
class soaMenu : soa_ZF_GenericMenu {
soaMenuHandler handler;
Font smallfont;
soa_ZF_Image background;
soa_ZF_Button soaButton01;
soa_ZF_Label soaLabel;
override void Init (Menu parent) {
Vector2 baseRes = (320, 200);
Super.Init(parent);
SetBaseResolution(baseRes);
smallfont = OptionFont();
handler = new("soaMenuHandler");
handler.link = self;
background = soa_ZF_Image.Create (
(0, 0),//position
(320, 200), //size
"graphics/soaMenu/Panel.png",//image path/name
soa_ZF_Image.AlignType_TopLeft
);
background.Pack(mainFrame);
// Create the box image's textures.
let boxTexture = soa_ZF_BoxTextures.CreateTexturePixels (
"graphics/soaMenu/BoxTexture.png",//the texture itself
(32, 32), //top-left corner of the middle of the box
(64, 64), //bottom-right corner of the middle of the box
false, //scale-true, tile-false the sides
false //scale-true, tile-false the middle
);
//add a box image
let boxSize = (128, 128);
let aBoxImage = soa_ZF_BoxImage.Create (
((baseRes.X - boxSize.X) / 2.0, (baseRes.Y - boxSize.Y) / 2.0), //position
boxSize, //size
boxTexture, //texture
(0.25, 0.25) //scale
);
aBoxImage.Pack(mainFrame);
//create the button's textures
let buttonIdle = soa_ZF_BoxTextures.CreateSingleTexture("graphics/soaMenu/SmallButtonIdle.png", true);
let buttonHover = soa_ZF_BoxTextures.CreateSingleTexture("graphics/soaMenu/SmallButtonHovered.png", false);
let buttonClick = soa_ZF_BoxTextures.CreateSingleTexture("graphics/soaMenu/SmallButtonClicked.png", false);
//add a button
soaButton01 = soa_ZF_Button.Create (
((baseRes.X - 18.0) / 2.0, (baseRes.Y - 18.0) / 2.0),//position
(18, 18), //size
cmdHandler : handler, //command handler
command : "soaButton01", //command string for button
inactive: buttonIdle,
hover: buttonHover,
click: buttonClick
);
soaButton01.Pack(mainFrame);
//add a label
soaLabel = soa_ZF_Label.Create(
(0, soaButton01.box.pos.Y + soaButton01.box.size.Y + 4), //position //<<<Getting error here, saying the protected member 'box' cannot be accessed. I don't know how to change this, since I cant figure out where the box is defined...
(0, smallFont.GetHeight()),
text: "Click me!", //label's text
fnt: smallFont, //font to use
wrap: false, //auto text wrap
autoSize: true, //auto resize elements
textColor: Font.CR_WHITE //text color
);
// Calculate the horizontal position for the label so that it's centered on the screen.
soaLabel.box.pos.X = baseRes.x - smallFont/stringWidth(soaLabel.text) / 2.0; //<<<Also, Getting error here, saying the protected member 'box' cannot be accessed. I don't know how to change this, since I cant figure out where the box is defined...
//add element ot mainframe
soaLabel.Pack(mainFrame);
}
}
Sun Sep 05, 2021 8:09 am
Sun Sep 05, 2021 9:09 am
Sun Sep 05, 2021 9:53 am
Sun Sep 05, 2021 9:58 am
Nash wrote:No, I actually didn't "fix" anything in the ZForms of my PDA Starter Kit. I was using just whatever stock release that was available at the time. Unfortunately I don't remember if it was a "stable" release or not.
Sun Sep 05, 2021 10:26 am
Sun Sep 05, 2021 2:28 pm
Sun Sep 05, 2021 2:43 pm
phantombeta wrote:The PDA starter kit is probably not using any tiling textures, nor box/multi-textures. It's also using a version of ZForms from before single-texture button rendering and API was unified with box/multi-textures, so that doesn't use Shape2D either.
Also, this crash has been fixed in GZDoom itself, as far as I know, it's just not in a stable release yet.