/*---------------------------------------------------------------------------*
  Project:  NITRO-System - build - demos - mcs - basic - nitro
  File:     nns_util.h

  Copyright 2005 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: nns_util.h,v $
  Revision 1.1  01/20/2005 04:44:44  kitamurs
  Initial Version

  $NoKeywords: $
 *---------------------------------------------------------------------------*/

#ifndef NNS_UTIL_H_
#define NNS_UTIL_H_

#include <nitro.h>
#include <nnsys/fnd.h>


#ifdef __cplusplus
extern "C" {
#endif

typedef struct
{
    u16     trigger;
    u16     release;
    u16     button;
}
GamePad;

extern GamePad          gGamePad;
extern NNSFndHeapHandle gAppHeap;       // Application heap


#define IS_TRIGGER(key)     (gGamePad.trigger & key)
#define IS_RELEASE(key)     (gGamePad.release & key)
#define IS_PRESS(key)       (gGamePad.button  & key)


#define ROUND_UP(value, alignment) \
    (((u32)(value) + (alignment-1)) & ~(alignment-1))

#define ROUND_DOWN(value, alignment) \
    ((u32)(value) & ~(alignment-1))


void            ReadGamePad(void);
void            InitMemory(void);
void            LoadPicture(void);


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

// NNS_UTIL_H_
#endif

