📄 helloworld.c.bak
字号:
myNum[1]='\0';
myNum[2]='\0';
myNum[3]='\0';
flagNum[0]='\0';
flagNum[1]='\0';
flagNum[2]='\0';
*/
IIMAGE_Draw(pMe->m_clockimg,pMe->m_cxWidth/3-30, pMe->m_cyHeight-15);
SPRINTF(myNum,"%d", pMe->time_count);//int ->char
STR_TO_WSTR (myNum, szBuf, sizeof (szBuf));
IDISPLAY_DrawText(pMe->a.m_pIDisplay, AEE_FONT_BOLD, szBuf, -1, pMe->m_cxWidth/3-3, pMe->m_cyHeight-12, 0,IDF_TEXT_TRANSPARENT);//print
IIMAGE_Draw(pMe->m_flag,pMe->m_cxWidth/3*2-15, pMe->m_cyHeight-12);
SPRINTF(flagNum,"%d", pMe->flag_count);//int ->char
STR_TO_WSTR (flagNum, szBuf, sizeof (szBuf));
IDISPLAY_DrawText(pMe->a.m_pIDisplay, AEE_FONT_BOLD, szBuf, -1, pMe->m_cxWidth/3*2, pMe->m_cyHeight-12, 0,IDF_TEXT_TRANSPARENT);//print
SPRINTF(flagNum2,"/%d", pMe->mine_num);//int ->char
STR_TO_WSTR (flagNum2, szBuf, sizeof (szBuf));
IDISPLAY_DrawText(pMe->a.m_pIDisplay, AEE_FONT_BOLD, szBuf, -1, pMe->m_cxWidth/3*2+15, pMe->m_cyHeight-12, 0,IDF_TEXT_TRANSPARENT);//print
IIMAGE_Draw(pMe->m_arrow,(pMe->x)*10+5,(pMe->y)*10+5);
IDISPLAY_Update (pMe->a.m_pIDisplay);
//if (pMe->time_count==10)
// draw_gameover(pMe,1);
}
// SEED狼 檬扁拳
// 付捞农肺 鸥烙狼 蔼阑 檬扁 SEED肺 汲沥
// 橇肺弊伐狼 贸澜捞唱 檬扁拳啊 鞘夸且锭 龋免
static void INIT_RAND(mousept * pMe, int a)
{
pMe->Seed = (unsigned long)GET_TIMEMS() + a;
pMe->Next_Seed = pMe->Seed;
}
////////////////// 罚待 惯积 窃荐 //////////////////////////
static int RAND(mousept * pMe, int ran)
{
int RAND_MAX = ran;
pMe->Next_Seed = pMe->Next_Seed * 1103515245L + 12345;
return((unsigned)(pMe->Next_Seed / 65536L) % (RAND_MAX + 1));
}
static void open_zero(mousept * pMe,int i,int j) {
pMe->field_state[i][j]=1;
if (i>0) {
if (j>0) {
if (pMe->mine_state[i-1][j-1]==0) {
if (pMe->field_state[i-1][j-1]!=1)
open_zero(pMe,i-1,j-1);
}
pMe->field_state[i-1][j-1]=1;
}
if (pMe->mine_state[i-1][j]==0) {
if (pMe->field_state[i-1][j]!=1)
open_zero(pMe,i-1,j);
}
pMe->field_state[i-1][j]=1;
if (pMe->mine_height>j+1) {
if (pMe->mine_state[i-1][j+1]==0) {
if (pMe->field_state[i-1][j+1]!=1)
open_zero(pMe,i-1,j+1);
}
pMe->field_state[i-1][j+1]=1;
}
}
if (j>0) {
if (pMe->mine_state[i][j-1]==0) {
if (pMe->field_state[i][j-1]!=1)
open_zero(pMe,i,j-1);
}
pMe->field_state[i][j-1]=1;
if (pMe->mine_width>i+1) {
if (pMe->mine_state[i+1][j-1]==0) {
if (pMe->field_state[i+1][j-1]!=1)
open_zero(pMe,i+1,j-1);
}
pMe->field_state[i+1][j-1]=1;
}
}
if (pMe->mine_height>j+1) {
if (pMe->mine_state[i][j+1]==0) {
if (pMe->field_state[i][j+1]!=1)
open_zero(pMe,i,j+1);
}
pMe->field_state[i][j+1]=1;
}
if (pMe->mine_width>i+1) {
if (pMe->mine_state[i+1][j]==0) {
if (pMe->field_state[i+1][j]!=1)
open_zero(pMe,i+1,j);
}
pMe->field_state[i+1][j]=1;
}
if (pMe->mine_height>j+1&&pMe->mine_width>i+1) {
if (pMe->mine_state[i+1][j+1]==0) {
if (pMe->field_state[i+1][j+1]!=1)
open_zero(pMe,i+1,j+1);
}
pMe->field_state[i+1][j+1]=1;
}
}
static void draw_popup(mousept * pMe) {
IIMAGE_Draw(pMe->m_popmain,0,pMe->m_cyHeight-40);
switch (pMe->popup_position) {
case 0:
IIMAGE_Draw(pMe->m_pop1,10-1,pMe->m_cyHeight-23);
IIMAGE_Draw(pMe->m_pophelp,20,pMe->m_cyHeight-40+2);
break;
case 1:
IIMAGE_Draw(pMe->m_pop2,30+1,pMe->m_cyHeight-23);
IIMAGE_Draw(pMe->m_popend,20,pMe->m_cyHeight-40+2);
break;
case 2:
IIMAGE_Draw(pMe->m_pop3,50+3,pMe->m_cyHeight-23);
IIMAGE_Draw(pMe->m_popresume,20,pMe->m_cyHeight-40+2);
break;
}
IDISPLAY_Update (pMe->a.m_pIDisplay);
pMe->state=popup_state;
}
static void draw_mainfield(mousept * pMe) {
int i,j;
pMe->flag_count=0;
//IDISPLAY_ClearScreen (pMe->a.m_pIDisplay); // Clear whole screen
//IIMAGE_Draw(pMe->m_arrow,(pMe->x)*10+5,(pMe->y)*10+5);
IDISPLAY_ClearScreen (pMe->a.m_pIDisplay); // Clear whole screen
draw_bg(pMe);
for (i=0;i<pMe->mine_width;i++) {
for (j=0;j<pMe->mine_height;j++) {
if (pMe->mine_state[i][j]==9) {
IIMAGE_Draw(pMe->m_common,i*10,j*10);
} else {
switch (pMe->mine_state[i][j]) {
case 1:
IIMAGE_Draw(pMe->m_1,i*10,j*10);
break;
case 2:
IIMAGE_Draw(pMe->m_2,i*10,j*10);
break;
case 3:
IIMAGE_Draw(pMe->m_3,i*10,j*10);
break;
case 4:
IIMAGE_Draw(pMe->m_4,i*10,j*10);
break;
case 5:
IIMAGE_Draw(pMe->m_5,i*10,j*10);
break;
case 6:
IIMAGE_Draw(pMe->m_6,i*10,j*10);
break;
case 7:
IIMAGE_Draw(pMe->m_7,i*10,j*10);
break;
case 8:
IIMAGE_Draw(pMe->m_8,i*10,j*10);
break;
}
}
if (pMe->field_state[i][j]==0) {
IIMAGE_Draw(pMe->m_field,i*10,j*10);
} else if (pMe->field_state[i][j]==0) {
;
} else if (pMe->field_state[i][j]==2) {
IIMAGE_Draw(pMe->m_flag,i*10,j*10);
pMe->flag_count++;
} else if (pMe->field_state[i][j]==3) {
IIMAGE_Draw(pMe->m_ques,i*10,j*10);
}
}//for
}//for
draw_timer(pMe);
//IDISPLAY_Update (pMe->a.m_pIDisplay);
}
/*
static void draw_mainfield2(mousept * pMe) {
int i,j;
//IDISPLAY_ClearScreen (pMe->a.m_pIDisplay); // Clear whole screen
//IIMAGE_Draw(pMe->m_arrow,(pMe->x)*10+5,(pMe->y)*10+5);
IDISPLAY_ClearScreen (pMe->a.m_pIDisplay); // Clear whole screen
for (i=0;i<pMe->mine_width;i++) {
for (j=0;j<pMe->mine_height;j++) {
if (pMe->mine_state[i][j]==9) {
IIMAGE_Draw(pMe->m_common,i*10,j*10);
} else {
switch (pMe->mine_state[i][j]) {
case 1:
IIMAGE_Draw(pMe->m_1,i*10,j*10);
break;
case 2:
IIMAGE_Draw(pMe->m_2,i*10,j*10);
break;
case 3:
IIMAGE_Draw(pMe->m_3,i*10,j*10);
break;
case 4:
IIMAGE_Draw(pMe->m_4,i*10,j*10);
break;
case 5:
IIMAGE_Draw(pMe->m_5,i*10,j*10);
break;
case 6:
IIMAGE_Draw(pMe->m_6,i*10,j*10);
break;
case 7:
IIMAGE_Draw(pMe->m_7,i*10,j*10);
break;
case 8:
IIMAGE_Draw(pMe->m_8,i*10,j*10);
break;
}
}
if (pMe->field_state[i][j]==0) {
IIMAGE_Draw(pMe->m_field,i*10,j*10);
} else if (pMe->field_state[i][j]==0) {
;
} else if (pMe->field_state[i][j]==2) {
IIMAGE_Draw(pMe->m_flag,i*10,j*10);
} else if (pMe->field_state[i][j]==3) {
IIMAGE_Draw(pMe->m_ques,i*10,j*10);
}
}//for
}//for
IIMAGE_Draw(pMe->m_arrow,(pMe->x)*10+5,(pMe->y)*10+5);
}
*/
/*
static void restart_game(mousept *pi) {
int i,j;
int mine_set=0;
int randx,randy;
int mine_this;
ISHELL_SetTimer(pMe->a.m_pIShell,timerValue,(PFNNOTIFY)TimerCB,pMe);
pMe->state=start_state;
pMe->time_count=0;
pMe->flag_count=0;
for (i=0;i<30;i++) {
for (j=0;j<30;j++) {
pMe->field_state[i][j]=0;
pMe->mine_state[i][j]=0;
}
}
//mine setting
while (mine_set<pMe->mine_num) {
randx=RAND(pMe, pMe->mine_width-1);
randy=RAND(pMe, pMe->mine_height-1);
if (pMe->mine_state[randx][randy]!=9) {
pMe->mine_state[randx][randy]=9;
mine_set++;
}
}
for (i=0;i<pMe->mine_width;i++) {
mine_this=0;
for (j=0;j<pMe->mine_height;j++) {
if (pMe->mine_state[i][j]==9)
continue;
if (i>0) {
if (j>0) {
if (pMe->mine_state[i-1][j-1]==9)
mine_this++;
}
if (pMe->mine_state[i-1][j]==9)
mine_this++;
if (pMe->mine_height>j+1)
if (pMe->mine_state[i-1][j+1]==9)
mine_this++;
}
if (j>0) {
if (pMe->mine_state[i][j-1]==9)
mine_this++;
if (pMe->mine_width>i+1)
if (pMe->mine_state[i+1][j-1]==9)
mine_this++;
}
if (pMe->mine_height>j+1)
if (pMe->mine_state[i][j+1]==9)
mine_this++;
if (pMe->mine_width>i+1)
if (pMe->mine_state[i+1][j]==9)
mine_this++;
if (pMe->mine_height>j+1&&pMe->mine_width>i+1 )
if (pMe->mine_state[i+1][j+1]==9)
mine_this++;
pMe->mine_state[i][j]=mine_this;
mine_this=0;
}
}
pMe->x=5;
pMe->y=5;
draw_mainfield(pMe);
}
*/
static void draw_gameover(mousept * pMe,int tag) {
int i,j;
//IDISPLAY_ClearScreen (pMe->a.m_pIDisplay); // Clear whole screen
//IIMAGE_Draw(pMe->m_arrow,(pMe->x)*10+5,(pMe->y)*10+5);
IDISPLAY_ClearScreen (pMe->a.m_pIDisplay); // Clear whole screen
draw_bg(pMe);
ISHELL_CancelTimer(pMe->a.m_pIShell,(PFNNOTIFY)TimerCB,(void *)pMe);
pMe->over_tag=tag;
for (i=0;i<pMe->mine_width;i++) {
for (j=0;j<pMe->mine_height;j++) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -