Run dixq.netrp2.html first. The main. cpp of the project is the "Basic Framework of the program to be written every time" mentioned in the game programming classroom. Then click compile to run the program. ----------------------------------------
Http://dixq.net/rp/2.html first run a look. The main. cpp of the project is the "Basic Framework of the program to be written every time" mentioned in the game programming classroom. Then click compile to run the program. ----------------------------------------
Http://dixq.net/rp/2.html
Run the command first. The main. cpp of the project is the "Basic Framework of the program to be written every time" mentioned in the game programming classroom. Then click compile to run the program.
------------------------------------------------------------------
---- Main. cpp changes ------
# Define GLOBAL_INSTANCE # include ".. /include/GV. h "int Key [256]; int GetHitKeyStateAll_2 (int token []) {char GetHitKeyStateAll_Key [256]; GetHitKeyStateAll (GetHitKeyStateAll_Key); for (int I = 0; I <256; I ++) {if (GetHitKeyStateAll_Key [I] = 1) GetHitKeyStateAll_InputKey [I] ++; else GetHitKeyStateAll_InputKey [I] = 0;} return 0 ;} int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstanc E, LPSTR lpCmdLine, int nCmdShow) {ChangeWindowMode (TRUE); // zookeeper contains multiple zookeeper if (DxLib_Init () =-1 | SetDrawScreen (DX_SCREEN_BACK )! = 0) return-1; // initialize and set the dual buffer screen while (ProcessMessage () = 0 & ClearDrawScreen () = 0 & GetHitKeyStateAll_2 (Key) = 0 & Key [KEY_INPUT_ESCAPE] = 0) {// notify message manager ← clear the screen ← Save the Key and enter the Escape Key. The ESC Key is not pressed. // here !! ScreenFlip ();} DxLib_End (); return 0 ;}
Note:
Here is a simple code description for beginners and those who don't want to study code like me.
It is mainly used to save the function of key input. First, the main function calls the above function. The input parameter is the defined global variable array Key [256].
In the above function, a char array is defined and then transmitted to the system function GetHitKeyStateAll_Key to obtain the key status.
Then, traverse the char array and compress it to the int array. Then, compress the corresponding keys in the int array ++. If the keys are not pressed, the keys are cleared. (After that, although the two arrays seem to be a bit around)
Okay, the window will be called up. Press ESC and it will exit.
So far, if you are doing well, the preparation is complete.