失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > c语言打砖块游戏说明 c语言打砖块游戏.doc

c语言打砖块游戏说明 c语言打砖块游戏.doc

时间:2024-01-28 07:35:11

相关推荐

c语言打砖块游戏说明 c语言打砖块游戏.doc

C语言打砖块游戏

一、游戏截图

游戏源码

#include

#include

#include

#include

/* DEFINES ********************************************************************************/

// defines for windows

#define WINDOW_CLASS_NAMETEXT("WIN32CLASS")

#define WINDOW_WIDTH640

#define WINDOW_HEIGHT480

// 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_COLORRGB(0, 0, 0)

#define BLOCK_COLORRGB(125, 0, 0)

#define BALL_COLORRGB(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 *******************************************************

如果觉得《c语言打砖块游戏说明 c语言打砖块游戏.doc》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。