Alchemy
Loading...
Searching...
No Matches

uiwindow.h

Go to the documentation of this file.
1#ifndef ALCHEMY_UIWINDOW_H
2#define ALCHEMY_UIWINDOW_H
3
4/// @file
5/// UiWindow, a window's work, and marking its tilemap rows for transfer.
6
7#include "render_input.h"
8
9/// A window: a framed rectangle of the tilemap with its sprite outputs, its
10/// opening or closing animation and the rectangle it last drew.
11struct UiWindow {
12 struct RenderOutputList output; ///< the sprites the window carries
13 u16 width; ///< tiles
14 u16 height; ///< tiles
15 u16 x; ///< tiles
16 u16 y; ///< tiles
17 u16 unk10; ///< 1 once opened, 0 once freed; not read by name in TBS
18 /// The effect a message's TEXT_WINDOW_STATE code sets. Only
19 /// UI_WINDOW_EFFECT_SWELL (4) is acted on; its channel types nothing more
20 /// until the swell ends and clears it.
22 /// 0 while a message channel is typing into the window; 1 once its text has
23 /// ended or closed the window, which frees the channel for the next text.
25 u16 flags; ///< UI_WINDOW_ flags; 0 once closing or free
26 /// The zoom's step: counts down from 7 to 0 while opening, and up from 0 to
27 /// duration while closing.
29 s16 duration; ///< frames of the zoom under way; 0 when none
30 u16 previousX; ///< tiles
31 u16 previousY; ///< tiles
32 u16 previousWidth; ///< tiles
33 u16 previousHeight; ///< tiles
34};
35
36STATIC_ASSERT(sizeof(struct UiWindow) == 0x24);
37STATIC_ASSERT(offsetof(struct UiWindow, width) == 8);
38STATIC_ASSERT(offsetof(struct UiWindow, frame) == 0x18);
39STATIC_ASSERT(offsetof(struct UiWindow, previousHeight) == 0x22);
40
41/// A text channel, one of three, which types decoded text into a window a few
42/// characters a frame and runs its control codes.
44 struct UiWindow *work; ///< the window typed into; NULL when free
45 u16 x; ///< pen, 8.8 fixed-point pixels
46 u16 y; ///< pen, 8.8 fixed-point pixels
47 /// Extra advance per line, in 1/256 pixels: after every character in
48 /// Japanese, after a space in the other editions.
50 u16 line; ///< line of the page, indexes spacing; at most 3
51 u16 entry; ///< next code in UiRenderWork.entries
52 u16 countdown; ///< frames left of a pause, a page wait or a swell
53 u16 colour; ///< text colour; 15 by default
54 u16 outline; ///< outline colour; 0 for none
55 u16 lineSpacing; ///< 10 by default
56 u16 transition; ///< frames left of the canvas scrolling up a line
57 u16 startX; ///< pen x each new line returns to, 8.8 fixed-point pixels
58 u16 ended; ///< 1 once a TEXT_END code is reached
59 u16 glyphDelay; ///< frames to wait after a glyph while no button is held
60 u16 flags; ///< nonzero keeps the window's size from page to page
61 u16 unk26; ///< not named by TBS code
62};
63
64STATIC_ASSERT(sizeof(struct UiChannelSlot) == 0x28);
65STATIC_ASSERT(offsetof(struct UiChannelSlot, entry) == 0x12);
66STATIC_ASSERT(offsetof(struct UiChannelSlot, countdown) == 0x14);
67STATIC_ASSERT(offsetof(struct UiChannelSlot, transition) == 0x1c);
69
70/// Requests transfer of the four-row tilemap band containing window row y.
71// A statement macro (S2: a layer, 10 sites): the dirty-row store stays where it
72// is written at every use; as a plain expression, tbs-en differs.
73#define UiRender_MarkRow(render, y) \
74 do { \
75 (render)->dirty |= 2 << ((u32)(y) >> 2); \
76 } while (0)
77
78#endif
The sprite renderer's inputs and outputs: render inputs, OAM attributes and render output lists.
#define STATIC_ASSERT(condition)
C89 permits repeated extern declarations of the same array.
#define offsetof(type, member)
Definition stddef.h:19
A list of render outputs: its first output and the link to append after.
A text channel, one of three, which types decoded text into a window a few characters a frame and run...
Definition uiwindow.h:43
u16 outline
outline colour; 0 for none
Definition uiwindow.h:54
u16 colour
text colour; 15 by default
Definition uiwindow.h:53
u16 y
pen, 8.8 fixed-point pixels
Definition uiwindow.h:46
u16 flags
nonzero keeps the window's size from page to page
Definition uiwindow.h:60
u16 glyphDelay
frames to wait after a glyph while no button is held
Definition uiwindow.h:59
u16 x
pen, 8.8 fixed-point pixels
Definition uiwindow.h:45
u16 spacing[4]
Extra advance per line, in 1/256 pixels: after every character in Japanese, after a space in the othe...
Definition uiwindow.h:49
u16 ended
1 once a TEXT_END code is reached
Definition uiwindow.h:58
u16 transition
frames left of the canvas scrolling up a line
Definition uiwindow.h:56
u16 lineSpacing
10 by default
Definition uiwindow.h:55
u16 unk26
not named by TBS code
Definition uiwindow.h:61
u16 line
line of the page, indexes spacing; at most 3
Definition uiwindow.h:50
u16 startX
pen x each new line returns to, 8.8 fixed-point pixels
Definition uiwindow.h:57
struct UiWindow * work
the window typed into; NULL when free
Definition uiwindow.h:44
u16 entry
next code in UiRenderWork.entries
Definition uiwindow.h:51
u16 countdown
frames left of a pause, a page wait or a swell
Definition uiwindow.h:52
A window: a framed rectangle of the tilemap with its sprite outputs, its opening or closing animation...
Definition uiwindow.h:11
u16 frame
The zoom's step: counts down from 7 to 0 while opening, and up from 0 to duration while closing.
Definition uiwindow.h:28
u16 previousX
tiles
Definition uiwindow.h:30
u16 y
tiles
Definition uiwindow.h:16
u16 effect
The effect a message's TEXT_WINDOW_STATE code sets.
Definition uiwindow.h:21
u16 flags
UI_WINDOW_ flags; 0 once closing or free.
Definition uiwindow.h:25
u16 unk10
1 once opened, 0 once freed; not read by name in TBS
Definition uiwindow.h:17
u16 previousHeight
tiles
Definition uiwindow.h:33
u16 state
0 while a message channel is typing into the window; 1 once its text has ended or closed the window,...
Definition uiwindow.h:24
u16 x
tiles
Definition uiwindow.h:15
u16 height
tiles
Definition uiwindow.h:14
struct RenderOutputList output
the sprites the window carries
Definition uiwindow.h:12
u16 previousY
tiles
Definition uiwindow.h:31
u16 previousWidth
tiles
Definition uiwindow.h:32
u16 width
tiles
Definition uiwindow.h:13
s16 duration
frames of the zoom under way; 0 when none
Definition uiwindow.h:29
signed short s16
Definition types.h:12
unsigned short u16
Definition types.h:13