Do not step on the windows program implementation in Zen mode, windows program

Source: Internet
Author: User
Tags textout

Do not step on the windows program implementation in Zen mode, windows program

Do not step on the white block-Zen mode windows program implementation

The Code is as follows:

# Include <Windows. h> lresult callback WndProc (HWND, UINT, WPARAM, LPARAM); int WINAPI WinMain (// program entry, WINAPI is a function call convention, HINSTANCE hInstance HINSTANCE // instance handle, which indicates how to generate a machine code that places call parameters in the stack to identify the program. HINSTANCE hPreInstance // identifies the previous instance of the program in 16 bits, 32-bit is no longer used, the parameter is NULL, LPSTR sz1_line // the command line for calling, int iCmdShow) // window display mode {static TCHAR szName [] = TEXT ("HIYUN"); HWND hwnd; MSG msg; WNDCLASS wc; wc. style = CS_VREDRAW | CS_HREDRAW; wc. cbClsExtra = 0; Wc. cbWndExtra = 0; wc. hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH); wc. hCursor = LoadCursor (NULL, IDC_ARROW); wc. hIcon = LoadIcon (NULL, IDI_APPLICATION); wc. hInstance = hInstance; wc. lpfnWndProc = WndProc; wc. lpszMenuName = NULL; wc. lpszClassName = szName; if (! RegisterClass (& wc) {MessageBox (NULL, TEXT ("registration failed! "), TEXT (" failed "), MB_ OK | MB_ICONERROR);} hwnd = CreateWindow (szName, TEXT (" do not step on the Zen mode of white blocks-creation of xianyunye Crane, QQ Group 116920287 "), WS_OVERLAPPEDWINDOW, 400,100,400,600, NULL, NULL, hInstance, NULL); ShowWindow (hwnd, iCmdShow); UpdateWindow (hwnd); while (GetMessage (& msg, NULL, 0, 0) {TranslateMessage (& msg); DispatchMessage (& msg);} return msg. wParam;} lresult callback WndProc (HWND hwnd, UINT message, WPARAM wparam, LPARAM lpara M) {HDC hdc; PAINTSTRUCT ps; RECT rect; TCHAR szBuff [50]; static HBRUSH brushPass = CreateSolidBrush (RGB (223,223,223); static int I, j, x, y, tx, ty; static int runing, cxChar, cyChar, cxClient, cyClient, cxSquare, cySquare; static TCHAR PlayName [] = TEXT ("YUN"); static ULONG score = 0, t; static int Loc [20]; switch (message) {case WM_CREATE: runing = 0; hdc = GetDC (hwnd); TEXTMETRIC tm; GetTextMetrics (hdc, & t M); cxChar = tm. tmAveCharWidth; cyChar = tm. tmHeight + tm. tmExternalLeading; ReleaseDC (hwnd, hdc); return 0; case WM_SIZE: cxClient = LOWORD (lparam); cyClient = HIWORD (lparam); cxSquare = cxClient/4; cySquare = (int) (cxSquare * 1.5); for (I = 0; I <= cyClient/cySquare + 2; ++ I) {Loc [I] = rand () % 4 ;} return 0; case WM_LBUTTONDOWN: tx = x = LOWORD (lparam); ty = y = HIWORD (lparam); x/= cxSquare; y = (cyClient- Y)/cySquare; if (Loc [0] = x & y = 0 &&! Runing) {runing = 1; InvalidateRect (hwnd, NULL, true);} else if (Loc [1] = x & y = 1 & runing) {score ++; for (I = 0; I <= cyClient/cySquare + 1; ++ I) {Loc [I] = Loc [I + 1];} loc [I] = rand () % 4; InvalidateRect (hwnd, NULL, true);} return 0; case WM_PAINT: hdc = BeginPaint (hwnd, & ps ); setBkMode (hdc, TRANSPARENT); SetTextColor (hdc, RGB (255, 0, 0); for (I = 1; I <4; ++ I) {MoveToEx (hdc, cxSquare * I, 0, NULL); Li NeTo (hdc, cxSquare * I, cyClient) ;}for (I = 0; I <= cyClient/cySquare + 1; ++ I) {MoveToEx (hdc, 0, cyClient-cySquare * I, NULL); LineTo (hdc, cxClient, cyClient-cySquare * I); j = Loc [I]; if (I = 0 & runing) selectObject (hdc, brushPass); elseSelectObject (hdc, GetStockObject (BLACK_BRUSH); Rectangle (hdc, j * cxSquare, cyClient-cySquare * (I + 1 ), cxSquare * (j + 1) + 1, cyClient-cySquare * I + 1); If (! Runing & I = 0) {TextOut (hdc, j * cxSquare + cxSquare/2-cxChar * 1.5, cyClient-cySquare/2, szBuff, wsprintf (szBuff, TEXT ("START") ;}} TextOut (hdc, cxChar, cyChar, szBuff, wsprintf (szBuff, TEXT ("Player: % s"), PlayName )); t = wsprintf (szBuff, TEXT ("Score: % ld"), score); TextOut (hdc, cxClient-(t + 2) * cxChar, cyChar, szBuff, t ); endPaint (hwnd, & ps); return 0; case WM_DESTROY: PostQuitMessage (0); return 0;} return DefWindowProc (hwnd, message, wparam, lparam );}



Who will change the white block? Zen Mode

Next cross-handed assistant.

What is the fastest classic network?

Let's talk about the three modes of gameplay and tips for getting high scores.

Do not step on the white block Classic Mode:
How to play: reach the end point as quickly as possible
High score tips: In this mode, students should pay attention to the number of seconds above. In fact, this mode is to set a distance. After this distance, the shorter the time we use, the better the score.
First, you need to fix your cell phone on the table, and then the index finger goes crazy. If you have experience in dance or dance games, it is easy to break through for seven seconds. There is another way. If it is a Xiaomi phone, please turn on the glove mode. When you press it, the response will be faster, but this is a double-edged sword and it is easy to lose.
Do not step on the white block Arcade Mode:
Introduction to gameplay: you have the ability to score more or less points without any restrictions. This is also the most challenging mode.
High-score tips: the arcade model is used again. Although it is really not good for the fans to play the arcade, I still want to talk about my method. The first one hundred people can usually pass through. After the speed is stable, the error is caused by gameover on the white block. Therefore, we can perform one-to-one (one-to-one) and three-to-three (one-to-two) operations ", as long as possible, the loss rate can be minimized. The other is to put the line of sight at the front of the screen as much as possible, but not limited to one point.
Do not step on the whitelist Zen Mode
How to play: within 30 seconds, you can take a few steps. I have played 86 steps. What about you?
Tips for high score: This is not fast but stable. Do not worry. It is a good strategy to get started. Because it takes a long time and the correctness is critical, we recommend that you use the thumb of your hands to perform the operation. In this way, the misoperation rate is the lowest. Because there is no speed limit, it is easy for players to get faster and disrupt their pace. Be patient, especially in the later stages.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.