ui_render.c File Reference

#include "ui_main.h"
#include "ui_font.h"
#include "ui_render.h"
#include "../cl_video.h"
#include "../renderer/r_draw.h"
#include "../renderer/r_misc.h"
Include dependency graph for ui_render.c:

Go to the source code of this file.

Functions

void UI_DrawFill (int x, int y, int w, int h, const vec4_t color)
 Fills a box of pixels with a single color.
void UI_Transform (const vec3_t transform, const vec3_t rotate, const vec3_t scale)
struct image_sUI_LoadImage (const char *name)
 Searches for an image in the image array.
void UI_DrawNormImage (float x, float y, float w, float h, float sh, float th, float sl, float tl, const image_t *image)
const image_tUI_DrawNormImageByName (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.
void UI_DrawPanel (const vec2_t pos, const vec2_t size, const char *texture, int texX, int texY, const int panelDef[6])
 draw a panel from a texture as we can see on the image
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
int UI_DrawString (const char *fontID, align_t align, int x, int y, int absX, int maxWidth, int lineHeight, const char *c, int boxHeight, int scrollPos, int *curLine, qboolean increaseLine, longlines_t method)

Detailed Description

Definition in file ui_render.c.


Function Documentation

void UI_DrawFill ( int  x,
int  y,
int  w,
int  h,
const vec4_t  color 
)
void UI_DrawNormImage ( float  x,
float  y,
float  w,
float  h,
float  sh,
float  th,
float  sl,
float  tl,
const image_t image 
)
const image_t* UI_DrawNormImageByName ( 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] x X position to draw the image to
[in] y Y position to draw the image to
[in] w Width of the image
[in] h Height of the image
[in] sh Right x corner coord of the square to draw
[in] th Lower y corner coord of the square to draw
[in] sl Left x corner coord of the square to draw
[in] tl Upper y corner coord of the square to draw
[in] name The 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 156 of file ui_render.c.

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

Referenced by UI_BaseMapNodeDraw(), UI_CheckBoxNodeDraw(), UI_CustomButtonNodeDraw(), UI_DrawIconInBox(), UI_DrawItem(), UI_RadarNodeDraw(), UI_RadioButtonNodeDraw(), UI_SpinnerNodeDraw(), UI_TabNodeDrawJunction(), UI_TabNodeDrawPlain(), and UI_TBarNodeDraw().

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

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

Inline_draw_panel.png
Parameters:
[in] pos Position of the output panel
[in] size Size of the output panel
[in] texture Texture contain the template of the panel
[in] texX Position x of the panel template into the texture
[in] texY Position y of the panel template into the texture
[in] panelDef Array 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 183 of file ui_render.c.

References UI_DrawNormImage(), and UI_LoadImage().

Referenced by UI_ButtonNodeDraw(), UI_KeyBindingNodeDraw(), UI_OptionListNodeDraw(), UI_OptionTreeNodeDraw(), UI_PanelNodeDraw(), UI_TextEntryNodeDraw(), and UI_WindowNodeDraw().

int UI_DrawString ( const char *  fontID,
align_t  align,
int  x,
int  y,
int  absX,
int  maxWidth,
int  lineHeight,
const char *  c,
int  boxHeight,
int  scrollPos,
int *  curLine,
qboolean  increaseLine,
longlines_t  method 
)
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] fontID the font id (defined in ufos/fonts.ufo)
[in] align Align of the text into the bounding box
[in] x Current x position of the bounded box
[in] y Current y position of the bounded box
[in] width Current width of the bounded box
[in] text The string to draw
[in] method Truncation 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 252 of file ui_render.c.

References qfalse, and UI_DrawString().

Referenced by UI_ButtonNodeDraw(), UI_CustomButtonNodeDraw(), UI_KeyBindingNodeDraw(), UI_RadarNodeDraw(), UI_StringNodeDraw(), UI_TextEntryNodeDraw(), UI_TextLineNodeDrawText(), and UI_WindowNodeDraw().

struct image_s* UI_LoadImage ( const char *  name  )  [read]

Searches for an image in the image array.

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

Definition at line 74 of file ui_render.c.

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

Referenced by UI_AutoGenerateIcon(), UI_DrawNormImageByName(), UI_DrawPanel(), UI_EKGNodeDraw(), UI_ImageNodeDraw(), UI_ImageNodeLoaded(), UI_RadarNodeDrawActor(), UI_RadarNodeDrawItem(), UI_SelectBoxNodeDraw(), UI_SelectBoxNodeDrawOverWindow(), and UI_VScrollbarNodeDraw().

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 NULL
Parameters:
transform Translation (if NULL the matrix is removed from stack)
rotate Rotation
scale Scale
See also:
R_Transform
R_PopMatrix
R_PushMatrix

Definition at line 51 of file ui_render.c.

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

Referenced by SEQ_Render2D(), and UI_LineChartNodeDraw().


Generated by  doxygen 1.6.2