1 /*---------------------------------------------------------------------------*
2   Project:  TWLSDK - demos - FS - overlay-staticinit
3   File:     mode.h
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 #if	!defined(NITRO_DEMOS_FS_OVERLAY_STATICINIT_MODE_H_)
18 #define NITRO_DEMOS_FS_OVERLAY_STATICINIT_MODE_H_
19 
20 
21 #include <nitro.h>
22 
23 
24 // Defines the overlay interface for each mode.
25 // These are self-configured by the overlay's static initializer.
26 
27 
28 #ifdef __cplusplus
29 extern  "C" {
30 #endif
31 
32 
33 /*---------------------------------------------------------------------------*/
34 /* Declarations */
35 
36 // Input information structure
37 typedef struct InputData
38 {
39     TPData  tp;
40     u16     push_bits;              // The key bit at the moment of the press
41     u16     hold_bits;              // The key bit of the state being pressed
42     u16     release_bits;           // The key bit at the moment of the release
43     u16     reserved;
44 }
45 InputData;
46 
47 
48 /*---------------------------------------------------------------------------*/
49 /* Constants */
50 
51 // Proprietary expanded bit that displays the stylus touch state
52 #define PAD_BUTTON_TP   0x4000
53 
54 
55 /*---------------------------------------------------------------------------*/
56 /* functions */
57 
58 // The state determination macro for the designated key
59 #define	IS_INPUT_(input, key, action)	\
60 	(((input).action ## _bits & (key)) != 0)
61 
62 
63 /*---------------------------------------------------------------------------*
64   Name:         UpdateFrame
65 
66   Description:  Updates the internal state by only one frame in the current mode.
67 
68   Arguments:    frame_count      Frame count for the current operation.
69                 input            Input information array.
70                 player_count     Current number of players (number of valid input elements)
71                 own_player_id    This system's player number
72 
73   Returns:      Returns FALSE if the current mode ends this frame and TRUE otherwise.
74 
75  *---------------------------------------------------------------------------*/
76 extern BOOL (*UpdateFrame) (int frame_count,
77                             const InputData * input, int player_count, int own_player_id);
78 
79 /*---------------------------------------------------------------------------*
80   Name:         DrawFrame
81 
82   Description:  Updates rendering based on the internal state in the current mode.
83 
84   Arguments:    frame_count      Frame count for the current operation.
85 
86   Returns:      None.
87  *---------------------------------------------------------------------------*/
88 extern void (*DrawFrame) (int frame_count);
89 
90 /*---------------------------------------------------------------------------*
91   Name:         EndFrame
92 
93   Description:  Ends the current mode.
94 
95   Arguments:    p_next_mode      When the next mode will be specified explicitly, the ID will overwrite the value indicated by this pointer.
96 
97                                  If no mode is specified, the mode that called the current mode will be selected.
98 
99 
100   Returns:      None.
101  *---------------------------------------------------------------------------*/
102 extern void (*EndFrame) (FSOverlayID *p_next_mode);
103 
104 
105 #ifdef __cplusplus
106 }   // extern "C"
107 #endif
108 
109 
110 #endif  // NITRO_DEMOS_FS_OVERLAY_STATICINIT_MODE_H_
111