mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-30 00:32:57 -04:00
stuff
This commit is contained in:
parent
dca70e1741
commit
d50576e488
@ -26,3 +26,12 @@ ConfigureFn(config_gui) {
|
||||
GuiButton::init_type();
|
||||
GuiFrame::init_type();
|
||||
}
|
||||
|
||||
float simple_text_margin_top =
|
||||
config_gui.GetFloat("simple-text-margin-top", 0.02);
|
||||
float simple_text_margin_bottom =
|
||||
config_gui.GetFloat("simple-text-margin-bottom", 0.05);
|
||||
float simple_text_margin_left =
|
||||
config_gui.GetFloat("simple-text-margin-left", 0.02);
|
||||
float simple_text_margin_right =
|
||||
config_gui.GetFloat("simple-text-margin-right", 0.02);
|
||||
|
@ -11,4 +11,9 @@
|
||||
|
||||
NotifyCategoryDecl(gui, EXPCL_PANDA, EXPTP_PANDA);
|
||||
|
||||
extern float simple_text_margin_top;
|
||||
extern float simple_text_margin_bottom;
|
||||
extern float simple_text_margin_left;
|
||||
extern float simple_text_margin_right;
|
||||
|
||||
#endif /* __CONFIG_GUI_H__ */
|
||||
|
@ -41,11 +41,17 @@ void GuiLabel::set_properties(void) {
|
||||
{
|
||||
TextNode* n = DCAST(TextNode, _geom);
|
||||
n->set_text_color(_foreground);
|
||||
if (!_have_background) {
|
||||
n->clear_card();
|
||||
} else {
|
||||
n->set_card_color(_background);
|
||||
n->clear_card();
|
||||
if ((_have_background) || (_tex == (Texture*)0L)) {
|
||||
if (_have_background)
|
||||
n->set_card_color(_background);
|
||||
if (_tex != (Texture*)0L)
|
||||
n->set_card_texture(_tex);
|
||||
if (_have_width || _have_height) {
|
||||
n->set_card_as_margin(simple_text_margin_left,
|
||||
simple_text_margin_right,
|
||||
simple_text_margin_bottom,
|
||||
simple_text_margin_top);
|
||||
LVecBase4f v = n->get_card_actual();
|
||||
float w = v[1] - v[0];
|
||||
float h = v[3] - v[2];
|
||||
@ -54,16 +60,25 @@ void GuiLabel::set_properties(void) {
|
||||
w *= 0.5;
|
||||
v[1] += w;
|
||||
v[0] -= w;
|
||||
} else {
|
||||
v[0] -= simple_text_margin_left;
|
||||
v[1] += simple_text_margin_right;
|
||||
}
|
||||
if (_have_height) {
|
||||
h = _height - h;
|
||||
h *= 0.5;
|
||||
v[3] += h;
|
||||
v[2] -= h;
|
||||
} else {
|
||||
v[2] -= simple_text_margin_bottom;
|
||||
v[3] += simple_text_margin_top;
|
||||
}
|
||||
n->set_card_actual(v[0], v[1], v[2], v[3]);
|
||||
} else
|
||||
n->set_card_as_margin(0., 0., 0., 0.);
|
||||
n->set_card_as_margin(simple_text_margin_left,
|
||||
simple_text_margin_right,
|
||||
simple_text_margin_bottom,
|
||||
simple_text_margin_top);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -6,7 +6,6 @@
|
||||
#include "framework.h"
|
||||
|
||||
void deadrec_keys(EventHandler& eh) {
|
||||
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
|
@ -301,7 +301,7 @@ static void event_2(CPT_Event) {
|
||||
}
|
||||
}
|
||||
|
||||
void demo_keys(EventHandler&) {
|
||||
void gui_keys(EventHandler&) {
|
||||
new RenderRelation( lights, dlight );
|
||||
have_dlight = true;
|
||||
|
||||
@ -309,6 +309,6 @@ void demo_keys(EventHandler&) {
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
define_keys = &demo_keys;
|
||||
define_keys = &gui_keys;
|
||||
return framework_main(argc, argv);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user