/*---------------------------------------------------------------------------*
  Project:  NitroSDK - MB - demos - multiboot-Model
  File:     common.h

  Copyright 2003,2004 Nintendo.  All rights reserved.

  These coded instructions, statements, and computer programs contain
  proprietary information of Nintendo of America Inc. and/or Nintendo
  Company Ltd., and are protected by Federal copyright law.  They may
  not be disclosed to third parties or copied or duplicated in any form,
  in whole or in part, without the prior written consent of Nintendo.

  $Log: common.h,v $
  Revision 1.1  2004/09/16 14:07:11  takano_makoto
  Initial Update

  $NoKeywords: $
 *---------------------------------------------------------------------------*/
#ifndef MB_DEMO_COMMON_H_
#define MB_DEMO_COMMON_H_

#ifdef __cplusplus
extern "C" {
#endif

#include <nitro.h>

//============================================================================
//  Function Declaration 
//============================================================================

void CommonInit();
void ReadKey( void );
u16  GetPressKey( void );
u16  GetTrigKey( void );
void InitAllocateSystem( void );

/*---------------------------------------------------------------------------*
  Name:         IS_PAD_PRESS

  Description:  Key determination 

  Arguments:    Flag for the key to be determined 

  Returns:      TRUE if the specified key has been pushed 
                FALSE otherwise 
 *---------------------------------------------------------------------------*/
static inline BOOL IS_PAD_PRESS( u16 flag )
{
    return ( GetPressKey() & flag ) == flag;
}

/*---------------------------------------------------------------------------*
  Name:         IS_PAD_TRIGGER

  Description:  Key trigger determination 

  Arguments:    Flag for the key to be determined 

  Returns:      TRUE if the specified key trigger is up 
                FALSE otherwise 
 *---------------------------------------------------------------------------*/
static inline BOOL IS_PAD_TRIGGER( u16 flag )
{
    return ( GetTrigKey() & flag ) == flag;
}


#ifdef __cplusplus
}/* extern "C" */
#endif

#endif // MB_DEMO_COMMON_H_

