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 *******************************************************

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值