Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
DebugText3d Class Reference
Inheritance diagram for DebugText3d:
Collaboration diagram for DebugText3d:

Public Member Functions

 DebugText3d (vector pos, string msg, float align, float fade_rate_, vector vel)
 ~DebugText3d ()
 ATTRIB (DebugText3d, fade_rate, float)
 ATTRIB (DebugText3d, health, float)
 ATTRIB (DebugText3d, hit_time, float)
 ATTRIB (DebugText3d, message, string)
 ATTRIB (DebugText3d, origin, vector)
 ATTRIB (DebugText3d, velocity, vector)
void DebugText3d_draw2d (DebugText3d this)
 void (DebugText3d) draw2d

Detailed Description

Definition at line 415 of file debug.qh.

Constructor & Destructor Documentation

◆ DebugText3d()

DebugText3d::DebugText3d ( vector pos,
string msg,
float align,
float fade_rate_,
vector vel )
inline

Definition at line 424 of file debug.qh.

424 {
426 this.origin = pos;
427 this.message = strzone(msg);
428 SetResource(this, RES_HEALTH, align);
429 this.hit_time = time;
430 this.fade_rate = fade_rate_;
431 this.velocity = vel;
432 IL_PUSH(g_drawables_2d, this);
433 }
void SetResource(entity e, Resource res_type, float amount)
Sets the current amount of resource the given entity will have.
DebugText3d(vector pos, string msg, float align, float fade_rate_, vector vel)
Definition debug.qh:424
string message
Definition powerups.qc:19
IntrusiveList g_drawables_2d
Definition main.qh:92
vector velocity
float time
vector origin
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
string strzone(string s)
#define CONSTRUCT(cname,...)
Definition oo.qh:123
fade_rate
Definition projectile.qh:14

References DebugText3d(), CONSTRUCT, CONSTRUCTOR, g_drawables_2d, IL_PUSH(), SetResource(), strzone(), time, and vector.

Referenced by DebugText3d(), ~DebugText3d(), ATTRIB(), ATTRIB(), ATTRIB(), ATTRIB(), ATTRIB(), ATTRIB(), DebugText3d_draw2d(), and void().

◆ ~DebugText3d()

DebugText3d::~DebugText3d ( )
inline

Definition at line 435 of file debug.qh.

435 {
436 strfree(this.message);
437 }
#define strfree(this)
Definition string.qh:59

References DebugText3d(), message, and strfree.

Member Function Documentation

◆ ATTRIB() [1/6]

DebugText3d::ATTRIB ( DebugText3d ,
fade_rate ,
float  )

References DebugText3d(), ATTRIB(), and fade_rate.

◆ ATTRIB() [2/6]

DebugText3d::ATTRIB ( DebugText3d ,
health ,
float  )

References DebugText3d(), ATTRIB(), and health.

◆ ATTRIB() [3/6]

DebugText3d::ATTRIB ( DebugText3d ,
hit_time ,
float  )

References DebugText3d(), and ATTRIB().

◆ ATTRIB() [4/6]

DebugText3d::ATTRIB ( DebugText3d ,
message ,
string  )

References DebugText3d(), ATTRIB(), and message.

◆ ATTRIB() [5/6]

DebugText3d::ATTRIB ( DebugText3d ,
origin ,
vector  )

References DebugText3d(), ATTRIB(), origin, and vector.

Referenced by ATTRIB(), ATTRIB(), ATTRIB(), ATTRIB(), ATTRIB(), and ATTRIB().

◆ ATTRIB() [6/6]

DebugText3d::ATTRIB ( DebugText3d ,
velocity ,
vector  )

References DebugText3d(), ATTRIB(), vector, and velocity.

◆ DebugText3d_draw2d()

void DebugText3d::DebugText3d_draw2d ( DebugText3d this)
inline

Definition at line 439 of file debug.qh.

439 {
440 float since_created = time - this.hit_time;
441 float alpha_ = 1 - since_created * this.fade_rate;
442
443 if (alpha_ < 0) {
444 delete(this);
445 return;
446 }
447
448 int size = 11;
449 vector screen_pos = project_3d_to_2d(this.origin) + since_created * this.velocity;
450 if (screen_pos.z < 0) return; // behind camera
451
452 screen_pos.z = 0;
453 float align = GetResource(this, RES_HEALTH);
454 string msg;
455 vector msg_pos;
456
457 int n = tokenizebyseparator(this.message, "\n");
458 for(int k = 0; k < n; ++k)
459 {
460 msg = argv(k);
461 msg_pos = screen_pos + k * 1.25 * size * eY;
462 if (align > 0)
463 msg_pos.x -= stringwidth(msg, true, size * '1 1 0') * min(1, align);
464
465 drawcolorcodedstring_builtin(msg_pos, msg, size * '1 1 0', alpha_, DRAWFLAG_NORMAL);
466 }
467 }
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
const float DRAWFLAG_NORMAL
vector size
#define stringwidth
#define tokenizebyseparator
float min(float f,...)
string argv(float n)
vector
Definition self.qh:92
const vector eY
Definition vector.qh:45
vector project_3d_to_2d(vector vec)
Definition view.qc:373

References DebugText3d(), argv(), DRAWFLAG_NORMAL, eY, fade_rate, GetResource(), message, min(), origin, project_3d_to_2d(), size, stringwidth, time, tokenizebyseparator, vector, and velocity.

Referenced by void().

◆ void()

DebugText3d::void ( DebugText3d )

The documentation for this class was generated from the following file: