1 /*---------------------------------------------------------------------------*
2   Project:  TWLSDK - demos - FS - overlay-staticinit
3   File:     mode_3.c
4 
5   Copyright 2007 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:: 2007-11-06 #$
14   $Rev: 2135 $
15   $Author: yosizaki $
16  *---------------------------------------------------------------------------*/
17 
18 #include <nitro.h>
19 #include "mode.h"
20 #include "DEMO.h"
21 
22 // Include this header when NitroStaticInit() is specified as a static initializer.
23 //
24 #include <nitro/sinit.h>
25 
26 /*---------------------------------------------------------------------------*/
27 /* Functions */
28 
29 /*---------------------------------------------------------------------------*
30   Name:         MyUpdateFrame
31 
32   Description:  Updates the internal state by one frame in the current mode.
33 
34   Arguments:    frame_count: Frame count of the current operation
35                 input: Array of input data
36                 player_count: Current number of total players (the number of valid input elements)
37                 own_player_id: Local player number
38 
39   Returns:      Returns FALSE if the current mode ends this frame and TRUE otherwise.
40 
41  *---------------------------------------------------------------------------*/
MyUpdateFrame(int frame_count,const InputData * input,int player_count,int own_player_id)42 static BOOL MyUpdateFrame(int frame_count,
43                           const InputData * input, int player_count, int own_player_id)
44 {
45     (void)frame_count;
46     (void)player_count;
47     return !IS_INPUT_(input[own_player_id], ~0, push);
48 }
49 
50 /*---------------------------------------------------------------------------*
51   Name:         MyDrawFrame
52 
53   Description:  Performs a rendering update based on the internal state in the current mode.
54 
55   Arguments:    frame_count: Frame count of the current operation
56 
57   Returns:      None.
58  *---------------------------------------------------------------------------*/
MyDrawFrame(int frame_count)59 static void MyDrawFrame(int frame_count)
60 {
61     (void)frame_count;
62 }
63 
64 /*---------------------------------------------------------------------------*
65   Name:         MyEndFrame
66 
67   Description:  Ends the current mode.
68 
69   Arguments:    p_next_mode: The ID indicated by this pointer is overwritten when the next mode is specified explicitly.
70                                  In the absence of a particular specification, the mode that called the current mode is selected.
71 
72 
73 
74   Returns:      None.
75  *---------------------------------------------------------------------------*/
MyEndFrame(FSOverlayID * p_next_mode)76 static void MyEndFrame(FSOverlayID *p_next_mode)
77 {
78     (void)p_next_mode;
79 }
80 
81 /*---------------------------------------------------------------------------*
82   Name:         NitroStaticInit
83 
84   Description:  This is an automatic initialization function as a static initializer.
85 
86   Arguments:    None.
87 
88   Returns:      None.
89  *---------------------------------------------------------------------------*/
NitroStaticInit(void)90 static void NitroStaticInit(void)
91 {
92     UpdateFrame = MyUpdateFrame;
93     DrawFrame = MyDrawFrame;
94     EndFrame = MyEndFrame;
95 
96     // Perform the necessary initialization processes for each mode here
97 
98     DEMOFillRect(0, 0, GX_LCD_SIZE_X, GX_LCD_SIZE_Y, DEMO_RGB_CLEAR);
99     DEMOSetBitmapTextColor(GX_RGBA(31, 31, 31, 1));
100     DEMODrawText(0, 10, "%s", __FILE__);
101     DEMODrawText(30, 40, "press any key to return");
102     DEMOSetBitmapTextColor(GX_RGBA(31, 16, 16, 1));
103     DEMODrawText(20, 80, "( no implementations )");
104     DEMO_DrawFlip();
105 }
106