注:以下内容为学习笔记,多数是从书本、资料中得来,只为加深印象,及日后参考。然而本人表达能力较差,写的不好。因非翻译、非转载,只好选原创,但多数乃摘抄,实为惭愧。但若能帮助一二访客,幸甚!


前一阵子学习Win32 SDK 时自己写过一个拼图游戏作为练习,基本功能是都完成了,但到后来随着代码量的增多,代码的组织上有点混乱。考虑到是第一次独立用Win32 SDK编写程序,就先放过了。但总觉的不爽。

最近看到一本名为《Windows 游戏编程大师技巧》的牛书,看到第一章打砖块的示例,欲效仿其组织代码的技巧,故将其源代码分拆成容易理解的若干部分,修改抄录于下,供他日重读或供无缘见到此书者查阅。

程序版权归原作者所有,吾仅是学习模仿,不敢掠美。

但源程序使用到了DirectX SDK,由于暂时不想涉及D3D,故改为用Win32 API 绘图。当然以后有空,或会学习一下DirectX SDK~


我们需要的是下面几个功能:

1)切换至任意图像模式

2)在屏幕上绘制各种颜色的矩形

3)获取键盘输入

4)使用一些定时函数同步游戏循环

5)在屏幕上画彩色字符串


1. 程序主框架(原程序为全屏隐藏鼠标,为调试简单,暂时改为非全屏不隐藏鼠标)

/** FreakOut.cpp (改编自《Windows 游戏编程大师技巧》第一章示例程序)* guzhoudiaoke@126.com* 2012-11-29*//* INCLUDES *****************************************************************************/
#include <windows.h>/* DEFINES ******************************************************************************/
// defines for windows
#define WINDOW_CLASS_NAME	TEXT("WIN32CLASS")
#define WINDOW_WIDTH		640
#define WINDOW_HEIGHT		480// states for game loop
#define GAME_STATE_INIT         0
#define GAME_STATE_START_LEVEL  1
#define GAME_STATE_RUN          2
#define GAME_STATE_SHUTDOWN     3
#define GAME_STATE_EXIT         4/* GLOBALS *******************************************************************************/
HWND		main_window_handle	= NULL;				// save the window handle
HINSTANCE	main_instance		= NULL;				// save the instance
int			game_state			= GAME_STATE_INIT;	// starting state/* WINDPROC ******************************************************************************/
LRESULT CALLBACK WindowProc(HWND	hwnd,UINT	msg,WPARAM	wparam,LPARAM	lparam)
{// this is the main message handler of the systemPAINTSTRUCT	ps;HDC			hdc;switch (msg){case WM_CREATE:{return 0;}case WM_PAINT:{hdc = BeginPaint(hwnd, &ps);EndPaint(hwnd, &ps);return 0;}case WM_DESTROY:{PostQuitMessage(0);return 0;}default:break;}return DefWindowProc(hwnd, msg, wparam, lparam);
}/* WINMAIN *******************************************************************************/
int WINAPI WinMain(HINSTANCE hinstance,HINSTANCE hprevinstance,LPSTR lpcmdline,int ncmdshow)
{WNDCLASS	winclass;HWND		hwnd;MSG			msg;HDC			hdc;PAINTSTRUCT	ps;/* CS_DBLCLKS Specifies that the window should be notified of double clicks with * WM_xBUTTONDBLCLK messages* CS_OWNDC标志,属于此窗口类的窗口实例都有自己的DC(称为私有DC),私有DC仅属于该窗口实例,* 所以程序只需要调用一次GetDC或BeginPaint获取DC,系统就为窗口初始化一个DC,并且保存程序* 对其进行的改变。ReleaseDC和EndPaint函数不再需要了,因为其他程序无法访问和改变私有DC。*/winclass.style			= CS_DBLCLKS | CS_OWNDC | CS_HREDRAW | CS_VREDRAW;winclass.lpfnWndProc	= WindowProc;winclass.cbClsExtra		= 0;winclass.cbWndExtra		= 0;winclass.hInstance		= hinstance;winclass.hIcon			= LoadIcon(NULL, IDI_APPLICATION);winclass.hCursor		= LoadCursor(NULL, IDC_ARROW);winclass.hbrBackground	= (HBRUSH)GetStockObject(BLACK_BRUSH);winclass.lpszMenuName	= NULL;winclass.lpszClassName	= WINDOW_CLASS_NAME;// register the window classif (!RegisterClass(&winclass))return 0;// Create the window, note the use of WS_POPUPhwnd = CreateWindow(WINDOW_CLASS_NAME,			// classTEXT("WIN32 Game Console"),	// titleWS_OVERLAPPEDWINDOW,		// style0, 0,						// initial x, y	WINDOW_WIDTH,				// initial widthWINDOW_HEIGHT,				// initial heightNULL,						// handle to parentNULL,						// handle to menuhinstance,					// instanceNULL);						// creation parmsif (! hwnd)return 0;ShowWindow(hwnd, ncmdshow);UpdateWindow(hwnd);// hide mouse//ShowCursor(FALSE);// save the window handle and instance in a globalmain_window_handle	= hwnd;main_instance		= hinstance;// perform all game console specific initialization//Game_Init();// enter main event loopwhile (1){if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)){// test if this is a quit msgif (msg.message == WM_QUIT)break;// translate any accelerator keysTranslateMessage(&msg);// send the message to the window procDispatchMessage(&msg);}// main game processing goes here//Game_Main();}// shutdown game and release all resources//Game_Shutdown();// show mouse//ShowCursor(TRUE);// return to windows like thisreturn (msg.wParam);
}


2.  游戏控制流程

int Game_Init(void *parms)
{// this function is where you do all the initialization for your gamereturn 1;
}int Game_Shutdown(void *parms)
{// this function is where you shutdown your game and release all resources // that you allocatedreturn 1;
}int Game_Main(void *parms)
{// this is the workhorse of your game it will be called continuously in real-time// this is like main() in C all the calls for you game go here!TCHAR buffer[80];// what state is the game in?if (game_state == GAME_STATE_INIT){// seed the random number generator so game is different each playsrand((unsigned int)time(0));// set the paddle position here to the middle bottompaddle_x = PADDLE_START_X;paddle_y = PADDLE_START_Y;// set ball position and velocityball_x = 8 + rand() % (WINDOW_WIDTH-16);ball_y = BALL_START_Y;ball_dx = -4 + rand() % (8+1);ball_dy =  6 + rand() % 2;// transition to start level stategame_state = GAME_STATE_START_LEVEL;}else if (game_state == GAME_STATE_START_LEVEL){// get a new level ready to run// initialize the blocksInit_Blocks();// reset block counterblocks_hit = 0;// transition to run stategame_state = GAME_STATE_RUN;}else if (game_state == GAME_STATE_RUN){// start the timing clockStart_Clock();// clear drawing surface for next frame of animationDraw_Rectangle(0, 0, WINDOW_WIDTH-1, WINDOW_HEIGHT-1, 0);// move the paddleif (KEY_DOWN(VK_RIGHT)){// move paddle to rightpaddle_x += 8;// make sure paddle doesn't go off screenif (paddle_x > (WINDOW_WIDTH - PADDLE_WIDTH))paddle_x = WINDOW_WIDTH - PADDLE_WIDTH;}else if (KEY_DOWN(VK_LEFT)){// move paddle to leftpaddle_x += 8;// make sure paddle doesn't go off screenif (paddle_x < 0)paddle_x = 0;}// draw blocksDraw_Blocks();// move the ballball_x += ball_dx;ball_y += ball_dy;// keep ball on screen, if the ball hits the edge of screen then// bounce it by reflecting its velocityif (ball_x > (WINDOW_WIDTH - BALL_SIZE) || ball_x < 0){// reflect x-axis velocityball_dx = -ball_dx;// update positionball_x += ball_dx;}// now y-axisif (ball_y < 0){// reflect y-axis velocityball_dy = -ball_dy;// update positionball_y += ball_dy;}else if (ball_y > (WINDOW_HEIGHT - BALL_SIZE)){// reflect y-axis velocityball_dy = -ball_dy;// update positionball_y += ball_dy;// minus the scorescore -= 100;}// next watch out for ball velocity getting out of handif (ball_dx > 8) ball_dx = 8;else if (ball_dx < -8)ball_dx = -8;// test if ball hit any blocks or the paddleProcess_Ball();// draw the paddleDraw_Rectangle(paddle_x, paddle_y, paddle_x+PADDLE_WIDTH, paddle_y+PADDLE_HEIGHT, PADDLE_COLOR);// draw the ballDraw_Rectangle(ball_x, ball_y, ball_x+BALL_SIZE, ball_y+BALL_SIZE, 255);// draw the infowsprintf(buffer, TEXT("FREAKOUT			Score %d				Level %d"), score, level);DrawText_GUI(buffer, 8, WINDOW_HEIGHT-16, 127);// sync to 30 fpsWait_Clock(30);// check if user is trying to exitif (KEY_DOWN(VK_ESCAPE)){// send message to windows to exitPostMessage(main_window_handle, WM_DESTROY, 0, 0);// set exit stategame_state = GAME_STATE_SHUTDOWN;}}else if (game_state == GAME_STATE_SHUTDOWN){// in this state shut everything down and release resources// switch to exit stategame_state = GAME_STATE_EXIT;}return 1;
}

3.小球的控制和绘制(原程序为directDraw绘制,此处改为Win32 API绘制)

/* DRAW FUNCTION **************************************************************************/
int Draw_Rectangle(int x1, int y1, int x2, int y2, int color)
{// this function uses Win32 API to draw a filled rectangleHBRUSH		hbrush;HDC			hdc;RECT		rect;SetRect(&rect, x1, y1, x2, y2);hbrush = CreateSolidBrush(color);hdc = GetDC(main_window_handle);FillRect(hdc, &rect, hbrush);ReleaseDC(main_window_handle, hdc);DeleteObject(hbrush);return 1;
}int DrawText_GUI(TCHAR *text, int x, int y, int color)
{HDC	hdc;hdc = GetDC(main_window_handle);// set the colors for the text upSetTextColor(hdc, color);// set background mode to transparent so black isn't copiedSetBkMode(hdc, TRANSPARENT);// draw the textTextOut(hdc, x, y, text, lstrlen(text));// release the dcReleaseDC(main_window_handle, hdc);return 1;
}/* GAME PROGRAMMING CONSOLE FUNCTIONS *****************************************************/
void Init_Blocks(void)
{// initialize the block fieldfor (int row = 0; row < NUM_BLOCK_ROWS; row++)for (int col = 0; col < NUM_BLOCK_COLUMNS; col++)blocks[row][col] = row*16 + col*3 + 16;
}void Draw_Blocks(void)
{// this function draws all the blocks in row major formint x1 = BLOCK_ORIGIN_X;int y1 = BLOCK_ORIGIN_Y;// draw all the blocksfor (int row = 0; row < NUM_BLOCK_ROWS; row++){// reset column positionx1 = BLOCK_ORIGIN_X;for (int col = 0; col < NUM_BLOCK_COLUMNS; col++){if (blocks[row][col] != 0){Draw_Rectangle(x1, y1, x1+BLOCK_WIDTH, y1+BLOCK_HEIGHT, blocks[row][col]);}// advance column positionx1 += BLOCK_X_GAP;}// advance to next row positiony1 += BLOCK_Y_GAP;}
}void Process_Ball(void)
{// this function tests if the ball has hit a block or the paddle if so, the ball is bounced // and the block is removed from  the playfield note: very cheesy collision algorithm :)// first test for ball block collisions// the algorithm basically tests the ball against each block's bounding box this is inefficient, // but easy to implement, later we'll see a better way// current rendering positionint x1 = BLOCK_ORIGIN_X;int y1 = BLOCK_ORIGIN_Y;// computer center of ballint ball_cx = ball_x + (BALL_SIZE/2);int ball_cy = ball_y + (BALL_SIZE/2);// test the ball has hit the paddleif (ball_y > (WINDOW_HEIGHT/2) && ball_dy > 0){// extract leading edge of ballint x = ball_x + (BALL_SIZE/2);int y = ball_y + (BALL_SIZE/2);// test for collision with paddleif ((x >= paddle_x && x <= paddle_x + PADDLE_WIDTH) &&(y >= paddle_y && y <= paddle_y + PADDLE_HEIGHT)){// reflect ballball_dy = -ball_dy;// push ball out of paddle since it made contactball_y += ball_dy;// add a little english to ball based on motion of paddleif (KEY_DOWN(VK_RIGHT))ball_dx -= rand() % 3;else if (KEY_DOWN(VK_LEFT))ball_dx += rand() % 3;elseball_dx += (-1 + rand() % 3);// test if there are no blocks, if so send a message to game loop to start another levelif (blocks_hit >= (NUM_BLOCK_ROWS * NUM_BLOCK_COLUMNS)){game_state = GAME_STATE_START_LEVEL;level++;}// make a little noiseMessageBeep(MB_OK);return;}}// now scan thru all the blocks and see of ball hit blocksfor (int row = 0; row < NUM_BLOCK_ROWS; row++){x1 = BLOCK_ORIGIN_X;// scan this row of blocksfor (int col = 0; col < NUM_BLOCK_COLUMNS; col++){if (blocks[row][col] != 0){// test ball against bounding box of blockif ((ball_cx > x1) && (ball_cx < x1 + BLOCK_WIDTH) &&(ball_cy > y1) && (ball_cy < y1 + BLOCK_HEIGHT)){// remove the blockblocks[row][col] = 0;// increment global block counter, so we know when to start another level upblocks_hit++;// bounce the ballball_dy = -ball_dy;// add a little englishball_dx += (-1 + rand() % 3);// make a little noiseMessageBeep(MB_OK);// add some pointsscore += 5 * (level + (abs)(ball_dx));return;}}// advance column positionx1 += BLOCK_X_GAP;}// advance row positiony1 += BLOCK_Y_GAP;}
}

4.时间控制

/* CLOCK FUNCTIONS ************************************************************************/
DWORD Get_Clock(void)
{// this function returns the current tick count// return timereturn GetTickCount();
}DWORD Start_Clock(void)
{// this function starts the block, that is, saves the current count,// use in conjunction with Wait_Clock()return (start_clock_count = Get_Clock());
}DWORD Wait_Clock(DWORD count)
{// this function is used to wait for a specific number of clicks since// the call to Start_Clockwhile (Get_Clock() - start_clock_count < count);return Get_Clock();
}



5. 发现的问题及解决方案

1)颜色太暗:

原因可能是int 到RGB转换的问题,解决办法是传参数时直接用RGB构造。


2)挡板和分数都看不到

原因是原程序没有标题栏,是全屏显示的,现在有了标题栏,占了一定的空间,导致位置计算的不对,修改窗口style 为WS_POPUP即可。


3)界面闪烁及耗费CPU

原因是每次都先绘制黑色屏幕清除全屏,然后重新绘制,较为浪费,且一直在循环,耗费CPU。

解决办法是减少重绘区域,每次只绘制需要绘制的地方,而不是重绘全屏。修改使用死循环来耗费时间,改为Sleep。


完整代码:

/** FreakOut.cpp (改编自《Windows 游戏编程大师技巧》第一章示例程序)* guzhoudiaoke@126.com* 2012-11-29*//* INCLUDES *******************************************************************************/
#include <windows.h>
#include <stdlib.h>
#include <time.h>
#include <stdio.h>/* DEFINES ********************************************************************************/
// defines for windows
#define WINDOW_CLASS_NAME	TEXT("WIN32CLASS")
#define WINDOW_WIDTH		640
#define WINDOW_HEIGHT		480// states for game loop
#define GAME_STATE_INIT         0
#define GAME_STATE_START_LEVEL  1
#define GAME_STATE_RUN          2
#define GAME_STATE_SHUTDOWN     3
#define GAME_STATE_EXIT         4// block defines
#define NUM_BLOCK_ROWS          6
#define NUM_BLOCK_COLUMNS       8#define BLOCK_WIDTH             64
#define BLOCK_HEIGHT            16
#define BLOCK_ORIGIN_X          8
#define BLOCK_ORIGIN_Y          8
#define BLOCK_X_GAP             80
#define BLOCK_Y_GAP             32// paddle defines
#define PADDLE_START_X          (WINDOW_WIDTH/2 - 16)
#define PADDLE_START_Y          (WINDOW_HEIGHT - 32);
#define PADDLE_WIDTH            32
#define PADDLE_HEIGHT           8
#define PADDLE_COLOR            RGB(0, 0, 255)// ball defines
#define BALL_START_Y            (WINDOW_HEIGHT/2)
#define BALL_SIZE                4// color defines
#define BACKGROUND_COLOR		RGB(0, 0, 0)
#define BLOCK_COLOR				RGB(125, 0, 0)
#define BALL_COLOR				RGB(222, 0, 222)// these read the keyboard asynchronously
#define KEY_DOWN(vk_code) ((GetAsyncKeyState(vk_code) & 0x8000) ? 1 : 0)
#define KEY_UP(vk_code)   ((GetAsyncKeyState(vk_code) & 0x8000) ? 0 : 1)/* basic unsigned types *******************************************************************/
typedef unsigned short USHORT;
typedef unsigned short WORD;
typedef unsigned char  UCHAR;
typedef unsigned char  BYTE;/* FUNCTION DECLARATION *******************************************************************/
int Game_Init(void *parms = NULL);
int Game_Shutdown(void *parms = NULL);
int Game_Main(void *parms = NULL);DWORD Start_Clock(void);
DWORD Wait_Clock(DWORD count);/* GLOBALS *********************************************************************************/
HWND		main_window_handle	= NULL;				// save the window handle
HINSTANCE	main_instance		= NULL;				// save the instance
int			game_state			= GAME_STATE_INIT;	// starting stateint			paddle_x = 0, paddle_y = 0;				// tracks position of paddle
int			ball_x   = 0, ball_y   = 0;				// tracks position of ball
int			ball_dx  = 0, ball_dy  = 0;				// velocity of ball
int			score    = 0;							// the score
int			level    = 1;							// the current level
int			blocks_hit = 0;							// tracks number of blocks hitDWORD		start_clock_count	= 0;				// used for timing// this contains the game grid data
UCHAR blocks[NUM_BLOCK_ROWS][NUM_BLOCK_COLUMNS];    /* WINDPROC ********************************************************************************/
LRESULT CALLBACK WindowProc(HWND	hwnd,UINT	msg,WPARAM	wparam,LPARAM	lparam)
{// this is the main message handler of the systemPAINTSTRUCT	ps;HDC			hdc;switch (msg){case WM_CREATE:return 0;case WM_PAINT:hdc = BeginPaint(hwnd, &ps);EndPaint(hwnd, &ps);return 0;case WM_DESTROY:PostQuitMessage(0);return 0;default:break;}return DefWindowProc(hwnd, msg, wparam, lparam);
}/* WINMAIN ********************************************************************************/
int WINAPI WinMain(HINSTANCE hinstance,HINSTANCE hprevinstance,LPSTR lpcmdline,int ncmdshow)
{WNDCLASS	winclass;HWND		hwnd;MSG			msg;HDC			hdc;PAINTSTRUCT	ps;/* CS_DBLCLKS Specifies that the window should be notified of double clicks with * WM_xBUTTONDBLCLK messages* CS_OWNDC标志,属于此窗口类的窗口实例都有自己的DC(称为私有DC),私有DC仅属于该窗口实例,* 所以程序只需要调用一次GetDC或BeginPaint获取DC,系统就为窗口初始化一个DC,并且保存程序* 对其进行的改变。ReleaseDC和EndPaint函数不再需要了,因为其他程序无法访问和改变私有DC。*/winclass.style			= CS_DBLCLKS | CS_OWNDC | CS_HREDRAW | CS_VREDRAW;winclass.lpfnWndProc	= WindowProc;winclass.cbClsExtra		= 0;winclass.cbWndExtra		= 0;winclass.hInstance		= hinstance;winclass.hIcon			= LoadIcon(NULL, IDI_APPLICATION);winclass.hCursor		= LoadCursor(NULL, IDC_ARROW);winclass.hbrBackground	= (HBRUSH)GetStockObject(BLACK_BRUSH);winclass.lpszMenuName	= NULL;winclass.lpszClassName	= WINDOW_CLASS_NAME;// register the window classif (!RegisterClass(&winclass))return 0;// Create the window, note the use of WS_POPUPhwnd = CreateWindow(WINDOW_CLASS_NAME,			// classTEXT("WIN32 Game Console"),	// titleWS_POPUP,					// style200,						// initial x100,						// initial y	WINDOW_WIDTH,				// initial widthWINDOW_HEIGHT,				// initial heightNULL,						// handle to parentNULL,						// handle to menuhinstance,					// instanceNULL);						// creation parmsif (! hwnd)return 0;ShowWindow(hwnd, ncmdshow);UpdateWindow(hwnd);// hide mouse//ShowCursor(FALSE);// save the window handle and instance in a globalmain_window_handle	= hwnd;main_instance		= hinstance;// perform all game console specific initializationGame_Init();// enter main event loopwhile (1){if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)){// test if this is a quit msgif (msg.message == WM_QUIT)break;// translate any accelerator keysTranslateMessage(&msg);// send the message to the window procDispatchMessage(&msg);}// main game processing goes hereGame_Main();Sleep(30);}// shutdown game and release all resourcesGame_Shutdown();// show mouse//ShowCursor(TRUE);// return to windows like thisreturn (msg.wParam);
}/* DRAW FUNCTION **************************************************************************/
int Draw_Rectangle(int x1, int y1, int x2, int y2, int color)
{// this function uses Win32 API to draw a filled rectangleHBRUSH		hbrush;HDC			hdc;RECT		rect;SetRect(&rect, x1, y1, x2, y2);hbrush = CreateSolidBrush(color);hdc = GetDC(main_window_handle);FillRect(hdc, &rect, hbrush);ReleaseDC(main_window_handle, hdc);DeleteObject(hbrush);return 1;
}int DrawText_GUI(TCHAR *text, int x, int y, int color)
{HDC	hdc;hdc = GetDC(main_window_handle);// set the colors for the text upSetTextColor(hdc, color);// set background mode to transparent so black isn't copiedSetBkMode(hdc, TRANSPARENT);// draw the textTextOut(hdc, x, y, text, lstrlen(text));// release the dcReleaseDC(main_window_handle, hdc);return 1;
}/* GAME PROGRAMMING CONSOLE FUNCTIONS *****************************************************/
void Init_Blocks(void)
{// initialize the block fieldfor (int row = 0; row < NUM_BLOCK_ROWS; row++)for (int col = 0; col < NUM_BLOCK_COLUMNS; col++)blocks[row][col] = 1;
}void Draw_Blocks(void)
{// this function draws all the blocks in row major formint x1 = BLOCK_ORIGIN_X;int y1 = BLOCK_ORIGIN_Y;// draw all the blocksfor (int row = 0; row < NUM_BLOCK_ROWS; row++){// reset column positionx1 = BLOCK_ORIGIN_X;for (int col = 0; col < NUM_BLOCK_COLUMNS; col++){if (blocks[row][col] != 0){Draw_Rectangle(x1, y1, x1+BLOCK_WIDTH, y1+BLOCK_HEIGHT, BLOCK_COLOR);}else{Draw_Rectangle(x1, y1, x1+BLOCK_WIDTH, y1+BLOCK_HEIGHT, BACKGROUND_COLOR);}x1 += BLOCK_X_GAP;		// advance column position}y1 += BLOCK_Y_GAP;			// advance to next row position}
}int Process_Ball(void)
{// this function tests if the ball has hit a block or the paddle if so, the ball is bounced // and the block is removed from  the playfield note: very cheesy collision algorithm :)// first test for ball block collisions// the algorithm basically tests the ball against each block's bounding box this is inefficient, // but easy to implement, later we'll see a better way// current rendering positionint x1 = BLOCK_ORIGIN_X;int y1 = BLOCK_ORIGIN_Y;// computer center of ballint ball_cx = ball_x + (BALL_SIZE/2);int ball_cy = ball_y + (BALL_SIZE/2);// test the ball has hit the paddleif (ball_y > (WINDOW_HEIGHT/2) && ball_dy > 0){// extract leading edge of ballint x = ball_x + (BALL_SIZE/2);int y = ball_y + (BALL_SIZE/2);// test for collision with paddleif ((x >= paddle_x && x <= paddle_x + PADDLE_WIDTH) &&(y >= paddle_y && y <= paddle_y + PADDLE_HEIGHT)){ball_dy = -ball_dy;		// reflect ballball_y += ball_dy;		// push ball out of paddle since it made contact// add a little english to ball based on motion of paddleif (KEY_DOWN(VK_RIGHT))ball_dx -= rand() % 3;else if (KEY_DOWN(VK_LEFT))ball_dx += rand() % 3;elseball_dx += (-1 + rand() % 3);// make a little noiseMessageBeep(MB_OK);return 0;}}// now scan thru all the blocks and see of ball hit blocksfor (int row = 0; row < NUM_BLOCK_ROWS; row++){x1 = BLOCK_ORIGIN_X;// scan this row of blocksfor (int col = 0; col < NUM_BLOCK_COLUMNS; col++){if (blocks[row][col] != 0){// test ball against bounding box of blockif ((ball_cx > x1) && (ball_cx < x1 + BLOCK_WIDTH) &&(ball_cy > y1) && (ball_cy < y1 + BLOCK_HEIGHT)){blocks[row][col] = 0;			// remove the block// increment global block counter, so we know when to start another level upblocks_hit++;				ball_dy = -ball_dy;				// bounce the ball				ball_dx += (-1 + rand() % 3);	// add a little englishMessageBeep(MB_OK);				// make a little noise// test if there are no blocks, if so send a message to game loop to start another levelif (blocks_hit >= (NUM_BLOCK_ROWS * NUM_BLOCK_COLUMNS)){game_state = GAME_STATE_START_LEVEL;level++;}// add some pointsscore += 5 * (level + (abs)(ball_dx));return 1;}}x1 += BLOCK_X_GAP;		// advance column position}y1 += BLOCK_Y_GAP;			// advance row position}return 0;
}int Game_Init(void *parms)
{// this function is where you do all the initialization for your gamereturn 1;
}int Game_Shutdown(void *parms)
{// this function is where you shutdown your game and release all resources // that you allocatedreturn 1;
}int Game_Main(void *parms)
{// this is the workhorse of your game it will be called continuously in real-time// this is like main() in C all the calls for you game go here!TCHAR	buffer[80];BOOL	bPaddleMoved = FALSE;int		old_paddle_x, old_paddle_y;int		old_ball_x, old_ball_y;// what state is the game in?if (game_state == GAME_STATE_INIT){// seed the random number generator so game is different each playsrand((unsigned int)time(0));// set the paddle position here to the middle bottompaddle_x = PADDLE_START_X;paddle_y = PADDLE_START_Y;// set ball position and velocityball_x =   8 + rand() % (WINDOW_WIDTH-16);ball_y = BALL_START_Y;ball_dx = -4 + rand() % (8+1);ball_dy =  6 + rand() % 2;// transition to start level stategame_state = GAME_STATE_START_LEVEL;}else if (game_state == GAME_STATE_START_LEVEL){// get a new level ready to runInit_Blocks();				// initialize the blocksblocks_hit = 0;				// reset block counterDraw_Blocks();				// draw blocks// draw the paddleDraw_Rectangle(paddle_x, paddle_y, paddle_x+PADDLE_WIDTH, paddle_y+PADDLE_HEIGHT, PADDLE_COLOR);game_state = GAME_STATE_RUN;// transition to run state}else if (game_state == GAME_STATE_RUN){// move the paddleif (KEY_DOWN(VK_RIGHT)){old_paddle_x = paddle_x;old_paddle_y = paddle_y;paddle_x += 8;			// move paddle to right// make sure paddle doesn't go off screenif (paddle_x > (WINDOW_WIDTH - PADDLE_WIDTH))paddle_x = WINDOW_WIDTH - PADDLE_WIDTH;bPaddleMoved = TRUE;}else if (KEY_DOWN(VK_LEFT)){old_paddle_x = paddle_x;old_paddle_y = paddle_y;paddle_x -= 8;			// move paddle to left// make sure paddle doesn't go off screenif (paddle_x < 0)paddle_x = 0;bPaddleMoved = TRUE;}old_ball_x = ball_x;old_ball_y = ball_y;// move the ballball_x += ball_dx;ball_y += ball_dy;// keep ball on screen, if the ball hits the edge of screen then// bounce it by reflecting its velocityif (ball_x > (WINDOW_WIDTH - BALL_SIZE) || ball_x < 0){ball_dx = -ball_dx;		// reflect x-axis velocityball_x += ball_dx;		// update position}// now y-axisif (ball_y < 0){ball_dy = -ball_dy;		// reflect y-axis velocityball_y += ball_dy;		// update position}else if (ball_y > (WINDOW_HEIGHT - BALL_SIZE)){ball_dy = -ball_dy;		// reflect y-axis velocityball_y += ball_dy;		// update position		score -= 100;			// minus the score}// next watch out for ball velocity getting out of handif (ball_dx > 8) ball_dx = 8;else if (ball_dx < -8)ball_dx = -8;// test if ball hit any blocks or the paddleif (Process_Ball()){	Draw_Blocks();			// draw blocks}if (bPaddleMoved){// 覆盖旧的paddleDraw_Rectangle(old_paddle_x, old_paddle_y, old_paddle_x+PADDLE_WIDTH, old_paddle_y+PADDLE_HEIGHT, BACKGROUND_COLOR);// draw the paddleDraw_Rectangle(paddle_x, paddle_y, paddle_x+PADDLE_WIDTH, paddle_y+PADDLE_HEIGHT, PADDLE_COLOR);}// 覆盖旧的ballDraw_Rectangle(old_ball_x, old_ball_y, old_ball_x+BALL_SIZE, old_ball_y+BALL_SIZE, BACKGROUND_COLOR);// draw the ballDraw_Rectangle(ball_x, ball_y, ball_x+BALL_SIZE, ball_y+BALL_SIZE, BALL_COLOR);// draw the infowsprintf(buffer, TEXT("FREAKOUT            Score %d              Level %d"), score, level);Draw_Rectangle(8, WINDOW_HEIGHT-26, WINDOW_WIDTH, WINDOW_HEIGHT, BACKGROUND_COLOR);DrawText_GUI(buffer, 8, WINDOW_HEIGHT-26, RGB(255, 255, 128));// check if user is trying to exitif (KEY_DOWN(VK_ESCAPE)){// send message to windows to exitPostMessage(main_window_handle, WM_DESTROY, 0, 0);// set exit stategame_state = GAME_STATE_SHUTDOWN;}}else if (game_state == GAME_STATE_SHUTDOWN){// in this state shut everything down and release resources// switch to exit stategame_state = GAME_STATE_EXIT;}return 1;
}/* CLOCK FUNCTIONS ************************************************************************/
DWORD Get_Clock(void)
{// this function returns the current tick count// return timereturn GetTickCount();
}DWORD Start_Clock(void)
{// this function starts the block, that is, saves the current count,// use in conjunction with Wait_Clock()return (start_clock_count = Get_Clock());
}DWORD Wait_Clock(DWORD count)
{// this function is used to wait for a specific number of clicks since// the call to Start_Clockwhile (Get_Clock() - start_clock_count < count);return Get_Clock();
}




不足之处:因为之前经常在linux下编程,用的是game_state类型的变量风格,最近在windows下想学所谓的匈牙利表示法,但这段代码作者用了game_state类型的变量风格,我又被俘获了。。。

编程风格要统一,不能总是变来变去的!切记。


查看全文
如若内容造成侵权/违法违规/事实不符,请联系编程学习网邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!

相关文章

  1. JavaScript(一)

    一、JS三种书写位置 1、行内式JS <input type"button" value"点击" onclick"alert(HelloWorld)"> 可以将单行或少量JS代码写在HTML标签的事件属性中&#xff08;以on开头的属性&#xff09;&#xff0c;如&#xff1a;onclick 注意单双…...

    2024/4/7 0:00:18
  2. php说明

    PHP是世界上最好的语言。 python也是。...

    2024/4/5 6:36:01
  3. 26.forn属性和formaction属性

    <!doctype html> <html> <head> <meta charset"utf-8"> <title>26.forn属性和formaction属性</title> </head><body><form id"textform"><input type"text" ><br/></form…...

    2024/4/5 6:36:00
  4. abc123

    PHP是世界上最好的语言。...

    2024/4/15 7:36:57
  5. c++高精度一系列的算法(包含阶乘求和)

    高精度运算 一、高精度加减高精度以及高精度乘低精度。 #include <iostream> #include <vector> //使用了vector动态数组的方法来实现。 #include <string> using namespace std; vector<int> add(vector<int> A, vecto…...

    2024/4/16 5:55:36
  6. element表格高度自适应

    mounted() {this.$nextTick(() => {this.tableHeight = window.innerHeight - this.$refs.table.$el.offsetTop -...

    2024/4/7 0:00:17
  7. 【AI视野·今日NLP 自然语言处理论文速览 第二十六期】Tue, 19 Oct 2021

    AI视野今日CS.NLP 自然语言处理论文速览 Tue, 19 Oct 2021 Totally 91 papers &#x1f449;上期速览✈更多精彩请移步主页 Daily Computation and Language Papers NormFormer: Improved Transformer Pretraining with Extra Normalization Authors Sam Shleifer, Jason West…...

    2024/4/15 7:36:52
  8. 【行研报告】衣物洗护行业:全健康趋势下的洗涤新机会——附下载链接

    衣物洗护行业保持稳定增长&#xff0c;据艾瑞咨询推算&#xff0c;2021年&#xff0c;衣物洗涤行业规模将突破800亿元人民币&#xff0c;同比增速5.5%。洗涤行业趋势&#xff1a;1&#xff09;洗衣液包装规格越来越“大”&#xff0c;而洗衣凝珠则越来越“小”&#xff1b;2&am…...

    2024/4/7 0:00:15
  9. 丰田开始应用量子计算:研发固态电池

    电动汽车常用的锂离子电池 据日经亚洲报道&#xff0c;丰田汽车公司上个月与总部位于东京的QunaSys达成了合作。QunaSys是一家专注于量子计算软件的公司&#xff0c;丰田将采用QunaSys的量子计算软件作为研究工具之一&#xff0c;寻找新材料来优化和提高丰田电池的性能。 通常…...

    2024/4/15 7:36:47
  10. TC3系统安装

    1、软件安装包和下载来源 1.1、V S2013&#xff0c;镜像文件&#xff1a;http://download.microsoft.com/download/B/1/9/B1932B8C-1046-4773-A1DD-4AB5C0978637/vs2013.2_ult_chs.iso 1.2 TC3安包和帮助 最新的安装包&#xff1a;Beckhoff | New Automation Technology | Bec…...

    2024/4/15 7:37:02
  11. zzu健康打卡requests版

    1.网页解析需要etree 在lxml 库里面,需要pip install lxml ,请求需要 requests ,pip install requests 2.原代码,看注释填你的信息 import requests import re import lxml.htmletree lxml.html.etreedef daka(user, password):# 发出post请求登录的urlurl_log_post https:/…...

    2024/4/15 7:37:02
  12. OI退役记,第九部分,过去和现在

    您要去斯卡布罗的集市吗? 欧芹,鼠尾草,迷迭香和百里香。 代我向那里的一个人问好, 如果他曾经是我的爱人。 让他为我做一件麻布衬衫; 欧芹,鼠尾草,迷迭香和百里香。 不要有针眼或缝线的痕迹, 那他才是我真正的爱人。 让他为我找一亩空旷田地; 欧芹,鼠尾草,迷迭香和百里香。…...

    2024/4/15 7:36:52
  13. shell循环--for

    循环1. for循环1.1 语法结构1.2 不带列表循环1.3 类似于C语言的循环1.4 举例1.4.1 计算1到100之间奇数的和2. 循环体的控制2.1 输入一个正整数&#xff0c;判断是否为质数2.2 批量加5个新用户&#xff0c;以u1到u5命名&#xff0c;并统一加一个新组&#xff0c;组名为class,统一…...

    2024/4/15 7:36:42
  14. lims实验室信息监控管理系统解决方案

    虽然许多实验室设备都具有嵌入式和外部PC软件&#xff0c;但迫切需要独立软件来帮助研究人员组织他们的工作。专用实验室管理软件&#xff0c;通常称为实验室信息管理系统(LIMS)&#xff0c;为控制设备、分类和计数样品、管理和维护任何复杂到需要持续计算机控制的项目提供简化…...

    2024/4/15 7:37:02
  15. 证明假如两个正整数 a 和 m 如果不互素(gcd(a, m) 不为 1),则 a 没有模 m 的逆元

    反证法&#xff1a; 假设gcd(a, m)1, 且 a 依然有模m的逆元s 使得 sa 1(mod m) 则由贝祖定理&#xff0c;当gcd(a, m&#xff09; 1时&#xff0c; 不存在两个整数 s 和 t&#xff0c; 使 由假设&#xff0c;可以得到 ( is an integer) 则有 &#xff0c;则 由贝祖定理&am…...

    2024/4/7 0:00:08
  16. 2021年春季学期期末统一考试电子商务概论(农) 试题

    试卷代号&#xff1a;4990 2021年春季学期期末统一考试 电子商务概论&#xff08;农&#xff09; 试题&#xff08;开卷&#xff09; 2021年7月 一、单项选择题&#xff08;每小题2分&#xff0c;共20分&#xff0c;每小题有1个正确答案&#xff0c;错选、不选均不得分&a…...

    2024/4/15 7:37:37
  17. ElasticSearch——Kibana Windows下的安装和Dev Tools的使用

    ElasticSearch——Kibana 的Windows安装和Dev Tools的使用 1、Kibana 下载安装 Kibana 简介 Kibana 是一款开源的数据分析和可视化平台&#xff0c;它是 Elastic Stack 成员之一&#xff0c;设计用于和 Elasticsearch 协作。您可以使用 Kibana 对 Elasticsearch 索引中的数据进…...

    2024/4/15 7:37:42
  18. python字符串的用法

    字符串的用法 #coding:utf-8 #字符串的三种风格print(hello world) print("hello world") print() ch 我 print(ord(ch)) #ord只能处理单个字符#字符串截取 mystr 生活中的程序员真实写照、一款游戏一包烟&#xff0c;一台电脑一下午。一盒泡面一壶水&#xff0c…...

    2024/4/5 6:36:09
  19. 算法工程团队的测试方法总结

    目录 服务于算法的工程团队的测试需求 当前团队的开发特点 团队测试开发的几个发展阶段 测试脚本、小工具 流量回放工具 专用测试工具 通用的压力测试平台 整体流程 自动化、白屏化 可视化 平台化 当前问题总结 专用工具和通用压力测试工具的优劣对比 多个团队各有…...

    2024/4/5 6:36:08
  20. 游戏编程书籍

    现在基本是3D游戏编程,而游戏编程又分为服务器和客户端编程。服务器方面需要掌握 SOCKET,多线程,数据库和LINUX技术。而客户端需要掌握的东西就多了,基础不错,如果你将DX玩会了就OK了,介绍一些书 吧,希望有用! 戏脚本高级编程(附光盘)http://book.jqcq.com/product/5…...

    2024/4/15 7:37:37

最新文章

  1. 如何应对当下软件开发技术的快速迭代

    当下软件开发技术的快速迭代是一个不可避免的趋势&#xff0c;随着技术的不断进步和市场需求的变化&#xff0c;开发团队需要及时跟进新技术和新方法&#xff0c;以保持竞争力。以下是一些应对当下软件开发技术快速迭代的建议&#xff1a; 持续学习和自我提升&#xff1a;作为开…...

    2024/4/16 14:52:31
  2. 梯度消失和梯度爆炸的一些处理方法

    在这里是记录一下梯度消失或梯度爆炸的一些处理技巧。全当学习总结了如有错误还请留言&#xff0c;在此感激不尽。 权重和梯度的更新公式如下&#xff1a; w w − η ⋅ ∇ w w w - \eta \cdot \nabla w ww−η⋅∇w 个人通俗的理解梯度消失就是网络模型在反向求导的时候出…...

    2024/3/20 10:50:27
  3. linux进阶篇:磁盘管理(一):LVM逻辑卷基本概念及LVM的工作原理

    Linux磁盘管理(一)&#xff1a;LVM逻辑卷基本概念及LVM的工作原理 一、传统的磁盘管理 在传统的磁盘管理方案中&#xff0c;如果我们的磁盘容量不够了&#xff0c;那这个时候应该要加一块硬盘&#xff0c;但是新增加的硬盘是作为独立的文件系统存在的&#xff0c;原有的文件系…...

    2024/4/15 13:17:10
  4. 开启 Keep-Alive 可能会导致http 请求偶发失败

    大家好&#xff0c;我是蓝胖子&#xff0c;说起提高http的传输效率&#xff0c;很多人会开启http的Keep-Alive选项&#xff0c;这会http请求能够复用tcp连接&#xff0c;节省了握手的开销。但开启Keep-Alive真的没有问题吗&#xff1f;我们来细细分析下。 最大空闲时间造成请求…...

    2024/4/16 13:06:38
  5. 在 Visual Studio Code (VSCode) 中隐藏以 . 开头的文件

    打开VSCode。 按下Ctrl ,快捷键打开设置。您也可以点击屏幕左下角的齿轮图标&#xff0c;然后选择“Settings”。 在设置搜索框中&#xff0c;键入files.exclude。 在找到的Files: Exclude项中&#xff0c;点击Add Pattern按钮来添加一个新的模式&#xff0c;或者直接在搜索…...

    2024/4/16 2:22:38
  6. 【外汇早评】美通胀数据走低,美元调整

    原标题:【外汇早评】美通胀数据走低,美元调整昨日美国方面公布了新一期的核心PCE物价指数数据,同比增长1.6%,低于前值和预期值的1.7%,距离美联储的通胀目标2%继续走低,通胀压力较低,且此前美国一季度GDP初值中的消费部分下滑明显,因此市场对美联储后续更可能降息的政策…...

    2024/4/16 14:09:00
  7. 【原油贵金属周评】原油多头拥挤,价格调整

    原标题:【原油贵金属周评】原油多头拥挤,价格调整本周国际劳动节,我们喜迎四天假期,但是整个金融市场确实流动性充沛,大事频发,各个商品波动剧烈。美国方面,在本周四凌晨公布5月份的利率决议和新闻发布会,维持联邦基金利率在2.25%-2.50%不变,符合市场预期。同时美联储…...

    2024/4/15 1:05:01
  8. 【外汇周评】靓丽非农不及疲软通胀影响

    原标题:【外汇周评】靓丽非农不及疲软通胀影响在刚结束的周五,美国方面公布了新一期的非农就业数据,大幅好于前值和预期,新增就业重新回到20万以上。具体数据: 美国4月非农就业人口变动 26.3万人,预期 19万人,前值 19.6万人。 美国4月失业率 3.6%,预期 3.8%,前值 3…...

    2024/4/15 9:18:15
  9. 【原油贵金属早评】库存继续增加,油价收跌

    原标题:【原油贵金属早评】库存继续增加,油价收跌周三清晨公布美国当周API原油库存数据,上周原油库存增加281万桶至4.692亿桶,增幅超过预期的74.4万桶。且有消息人士称,沙特阿美据悉将于6月向亚洲炼油厂额外出售更多原油,印度炼油商预计将每日获得至多20万桶的额外原油供…...

    2024/4/16 1:57:15
  10. 【外汇早评】日本央行会议纪要不改日元强势

    原标题:【外汇早评】日本央行会议纪要不改日元强势近两日日元大幅走强与近期市场风险情绪上升,避险资金回流日元有关,也与前一段时间的美日贸易谈判给日本缓冲期,日本方面对汇率问题也避免继续贬值有关。虽然今日早间日本央行公布的利率会议纪要仍然是支持宽松政策,但这符…...

    2024/4/15 9:17:51
  11. 【原油贵金属早评】欧佩克稳定市场,填补伊朗问题的影响

    原标题:【原油贵金属早评】欧佩克稳定市场,填补伊朗问题的影响近日伊朗局势升温,导致市场担忧影响原油供给,油价试图反弹。此时OPEC表态稳定市场。据消息人士透露,沙特6月石油出口料将低于700万桶/日,沙特已经收到石油消费国提出的6月份扩大出口的“适度要求”,沙特将满…...

    2024/4/15 9:17:44
  12. 【外汇早评】美欲与伊朗重谈协议

    原标题:【外汇早评】美欲与伊朗重谈协议美国对伊朗的制裁遭到伊朗的抗议,昨日伊朗方面提出将部分退出伊核协议。而此行为又遭到欧洲方面对伊朗的谴责和警告,伊朗外长昨日回应称,欧洲国家履行它们的义务,伊核协议就能保证存续。据传闻伊朗的导弹已经对准了以色列和美国的航…...

    2024/4/15 13:52:20
  13. 【原油贵金属早评】波动率飙升,市场情绪动荡

    原标题:【原油贵金属早评】波动率飙升,市场情绪动荡因中美贸易谈判不安情绪影响,金融市场各资产品种出现明显的波动。随着美国与中方开启第十一轮谈判之际,美国按照既定计划向中国2000亿商品征收25%的关税,市场情绪有所平复,已经开始接受这一事实。虽然波动率-恐慌指数VI…...

    2024/4/16 1:58:32
  14. 【原油贵金属周评】伊朗局势升温,黄金多头跃跃欲试

    原标题:【原油贵金属周评】伊朗局势升温,黄金多头跃跃欲试美国和伊朗的局势继续升温,市场风险情绪上升,避险黄金有向上突破阻力的迹象。原油方面稍显平稳,近期美国和OPEC加大供给及市场需求回落的影响,伊朗局势并未推升油价走强。近期中美贸易谈判摩擦再度升级,美国对中…...

    2024/4/15 9:17:27
  15. 【原油贵金属早评】市场情绪继续恶化,黄金上破

    原标题:【原油贵金属早评】市场情绪继续恶化,黄金上破周初中国针对于美国加征关税的进行的反制措施引发市场情绪的大幅波动,人民币汇率出现大幅的贬值动能,金融市场受到非常明显的冲击。尤其是波动率起来之后,对于股市的表现尤其不安。隔夜美国股市出现明显的下行走势,这…...

    2024/4/15 9:17:21
  16. 【外汇早评】美伊僵持,风险情绪继续升温

    原标题:【外汇早评】美伊僵持,风险情绪继续升温昨日沙特两艘油轮再次发生爆炸事件,导致波斯湾局势进一步恶化,市场担忧美伊可能会出现摩擦生火,避险品种获得支撑,黄金和日元大幅走强。美指受中美贸易问题影响而在低位震荡。继5月12日,四艘商船在阿联酋领海附近的阿曼湾、…...

    2024/4/15 9:17:15
  17. 【原油贵金属早评】贸易冲突导致需求低迷,油价弱势

    原标题:【原油贵金属早评】贸易冲突导致需求低迷,油价弱势近日虽然伊朗局势升温,中东地区几起油船被袭击事件影响,但油价并未走高,而是出于调整结构中。由于市场预期局势失控的可能性较低,而中美贸易问题导致的全球经济衰退风险更大,需求会持续低迷,因此油价调整压力较…...

    2024/4/15 13:53:08
  18. 氧生福地 玩美北湖(上)——为时光守候两千年

    原标题:氧生福地 玩美北湖(上)——为时光守候两千年一次说走就走的旅行,只有一张高铁票的距离~ 所以,湖南郴州,我来了~ 从广州南站出发,一个半小时就到达郴州西站了。在动车上,同时改票的南风兄和我居然被分到了一个车厢,所以一路非常愉快地聊了过来。 挺好,最起…...

    2024/4/15 9:16:52
  19. 氧生福地 玩美北湖(中)——永春梯田里的美与鲜

    原标题:氧生福地 玩美北湖(中)——永春梯田里的美与鲜一觉醒来,因为大家太爱“美”照,在柳毅山庄去寻找龙女而错过了早餐时间。近十点,向导坏坏还是带着饥肠辘辘的我们去吃郴州最富有盛名的“鱼头粉”。说这是“十二分推荐”,到郴州必吃的美食之一。 哇塞!那个味美香甜…...

    2024/4/15 13:53:31
  20. 氧生福地 玩美北湖(下)——奔跑吧骚年!

    原标题:氧生福地 玩美北湖(下)——奔跑吧骚年!让我们红尘做伴 活得潇潇洒洒 策马奔腾共享人世繁华 对酒当歌唱出心中喜悦 轰轰烈烈把握青春年华 让我们红尘做伴 活得潇潇洒洒 策马奔腾共享人世繁华 对酒当歌唱出心中喜悦 轰轰烈烈把握青春年华 啊……啊……啊 两…...

    2024/4/15 9:16:39
  21. 扒开伪装医用面膜,翻六倍价格宰客,小姐姐注意了!

    原标题:扒开伪装医用面膜,翻六倍价格宰客,小姐姐注意了!扒开伪装医用面膜,翻六倍价格宰客!当行业里的某一品项火爆了,就会有很多商家蹭热度,装逼忽悠,最近火爆朋友圈的医用面膜,被沾上了污点,到底怎么回事呢? “比普通面膜安全、效果好!痘痘、痘印、敏感肌都能用…...

    2024/4/15 9:16:31
  22. 「发现」铁皮石斛仙草之神奇功效用于医用面膜

    原标题:「发现」铁皮石斛仙草之神奇功效用于医用面膜丽彦妆铁皮石斛医用面膜|石斛多糖无菌修护补水贴19大优势: 1、铁皮石斛:自唐宋以来,一直被列为皇室贡品,铁皮石斛生于海拔1600米的悬崖峭壁之上,繁殖力差,产量极低,所以古代仅供皇室、贵族享用 2、铁皮石斛自古民间…...

    2024/4/15 13:54:27
  23. 丽彦妆\医用面膜\冷敷贴轻奢医学护肤引导者

    原标题:丽彦妆\医用面膜\冷敷贴轻奢医学护肤引导者【公司简介】 广州华彬企业隶属香港华彬集团有限公司,专注美业21年,其旗下品牌: 「圣茵美」私密荷尔蒙抗衰,产后修复 「圣仪轩」私密荷尔蒙抗衰,产后修复 「花茵莳」私密荷尔蒙抗衰,产后修复 「丽彦妆」专注医学护…...

    2024/4/15 23:28:22
  24. 广州械字号面膜生产厂家OEM/ODM4项须知!

    原标题:广州械字号面膜生产厂家OEM/ODM4项须知!广州械字号面膜生产厂家OEM/ODM流程及注意事项解读: 械字号医用面膜,其实在我国并没有严格的定义,通常我们说的医美面膜指的应该是一种「医用敷料」,也就是说,医用面膜其实算作「医疗器械」的一种,又称「医用冷敷贴」。 …...

    2024/4/15 23:28:30
  25. 械字号医用眼膜缓解用眼过度到底有无作用?

    原标题:械字号医用眼膜缓解用眼过度到底有无作用?医用眼膜/械字号眼膜/医用冷敷眼贴 凝胶层为亲水高分子材料,含70%以上的水分。体表皮肤温度传导到本产品的凝胶层,热量被凝胶内水分子吸收,通过水分的蒸发带走大量的热量,可迅速地降低体表皮肤局部温度,减轻局部皮肤的灼…...

    2024/4/15 13:54:53
  26. 配置失败还原请勿关闭计算机,电脑开机屏幕上面显示,配置失败还原更改 请勿关闭计算机 开不了机 这个问题怎么办...

    解析如下&#xff1a;1、长按电脑电源键直至关机&#xff0c;然后再按一次电源健重启电脑&#xff0c;按F8健进入安全模式2、安全模式下进入Windows系统桌面后&#xff0c;按住“winR”打开运行窗口&#xff0c;输入“services.msc”打开服务设置3、在服务界面&#xff0c;选中…...

    2022/11/19 21:17:18
  27. 错误使用 reshape要执行 RESHAPE,请勿更改元素数目。

    %读入6幅图像&#xff08;每一幅图像的大小是564*564&#xff09; f1 imread(WashingtonDC_Band1_564.tif); subplot(3,2,1),imshow(f1); f2 imread(WashingtonDC_Band2_564.tif); subplot(3,2,2),imshow(f2); f3 imread(WashingtonDC_Band3_564.tif); subplot(3,2,3),imsho…...

    2022/11/19 21:17:16
  28. 配置 已完成 请勿关闭计算机,win7系统关机提示“配置Windows Update已完成30%请勿关闭计算机...

    win7系统关机提示“配置Windows Update已完成30%请勿关闭计算机”问题的解决方法在win7系统关机时如果有升级系统的或者其他需要会直接进入一个 等待界面&#xff0c;在等待界面中我们需要等待操作结束才能关机&#xff0c;虽然这比较麻烦&#xff0c;但是对系统进行配置和升级…...

    2022/11/19 21:17:15
  29. 台式电脑显示配置100%请勿关闭计算机,“准备配置windows 请勿关闭计算机”的解决方法...

    有不少用户在重装Win7系统或更新系统后会遇到“准备配置windows&#xff0c;请勿关闭计算机”的提示&#xff0c;要过很久才能进入系统&#xff0c;有的用户甚至几个小时也无法进入&#xff0c;下面就教大家这个问题的解决方法。第一种方法&#xff1a;我们首先在左下角的“开始…...

    2022/11/19 21:17:14
  30. win7 正在配置 请勿关闭计算机,怎么办Win7开机显示正在配置Windows Update请勿关机...

    置信有很多用户都跟小编一样遇到过这样的问题&#xff0c;电脑时发现开机屏幕显现“正在配置Windows Update&#xff0c;请勿关机”(如下图所示)&#xff0c;而且还需求等大约5分钟才干进入系统。这是怎样回事呢&#xff1f;一切都是正常操作的&#xff0c;为什么开时机呈现“正…...

    2022/11/19 21:17:13
  31. 准备配置windows 请勿关闭计算机 蓝屏,Win7开机总是出现提示“配置Windows请勿关机”...

    Win7系统开机启动时总是出现“配置Windows请勿关机”的提示&#xff0c;没过几秒后电脑自动重启&#xff0c;每次开机都这样无法进入系统&#xff0c;此时碰到这种现象的用户就可以使用以下5种方法解决问题。方法一&#xff1a;开机按下F8&#xff0c;在出现的Windows高级启动选…...

    2022/11/19 21:17:12
  32. 准备windows请勿关闭计算机要多久,windows10系统提示正在准备windows请勿关闭计算机怎么办...

    有不少windows10系统用户反映说碰到这样一个情况&#xff0c;就是电脑提示正在准备windows请勿关闭计算机&#xff0c;碰到这样的问题该怎么解决呢&#xff0c;现在小编就给大家分享一下windows10系统提示正在准备windows请勿关闭计算机的具体第一种方法&#xff1a;1、2、依次…...

    2022/11/19 21:17:11
  33. 配置 已完成 请勿关闭计算机,win7系统关机提示“配置Windows Update已完成30%请勿关闭计算机”的解决方法...

    今天和大家分享一下win7系统重装了Win7旗舰版系统后&#xff0c;每次关机的时候桌面上都会显示一个“配置Windows Update的界面&#xff0c;提示请勿关闭计算机”&#xff0c;每次停留好几分钟才能正常关机&#xff0c;导致什么情况引起的呢&#xff1f;出现配置Windows Update…...

    2022/11/19 21:17:10
  34. 电脑桌面一直是清理请关闭计算机,windows7一直卡在清理 请勿关闭计算机-win7清理请勿关机,win7配置更新35%不动...

    只能是等着&#xff0c;别无他法。说是卡着如果你看硬盘灯应该在读写。如果从 Win 10 无法正常回滚&#xff0c;只能是考虑备份数据后重装系统了。解决来方案一&#xff1a;管理员运行cmd&#xff1a;net stop WuAuServcd %windir%ren SoftwareDistribution SDoldnet start WuA…...

    2022/11/19 21:17:09
  35. 计算机配置更新不起,电脑提示“配置Windows Update请勿关闭计算机”怎么办?

    原标题&#xff1a;电脑提示“配置Windows Update请勿关闭计算机”怎么办&#xff1f;win7系统中在开机与关闭的时候总是显示“配置windows update请勿关闭计算机”相信有不少朋友都曾遇到过一次两次还能忍但经常遇到就叫人感到心烦了遇到这种问题怎么办呢&#xff1f;一般的方…...

    2022/11/19 21:17:08
  36. 计算机正在配置无法关机,关机提示 windows7 正在配置windows 请勿关闭计算机 ,然后等了一晚上也没有关掉。现在电脑无法正常关机...

    关机提示 windows7 正在配置windows 请勿关闭计算机 &#xff0c;然后等了一晚上也没有关掉。现在电脑无法正常关机以下文字资料是由(历史新知网www.lishixinzhi.com)小编为大家搜集整理后发布的内容&#xff0c;让我们赶快一起来看一下吧&#xff01;关机提示 windows7 正在配…...

    2022/11/19 21:17:05
  37. 钉钉提示请勿通过开发者调试模式_钉钉请勿通过开发者调试模式是真的吗好不好用...

    钉钉请勿通过开发者调试模式是真的吗好不好用 更新时间:2020-04-20 22:24:19 浏览次数:729次 区域: 南阳 > 卧龙 列举网提醒您:为保障您的权益,请不要提前支付任何费用! 虚拟位置外设器!!轨迹模拟&虚拟位置外设神器 专业用于:钉钉,外勤365,红圈通,企业微信和…...

    2022/11/19 21:17:05
  38. 配置失败还原请勿关闭计算机怎么办,win7系统出现“配置windows update失败 还原更改 请勿关闭计算机”,长时间没反应,无法进入系统的解决方案...

    前几天班里有位学生电脑(windows 7系统)出问题了&#xff0c;具体表现是开机时一直停留在“配置windows update失败 还原更改 请勿关闭计算机”这个界面&#xff0c;长时间没反应&#xff0c;无法进入系统。这个问题原来帮其他同学也解决过&#xff0c;网上搜了不少资料&#x…...

    2022/11/19 21:17:04
  39. 一个电脑无法关闭计算机你应该怎么办,电脑显示“清理请勿关闭计算机”怎么办?...

    本文为你提供了3个有效解决电脑显示“清理请勿关闭计算机”问题的方法&#xff0c;并在最后教给你1种保护系统安全的好方法&#xff0c;一起来看看&#xff01;电脑出现“清理请勿关闭计算机”在Windows 7(SP1)和Windows Server 2008 R2 SP1中&#xff0c;添加了1个新功能在“磁…...

    2022/11/19 21:17:03
  40. 请勿关闭计算机还原更改要多久,电脑显示:配置windows更新失败,正在还原更改,请勿关闭计算机怎么办...

    许多用户在长期不使用电脑的时候&#xff0c;开启电脑发现电脑显示&#xff1a;配置windows更新失败&#xff0c;正在还原更改&#xff0c;请勿关闭计算机。。.这要怎么办呢&#xff1f;下面小编就带着大家一起看看吧&#xff01;如果能够正常进入系统&#xff0c;建议您暂时移…...

    2022/11/19 21:17:02
  41. 还原更改请勿关闭计算机 要多久,配置windows update失败 还原更改 请勿关闭计算机,电脑开机后一直显示以...

    配置windows update失败 还原更改 请勿关闭计算机&#xff0c;电脑开机后一直显示以以下文字资料是由(历史新知网www.lishixinzhi.com)小编为大家搜集整理后发布的内容&#xff0c;让我们赶快一起来看一下吧&#xff01;配置windows update失败 还原更改 请勿关闭计算机&#x…...

    2022/11/19 21:17:01
  42. 电脑配置中请勿关闭计算机怎么办,准备配置windows请勿关闭计算机一直显示怎么办【图解】...

    不知道大家有没有遇到过这样的一个问题&#xff0c;就是我们的win7系统在关机的时候&#xff0c;总是喜欢显示“准备配置windows&#xff0c;请勿关机”这样的一个页面&#xff0c;没有什么大碍&#xff0c;但是如果一直等着的话就要两个小时甚至更久都关不了机&#xff0c;非常…...

    2022/11/19 21:17:00
  43. 正在准备配置请勿关闭计算机,正在准备配置windows请勿关闭计算机时间长了解决教程...

    当电脑出现正在准备配置windows请勿关闭计算机时&#xff0c;一般是您正对windows进行升级&#xff0c;但是这个要是长时间没有反应&#xff0c;我们不能再傻等下去了。可能是电脑出了别的问题了&#xff0c;来看看教程的说法。正在准备配置windows请勿关闭计算机时间长了方法一…...

    2022/11/19 21:16:59
  44. 配置失败还原请勿关闭计算机,配置Windows Update失败,还原更改请勿关闭计算机...

    我们使用电脑的过程中有时会遇到这种情况&#xff0c;当我们打开电脑之后&#xff0c;发现一直停留在一个界面&#xff1a;“配置Windows Update失败&#xff0c;还原更改请勿关闭计算机”&#xff0c;等了许久还是无法进入系统。如果我们遇到此类问题应该如何解决呢&#xff0…...

    2022/11/19 21:16:58
  45. 如何在iPhone上关闭“请勿打扰”

    Apple’s “Do Not Disturb While Driving” is a potentially lifesaving iPhone feature, but it doesn’t always turn on automatically at the appropriate time. For example, you might be a passenger in a moving car, but your iPhone may think you’re the one dri…...

    2022/11/19 21:16:57