mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-30 08:44:19 -04:00
blah blah blah
This commit is contained in:
parent
51fa40c5e7
commit
caac14f9c6
@ -97,6 +97,7 @@ INLINE void GuiButton::click(void) {
|
|||||||
up();
|
up();
|
||||||
break;
|
break;
|
||||||
case INACTIVE:
|
case INACTIVE:
|
||||||
|
case INACTIVE_ROLLOVER:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
gui_cat->warning() << "got click from invalid state (" << (int)_state
|
gui_cat->warning() << "got click from invalid state (" << (int)_state
|
||||||
|
@ -66,7 +66,7 @@ static void event_frame(CPT_Event) {
|
|||||||
enum MotionType { M_None, M_Line, M_SLine, M_Box, M_SBox, M_Circle, M_SCircle,
|
enum MotionType { M_None, M_Line, M_SLine, M_Box, M_SBox, M_Circle, M_SCircle,
|
||||||
M_Random, M_SRandom };
|
M_Random, M_SRandom };
|
||||||
PT(AutonomousLerp) curr_lerp;
|
PT(AutonomousLerp) curr_lerp;
|
||||||
MotionType curr_type;
|
MotionType curr_type, switching_to;
|
||||||
PT(GuiButton) lineButton;
|
PT(GuiButton) lineButton;
|
||||||
PT(GuiButton) slineButton;
|
PT(GuiButton) slineButton;
|
||||||
PT(GuiButton) boxButton;
|
PT(GuiButton) boxButton;
|
||||||
@ -333,64 +333,95 @@ static void make_active(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void event_button_up(CPT_Event e) {
|
||||||
|
string s = e->get_name();
|
||||||
|
s = s.substr(0, s.find("-up"));
|
||||||
|
event_handler.remove_hook(s + "-up", event_button_up);
|
||||||
|
event_handler.remove_hook(s + "-up-rollover", event_button_up);
|
||||||
|
make_active();
|
||||||
|
switch (switching_to) {
|
||||||
|
case M_Line:
|
||||||
|
lineButton->inactive();
|
||||||
|
break;
|
||||||
|
case M_SLine:
|
||||||
|
slineButton->inactive();
|
||||||
|
break;
|
||||||
|
case M_Box:
|
||||||
|
boxButton->inactive();
|
||||||
|
break;
|
||||||
|
case M_SBox:
|
||||||
|
sboxButton->inactive();
|
||||||
|
break;
|
||||||
|
case M_Circle:
|
||||||
|
circleButton->inactive();
|
||||||
|
break;
|
||||||
|
case M_SCircle:
|
||||||
|
scircleButton->inactive();
|
||||||
|
break;
|
||||||
|
case M_Random:
|
||||||
|
randomButton->inactive();
|
||||||
|
break;
|
||||||
|
case M_SRandom:
|
||||||
|
srandomButton->inactive();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
deadrec_cat->error() << "switching to invalid motion type ("
|
||||||
|
<< (int)switching_to << ")" << endl;
|
||||||
|
}
|
||||||
|
curr_type = switching_to;
|
||||||
|
handle_lerp();
|
||||||
|
}
|
||||||
|
|
||||||
static void event_button_down(CPT_Event e) {
|
static void event_button_down(CPT_Event e) {
|
||||||
string s = e->get_name();
|
string s = e->get_name();
|
||||||
s = s.substr(0, s.find("-down"));
|
s = s.substr(0, s.find("-down"));
|
||||||
if (s == "line") {
|
if (s == "line") {
|
||||||
if (curr_type != M_Line) {
|
if (curr_type != M_Line) {
|
||||||
make_active();
|
switching_to = M_Line;
|
||||||
curr_type = M_Line;
|
event_handler.add_hook(s + "-up", event_button_up);
|
||||||
handle_lerp();
|
event_handler.add_hook(s + "-up-rollover", event_button_up);
|
||||||
lineButton->inactive();
|
|
||||||
}
|
}
|
||||||
} else if (s == "s-line") {
|
} else if (s == "s-line") {
|
||||||
if (curr_type != M_SLine) {
|
if (curr_type != M_SLine) {
|
||||||
make_active();
|
switching_to = M_SLine;
|
||||||
curr_type = M_SLine;
|
event_handler.add_hook(s + "-up", event_button_up);
|
||||||
handle_lerp();
|
event_handler.add_hook(s + "-up-rollover", event_button_up);
|
||||||
slineButton->inactive();
|
|
||||||
}
|
}
|
||||||
} else if (s == "box") {
|
} else if (s == "box") {
|
||||||
if (curr_type != M_Box) {
|
if (curr_type != M_Box) {
|
||||||
make_active();
|
switching_to = M_Box;
|
||||||
curr_type = M_Box;
|
event_handler.add_hook(s + "-up", event_button_up);
|
||||||
handle_lerp();
|
event_handler.add_hook(s + "-up-rollover", event_button_up);
|
||||||
boxButton->inactive();
|
|
||||||
}
|
}
|
||||||
} else if (s == "s-box") {
|
} else if (s == "s-box") {
|
||||||
if (curr_type != M_SBox) {
|
if (curr_type != M_SBox) {
|
||||||
make_active();
|
switching_to = M_SBox;
|
||||||
curr_type = M_SBox;
|
event_handler.add_hook(s + "-up", event_button_up);
|
||||||
handle_lerp();
|
event_handler.add_hook(s + "-up-rollover", event_button_up);
|
||||||
sboxButton->inactive();
|
|
||||||
}
|
}
|
||||||
} else if (s == "circle") {
|
} else if (s == "circle") {
|
||||||
if (curr_type != M_Circle) {
|
if (curr_type != M_Circle) {
|
||||||
make_active();
|
switching_to = M_Circle;
|
||||||
curr_type = M_Circle;
|
event_handler.add_hook(s + "-up", event_button_up);
|
||||||
handle_lerp();
|
event_handler.add_hook(s + "-up-rollover", event_button_up);
|
||||||
circleButton->inactive();
|
|
||||||
}
|
}
|
||||||
} else if (s == "s-circle") {
|
} else if (s == "s-circle") {
|
||||||
if (curr_type != M_SCircle) {
|
if (curr_type != M_SCircle) {
|
||||||
make_active();
|
switching_to = M_SCircle;
|
||||||
curr_type = M_SCircle;
|
event_handler.add_hook(s + "-up", event_button_up);
|
||||||
handle_lerp();
|
event_handler.add_hook(s + "-up-rollover", event_button_up);
|
||||||
scircleButton->inactive();
|
|
||||||
}
|
}
|
||||||
} else if (s == "random") {
|
} else if (s == "random") {
|
||||||
if (curr_type != M_Random) {
|
if (curr_type != M_Random) {
|
||||||
make_active();
|
switching_to = M_Random;
|
||||||
curr_type = M_Random;
|
event_handler.add_hook(s + "-up", event_button_up);
|
||||||
handle_lerp();
|
event_handler.add_hook(s + "-up-rollover", event_button_up);
|
||||||
randomButton->inactive();
|
|
||||||
}
|
}
|
||||||
} else if (s == "s-random") {
|
} else if (s == "s-random") {
|
||||||
if (curr_type != M_SRandom) {
|
if (curr_type != M_SRandom) {
|
||||||
make_active();
|
switching_to = M_SRandom;
|
||||||
curr_type = M_SRandom;
|
event_handler.add_hook(s + "-up", event_button_up);
|
||||||
handle_lerp();
|
event_handler.add_hook(s + "-up-rollover", event_button_up);
|
||||||
srandomButton->inactive();
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
deadrec_cat->error() << "got invalid button event '" << s << "'" << endl;
|
deadrec_cat->error() << "got invalid button event '" << s << "'" << endl;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user