mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-24 12:42:32 +00:00
[ui] Add some basic math ops for view_pos_t
Just add and subtract, but I got tired of having to write two lines of code for such.
This commit is contained in:
parent
082d00b6c3
commit
aa5dc657fd
1 changed files with 21 additions and 0 deletions
|
@ -138,6 +138,9 @@ typedef void (*view_move_f) (view_t view, view_pos_t abs);
|
||||||
|
|
||||||
#define VIEWINLINE GNU89INLINE inline
|
#define VIEWINLINE GNU89INLINE inline
|
||||||
|
|
||||||
|
VIEWINLINE view_pos_t VP_add (view_pos_t a, view_pos_t b);
|
||||||
|
VIEWINLINE view_pos_t VP_sub (view_pos_t a, view_pos_t b);
|
||||||
|
|
||||||
VIEWINLINE view_t View_FromEntity (ecs_system_t viewsys, uint32_t ent);
|
VIEWINLINE view_t View_FromEntity (ecs_system_t viewsys, uint32_t ent);
|
||||||
view_t View_New (ecs_system_t viewsys, view_t parent);
|
view_t View_New (ecs_system_t viewsys, view_t parent);
|
||||||
view_t View_AddToEntity (uint32_t ent, ecs_system_t viewsys, view_t parent,
|
view_t View_AddToEntity (uint32_t ent, ecs_system_t viewsys, view_t parent,
|
||||||
|
@ -185,6 +188,24 @@ VIEWINLINE void View_SetOnMove (view_t view, view_move_f onmove);
|
||||||
#define VIEWINLINE VISIBLE
|
#define VIEWINLINE VISIBLE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
VIEWINLINE view_pos_t
|
||||||
|
VP_add (view_pos_t a, view_pos_t b)
|
||||||
|
{
|
||||||
|
return (view_pos_t) {
|
||||||
|
.x = a.x + b.x,
|
||||||
|
.y = a.y + b.y,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
VIEWINLINE view_pos_t
|
||||||
|
VP_sub (view_pos_t a, view_pos_t b)
|
||||||
|
{
|
||||||
|
return (view_pos_t) {
|
||||||
|
.x = a.x - b.x,
|
||||||
|
.y = a.y - b.y,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
VIEWINLINE
|
VIEWINLINE
|
||||||
view_t
|
view_t
|
||||||
View_FromEntity (ecs_system_t viewsys, uint32_t ent)
|
View_FromEntity (ecs_system_t viewsys, uint32_t ent)
|
||||||
|
|
Loading…
Reference in a new issue