layering priority in GUI
This commit is contained in:
parent
2de90c8caa
commit
df6ecb17bf
|
|
@ -4,7 +4,24 @@
|
|||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
INLINE GuiItem::GuiItem(void) : Namable("fubar"), _left(-1.), _right(1.),
|
||||
_bottom(-1.), _top(1.) {}
|
||||
_bottom(-1.), _top(1.), _pri(P_Normal) {}
|
||||
|
||||
INLINE void GuiItem::set_priority(const GuiItem::Priority p) {
|
||||
_pri = p;
|
||||
float r = _pos.dot(LVector3f::rfu(1., 0., 0.));
|
||||
float u = _pos.dot(LVector3f::rfu(0., 0., 1.));
|
||||
switch (_pri) {
|
||||
case P_Low:
|
||||
this->set_pos(LVector3f::rfu(r, 0.5, u));
|
||||
break;
|
||||
case P_Normal:
|
||||
this->set_pos(LVector3f::rfu(r, 0., u));
|
||||
break;
|
||||
case P_High:
|
||||
this->set_pos(LVector3f::rfu(r, -0.5, u));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
INLINE float GuiItem::get_scale(void) const {
|
||||
return _scale;
|
||||
|
|
@ -34,6 +51,10 @@ INLINE LVector4f GuiItem::get_frame(void) const {
|
|||
return LVector4f(_left, _right, _bottom, _top);
|
||||
}
|
||||
|
||||
INLINE GuiItem::Priority GuiItem::get_priority(void) const {
|
||||
return _pri;
|
||||
}
|
||||
|
||||
INLINE void GuiItem::recompute(void) {
|
||||
this->recompute_frame();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ GuiItem::GuiItem(const string& name) : Namable(name), _added_hooks(false),
|
|||
_scale(1.), _left(-1.), _right(1.),
|
||||
_bottom(-1.), _top(1.),
|
||||
_pos(0., 0., 0.),
|
||||
_mgr((GuiManager*)0L) {
|
||||
_mgr((GuiManager*)0L), _pri(P_Normal) {
|
||||
}
|
||||
|
||||
GuiItem::~GuiItem(void) {
|
||||
|
|
|
|||
|
|
@ -11,11 +11,15 @@
|
|||
#include <eventHandler.h>
|
||||
|
||||
class EXPCL_PANDA GuiItem : public TypedReferenceCount, public Namable {
|
||||
PUBLISHED:
|
||||
enum Priority { P_Low, P_Normal, P_High };
|
||||
|
||||
protected:
|
||||
bool _added_hooks;
|
||||
float _scale, _left, _right, _bottom, _top;
|
||||
LVector3f _pos;
|
||||
GuiManager* _mgr;
|
||||
Priority _pri;
|
||||
|
||||
INLINE GuiItem(void);
|
||||
virtual void recompute_frame(void) = 0;
|
||||
|
|
@ -29,6 +33,7 @@ PUBLISHED:
|
|||
|
||||
virtual void set_scale(float) = 0;
|
||||
virtual void set_pos(const LVector3f&) = 0;
|
||||
INLINE void set_priority(const Priority);
|
||||
|
||||
INLINE float get_scale(void) const;
|
||||
INLINE LVector3f get_pos(void) const;
|
||||
|
|
@ -37,6 +42,7 @@ PUBLISHED:
|
|||
INLINE float get_bottom(void) const;
|
||||
INLINE float get_top(void) const;
|
||||
INLINE LVector4f get_frame(void) const;
|
||||
INLINE Priority get_priority(void) const;
|
||||
|
||||
INLINE void recompute(void);
|
||||
|
||||
|
|
|
|||
|
|
@ -443,14 +443,14 @@ inline static void predict_linear(void) {
|
|||
B_time = telemetry_time;
|
||||
V = B - A;
|
||||
V *= 1. / (B_time - A_time);
|
||||
// time = 0.;
|
||||
time = 0.;
|
||||
} else {
|
||||
// is between our two samples
|
||||
A = telemetry_pos;
|
||||
A_time = telemetry_time;
|
||||
V = B - A;
|
||||
V *= 1. / (B_time - A_time);
|
||||
// time = 0.;
|
||||
time = 0.;
|
||||
}
|
||||
}
|
||||
if (time <= 0.) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue