📄 small.c
字号:
FillBoxWithBitmap(hdc,56,5,200,50,&Bk_State); FillBoxWithBitmap(hdc,320,5,200,50,&Bk_State); FillBoxWithBitmap(hdc,580,5,200,50,&Bk_State); FillBoxWithBitmap(hdc,65,0,44,60,&Bk_Score); FillBoxWithBitmap(hdc,330,0,44,60,&Bk_Record); FillBoxWithBitmap(hdc,590,6,100,44,&Bk_Stage); FillBoxWithBitmap(hdc,700,STATE_Y,18,19,&Number[Pass]); number=SCORE/10000; FillBoxWithBitmap(hdc,125,STATE_Y,18,19,&Number[number]); number=SCORE/1000 -number*10; FillBoxWithBitmap(hdc,145,STATE_Y,18,19,&Number[number]); number=SCORE/100 - (SCORE/1000)*10; FillBoxWithBitmap(hdc,165,STATE_Y,18,19,&Number[number]); number=SCORE/10 - (SCORE/100)*10; FillBoxWithBitmap(hdc,185,STATE_Y,18,19,&Number[number]); number=SCORE%10; FillBoxWithBitmap(hdc,205,STATE_Y,18,19,&Number[number]); number=RECORD/10000; FillBoxWithBitmap(hdc,390,STATE_Y,18,19,&Number[number]); number=RECORD/1000 -number*10; FillBoxWithBitmap(hdc,410,STATE_Y,18,19,&Number[number]); number=RECORD/100 - (RECORD/1000)*10; FillBoxWithBitmap(hdc,430,STATE_Y,18,19,&Number[number]); number=RECORD/10 - (RECORD/100)*10; FillBoxWithBitmap(hdc,450,STATE_Y,18,19,&Number[number]); number=RECORD%10; FillBoxWithBitmap(hdc,470,STATE_Y,18,19,&Number[number]); number=Time/10; FillBoxWithBitmap(hdc,740,350,18,19,&Number[number]); number=Time%10; FillBoxWithBitmap(hdc,760,350,18,19,&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.Line>0 && Choose_A.Line<9) { FillBoxWithBitmap(hdc, SQUARE*Choose_A.Row, SQUARE*Choose_A.Line, Choose_A.Length,Choose_A.Width,&Base.Picture[20]); } if( Mode==2 ) { 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/55; row = prex/55; 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,&Area[Choose_A.Line][Choose_A.Row],TRUE); InvalidateRect (hWnd,&Area[Choose_B.Line][Choose_B.Row],TRUE); } Mode=2; } } if (prex>680 && prex<680+120 && prey>56 &&prey<56+50) //ruffer { if( RuffleNum>0 ) { RuffleNum--; Mode=0; Take=0; Ruffle(); InvalidateRect (hWnd,NULL,TRUE); } } if (prex>680 && prex<680+120 && prey>126 &&prey<126+50) //clew { if( ClewNum>0 ) { ClewNum--; Take=1; Mode=2; if( Clew(hWnd)==0 ) { Take=0; } InvalidateRect (hWnd,NULL,TRUE); } } if (prex>680 && prex<680+120 && prey>196 &&prey<196+50) //restart { InitLian(); Ruffle(); RuffleNum=9; ClewNum=9; InvalidateRect (hWnd,NULL,TRUE); } if (prex>680 && prex<680+120 && prey>266 &&prey<266+50) //end { // SendMessage( hProgBar, PBM_STEPIT, 20, 0); 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; InvalidateRect (hWnd,NULL,TRUE); } if( Count==0 ) { InitLian(); Ruffle(); Pass++; SCORE+=Time*4; if( SCORE>RECORD ) { RECORD=SCORE; } 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 = 800; CreateInfo.by = 560; CreateInfo.iBkColor = COLOR_lightwhite; CreateInfo.dwAddData = 0; CreateInfo.hHosting = HWND_DESKTOP; hMainWnd = CreateMainWindow (&CreateInfo); if (hMainWnd == HWND_INVALID) return -1; LoadPicture(); InitLian(); Ruffle(); SetArea(); 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 + -