1 /*---------------------------------------------------------------------------*
2   Project:  TwlSDK - MB - demos - multiboot-PowerSave
3   File:     dispfunc.h
4 
5   Copyright 2006-2008 Nintendo. All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain
8   proprietary information of Nintendo of America Inc. and/or Nintendo
9   Company Ltd., and are protected by Federal copyright law. They may
10   not be disclosed to third parties or copied or duplicated in any form,
11   in whole or in part, without the prior written consent of Nintendo.
12 
13   $Date:: 2008-09-18#$
14   $Rev: 8573 $
15   $Author: okubata_ryoma $
16  *---------------------------------------------------------------------------*/
17 
18 #if !defined(NITROSDK_DEMOS_MB_MULTIBOOT_POWERSAVE_DISPFUNC_H_)
19 #define NITROSDK_DEMOS_MB_MULTIBOOT_POWERSAVE_DISPFUNC_H_
20 
21 
22 #ifdef SDK_TWL
23 #include	<twl.h>
24 #else
25 #include	<nitro.h>
26 #endif
27 
28 
29 /*****************************************************************************/
30 /* Constants */
31 
32 /* Palette color for text */
33 enum
34 {
35     WHITE,
36     RED,
37     GREEN,
38     BLUE,
39     YELLOW,
40     CYAN,
41     PURPLE,
42     LIGHT_GREEN,
43     HI_YELLOW,
44     HI_CYAN,
45     HI_WHITE,
46     HI_BLUE,
47     HI_PURPLE,
48     HI_LIGHT_GREEN,
49     BROWN,
50     HI_BROWN,
51     COLOR_NUM
52 };
53 
54 
55 /*****************************************************************************/
56 /* Functions */
57 
58 /*---------------------------------------------------------------------------*
59   Name:         BgInit
60 
61   Description:  Initializes BG for display of strings.
62 
63   Arguments:    None.
64 
65   Returns:      None.
66  *---------------------------------------------------------------------------*/
67 void    BgInit(void);
68 
69 /*---------------------------------------------------------------------------*
70   Name:         BgClear
71 
72   Description:  Initializes BG screen of the main screen so that all chars are set to 0.
73 
74   Arguments:    None.
75 
76   Returns:      None.
77  *---------------------------------------------------------------------------*/
78 void    BgClear(void);
79 
80 /*---------------------------------------------------------------------------*
81   Name:         BgUpdate
82 
83   Description:  Reflects BG screen in real memory.
84 
85   Arguments:    None.
86 
87   Returns:      None.
88  *---------------------------------------------------------------------------*/
89 void    BgUpdate(void);
90 
91 /*---------------------------------------------------------------------------*
92   Name:         BgPutString
93 
94   Description:  Displays ASCII characters horizontally from BG's specified grid.
95 
96   Arguments:    x                Upper-left x grid to display. (8 pixel units)
97                 x                Upper-left y grid to display. (8 pixel units)
98                 pal              Palette number. (0-15)
99                 str              ASCII string to display.
100                 len              Length of string to display.
101                                  If str contains a null character in a location less than len, length up to that position is used.
102 
103 
104   Returns:      None.
105  *---------------------------------------------------------------------------*/
106 void    BgPutString(int x, int y, int pal, const char *str, int len);
107 
108 /*---------------------------------------------------------------------------*
109   Name:         BgPrintf
110 
111   Description:  Displays formatted ASCII string horizontally from BG's specified grid.
112 
113   Arguments:    x                Upper left x grid to display. (8 pixel units)
114                 x                Upper left y grid to display. (8 pixel units)
115                 pal              Palette number. (0-15)
116                 str              ASCII string to display.
117                                  The supported format is that of OS_VSNPrintf().
118 
119   Returns:      None.
120  *---------------------------------------------------------------------------*/
121 void    BgPrintf(int x, int y, int pal, const char *str, ...);
122 
123 /*---------------------------------------------------------------------------*
124   Name:         BgPutChar
125 
126   Description:  Displays a string on the BG specification grid.
127 
128   Arguments:    x                Upper left x grid to display. (8 pixel units)
129                 x                Upper left y grid to display. (8 pixel units)
130                 pal              Palette number. (0-15)
131                 c                BG character number to be displayed.
132 
133   Returns:      None.
134  *---------------------------------------------------------------------------*/
BgPutChar(int x,int y,int pal,int c)135 static  inline void BgPutChar(int x, int y, int pal, int c)
136 {
137     const char tmp = (char)c;
138     BgPutString(x, y, pal, &tmp, 1);
139 }
140 
141 /*---------------------------------------------------------------------------*
142   Name:         BgSetMessage
143 
144   Description:  Displays string at the (4, 22) position of both main and sub screens.
145 
146   Arguments:    pal              Palette number. (0-15)
147                 str              ASCII string to display.
148                                  The supported format is that of OS_VSNPrintf().
149 
150   Returns:      None.
151  *---------------------------------------------------------------------------*/
152 void    BgSetMessage(int pal, const char *str, ...);
153 
154 
155 #endif /* NITROSDK_DEMOS_MB_MULTIBOOT_POWERSAVE_DISPFUNC_H_ */
156