My Project
Loading...
Searching...
No Matches
Functions
font.c File Reference

Text drawing routines. More...

#include "font.h"
#include "fonthand.h"
#include "sprite.h"

Functions

void draw_font_hv_shadow (SDL_Surface *surface, int x, int y, const char *text, Font font, FontAlignment alignment, Uint8 hue, Sint8 value, bool black, int shadow_dist)
 Draws text in a color specified by hue and value and with a drop shadow.
 
void draw_font_hv_full_shadow (SDL_Surface *surface, int x, int y, const char *text, Font font, FontAlignment alignment, Uint8 hue, Sint8 value, bool black, int shadow_dist)
 Draws text in a color specified by hue and value and with a surrounding shadow.
 
void draw_font_hv (SDL_Surface *surface, int x, int y, const char *text, Font font, FontAlignment alignment, Uint8 hue, Sint8 value)
 Draws text in a color specified by hue and value.
 
void draw_font_hv_blend (SDL_Surface *surface, int x, int y, const char *text, Font font, FontAlignment alignment, Uint8 hue, Sint8 value)
 Draws blended text in a color specified by hue and value.
 
void draw_font_dark (SDL_Surface *surface, int x, int y, const char *text, Font font, FontAlignment alignment, bool black)
 Draws darkened text.
 

Detailed Description

Text drawing routines.

Function Documentation

◆ draw_font_dark()

void draw_font_dark ( SDL_Surface * surface,
int x,
int y,
const char * text,
Font font,
FontAlignment alignment,
bool black )

Draws darkened text.

Corresponds to blit_sprite_dark()

  • like JE_outText() with (brightness < 0) if (black == true)
Parameters
surfacedestination surface
xinitial x-position in pixels; which direction(s) the text is drawn from this position depends on the alignment
yinitial upper y-position in pixels
texttext to be drawn
fontstyle/size of text
alignmentleft_aligned, centered, or right_aligned
blackif true text is drawn as solid black, if false text is drawn by darkening the pixels of the destination surface

◆ draw_font_hv()

void draw_font_hv ( SDL_Surface * surface,
int x,
int y,
const char * text,
Font font,
FontAlignment alignment,
Uint8 hue,
Sint8 value )

Draws text in a color specified by hue and value.

A '~' in the text is not drawn but instead toggles highlighting which increases value by 4.

  • like JE_outText() with (brightness >= 0)
  • like JE_outTextAdjust() without shadow
Parameters
surfacedestination surface
xinitial x-position in pixels; which direction(s) the text is drawn from this position depends on the alignment
yinitial upper y-position in pixels
texttext to be drawn
fontstyle/size of text
alignmentleft_aligned, centered, or right_aligned
huehue component of text color
valuevalue component of text color

◆ draw_font_hv_blend()

void draw_font_hv_blend ( SDL_Surface * surface,
int x,
int y,
const char * text,
Font font,
FontAlignment alignment,
Uint8 hue,
Sint8 value )

Draws blended text in a color specified by hue and value.

Corresponds to blit_sprite_hv_blend()

  • like JE_outTextModify()
Parameters
surfacedestination surface
xinitial x-position in pixels; which direction(s) the text is drawn from this position depends on the alignment
yinitial upper y-position in pixels
texttext to be drawn
fontstyle/size of text
alignmentleft_aligned, centered, or right_aligned
huehue component of text color
valuevalue component of text color

◆ draw_font_hv_full_shadow()

void draw_font_hv_full_shadow ( SDL_Surface * surface,
int x,
int y,
const char * text,
Font font,
FontAlignment alignment,
Uint8 hue,
Sint8 value,
bool black,
int shadow_dist )

Draws text in a color specified by hue and value and with a surrounding shadow.

A '~' in the text is not drawn but instead toggles highlighting which increases value by 4.

  • like JE_textShade() with FULL_SHADE if (black == true && shadow_dist == 1)
Parameters
surfacedestination surface
xinitial x-position in pixels; which direction(s) the text is drawn from this position depends on the alignment
yinitial upper y-position in pixels
texttext to be drawn
fontstyle/size of text
alignmentleft_aligned, centered, or right_aligned
huehue component of text color
valuevalue component of text color
blackif true the shadow is drawn as solid black, if false the shadow is drawn by darkening the pixels of the destination surface
shadow_distdistance in pixels that the shadows will be drawn away from the text. (This distance is separately added to and subtracted from the x position and y position, resulting in four shadows – one in each cardinal direction. If this shadow distance is small enough, this produces a shadow that outlines the text.)

◆ draw_font_hv_shadow()

void draw_font_hv_shadow ( SDL_Surface * surface,
int x,
int y,
const char * text,
Font font,
FontAlignment alignment,
Uint8 hue,
Sint8 value,
bool black,
int shadow_dist )

Draws text in a color specified by hue and value and with a drop shadow.

A '~' in the text is not drawn but instead toggles highlighting which increases value by 4.

  • like JE_dString() if (black == false && shadow_dist == 2 && hue == 15)
  • like JE_textShade() with PART_SHADE if (black == true && shadow_dist == 1)
  • like JE_outTextAndDarken() if (black == false && shadow_dist == 1)
  • like JE_outTextAdjust() with shadow if (black == false && shadow_dist == 2)
Parameters
surfacedestination surface
xinitial x-position in pixels; which direction(s) the text is drawn from this position depends on the alignment
yinitial upper y-position in pixels
texttext to be drawn
fontstyle/size of text
alignmentleft_aligned, centered, or right_aligned
huehue component of text color
valuevalue component of text color
blackif true the shadow is drawn as solid black, if false the shadow is drawn by darkening the pixels of the destination surface
shadow_distdistance in pixels that the shadow will be drawn away from the text. (This is added to both the x and y positions, so a value of 1 causes the shadow to be drawn 1 pixel right and 1 pixel lower than the text.)