-
Notifications
You must be signed in to change notification settings - Fork 84
Description
The original code sets the x and y values to 320 and 490 respectively in the constructor of the D2Panel for creating characters dynamically, which includes the widgets NameEntry, ExpansionCheckBox and HardcoreCheckBox.
When AddWidget is called for those widgets listed above the following lines do not produce the expected behavior for the relative position of the widgets in conjunction with the code responsible for drawing a TextEntry as well as the CheckBox widget.
In AddWidget we have:
pWidget->x += x; pWidget->y += y;
If the owners position x value is set to 320, and current pWidget x position is set to 0 then pWidgets position would be 320 still which is all good, but if you look in the Draw() method of the D2Widget_TextEntry::Draw we have the following code:
engine->R_DrawText(cl.font16, szLabel, m_pOwner->x + x, m_pOwner->y + y - 15, w, 10, ALIGN_LEFT, ALIGN_BOTTOM);
As you can see it takes the owners position, in this case the 320 and adds it to widgets 320 x position and this will go off the screen and not render anything.
Possible solution, quick and dirty is to remove the x and y value assignments in the D2 dynamic Panel creation, and add the position values to the widget x y coordinates directly, or fix the actual relative position calculations in the widget draw call.
I believe all the other widgets just hardcode the relative position so none of those have these issues.