summaryrefslogtreecommitdiffhomepage
path: root/src/hud.h
blob: 8ea0877c4909fc8764509a6ed206e5b7dde53b34 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*
 * Copyright © 2022 Matthew Wozniak <sirtomato999@gmail.com>
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED “AS IS” AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
 * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 * PERFORMANCE OF THIS SOFTWARE.
 */

#ifndef INC_HUD_H
#define INC_HUD_H

#include "event.h"
#include "engineapi.h"
#include "intdefs.h"

/*
 * Emitted when the game HUD is being drawn. Allows features to draw their own
 * additional overlays atop the game's standard HUD.
 */
DECL_EVENT(HudPaint, void)

/* Font style flags */
#define HUD_FONT_ITALIC 1
#define HUD_FONT_UNDERLINE 2
#define HUD_FONT_STRIKE 4
#define HUD_FONT_SYMBOL 8
#define HUD_FONT_AA 16
#define HUD_FONT_GAUSSBLUR 32
#define HUD_FONT_ROTARY 64
#define HUD_FONT_DROPSHADOW 128
#define HUD_FONT_ADDITIVE 256
#define HUD_FONT_OUTLINE 512
#define HUD_FONT_CUSTOM 1024
#define HUD_FONT_BITMAP 2048

/* Gets a font handle by its name in sourcescheme.res. */
ulong hud_getfont(const char *name, bool proportional);

/* Sets the drawing pen colour for subsequent HUD drawing calls (below). */
void hud_setcolour(struct rgba colour);

/* Draws a rectangle on top of the HUD. */
void hud_drawrect(int x0, int y0, int x1, int y1, struct rgba colour, bool fill);

/* Draws a line on top of the HUD. */
void hud_drawline(int x0, int y0, int x1, int y1, struct rgba colour);

/* Draws an arbitrary series of lines between an array of points. */
void hud_drawpolyline(int *xs, int *ys, int npoints, struct rgba colour);

/* Draws text using a given font handle. */
void hud_drawtext(ulong font, int x, int y, struct rgba colour, ushort *str,
		int len);

/* Returns the width and height of the game window in pixels. */
void hud_screensize(int *width, int *height);

/* Returns the height of a font, in pixels. */
int hud_fontheight(ulong font);

/* Returns the width of a font character, in pixels. */
int hud_getcharwidth(ulong font, int ch);

#endif