資源簡介
打磚塊C++源碼,有興趣的去看看

代碼片段和文件信息
//?BLACKBOX.CPP?-?Game?Engine?
?
//?INCLUDES?///////////////////////////////////////////////////
#define?WIN32_LEAN_AND_MEAN??//?make?sure?all?macros?are?included
#include??????????//?include?important?windows?stuff
#include??
#include?
#include?????????//?include?important?C/C++?stuff
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include????????????//?directX?includes
#include?“blackbox.h“????????//?game?library?includes
???????????????????????????????????
//?DEFINES?////////////////////////////////////////////////////
//?TYPES?//////////////////////////////////////////////////////
//?PROTOTYPES?/////////////////////////////////////////////////
//?EXTERNALS?//////////////////////////////////////////////////
extern?HWND?main_window_handle;?//?save?the?window?handle
extern?HINSTANCE?main_instance;?//?save?the?instance
//?GLOBALS?////////////////////////////////////////////////////
LPDIRECTDRAW7?????????lpdd?????????=?NULL;???//?dd?object
LPDIRECTDRAWSURFACE7??lpddsprimary?=?NULL;???//?dd?primary?surface
LPDIRECTDRAWSURFACE7??lpddsback????=?NULL;???//?dd?back?surface
LPDIRECTDRAWPALETTE???lpddpal??????=?NULL;???//?a?pointer?to?the?created?dd?palette
LPDIRECTDRAWCLIPPER???lpddclipper??=?NULL;???//?dd?clipper
PALETTEENTRY??????????palette[256];??????????//?color?palette
PALETTEENTRY??????????save_palette[256];?????//?used?to?save?palettes
DDSURFACEDESC2????????ddsd;??????????????????//?a?direct?draw?surface?description?struct
DDBLTFX???????????????ddbltfx;???????????????//?used?to?fill
DDSCAPS2??????????????ddscaps;???????????????//?a?direct?draw?surface?capabilities?struct
HRESULT???????????????ddrval;????????????????//?result?back?from?dd?calls
DWORD?????????????????start_clock_count?=?0;?//?used?for?timing
//?these?defined?the?general?clipping?rectangle
int?min_clip_x?=?0??????????????????????????//?clipping?rectangle?
????max_clip_x?=?SCREEN_WIDTH-1
????min_clip_y?=?0
????max_clip_y?=?SCREEN_HEIGHT-1;
//?these?are?overwritten?globally?by?DD_Init()
int?screen_width??=?SCREEN_WIDTH????????????//?width?of?screen
????screen_height?=?SCREEN_HEIGHT???????????//?height?of?screen
????screen_bpp????=?SCREEN_BPP;??????????????//?bits?per?pixel
//?FUNCTIONS?//////////////////////////////////////////////////
int?DD_Init(int?width?int?height?int?bpp)
{
//?this?function?initializes?directdraw
int?index;?//?looping?variable
//?create?object?and?test?for?error
if?(DirectDrawCreateEx(NULL?(void?**)&lpdd?IID_IDirectDraw7?NULL)!=DD_OK)
???return(0);
//?set?cooperation?level?to?windowed?mode?normal
if?(lpdd->SetCooperativeLevel(main_window_handle
???????????DDSCL_ALLOWMODEX?|?DDSCL_FULLSCREEN?|?
???????????DDSCL_EXCLUSIVE?|?DDSCL_ALLOWREBOOT)!=DD_OK)
????return(0)
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????12469??2001-12-07?10:16??T3DCHAP01\blackbox.cpp
?????文件???????3329??2001-12-07?10:10??T3DCHAP01\blackbox.h
?????文件??????15916??1999-07-06?13:21??T3DCHAP01\freakout.cpp
?????文件?????163909??2001-12-25?09:32??T3DCHAP01\freakout.exe
?????目錄??????????0??2007-04-24?19:46??T3DCHAP01
-----------?---------??----------?-----??----
???????????????195623????????????????????5
評論
共有 條評論