game_app.h

来自「AMLOGIC DPF source code」· C头文件 代码 · 共 191 行

H
191
字号
/** @file
 */

/*************************************************************************
**                                                                      **
**  Copyright (C) 1999 Amlogic,Inc.                                     **
**  All rights reserved                                                 **
**      Filename : game_app.h / Project: AVOS                           **
**      Revision : 1.0                                                  **
**                                                                      **
*************************************************************************/
#ifndef _GAMEAPP_H_
#define _GAMEAPP_H_

/** 
 * Callback function, perform customer "key" processing. 
 *
 * @param[in] arg Remote key code.
 *
 * @see nec_key.h
 * @see INT32S ListenOnKeyPress(INT16U key_code, GAME_CALLBACK upCall);
 */
typedef void (*GAME_CALLBACK)(INT32U arg);

typedef struct _rect_s GAME_RECT;

#ifndef __ROM_
    #define M_GAME_DIAG(x)                 \
    {                                      \
        AVSchedLock();                     \
        printf x;                          \
        AVSchedUnlock();                   \
    }
#else
    #define M_GAME_DIAG(x)
#endif

#define M_AtoN(x) (x>96?(x-87):(x>64?(x-55):(x-48)))

#define KEY_NUM 0xff

/* OSD screen size in pixel, for temporarily use*/
#define OSD_START_X	0
#define OSD_START_Y	0
#define OSD_WIDTH	600
#define OSD_HEIGHT	400

GAME_CALLBACK Key_Callback[KEY_NUM];

/** Initial Key callback function */
INT32S InitGame(void);

/** NULL by now */
INT32S ExitGame(void);

/**
 * Bind customer "key" processing routine to an async event. 
 *
 * @param[in] key_code Remote key code.
 * @param[in] upCall Function called perform customer "key"
 *               processing.
 *
 * @return Binding status.
 * - -1. Fails.
 * - Other. Succeeds
 *
 * @see nec_key.h
 */
INT32S ListenOnKeyPress(INT16U key_code, GAME_CALLBACK upCall);

/**
 * Create a buffer based on OSD screen information which is set by system,
 * user can get those information via function GetOSDScreenInfo.
 *
 * @param[in] layerspec Screen parameter for later use, now it should be zero
 *
 * @return GAME_RECT structure pointer.
 * - NULL. Fails.
 * - Other. Succeeds
 *
 * @see void GetOSDScreenInfo(INT32U *xsize, INT32U *ysize, INT32U *color, INT32U *video_type)
 *
 */
GAME_RECT *CreateScreen(INT32U layerspec);

/**
 * Free screen buffer 
 *
 * @param[in] scrid Screen pointer.
 *
 */
void DestroyScreen(GAME_RECT *scrid);

/**
 * Create a buffer based on Bitmap size and layerspec information 
 *
 * @param[in] xsize Bitmap width in pixel.
 * @param[in] ysize Bitmap height in pixel.
 * @param[in] layerspec Screen parameter for later use, now it should be zero
 *
 * @return GAME_RECT structure pointer.
 * - NULL. Fails.
 * - Other. Succeeds
 *
 */
GAME_RECT *CreateSprite(COORD xsize, COORD ysize, INT32U layerspec);

/**
 * Free sprite buffer 
 *
 * @param[in] scrid Screen pointer.
 *
 */
void DestroySprite(GAME_RECT *spritePtr);

/**
 * Load RLE uncompressed format bitmap file into spride buffer
 *
 * @param[in] spritePtr Sprite pointer.
 * @param[in] name RLE Bitmap file name
 *
 * @note bitmap and spride must be the same size, there is no validation 
 *  in this function since no size information in bitmap file.
 *
 * @return Loading status
 * - -1. Fails.
 * - Other. Succeeds
 *
 */
INT32S LoadRLEBitmapToSprite(GAME_RECT *spritePtr, const char *name);

/**
 * Load specified area from spride buffer to screen buffer
 *
 * @param[in] spritePtr Source sprite pointer.
 * @param[in] x_src Start x pixel on sprite
 * @param[in] y_src Start y pixel on sprite
 * @param[in] x_dest Start x pixel on Screen
 * @param[in] y_dest Start y pixel on Screen
 * @param[in] xsize Width of copy area in pixel
 * @param[in] ysize height of copy area in pixel
 * @param[in] scrid Destination Screen pointer.
 *
 *
 * @return Loading status
 * - -1. Fails.
 * - Other. Succeeds
 *
 */
INT32S DrawSprite(GAME_RECT *spritePtr, COORD x_src, COORD y_src, COORD x_dest,
           COORD y_dest, COORD xsize, COORD ysize, GAME_RECT *scrid);

/** 
 * Display screen
 *
 * @param[in] scrid Screen to be displayed.
 *
 * @return Display status
 * - -1. Fails.
 * - Other. Succeeds
 *
 */
INT32S SetActiveScreen(GAME_RECT *scrid);

/**
 * Return current OSD screen information which is set by system 
 *
 * @param[out] xsize Screen width in pixel.
 * @param[out] ysize Screen height in pixel.
 * @param[out] color Screen color depth. 4: 4 colors; 16: 16 colors; 256: 256 colors; other: reserved
 * @param[out] video_type System video type. 0: progressive; 1: interlace; other: reserved
 *
 */
void GetOSDScreenInfo(INT32U *xsize, INT32U *ysize, INT32U *color, INT32U *video_type);

/**
 * Get current value of 32-bit clock ticks, 1000ticks = 1second
 *
 * @return current clock ticks
 *
 */
INT32U GetTimeTicks(void);

/**
 * Set the palette section and alpha blending mask section to the
 * passed palette entries
 *
 */
void SetPalette(YUVENTRY mask_para[4], YUVENTRY palette_para[16]);

#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?