⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 games_help.c

📁 几个嵌入式手机平台小游戏c源代码
💻 C
📖 第 1 页 / 共 3 页
字号:
{
    OP_UINT8 temp_str[50];
    OP_UINT8 str_length;
        
    ds_draw_rect(0, 0, 127, 91,  COLOR_SAP_BLUE);
    ds_fill_rect(1, 1, 126, 90,  COLOR_WHITE_VIOLET);
    ds_draw_line(0, 92, 128, 92, COLOR_SAP_BLUE);
    ds_fill_rect(0, 93, 128, 126,  COLOR_WHITE);

    ds_draw_bitmap_image_rm(0, 0, BMP_CARGADOR_TITLE);
    ds_draw_bitmap_image_rm(44, 38, BMP_CARGADOR_ARROWKEY);
    
    if (RM_GetCurrentLanguage() == RM_LANG_ENG)
        ds_draw_icon_rm(38, 6, ICON_KEYMAP_ENG);
    else if (RM_GetCurrentLanguage() == RM_LANG_CHN)
        ds_draw_icon_rm(38, 6, ICON_KEYMAP_CHN);

    Games_Help_draw_text_rm(5, 45, LCD_MAX_X-1, PMPT_TEXT_MOVE_LEFT, FONT_SIZE_SMALL|FONT_OVERLAP, COLOR_MIDDLE_BLUE, COLOR_TRANS);
    ds_draw_line(33, 57, 43, 57, COLOR_MIDDLE_BLUE);
    
    Games_Help_draw_text_rm(95, 45, LCD_MAX_X-1, PMPT_TEXT_MOVE_RIGHT, FONT_SIZE_SMALL|FONT_OVERLAP, COLOR_MIDDLE_BLUE, COLOR_TRANS);
    ds_draw_line(84, 57, 94, 57, COLOR_MIDDLE_BLUE);
    
    Games_Help_draw_text_rm(75, 27, LCD_MAX_X-1, PMPT_TEXT_MOVE_UP, FONT_SIZE_SMALL|FONT_OVERLAP, COLOR_MIDDLE_BLUE, COLOR_TRANS);
    ds_draw_line(63, 38, 63, 33, COLOR_MIDDLE_BLUE);
    ds_draw_line(63, 33, 74, 33, COLOR_MIDDLE_BLUE);
    
    ds_draw_line(63, 78, 63, 83, COLOR_MIDDLE_BLUE);
    ds_draw_line(60, 83, 63, 83, COLOR_MIDDLE_BLUE);
    util_cnvrt_res_into_text(PMPT_TEXT_MOVE_DOWN, temp_str);
    str_length = (OP_INT8)ds_get_string_width(temp_str, FONT_SIZE_SMALL);
    Games_Help_draw_text_rm((OP_INT16)(60-str_length), 
                                                    77, 
                                                    LCD_MAX_X-1, 
                                                    PMPT_TEXT_MOVE_DOWN, 
                                                    FONT_SIZE_SMALL|FONT_OVERLAP, COLOR_MIDDLE_BLUE, 
                                                    COLOR_TRANS
                                                    );

    
    ds_draw_line(70, 57, 72, 57, COLOR_MIDDLE_BLUE);
    ds_draw_line(72, 57, 72, 83, COLOR_MIDDLE_BLUE);
    ds_draw_line(72, 83, 78, 83, COLOR_MIDDLE_BLUE);
    Games_Help_draw_text_rm(79, 77, LCD_MAX_X-1, PMPT_TEXT_UNDO, FONT_SIZE_SMALL|FONT_OVERLAP, COLOR_MIDDLE_BLUE, COLOR_TRANS);

    Games_Help_draw_text_rm(4, 95, LCD_MAX_X-1, PMPT_MSG_SOFT_LEFT, FONT_SIZE_SMALL|FONT_OVERLAP, COLOR_VIOLET_PALE, COLOR_TRANS);
    
    Games_Help_draw_text_rm(4, 111, LCD_MAX_X-1, PMPT_TEXT_REFRESH_STAGE, FONT_SIZE_SMALL|FONT_OVERLAP, COLOR_BLACK, COLOR_TRANS);
    
   
}
#endif

/*==================================================================================================
    FUNCTION: Games_Help_Gopher_keymap

    DESCRIPTION:
        Description of this specific function.

    ARGUMENTS PASSED:

    RETURN VALUE:

    IMPORTANT NOTES:
        
==================================================================================================*/
#ifdef GAMES_GOPHER
static void Games_Help_Gopher_keymap(void)
{
    ds_draw_rect(0, 0, 127, 125,  _RGB(51, 153, 255));
    ds_draw_line(0, 126, 127, 126, _RGB(51, 153, 255));
    ds_fill_rect(1, 1, 126, 124,  COLOR_LEMON_YELLOW);

    ds_draw_bitmap_image_rm(0, 0, BMP_GOPHER_TITLE);
    ds_draw_bitmap_image_rm(7, 30, BMP_GOPHER_IMAGE1);
    ds_draw_bitmap_image_rm(7, 51, BMP_GOPHER_IMAGE2);
    ds_draw_bitmap_image_rm(7, 88, BMP_GOPHER_IMAGE3);
    
    if (RM_GetCurrentLanguage() == RM_LANG_ENG)
        ds_draw_icon_rm(38, 6, ICON_KEYMAP_ENG);
    else if (RM_GetCurrentLanguage() == RM_LANG_CHN)
        ds_draw_icon_rm(38, 6, ICON_KEYMAP_CHN);


    ds_draw_rect(55, 46, 122, 109,  COLOR_ORANGE); 

    Games_Help_draw_text_rm(59, 57, 121, PMPT_TEXT_PRESS, FONT_SIZE_SMALL|FONT_OVERLAP, COLOR_CARMINE, COLOR_TRANS);

    Games_Help_draw_text_rm(59, 69, 121, PMPT_TEXT_MATCHING_KEY, FONT_SIZE_SMALL|FONT_OVERLAP, COLOR_DARK_YELLOW, COLOR_TRANS);
}
#endif

/*==================================================================================================
    FUNCTION: Games_Help_Fruit_keymap

    DESCRIPTION:
        Description of this specific function.

    ARGUMENTS PASSED:

    RETURN VALUE:

    IMPORTANT NOTES:
        
==================================================================================================*/
#ifdef GAMES_FRUIT
static void Games_Help_Fruit_keymap(void)
{
#if 0
    ds_draw_rect(0, 0, 127, 125,  _RGB(51, 153, 255));
    ds_draw_line(0, 126, 127, 126, _RGB(51, 153, 255));
    ds_fill_rect(1, 1, 126, 124,  COLOR_LEMON_YELLOW);

    ds_draw_bitmap_image_rm(0, 0, BMP_GOPHER_TITLE);
    ds_draw_bitmap_image_rm(7, 30, BMP_GOPHER_IMAGE1);
    ds_draw_bitmap_image_rm(7, 51, BMP_GOPHER_IMAGE2);
    ds_draw_bitmap_image_rm(7, 88, BMP_GOPHER_IMAGE3);
    
    if (RM_GetCurrentLanguage() == RM_LANG_ENG)
        ds_draw_icon_rm(38, 6, ICON_KEYMAP_ENG);
    else if (RM_GetCurrentLanguage() == RM_LANG_CHN)
        ds_draw_icon_rm(38, 6, ICON_KEYMAP_CHN);


    ds_draw_rect(55, 46, 122, 109,  COLOR_ORANGE); 

    Games_Help_draw_text_rm(59, 57, 121, PMPT_TEXT_PRESS, FONT_SIZE_SMALL|FONT_OVERLAP, COLOR_CARMINE, COLOR_TRANS);

    Games_Help_draw_text_rm(59, 69, 121, PMPT_TEXT_MATCHING_KEY, FONT_SIZE_SMALL|FONT_OVERLAP, COLOR_DARK_YELLOW, COLOR_TRANS);
#endif
}
#endif

/*==================================================================================================
    FUNCTION: Games_Help_Huarong_keymap

    DESCRIPTION:
        Description of this specific function.

    ARGUMENTS PASSED:

    RETURN VALUE:

    IMPORTANT NOTES:
        
==================================================================================================*/
#ifdef GAMES_HUARONG
static void Games_Help_Huarong_keymap(void)
{
#if 0
    OP_UINT8 temp_str[50];
    
    ds_draw_rect(0, 0, 127, 125,  COLOR_SAP_GREEN);
    ds_draw_line(0, 126, 127, 126, COLOR_SAP_GREEN);
    ds_fill_rect(1, 1, 126, 124,  COLOR_LEMON_YELLOW);

    ds_draw_bitmap_image_rm(0, 0, BMP_GOPHER_TITLE);
    if (RM_GetCurrentLanguage() == RM_LANG_ENG)
        ds_draw_icon_rm(38, 6, ICON_KEYMAP_ENG);
    else if (RM_GetCurrentLanguage() == RM_LANG_CHN)
        ds_draw_icon_rm(38, 6, ICON_KEYMAP_CHN);



    AtoU(temp_str, (OP_UINT8 *)"To be\ndetermined...");
    Games_Help_draw_text(20, 20, 121, temp_str, FONT_SIZE_MED|FONT_OVERLAP, COLOR_CARMINE, COLOR_TRANS);
#endif
}
#endif

/*==================================================================================================
    FUNCTION: Games_Help_Lightup_keymap

    DESCRIPTION:
        Description of this specific function.

    ARGUMENTS PASSED:

    RETURN VALUE:

    IMPORTANT NOTES:
        
==================================================================================================*/
#ifdef GAMES_LIGHTUP
static void Games_Help_Lightup_keymap(void)
{
#if 0
    OP_UINT8 temp_str[50];
    
    ds_draw_rect(0, 0, 127, 125,  COLOR_SAP_GREEN);
    ds_draw_line(0, 126, 127, 126, COLOR_SAP_GREEN);
    ds_fill_rect(1, 1, 126, 124,  COLOR_LEMON_YELLOW);

    ds_draw_bitmap_image_rm(0, 0, BMP_GOPHER_TITLE);
    if (RM_GetCurrentLanguage() == RM_LANG_ENG)
        ds_draw_icon_rm(38, 6, ICON_KEYMAP_ENG);
    else if (RM_GetCurrentLanguage() == RM_LANG_CHN)
        ds_draw_icon_rm(38, 6, ICON_KEYMAP_CHN);


    AtoU(temp_str, (OP_UINT8 *)"To be\ndetermined...");
    Games_Help_draw_text(20, 20, 121, temp_str, FONT_SIZE_MED|FONT_OVERLAP, COLOR_CARMINE, COLOR_TRANS);
#endif
}
#endif



/*==================================================================================================
    FUNCTION: Games_Help_draw_text 

    DESCRIPTION:
        Draw text in the specified area and position accroding to the given atttibutes. 
        If the text exceeds the end of a line, it wil be auto-wrpped to the next line of the area.
        Text exceeds longer than given buffer (area) is truncated.

        The height of every line equals to the font height

    ARGUMENTS PASSED:

    RETURN VALUE:

    IMPORTANT NOTES:

==================================================================================================*/
void Games_Help_draw_text 
(
    OP_INT16           x,
    OP_INT16           y,
    OP_INT16           xlimit,
    OP_UINT8           *text,
    DS_FONTATTR        fontattr,
    DS_COLOR           fontcolor,
    DS_COLOR           backcolor
)
{
    OP_INT16       coffset;          /* number of the processed character by draw_text_line */
    OP_UINT8       *next_text;       /* it is updated by draw_text_line to point to next character to be
                                        processed as a next line */

    OP_BOOLEAN     first_line = OP_TRUE;
    OP_UINT8 line_height;
    OP_UINT8    font_width,font_height;
    DS_FONT_ID  chn_fontid,eng_fontid;
    SCRNAREA_ENUM_T    drawing_area;

    font_get_font_id(fontattr,&eng_fontid,&chn_fontid);
    /*
     * Get font sizes - font height is the same for both ascii and chiness 
     */
    if(font_get_font_size(eng_fontid,&font_width,&font_height) == OP_TRUE && y>=0)
    {
        line_height = font_height;  

        next_text = text;
        coffset   = 0;

        switch(ds.scrnMode)
        {
            case SCREEN_FULL_IMAGE:
               drawing_area = AREA_BITMAP;
               break;
            case SCREEN_GENERAL_BG:
            case SCREEN_FUNC_BG:
            case SCREEN_IDLE:
            case SCREEN_OWNERDRAW:
            case SCREEN_MAINMENU:
            case SCREEN_MENU:
            case SCREEN_LIST:
            case SCREEN_FUNC:
            case SCREEN_GENERAL:
            case SCREEN_PLAIN_TEXT:
               drawing_area = AREA_TEXT;
               break;
            default :
                drawing_area = AREA_TEXT;
                break;
        }

        do 
        {
            coffset = draw_text_line (drawing_area, x, y, xlimit, next_text, first_line, 
                                              fontattr, fontcolor, backcolor );
            next_text += coffset;
            y += line_height;    
            first_line = OP_FALSE;
        } while ((IS_NOT_NULL_STRING(next_text)) && (coffset != 0));
    }
}

/*==================================================================================================
    FUNCTION: Games_Help_draw_text_rm 

    DESCRIPTION:
        Draw text in the specified area and position accroding to the given atttibutes. 
        If the text exceeds the end of a line, it wil be auto-wrpped to the next line of the area.
        Text exceeds longer than given buffer (area) is truncated.

        The height of every line equals to the font height

    ARGUMENTS PASSED:

    RETURN VALUE:

    IMPORTANT NOTES:

==================================================================================================*/
void Games_Help_draw_text_rm 
(
    OP_INT16           x,
    OP_INT16           y,
    OP_INT16           xlimit,
    RM_RESOURCE_ID_T    res_id,
    DS_FONTATTR        fontattr,
    DS_COLOR           fontcolor,
    DS_COLOR           backcolor
)
{
    OP_UINT8    text_str[DS_SCRN_MAX_UC_LEN*DS_SCRN_CHIGH+2];
    if (util_cnvrt_res_into_text(res_id,text_str) != OP_NULL)
    {
        Games_Help_draw_text(x, y, xlimit, text_str, fontattr, fontcolor, backcolor);
    }
}


/*==================================================================================================
    GLOBAL FUNCTIONS
==================================================================================================*/

/*================================================================================================*/

#ifdef __cplusplus
}
#endif

⌨️ 快捷键说明

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