📄 baselian.c
字号:
FillBoxWithBitmap(hdc,W_WIDE-25,(SQUARE+19),BASENUM,BASENUM,&Number[RuffleNum]); FillBoxWithBitmap(hdc,W_WIDE-25,(SQUARE+10)*2+9,BASENUM,BASENUM,&Number[ClewNum]); FillBoxWithBitmap(hdc,SQUARE,0,130,SQUARE,&Bk_State); FillBoxWithBitmap(hdc,190,0,130,SQUARE,&Bk_State); FillBoxWithBitmap(hdc,350,0,130,SQUARE,&Bk_State); FillBoxWithBitmap(hdc,40,0,40,30,&Bk_Score); FillBoxWithBitmap(hdc,200,0,40,30,&Bk_Record); FillBoxWithBitmap(hdc,360,0,65,30,&Bk_Stage); FillBoxWithBitmap(hdc,440,STATE_Y,BASENUM,BASENUM,&Number[Pass]); number=SCORE/10000; FillBoxWithBitmap(hdc,80,STATE_Y,BASENUM,BASENUM,&Number[number]); number=SCORE/1000 -number*10; FillBoxWithBitmap(hdc,95,STATE_Y,BASENUM,BASENUM,&Number[number]); number=SCORE/100 - (SCORE/1000)*10; FillBoxWithBitmap(hdc,110,STATE_Y,BASENUM,BASENUM,&Number[number]); number=SCORE/10 - (SCORE/100)*10; FillBoxWithBitmap(hdc,125,STATE_Y,BASENUM,BASENUM,&Number[number]); number=SCORE%10; FillBoxWithBitmap(hdc,140,STATE_Y,BASENUM,BASENUM,&Number[number]); number=RECORD/10000; FillBoxWithBitmap(hdc,240,STATE_Y,BASENUM,BASENUM,&Number[number]); number=RECORD/1000 -number*10; FillBoxWithBitmap(hdc,255,STATE_Y,BASENUM,BASENUM,&Number[number]); number=RECORD/100 - (RECORD/1000)*10; FillBoxWithBitmap(hdc,270,STATE_Y,BASENUM,BASENUM,&Number[number]); number=RECORD/10 - (RECORD/100)*10; FillBoxWithBitmap(hdc,285,STATE_Y,BASENUM,BASENUM,&Number[number]); number=RECORD%10; FillBoxWithBitmap(hdc,300,STATE_Y,BASENUM,BASENUM,&Number[number]); number=Time/10; FillBoxWithBitmap(hdc,W_WIDE-40,(SQUARE+10)*5+9,BASENUM,BASENUM,&Number[number]); number=Time%10; FillBoxWithBitmap(hdc,W_WIDE-25,(SQUARE+10)*5+9,BASENUM,BASENUM,&Number[number]); for( i=0; i<10; i++) { for( j=0; j<12; j++) { if( Flag[i][j]>=0 ) { FillBoxWithBitmap(hdc,SQUARE*j,SQUARE*i,Base.Length,Base.Width,&Base.Picture[Flag[i][j]]); } /* if( V_Line[i][j]==1 ) { FillBoxWithBitmap(hdc,SQUARE*j,SQUARE*i,Base.Length,Base.Width,&Base.Picture[22]); } if( V_Line[i][j]==2 ) { FillBoxWithBitmap(hdc,SQUARE*j,SQUARE*i,Base.Length,Base.Width,&Base.Picture[21]); } if( V_Line[i][j]==3 ) { FillBoxWithBitmap(hdc,SQUARE*j,SQUARE*i,Base.Length,Base.Width,&Base.Picture[23]); } if( V_Line[i][j]==4 ) { FillBoxWithBitmap(hdc,SQUARE*j,SQUARE*i,Base.Length,Base.Width,&Base.Picture[24]); } if( V_Line[i][j]==5 ) { FillBoxWithBitmap(hdc,SQUARE*j,SQUARE*i,Base.Length,Base.Width,&Base.Picture[25]); } if( V_Line[i][j]==6 ) { FillBoxWithBitmap(hdc,SQUARE*j,SQUARE*i,Base.Length,Base.Width,&Base.Picture[26]); }*/ } } if( Mode>0 && Choose_A.Row>0 && Choose_A.Row<11) { FillBoxWithBitmap(hdc, SQUARE*Choose_A.Row, SQUARE*Choose_A.Line, Choose_A.Length,Choose_A.Width,&Base.Picture[20]); } if( Mode==2 && Choose_B.Row>0 && Choose_B.Row<11) { FillBoxWithBitmap(hdc,SQUARE*Choose_B.Row, SQUARE*Choose_B.Line,Choose_B.Length,Choose_B.Width,&Base.Picture[20]); } if( Take==1 ) { FillBoxWithBitmap(hdc,SQUARE*Clew_A.Row, SQUARE*Clew_A.Line,Clew_A.Length,Clew_A.Width,&Base.Picture[20]); FillBoxWithBitmap(hdc,SQUARE*Clew_B.Row, SQUARE*Clew_B.Line,Clew_B.Length,Clew_B.Width,&Base.Picture[20]); } EndPaint(hWnd,hdc); break; } case MSG_LBUTTONDOWN: { prex = LOSWORD (lParam); prey = HISWORD (lParam); line = prey/SQUARE; row = prex/SQUARE; if( Mode==0 && Pass>0 ) { Take=0; Choose_A.Line=line; Choose_A.Row=row; Mode=1; InvalidateRect (hWnd,&Area[Choose_A.Line][Choose_A.Row],TRUE); } else if( Mode==1 && Pass>0 ) { if( line!=Choose_A.Line || row!=Choose_A.Row ) { Choose_B.Line=line; Choose_B.Row=row; if( JudgeChoose(hWnd)==1 ) { Flag[Choose_A.Line][Choose_A.Row]=-1; Flag[Choose_B.Line][Choose_B.Row]=-1; ResetTimer(hWnd, 100, 40 ); SCORE+=10; if( (Time+5)<99 ) { Time+=5; } else { Time=99; } Count-=2; if( SCORE>RECORD ) { RECORD=SCORE; } InvalidateRect (hWnd,&RectScore,TRUE); InvalidateRect (hWnd,&RectRcord,TRUE); InvalidateRect (hWnd,&Area[Choose_A.Line][Choose_A.Row],TRUE); InvalidateRect (hWnd,&Area[Choose_B.Line][Choose_B.Row],TRUE); } Mode=2; } } if (prex>W_WIDE-BUTTOM_X && prex<W_WIDE && prey>(SQUARE+10) &&prey<(SQUARE+10)+SQUARE) //ruffer { if( RuffleNum>0 ) { RuffleNum--; Mode=0; Take=0; Ruffle(); InvalidateRect (hWnd,NULL,TRUE); } } if (prex>W_WIDE-BUTTOM_X && prex<W_WIDE && prey>(SQUARE+10)*2 &&prey<(SQUARE+10)*2+SQUARE) //clew { if( ClewNum>0 ) { ClewNum--; Take=1; Mode=2; if( Clew(hWnd)==0 ) { Take=0; Ruffle(); } InvalidateRect (hWnd,&Area[Clew_A.Line][Clew_A.Row],TRUE); InvalidateRect (hWnd,&Area[Clew_B.Line][Clew_B.Row],TRUE); InvalidateRect (hWnd,&RectClew,TRUE);// InvalidateRect (hWnd,NULL,TRUE); } } if (prex>W_WIDE-BUTTOM_X && prex<W_WIDE && prey>(SQUARE+10)*3 &&prey<(SQUARE+10)*3+SQUARE) //restart { SCORE=0; InitLian(); Ruffle(); RuffleNum=9; ClewNum=9; InvalidateRect (hWnd,NULL,TRUE); } if (prex>W_WIDE-BUTTOM_X && prex<W_WIDE && prey>(SQUARE+10)*4 &&prey<(SQUARE+10)*4+SQUARE) //end { InvalidateRect (hWnd,NULL,TRUE); } ResetTimer(hWnd, 100, 40 ); InvalidateRect (hWnd,&Area[Choose_A.Line][Choose_A.Row],TRUE); InvalidateRect (hWnd,&Area[Choose_B.Line][Choose_B.Row],TRUE); break; } case MSG_TIMER: { if( Pass>0 ) { Time--; InvalidateRect (hWnd,&Rect,TRUE); if( Time==0 ) { Pass=0; Writescore(); InvalidateRect (hWnd,NULL,TRUE); } if( Count==0 ) { InitLian(); Ruffle(); Pass++; SCORE+=Time*4; if( SCORE>RECORD ) { RECORD=SCORE; } Writescore(); if( Pass==9) { Pass=1; } InvalidateRect (hWnd,NULL,TRUE); } if (wParam == 100 && Mode==2 ) {/* for( i=0; i<10; i++) { for( j=0; j<12; j++) { V_Line[i][j]=0; } }*/ Mode=0; if( Pass==1 ) { InvalidateRect (hWnd,&Area[Choose_A.Line][Choose_A.Row],TRUE); InvalidateRect (hWnd,&Area[Choose_B.Line][Choose_B.Row],TRUE); } if( Pass==2 ) { BottomMove(); if( Choose_A.Row==Choose_B.Row ) { line= (Choose_A.Line > Choose_B.Line ) ? Choose_A.Line : Choose_B.Line; while( line>0 ) { InvalidateRect (hWnd,&Area[line][Choose_A.Row],TRUE); line--; } } else { line=Choose_A.Line; while( line>0 ) { InvalidateRect (hWnd,&Area[line][Choose_A.Row],TRUE); line--; } line=Choose_B.Line; while( line>0 ) { InvalidateRect (hWnd,&Area[line][Choose_B.Row],TRUE); line--; } } } else if( Pass==3 ) { TopMove(); if( Choose_A.Row==Choose_B.Row ) { line= (Choose_A.Line < Choose_B.Line ) ? Choose_A.Line : Choose_B.Line; while( line<9 ) { InvalidateRect (hWnd,&Area[line][Choose_A.Row],TRUE); line++; } } else { line=Choose_A.Line; while( line<9 ) { InvalidateRect (hWnd,&Area[line][Choose_A.Row],TRUE); line++; } line=Choose_B.Line; while( line<9 ) { InvalidateRect (hWnd,&Area[line][Choose_B.Row],TRUE); line++; } } } else if( Pass==4 ) { RightMove(); if( Choose_A.Line==Choose_B.Line ) { row=(Choose_A.Row > Choose_B.Row) ? Choose_A.Row : Choose_B.Row; while( row>0 ) { InvalidateRect (hWnd,&Area[Choose_A.Line][row],TRUE); row--; } } else { row=Choose_A.Row; while( row>0 ) { InvalidateRect (hWnd,&Area[Choose_A.Line][row],TRUE); row--; } row=Choose_B.Row; while( row>0 ) { InvalidateRect (hWnd,&Area[Choose_B.Line][row],TRUE); row--; } } } else if( Pass==5 ) { LeftMove(); if( Choose_A.Line==Choose_B.Line ) { row=(Choose_A.Row < Choose_B.Row) ? Choose_A.Row : Choose_B.Row; while( row<11 ) { InvalidateRect (hWnd,&Area[Choose_A.Line][row],TRUE); row++; } } else { row=Choose_A.Row; while( row<11 ) { InvalidateRect (hWnd,&Area[Choose_A.Line][row],TRUE); row++; } row=Choose_B.Row; while( row<11 ) { InvalidateRect (hWnd,&Area[Choose_B.Line][row],TRUE); row++; } } } else if( Pass==6 ) { BTMove(); if( Choose_A.Row==Choose_B.Row ) { line=1; while( line <9 ) { InvalidateRect (hWnd,&Area[line][Choose_A.Row],TRUE); line++; } } else { line=1; while( line <9 ) { InvalidateRect (hWnd,&Area[line][Choose_A.Row],TRUE); InvalidateRect (hWnd,&Area[line][Choose_B.Row],TRUE); line++; } } } else if( Pass==7 ) { RLMove(); if( Choose_A.Line==Choose_B.Line ) { line=1; while( line <11 ) { InvalidateRect (hWnd,&Area[Choose_A.Line][line],TRUE); line++; } } else { line=1; while( line <11 ) { InvalidateRect (hWnd,&Area[Choose_A.Line][line],TRUE); InvalidateRect (hWnd,&Area[Choose_A.Line][line],TRUE); line++; } } } else if( Pass==8 ) { CenterBTMove(); if( Choose_A.Row==Choose_B.Row ) { line=1; while( line <9 ) { InvalidateRect (hWnd,&Area[line][Choose_A.Row],TRUE); line++; } } else { line=1; while( line <9 ) { InvalidateRect (hWnd,&Area[line][Choose_A.Row],TRUE); InvalidateRect (hWnd,&Area[line][Choose_B.Row],TRUE); line++; } } } else if( Pass==9 ) { CenterRLMove(); if( Choose_A.Line==Choose_B.Line ) { line=1; while( line <11 ) { InvalidateRect (hWnd,&Area[Choose_A.Line][line],TRUE); line++; } } else { line=1; while( line <11 ) { InvalidateRect (hWnd,&Area[Choose_A.Line][line],TRUE); InvalidateRect (hWnd,&Area[Choose_A.Line][line],TRUE); line++; } } } } } break; } case MSG_CLOSE: DestroyMainWindow (hWnd); PostQuitMessage (hWnd); return 0; } return DefaultMainWinProc(hWnd, message, wParam, lParam);}int MiniGUIMain (int argc, const char* argv[]){ MSG Msg; HWND hMainWnd; MAINWINCREATE CreateInfo;#ifdef _LITE_VERSION SetDesktopRect(0, 0, 1024, 768);#endif CreateInfo.dwStyle = WS_VISIBLE | WS_BORDER; CreateInfo.dwExStyle = WS_EX_NONE; CreateInfo.spCaption = " game "; CreateInfo.hMenu =0; CreateInfo.hCursor = GetSystemCursor(0); CreateInfo.hIcon = 0; CreateInfo.MainWindowProc = LianWinProc; CreateInfo.lx = 0; CreateInfo.ty = 0; CreateInfo.rx = W_WIDE; CreateInfo.by = W_HEIGTH; CreateInfo.iBkColor = COLOR_lightwhite; CreateInfo.dwAddData = 0; CreateInfo.hHosting = HWND_DESKTOP; hMainWnd = CreateMainWindow (&CreateInfo); if (hMainWnd == HWND_INVALID) return -1; LoadPicture(); InitLian(); Ruffle(); SetArea(); Readscore(); ShowWindow(hMainWnd, SW_SHOWNORMAL); while (GetMessage(&Msg, hMainWnd)) { TranslateMessage(&Msg); DispatchMessage(&Msg); } MainWindowThreadCleanup (hMainWnd); return 0;}#ifndef _LITE_VERSION#include <minigui/dti.c>#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -