System analysis (2)

zhaozj2021-02-17  51

The general framework for message processing is as follows:

// First define some messages:

#define walking 1 // Walk message is defined as 1

#define fight 2 // fight message defined as 2

#define dialog 3 // Dialog message is defined as 3

#define upgrade 4 // upgrade message is defined as 4

#define event 5 // Event message is defined as 5

#define end 6 // End message is defined as 6

......

/ / Define the variables you want to use in the program

DWORD Message; // Message variable

Role_struct helo; // Define the properties structure of the small flying knife

Map_struct map; // Define the properties structure of the map

......

WinMain () // Enter the program

{

Initialization main window;

Initialize the DirectDraw environment and transfer the graphics required by the program;

While (1) // message loop

{

Switch (Message)

{

Case walking: walking module ();

Case fight: fight module ();

Case conversation: dialog module ();

Case event: Event module ();

CASE exits: exit the game ();

}

}

}

OK! Our program framework has come out, then you must have a fairly clear contour! Ok, so far, the overall plan of the game will also take a paragraph. The focus of the future in the next few days will go to the implementation method of the specific module.

转载请注明原文地址:https://www.9cbs.com/read-30589.html

New Post(0)