src/window/window_measure.c
Sizing windows to their text and fitting them on the screen. More…
Included by window.c.
Macros
| Name | Description | |
|---|---|---|
#define | WINDOW_BORDER_WIDTH 16 | The pixels of a window's two border tiles, left and right. |
#define | LINE_GAP_MAX 12 | The widest gap between characters that spreads a line across its window, in pixels, outside Japanese. |
#define | WINDOW_PAD_X (WINDOW_BORDER_WIDTH + 3) | What a window adds to its text's size in pixels before it is cut to tiles: across, its border and 3, so a width rounds up to the next tile only past 4 pixels into it; down, 15, so a height rounds up and takes one tile more. |
#define | WINDOW_PAD_Y 15 |
Functions
| Name | Description | |
|---|---|---|
void | mnWindowFitOnScreen (Sint32 entryIndex, Sint32 *windowX, Sint32 *windowY, Uint32 *windowWidth, Uint32 *windowHeight, Uint16 *spacing, Uint32 flags) | Sizes a window for the decoded text at entryIndex, as flags (WINDOW_FIT_) ask, and moves (*windowX, *windowY) so the window fits on the screen; spacing receives each line's extra gap between characters. |
void | mnTextMeasureMessage (Sint32 msg, Sint32 *x, Sint32 *y) | Decodes message and returns its text's width and height in pixels. |
DEFINE_GET_RESOURCE_DIMENSIONS( | mnTextGetMessageSize , 0) | Sizes and places a window for a message's first page. |
DEFINE_GET_RESOURCE_DIMENSIONS( | mnTextGetMessageSizeAllPages , WINDOW_FIT_ALL_PAGES) | Sizes and places a window for all of a message's pages. |
void | mnTextMeasureDecoded (Sint32 entryIndex, Uint32 *outWidth, Uint32 *outHeight, Uint16 *spacing) | Measures decoded text from entryIndex to its first page's end: returns the width of the longest line and the height (TEXT_LINE_HEIGHT a line) in pixels. |
void | mnTextMeasureAllPages (Sint32 entryIndex, Uint32 *outWidth, Uint32 *outHeight, Uint16 *spacing) | Measures decoded text from start over all its pages: the width of the first page's longest line and the height of its tallest page, in pixels, with each line's extra character gap in spacing as mnTextMeasureDecoded. |
Description
Sizing windows to their text and fitting them on the screen. Part of
window.c.
Macros in detail
WINDOW_BORDER_WIDTH
#define WINDOW_BORDER_WIDTH 16
The pixels of a window's two border tiles, left and right.
Referenced by mnTextMeasureAllPages() and mnTextMeasureDecoded().
Definition at line 5 of file window_measure.c.
LINE_GAP_MAX
#define LINE_GAP_MAX 12
The widest gap between characters that spreads a line across its window, in pixels, outside Japanese.
Referenced by mnTextMeasureDecoded().
Definition at line 8 of file window_measure.c.
WINDOW_PAD_X
#define WINDOW_PAD_X (WINDOW_BORDER_WIDTH + 3)
What a window adds to its text's size in pixels before it is cut to tiles: across, its border and 3, so a width rounds up to the next tile only past 4 pixels into it; down, 15, so a height rounds up and takes one tile more.
Referenced by mnTextMeasureAllPages(), mnTextMeasureDecoded() and mnWindowFitOnScreen().
Definition at line 13 of file window_measure.c.
WINDOW_PAD_Y
#define WINDOW_PAD_Y 15
Referenced by mnWindowFitOnScreen().
Definition at line 14 of file window_measure.c.
Functions in detail
mnWindowFitOnScreen
void mnWindowFitOnScreen(Sint32 entryIndex, Sint32 *windowX, Sint32 *windowY, Uint32 *windowWidth, Uint32 *windowHeight, Uint16 *spacing, Uint32 flags)
Sizes a window for the decoded text at entryIndex, as flags (WINDOW_FIT_)
ask, and moves (*windowX, *windowY) so the window fits on the screen; spacing
receives each line's extra gap between characters. In the Japanese and
English releases, under Mind Read, a measured window is 2 tiles wider and
kept off the screen's last column.
References mnTextMeasureAllPages(), mnTextMeasureDecoded(), Sint32 and state.
Referenced by mnMessageOpenWindow() and mnMessageType().
Definition at line 21 of file window_measure.c.
mnTextMeasureMessage
void mnTextMeasureMessage(Sint32 msg, Sint32 *x, Sint32 *y)
Decodes message and returns its text's width and height in pixels.
References mnMessageDecode(), mnTextMeasureDecoded() and Sint32.
Definition at line 109 of file window_measure.c.
mnTextGetMessageSize
DEFINE_GET_RESOURCE_DIMENSIONS(mnTextGetMessageSize, 0)
Sizes and places a window for a message's first page.
Referenced by mnAreaNameWindowShow(), mnFieldMessageShow() and mnFieldMessageShowCentered().
Definition at line 115 of file window_measure.c.
mnTextGetMessageSizeAllPages
DEFINE_GET_RESOURCE_DIMENSIONS(mnTextGetMessageSizeAllPages, WINDOW_FIT_ALL_PAGES)
Sizes and places a window for all of a message's pages.
Definition at line 117 of file window_measure.c.
mnTextMeasureDecoded
void mnTextMeasureDecoded(Sint32 entryIndex, Uint32 *outWidth, Uint32 *outHeight, Uint16 *spacing)
Measures decoded text from entryIndex to its first page's end: returns the
width of the longest line and the height (TEXT_LINE_HEIGHT a line) in pixels.
References FontGlyphs, glyph, Sint32, state and width.
Referenced by mnTextMeasureMessage(), mnTextSetString() and mnWindowFitOnScreen().
Definition at line 122 of file window_measure.c.
mnTextMeasureAllPages
void mnTextMeasureAllPages(Sint32 entryIndex, Uint32 *outWidth, Uint32 *outHeight, Uint16 *spacing)
Measures decoded text from start over all its pages: the width of the first
page's longest line and the height of its tallest page, in pixels, with each
line's extra character gap in spacing as mnTextMeasureDecoded.
References FontGlyphs, glyph, line, Sint32, state and width.
Referenced by mnWindowFitOnScreen().
Definition at line 316 of file window_measure.c.