UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ui_render.h File Reference
#include "ui_nodes.h"
#include "../cl_renderer.h"

Go to the source code of this file.

Functions

const struct image_sUI_LoadImage (const char *name)
 Searches for an image in the image array. More...
 
const struct image_sUI_LoadWrappedImage (const char *name)
 Searches for a wrapped image in the image array. More...
 
void UI_DrawNormImage (bool flip, float x, float y, float w, float h, float sh, float th, float sl, float tl, const struct image_s *image)
 
const image_tUI_DrawNormImageByName (bool flip, float x, float y, float w, float h, float sh, float th, float sl, float tl, const char *name)
 Draws an image or parts of it. More...
 
void UI_DrawPanel (const vec2_t pos, const vec2_t size, const char *texture, int texX, int texY, const int panelDef[7])
 draw a panel from a texture as we can see on the image More...
 
void UI_DrawBorderedPanel (const vec2_t pos, const vec2_t size, const char *texture, int texX, int texY, int texW, int texH, int border)
 draw a panel from a texture as we can see on the image More...
 
void UI_DrawFill (int x, int y, int w, int h, const vec4_t color)
 Fills a box of pixels with a single color. More...
 
int UI_DrawStringInBox (const char *fontID, align_t align, int x, int y, int width, int height, const char *text, longlines_t method=LONGLINES_PRETTYCHOP)
 draw a line into a bounding box More...
 
int UI_DrawString (const char *fontID, align_t align, int x, int y, int absX, int maxWidth, const int lineHeight, const char *c, int box_height=0, int scroll_pos=0, int *cur_line=nullptr, bool increaseLine=false, longlines_t method=LONGLINES_WRAP)
 
void UI_Transform (const vec3_t transform, const vec3_t rotate, const vec3_t scale)
 Pushes a new matrix, normalize to current resolution and move, rotate and scale the matrix to the given values. More...
 
void UI_DrawRect (int x, int y, int w, int h, const vec4_t color, float lineWidth, int pattern)
 
void UI_PushClipRect (int x, int y, int width, int height)
 
void UI_PopClipRect (void)
 
void UI_EnableFlashing (const vec4_t flashingColor, float speed=1)
 Enables flashing effect for UI nodes. More...
 
void UI_DisableFlashing (void)
 Disables flashing effect for UI nodes. More...
 

Function Documentation

void UI_DisableFlashing ( void  )

Disables flashing effect for UI nodes.

Definition at line 417 of file ui_render.cpp.

References R_TexOverride().

Referenced by uiButtonNode::draw().

void UI_DrawBorderedPanel ( const vec2_t  pos,
const vec2_t  size,
const char *  texture,
int  texX,
int  texY,
int  texW,
int  texH,
int  border 
)

draw a panel from a texture as we can see on the image

Inline_draw_panel.png
Parameters
[in]posPosition of the output panel
[in]sizeSize of the output panel
[in]textureTexture contain the template of the panel
[in]texX,texYPosition of the panel template into the texture
[in]texW,texHWidth/height of the panel template into the texture
[in]borderSize of unscalable border From the first to the last: left width, mid width, right width, top height, mid height, bottom height, and margin
Todo:
can we improve the code? is it need?

Definition at line 293 of file ui_render.cpp.

References UI_DrawNormImage(), and UI_LoadImage().

Referenced by UI_DrawSpriteInBox().

void UI_DrawNormImage ( bool  flip,
float  x,
float  y,
float  w,
float  h,
float  sh,
float  th,
float  sl,
float  tl,
const struct image_s image 
)
const image_t* UI_DrawNormImageByName ( bool  flip,
float  x,
float  y,
float  w,
float  h,
float  sh,
float  th,
float  sl,
float  tl,
const char *  name 
)

Draws an image or parts of it.

Parameters
[in]flipFlip the icon rendering (horizontal)
[in]x,yposition to draw the image to
[in]wWidth of the image
[in]hHeight of the image
[in]shRight x corner coord of the square to draw
[in]thLower y corner coord of the square to draw
[in]slLeft x corner coord of the square to draw
[in]tlUpper y corner coord of the square to draw
[in]nameThe name of the image - relative to base/pics
See also
R_RegisterImage
Note
All these parameter are normalized to VID_NORM_WIDTH and VID_NORM_HEIGHT they are adjusted in this function

Definition at line 203 of file ui_render.cpp.

References Com_Printf(), UI_DrawNormImage(), and UI_LoadImage().

Referenced by uiTBarNode::draw(), uiRadarNode::draw(), uiRadioButtonNode::draw(), UI_DrawItem(), UI_DrawNormImageByName_(), and UI_DrawSpriteInBox().

void UI_DrawPanel ( const vec2_t  pos,
const vec2_t  size,
const char *  texture,
int  texX,
int  texY,
const int  panelDef[7] 
)

draw a panel from a texture as we can see on the image

Inline_draw_panel.png
Parameters
[in]posPosition of the output panel
[in]sizeSize of the output panel
[in]textureTexture contain the template of the panel
[in]texXPosition x of the panel template into the texture
[in]texYPosition y of the panel template into the texture
[in]panelDefArray of seven elements define the panel template used in the texture. From the first to the last: left width, mid width, right width, top height, mid height, bottom height, and margin
Todo:
can we improve the code? is it need?
Todo:
merge texX and texY here

Definition at line 230 of file ui_render.cpp.

References UI_DrawNormImage(), and UI_LoadImage().

Referenced by UI_DrawSpriteInBox().

void UI_DrawRect ( int  x,
int  y,
int  w,
int  h,
const vec4_t  color,
float  lineWidth,
int  pattern 
)
int UI_DrawStringInBox ( const char *  fontID,
align_t  align,
int  x,
int  y,
int  width,
int  height,
const char *  text,
longlines_t  method 
)

draw a line into a bounding box

Parameters
[in]fontIDthe font id (defined in ufos/fonts.ufo)
[in]alignAlign of the text into the bounding box
[in]x,yCurrent position of the bounded box
[in]widthCurrent width of the bounded box
[in]heightCurrent height of the bounded box
[in]textThe string to draw
[in]methodTruncation method
Text_position.png
Note
the x, y, width and height values are all normalized here - don't use the viddef settings for drawstring calls - make them all relative to VID_NORM_WIDTH and VID_NORM_HEIGHT
Todo:

remove the use of UI_DrawString

test the code for multiline?

fix problem with truncation (maybe problem into UI_DrawString)

Definition at line 359 of file ui_render.cpp.

References UI_DrawString().

Referenced by uiStringNode::draw(), uiRadarNode::draw(), uiButtonNode::draw(), uiTextEntryNode::draw(), uiWindowNode::draw(), and uiTextListNode::drawText().

void UI_EnableFlashing ( const vec4_t  flashingColor,
float  speed 
)

Enables flashing effect for UI nodes.

Parameters
[in]flashingColorColor to fade to and back
[in]speedSpeed of flashing effect

Definition at line 406 of file ui_render.cpp.

References cls, M_PI, R_TexOverride(), client_static_s::realtime, and Vector4Copy.

Referenced by uiButtonNode::draw().

const struct image_s* UI_LoadImage ( const char *  name)

Searches for an image in the image array.

Parameters
[in]nameThe name of the image relative to pics/
Note
name may not be null and has to be longer than 4 chars
Returns
nullptr on error or image_t pointer on success
See also
R_FindImage

Definition at line 91 of file ui_render.cpp.

References it_pic, R_FindImage(), r_noTexture, and va().

Referenced by uiVScrollbarNode::draw(), uiSelectBoxNode::draw(), uiImageNode::draw(), uiSelectBoxNode::drawOverWindow(), uiImageNode::onLoaded(), UI_AutoGenerateSprite(), UI_DrawBorderedPanel(), UI_DrawNormImageByName(), UI_DrawPanel(), and UI_RadarNodeDrawActor().

const struct image_s* UI_LoadWrappedImage ( const char *  name)

Searches for a wrapped image in the image array.

Parameters
[in]nameThe name of the image relative to pics/
Note
name may not be null and has to be longer than 4 chars
Returns
nullptr on error or image_t pointer on success
See also
R_FindImage

Definition at line 106 of file ui_render.cpp.

References it_wrappic, R_FindImage(), r_noTexture, and va().

Referenced by uiTextureNode::draw().

void UI_PushClipRect ( int  x,
int  y,
int  width,
int  height 
)
void UI_Transform ( const vec3_t  transform,
const vec3_t  rotate,
const vec3_t  scale 
)

Pushes a new matrix, normalize to current resolution and move, rotate and scale the matrix to the given values.

Note
Will pop the matrix if transform is nullptr
Parameters
transformTranslation (if nullptr the matrix is removed from stack)
rotateRotation
scaleScale
See also
R_Transform
R_PopMatrix
R_PushMatrix

Definition at line 68 of file ui_render.cpp.

References R_PopMatrix(), R_PushMatrix(), R_Transform(), viddef_t::rx, viddef_t::ry, VectorCopy, and viddef.

Referenced by uiLineChartNode::draw(), and SEQ_Render().