




已阅读5页,还剩9页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
MTK上开发的游戏源代码-推箱子去掉了数据部分和内核。,留下了框架供大家学习MTK平台开发。#include GlobalDefs.h#include HistoryGprot.h#include GlobalConstants.h#include MMI_features.h#include PixtelDataTypes.h#include Unicodexdcl.h#include gui.h#include Calculator.h#include SettingProfile.h#include ProfileGprots.h#include Globaldefs.h#include CustDataRes.h#include gui_themes.h#include wgui_categories.h#include wgui_softkeys.h#include HistoryGprot.h#include OrganizerDef.h#include GameDefs.h#define MTK_GUANSHU 40#define PUSH_LCD_WIDTH176#define PUSH_LCD_HEIGHT 220static const char MTK_DATAMTK_GUANSHU80 = 1,1,1,1,1,1,1,1,1,1, 1,0,0,0,1,3,0,1,1,1, 1,3,0,0,2,0,0,1,1,1, 1,1,2,1,1,0,0,1,1,1,1,0,0,1,1,2,1,1,1,1, 1,0,0,4,0,0,0,1,1,1, 1,0,3,1,0,0,0,1,1,1, 1,1,1,1,1,1,1,1,1,1;typedef struct INT16 X; INT16 Y; MTK_POS;typedef struct UINT8 Data1; UINT8 Data2; MTK_sg_PUSHBOXSTRUCT;static MTK_sg_PUSHBOXSTRUCT g_Pushbox;static char Config_Passs=1;enum PushSharp_Blank, PushSharp_Bar , PushSharp_Box, PushSharp_Goal , PushSharp_Boxer, PushSharp_Oke_PushSharp;void Game_Push_Null(void)return;/*Name:CalculateDesc: Calculate the current position of the block Return: no return valueAuthor: helloworld*/static void Game_Push_Calculate( UINT8 val )UINT8 row;UINT8 col;/kal_prompt_trace(MOD_MMI, nPush-Game_Push_Calculate,val=%d n, val);row = val/10;col = val - row * 10;kal_prompt_trace(MOD_MMI, nPush-Game_Push_Calculate,row=%d, col=%dn,row,col);g_Pushbox.BoxPos.X = 15 * col + 14;g_Pushbox.BoxPos.Y = 15 * row + 24;static void UIFDrawBitmap(S32 offset_x, S32 offset_y, U16 image_id) /kal_prompt_trace(MOD_MMI, nPush-UIFDrawBitmap, image_id=%dn, image_id);pixtel_UI_lock_double_buffer();/pixtel_UI_reset_clip();pixtel_UI_show_image(offset_x,(offset_y +20),(UI_image_type)GetImage(image_id);pixtel_UI_unlock_double_buffer();pixtel_UI_BLT_double_buffer(0,0,PUSH_LCD_WIDTH,PUSH_LCD_HEIGHT);static short Game_Push_Itou(short *pOutStr,long InNum)/ 0: ox0030char NumString10;short i,j;short NumLen;/ 位数memset(NumString,0,10);kal_prompt_trace(MOD_MMI, nPush-Game_Push_Itoa, InNum=%dn, InNum); if(NULL=pOutStr)return; if(InNum/1000000 0)/ to longreturn;if(InNum/100000 0)NumLen=6;else if(InNum/10000 0)NumLen=5;else if(InNum/1000 0)NumLen=4;else if(InNum/100 0)NumLen=3;else if(InNum/10 0)NumLen=2;elseNumLen=1;for(i=NumLen;i0;i-)if(1=i) NumString0= InNum%10 +0;else if(2=i) NumStringi-1= (InNum/10)%10 +0;else if(3=i) NumStringi-1= (InNum/100)%10 +0;else if(4=i) NumStringi-1= (InNum/1000)%10 +0;else if(5=i) NumStringi-1= (InNum/10000)%10 +0;pOutStrNumLen-i= NumStringi-1;kal_prompt_trace(MOD_MMI, nPush-Game_Push_Itoa, =%dn, pOutStrNumLen-i);kal_prompt_trace(MOD_MMI, nPush-Game_Push_Itoa, len=%dn,NumLen);return j;const color PushTextColor = 0,0,100,100;static void Game_Push_DrawString(void)#define REC_POS_X 1#define REC_POS_Y 170#define REC_POS_W 176#define REC_POS_H 50S32 w;short Psss_uncode10, Step_uncode10;memset(Psss_uncode,0,10);memset(Step_uncode,0,10);Game_Push_Itou(Psss_uncode, (long)Config_Passs);Game_Push_Itou(Step_uncode, (long)g_Pushbox.step);pixtel_UI_lock_double_buffer();pixtel_UI_set_font(&MMI_medium_font);pixtel_UI_set_text_color(PushTextColor);pixtel_UI_reset_clip();pixtel_UI_reset_text_clip();pixtel_UI_move_text_cursor( 63, 185);pixtel_UI_print_text(UI_string_type)Psss_uncode);UIFDrawBitmap( 145, (185 -20) ,IMG_ID_PUSH_BOX_SMALL_BKG);UIFDrawBitmap( 155, (185 -20) ,IMG_ID_PUSH_BOX_SMALL_BKG);pixtel_UI_move_text_cursor( 145, 185);pixtel_UI_print_text(UI_string_type)Step_uncode);pixtel_UI_unlock_double_buffer();pixtel_UI_BLT_double_buffer(REC_POS_X, REC_POS_Y, REC_POS_X + REC_POS_W, REC_POS_Y + REC_POS_H);return;/ service for FirstDraw and commonDrawstatic void Game_Push_Draw(INT8 i )Game_Push_Calculate( i );kal_prompt_trace(MOD_MMI, nPush-Game_Push_Draw, drawID=%d, posX=%d, posY=%dn, g_Pushbox.tempbox, g_Pushbox.BoxPos.X, g_Pushbox.BoxPos.Y);switch( g_Pushbox.tempbox )case 0: /为空时根本就不用画. 让他显示背景,(不行! 还是要画) UIFDrawBitmap( g_Pushbox.BoxPos.X, g_Pushbox.BoxPos.Y, IMG_ID_PUSH_BOX_BLANK); break;case 1: UIFDrawBitmap( g_Pushbox.BoxPos.X, g_Pushbox.BoxPos.Y, IMG_ID_PUSH_BOX_BAR); break;case 2: UIFDrawBitmap( g_Pushbox.BoxPos.X, g_Pushbox.BoxPos.Y, IMG_ID_PUSH_BOX_BOX); break;case 3:/*这是个傻办法, 以保证用24. 但又不露出背景. 挖空背景后, 仍要用, 因为推走box后,要立即将其覆盖掉 */ UIFDrawBitmap( g_Pushbox.BoxPos.X, g_Pushbox.BoxPos.Y,IMG_ID_PUSH_BOX_GOAL); break;case 4: UIFDrawBitmap( g_Pushbox.BoxPos.X, g_Pushbox.BoxPos.Y, IMG_ID_PUSH_BOX_BOXER); break;case 5: UIFDrawBitmap( g_Pushbox.BoxPos.X, g_Pushbox.BoxPos.Y,IMG_ID_PUSH_BOX_OK); break;case 6: UIFDrawBitmap( g_Pushbox.BoxPos.X, g_Pushbox.BoxPos.Y, IMG_ID_PUSH_BOX_BOXER ); break;case 7: UIFDrawBitmap( g_Pushbox.BoxPos.X, g_Pushbox.BoxPos.Y, IMG_ID_PUSH_BOX_SMALL_BKG ); break;default: break;static void Game_Push_FirstDraw(void)short i;pixtel_UI_lock_double_buffer();pixtel_UI_reset_clip();clear_screen();UIFDrawBitmap( 0, 0,IMG_ID_PUSH_BOX_BKG); /大背景for( i = 0; i 80; i+ )Game_Push_Draw( i );Game_Push_DrawString();pixtel_UI_unlock_double_buffer();pixtel_UI_BLT_double_buffer(0,0,PUSH_LCD_WIDTH,PUSH_LCD_HEIGHT); static void Game_Push_ComonDraw(void)Game_Push_Draw( g_Pushbox.BeforeBoxer );Game_Push_Draw( g_Pushbox.Boxer );Game_Push_Draw( g_Pushbox.AfterBoxer );static void Game_Push_Ini(void)/开局short i;g_Pushbox.over = FALSE;g_Pushbox.goalnum = 0;g_Pushbox.I = 0;g_Pushbox.step = 0;for( i = 0; i MTK_GUANSHU )Config_Passs = 1;DisplayConfirm( STR_GLOBAL_YES, IMG_GLOBAL_YES, STR_GLOBAL_NO, IMG_GLOBAL_NO, get_string(STR_GAME_RESUME),IMG_GLOBAL_QUESTION, WARNING_TONE);SetRightSoftkeyFunction(Game_Push_ConfirmExitGame,KEY_EVENT_UP);SetLeftSoftkeyFunction(Game_Push_ConfirmNewGame,KEY_EVENT_UP);return g_Pushbox.over;/*Name:MoveStepDesc: Move theblock Return: no return valueAuthor: helloworld*/static void Game_Push_MoveStep( void)/core static void Game_Push_UpKeyProc(void)kal_prompt_trace(MOD_MMI, nPush-Game_Push_UpKeyProcn);g_Pushbox.flag = 0 - 10;Game_Push_MoveStep();return;static void Game_Push_DownKeyProc(void)kal_prompt_trace(MOD_MMI, nPush-Game_Push_DownKeyProcn);g_Pushbox.flag = 10;Game_Push_MoveStep();return;static void Game_Push_LeftKeyProc(void)kal_prompt_trace(MOD_MMI, nPush-Game_Push_LeftKeyProcn);g_Pushbox.flag = -1;Game_Push_MoveStep();return;static void Game_Push_RightKeyProc(void)kal_prompt_trace(MOD_MMI, nPush-Game_Push_RightKeyProcn);g_Pushbox.flag = 1;Game_Push_MoveStep();return;static void Game_Push_HashKeyProc(void)kal_prompt_trace(MOD_MMI, nPush-Game_Push_HashKeyProcn);Config_Passs-;if( Config_Passs Game_Push_StarKeyProcn);Config_Passs+;if( Config_Passs MTK_GUANSHU )Config_Passs = 1;Game_Push_BeginNewStep();return;static void Game_Push_SendKeyProc(void)Game_Push_BeginNewStep();return;static void Game_Push_EndKeyProc(void)Game_Push_DeIni();GoBackHistory();return;static void Game_Push_SetKeysHandle(void)/kal_prompt_trace(MOD_MMI, nPush-Game_Push_SetKeysHandlen);ClearAllKeyHandler();SetKeyHandler(Game_Push_UpKeyProc, KEY_UP_ARROW, KEY_EVENT_DOWN);SetKeyHandler(Game_Push
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- Chapter 3 Our school events教学设计-2025-2026学年小学英语新思维小学英语3A-新思维小学英语
- 本章复习与测试教学设计-2023-2024学年中职数学基础模块上册高教版(第三版·李广全)
- 八年级物理上册 第四章 第二节 光的反射说课稿 (新版)新人教版
- 初中生物北师大版八年级上册第2节 动物行为的类型 说课稿
- 管理类考试题及答案
- 宫斗考试题目及答案
- 基层医生在线医疗平台创新服务模式的探索与应用
- 法官考试题目及答案大全
- 验收管理人员专业素养提升路径探讨
- 一体化智算中心项目风险评估报告
- 高一 人教A版 数学 第三章《幂函数》课件
- 氩气瓶的安全使用要求
- 《大模型原理与技术》全套教学课件
- 糖尿病足的影像学鉴别诊断
- 象棋入门课件教学
- 第47届世界技能大赛江苏省选拔赛精细木工项目技术文件(初稿)
- VR医学模拟手术训练系统
- 街道办消防安全知识培训课件
- 垃圾分类志愿服务
- 初中九年级数学中考复习讲义(20讲全)
- 可解释性AI在故障诊断中的应用
评论
0/150
提交评论