亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? outofmouth.cpp

?? 考驗?zāi)愕挠^察力和判斷力的時候到了
?? CPP
?? 第 1 頁 / 共 4 頁
字號:
// outofmouth demo 8-bit blitting

// INCLUDES ///////////////////////////////////////////////

#define WIN32_LEAN_AND_MEAN  // 無 MFC

#define INITGUID

#include <windows.h>   // include important windows stuff
#include <windowsx.h> 
#include <mmsystem.h>
#include <iostream> // include important C/C++ stuff
#include <conio.h>
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <string.h>
#include <stdarg.h>
#include <stdio.h> 
#include <math.h>
#include <io.h>
#include <fcntl.h>

#include <ddraw.h> // include directdraw

// DEFINES ////////////////////////////////////////////////

// defines for windows 
#define WINDOW_CLASS_NAME "WINCLASS1"

// default screen size
#define SCREEN_WIDTH    1024  // size of screen
#define SCREEN_HEIGHT   768
#define SCREEN_BPP      8    // bits per pixel

#define BITMAP_ID            0x4D42 // universal id for a bitmap
#define MAX_COLORS_PALETTE   256

///defines for game 
#define BOW_WIDTH         42       //爆炸寬
#define BOW_HEIGHT        36       ///爆炸高
#define ALL_BOW           14

#define BOW2_WIDTH        86       //爆炸寬
#define BOW2_HEIGHT       74       ///爆炸高
#define ALL_BOW2          14

#define TOOTH_WIDTH       50       //牙齒寬
#define TOOTH_HEIGHT      150      //牙齒高

#define SMALLONE_WIDTH    50       //小東西寬
#define SMALLONE_HEIGHT   30       //小東西高

#define INIT_BOTTOM_X     300      //底部第一個牙齒X坐標(biāo)
#define INIT_BOTTOM_y     450      //底部第一個牙齒Y坐標(biāo)

#define DISTANCE          200      //底部牙齒與上部的距離

#define TOOTH_NUM         7        //一排牙齒的數(shù)目

#define SHAPE_NUM         5        //單排牙齒形狀數(shù)
#define ALL_SHAPE_NUM     10       //上下牙齒形狀數(shù)

#define INIT_SPEED        1        //游戲速度,牙齒速度,33pixel/sec

#define SMALLONE_INIT_y   560
#define SMALLONE_SPEC     110 

#define DELAY             8        //操作延遲時間 N frame

#define FRAME_PER_SEC     30       //frame per sec = 1sec/N(30)=33.3fps

#define DEATH_DELAY       30

// TYPES //////////////////////////////////////////////////////

// basic unsigned types
typedef unsigned short USHORT;
typedef unsigned short WORD;
typedef unsigned char  UCHAR;
typedef unsigned char  BYTE;

// container structure for bitmaps .BMP file
typedef struct BITMAP_FILE_TAG
        {
        BITMAPFILEHEADER bitmapfileheader;  // this contains the bitmapfile header
        BITMAPINFOHEADER bitmapinfoheader;  // this is all the info including the palette
        PALETTEENTRY     palette[256];      // we will store the palette here
        UCHAR            *buffer;           // this is a pointer to the data

        } BITMAP_FILE, *BITMAP_FILE_PTR;

// this will hold our little alien
typedef struct ALIEN_OBJ_TYP
        {
        LPDIRECTDRAWSURFACE7 frames[14]; // 3 frames of animation for complete walk cycle
        int x,y;                        // position of alien
        int velocity;                   // x-velocity
        int current_frame;              // current frame of animation
        int counter;                    // used to time animation
		int position;
 
        } ALIEN_OBJ, *ALIEN_OBJ_PTR;

//牙齒的關(guān)卡地圖結(jié)構(gòu)
typedef struct MAP_SET_TYP
{
	ALIEN_OBJ BottomSet[TOOTH_NUM];       //下排牙齒的數(shù)地圖
	ALIEN_OBJ TopSet[TOOTH_NUM];          //下排牙齒的數(shù)地圖
	int iKey;                             //缺牙地址
} MAP_SET, *MAP_SET_PTR;

// PROTOTYPES  //////////////////////////////////////////////

int Build_Map();

int Flip_Bitmap(UCHAR *image, int bytes_per_line, int height);

int Load_Bitmap_File(BITMAP_FILE_PTR bitmap, char *filename);

int Unload_Bitmap_File(BITMAP_FILE_PTR bitmap);

int DDraw_Fill_Surface(LPDIRECTDRAWSURFACE7 lpdds,int color);

int Scan_Image_Bitmap(BITMAP_FILE_PTR bitmap, LPDIRECTDRAWSURFACE7 lpdds, int cx,int cy);

LPDIRECTDRAWSURFACE7 DDraw_Create_Surface(int width, int height, int mem_flags, int color_key);

int DDraw_Draw_Surface(LPDIRECTDRAWSURFACE7 source, int x, int y, 
                      int width, int height, LPDIRECTDRAWSURFACE7 dest, 
                      int transparent);    

LPDIRECTDRAWCLIPPER DDraw_Attach_Clipper(LPDIRECTDRAWSURFACE7 lpdds,
                                         int num_rects,
                                         LPRECT clip_list);

int Draw_Text_GDI(char *text, int x,int y,COLORREF color, LPDIRECTDRAWSURFACE7 lpdds);

// MACROS /////////////////////////////////////////////////

// tests if a key is up or down
#define KEYDOWN(vk_code) ((GetAsyncKeyState(vk_code) & 0x8000) ? 1 : 0)
#define KEYUP(vk_code)   ((GetAsyncKeyState(vk_code) & 0x8000) ? 0 : 1)

// initializes a direct draw struct
#define DDRAW_INIT_STRUCT(ddstruct) { memset(&ddstruct,0,sizeof(ddstruct)); ddstruct.dwSize=sizeof(ddstruct); }

// GLOBALS ////////////////////////////////////////////////

HWND      main_window_handle = NULL; // globally track main window
int       window_closed      = 0;    // tracks if window is closed
HINSTANCE hinstance_app      = NULL; // globally track hinstance

// directdraw stuff

LPDIRECTDRAW7         lpdd         = NULL;   // dd4 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
//全局結(jié)構(gòu)體變量
BITMAP_FILE           bitmap;                // holds the bitmap

ALIEN_OBJ             aliens[3];             // 3 aliens, one on each level
ALIEN_OBJ             tooth[ALL_SHAPE_NUM];
ALIEN_OBJ             smallone;
ALIEN_OBJ             bow;
ALIEN_OBJ             bow2;

MAP_SET               map;                    //地圖


LPDIRECTDRAWSURFACE7  lpddsbackground = NULL;// this will hold the background image

char buffer[600];                             // general printing buffer

int gwidth  = -1;
int gheight = -1;

//mine////////////////////////////////全局變量
int turnflag=0;
char *text=NULL;
char num[80];

int iFrame=0;

int iLevelNum=0;                  //過關(guān)數(shù)目

int iScore=0;                     //游戲分?jǐn)?shù)
int iLevel=0;

int iSpeed=INIT_SPEED;            //游戲速度,牙齒速度,50pixel/sec

int iTimeCounter=0;               //操作延遲計數(shù)器
int delayflag=0;				  //操作延遲標(biāo)志

int iCounterBow=0;                //爆炸精靈計數(shù)器
int iBowFlag=0;					
int iCounterBow2=0;
int iBowFlag2=0;

//game state
int iDistance=DISTANCE;		      //上下排牙齒距離
int iDeathFlag=0;				  //死亡標(biāo)志

int iDeathTimeCounter=0;		  //死亡延遲
int iDeathDelayFlag=0;

int iGameMode=0;           //游戲模式0:記分模式,1:闖關(guān)模式,2:連續(xù)模式,3:極限模式


// FUNCTIONS ////////////////////////////////////////////////

int Build_Map()
{
	//生成地圖
	srand(GetTickCount());
	map.iKey=rand()%(TOOTH_NUM);  //隨機(jī)缺牙位置
	smallone.position=rand()%(TOOTH_NUM);//隨機(jī)小東西位置
	srand(GetTickCount());
	for(int index=0; index<TOOTH_NUM; index++)
	{
		//分配下上部分地圖
		if(index==map.iKey)
		{
			//缺牙
			map.BottomSet[index].current_frame=rand()%(SHAPE_NUM-1); //current_frame為該位置的位圖編號
			map.TopSet[index].current_frame=((ALL_SHAPE_NUM - 2) - map.BottomSet[index].current_frame);
			//分配下部坐標(biāo)
			map.BottomSet[index].x        = INIT_BOTTOM_X + index * TOOTH_WIDTH;
			map.BottomSet[index].y        = INIT_BOTTOM_y;
			map.BottomSet[index].velocity = iSpeed;
			map.BottomSet[index].counter  = 0;
			//分配上部坐標(biāo)
			map.TopSet[index].x        = INIT_BOTTOM_X + index * TOOTH_WIDTH;
			map.TopSet[index].y        = INIT_BOTTOM_y - DISTANCE;
			map.TopSet[index].velocity = iSpeed;
			map.TopSet[index].counter  = 0;
		}
		else
		{
			//平牙
			map.BottomSet[index].current_frame=rand()%SHAPE_NUM; //current_frame為該位置的位圖編號
			map.TopSet[index].current_frame=((ALL_SHAPE_NUM - 1) - map.BottomSet[index].current_frame);
			//分配下部坐標(biāo)
			map.BottomSet[index].x        = INIT_BOTTOM_X + index * TOOTH_WIDTH;
			map.BottomSet[index].y        = INIT_BOTTOM_y;
			map.BottomSet[index].velocity = iSpeed;
			map.BottomSet[index].counter  = 0;
			//分配上部坐標(biāo)
			map.TopSet[index].x        = INIT_BOTTOM_X + index * TOOTH_WIDTH;
			map.TopSet[index].y        = INIT_BOTTOM_y - DISTANCE;
			map.TopSet[index].velocity = iSpeed;
			map.TopSet[index].counter  = 0;
		}
	}
	for(index=1; index<TOOTH_NUM; index++)
	{
		//對齊
		map.BottomSet[index].x-=index;
		map.TopSet[index].x-=index;
	}
	//init smallone
	smallone.x              = ( INIT_BOTTOM_X + smallone.position * TOOTH_WIDTH );
    smallone.y              = SMALLONE_INIT_y - map.BottomSet[smallone.position].current_frame * 30;               
    smallone.velocity       = iSpeed;
    smallone.current_frame  = 0;             
    smallone.counter        = 0; 

	return(1);
}

int Load_Bitmap_File(BITMAP_FILE_PTR bitmap, char *filename)
{
// this function opens a bitmap file and loads the data into bitmap

int file_handle,  // the file handle
    index;        // looping index

UCHAR   *temp_buffer = NULL; // used to convert 24 bit images to 16 bit
OFSTRUCT file_data;          // the file data information

// open the file if it exists
if ((file_handle = OpenFile(filename,&file_data,OF_READ))==-1)
   return(0);

// now load the bitmap file header
_lread(file_handle, &bitmap->bitmapfileheader,sizeof(BITMAPFILEHEADER));

// test if this is a bitmap file
if (bitmap->bitmapfileheader.bfType!=BITMAP_ID)
   {
   // close the file
   _lclose(file_handle);

   // return error
   return(0);
   } // end if

// now we know this is a bitmap, so read in all the sections

// first the bitmap infoheader

// now load the bitmap file header
_lread(file_handle, &bitmap->bitmapinfoheader,sizeof(BITMAPINFOHEADER));

// now load the color palette if there is one
if (bitmap->bitmapinfoheader.biBitCount == 8)
   {
   _lread(file_handle, &bitmap->palette,MAX_COLORS_PALETTE*sizeof(PALETTEENTRY));

   // now set all the flags in the palette correctly and fix the reversed 
   // BGR RGBQUAD data format
   for (index=0; index < MAX_COLORS_PALETTE; index++)
       {
       // reverse the red and green fields
       int temp_color                = bitmap->palette[index].peRed;
       bitmap->palette[index].peRed  = bitmap->palette[index].peBlue;
       bitmap->palette[index].peBlue = temp_color;
       
       // always set the flags word to this
       bitmap->palette[index].peFlags = PC_NOCOLLAPSE;
       } // end for index

    } // end if

// finally the image data itself
_lseek(file_handle,-(int)(bitmap->bitmapinfoheader.biSizeImage),SEEK_END);

// now read in the image, if the image is 8 or 16 bit then simply read it
// but if its 24 bit then read it into a temporary area and then convert
// it to a 16 bit image

if (bitmap->bitmapinfoheader.biBitCount==8 || bitmap->bitmapinfoheader.biBitCount==16 || 
    bitmap->bitmapinfoheader.biBitCount==24)
   {
   // delete the last image if there was one
   if (bitmap->buffer)
       free(bitmap->buffer);

   // allocate the memory for the image
   if (!(bitmap->buffer = (UCHAR *)malloc(bitmap->bitmapinfoheader.biSizeImage)))
      {
      // close the file
      _lclose(file_handle);

      // return error
      return(0);
      } // end if

   // now read it in
   _lread(file_handle,bitmap->buffer,bitmap->bitmapinfoheader.biSizeImage);

   } // end if
else
   {
   // serious problem
   return(0);

   } // end else

#if 0
// write the file info out 
printf("\nfilename:%s \nsize=%d \nwidth=%d \nheight=%d \nbitsperpixel=%d \ncolors=%d \nimpcolors=%d",
        filename,
        bitmap->bitmapinfoheader.biSizeImage,
        bitmap->bitmapinfoheader.biWidth,
        bitmap->bitmapinfoheader.biHeight,
		bitmap->bitmapinfoheader.biBitCount,
        bitmap->bitmapinfoheader.biClrUsed,
        bitmap->bitmapinfoheader.biClrImportant);
#endif

// close the file
_lclose(file_handle);

// flip the bitmap
Flip_Bitmap(bitmap->buffer, 
            bitmap->bitmapinfoheader.biWidth*(bitmap->bitmapinfoheader.biBitCount/8), 
            bitmap->bitmapinfoheader.biHeight);

// return success
return(1);

} // end Load_Bitmap_File

///////////////////////////////////////////////////////////

int Unload_Bitmap_File(BITMAP_FILE_PTR bitmap)
{
// this function releases all memory associated with "bitmap"
if (bitmap->buffer)
   {
   // release memory
   free(bitmap->buffer);

   // reset pointer
   bitmap->buffer = NULL;

   } // end if

// return success
return(1);

} // end Unload_Bitmap_File

///////////////////////////////////////////////////////////

int Flip_Bitmap(UCHAR *image, int bytes_per_line, int height)
{
// this function is used to flip bottom-up .BMP images

UCHAR *buffer; // used to perform the image processing
int index;     // looping index

// allocate the temporary buffer
if (!(buffer = (UCHAR *)malloc(bytes_per_line*height)))
   return(0);

// copy image to work area
memcpy(buffer,image,bytes_per_line*height);

// flip vertically
for (index=0; index < height; index++)
    memcpy(&image[((height-1) - index)*bytes_per_line],
           &buffer[index*bytes_per_line], bytes_per_line);

// release the memory
free(buffer);

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久久久久久久免费| 91麻豆精品久久久久蜜臀| 久久蜜桃av一区精品变态类天堂| 日韩av成人高清| 精品对白一区国产伦| 国产最新精品免费| 国产精品嫩草久久久久| 91美女视频网站| 亚洲成在线观看| 精品国产伦一区二区三区观看体验| 国产一区在线不卡| 国产精品不卡一区二区三区| 日本二三区不卡| 免费成人av资源网| 欧美激情综合五月色丁香| 91一区二区在线观看| 午夜精品视频一区| 精品成人免费观看| 91色九色蝌蚪| 日韩精品乱码av一区二区| 久久婷婷成人综合色| 99热这里都是精品| 午夜视频久久久久久| 国产日韩欧美麻豆| 欧美日韩亚洲综合在线 欧美亚洲特黄一级 | 午夜精品久久久久久久久| 日韩一区二区麻豆国产| 国产91色综合久久免费分享| 亚洲国产精品综合小说图片区| 欧美一级片在线看| 99这里只有久久精品视频| 日韩av不卡在线观看| 国产精品久久久久久久久久免费看 | 成人网页在线观看| 舔着乳尖日韩一区| 国产精品你懂的| 欧美一级理论片| 一本到一区二区三区| 国产精品综合在线视频| 亚洲一区在线观看免费观看电影高清 | 毛片av一区二区三区| 亚洲欧美偷拍卡通变态| 欧美精品一区二区在线播放| 欧美亚男人的天堂| 国产成人综合视频| 奇米精品一区二区三区在线观看一| 国产精品视频麻豆| 精品国产乱码久久久久久蜜臀| 色综合久久天天| 国产69精品一区二区亚洲孕妇| 丝袜美腿高跟呻吟高潮一区| 亚洲免费av观看| 中文一区二区完整视频在线观看| 欧美一区二区三区免费| 在线视频一区二区免费| 成人h动漫精品一区二区| 狠狠色综合播放一区二区| 亚洲高清视频的网址| 亚洲三级免费观看| 亚洲国产精品成人综合| 精品免费国产二区三区| 91精品国产综合久久福利| 91久久奴性调教| 97成人超碰视| 9人人澡人人爽人人精品| 久久se这里有精品| 久久精品理论片| 日韩av中文字幕一区二区| 亚州成人在线电影| 午夜精品国产更新| 亚洲成av人片| 水野朝阳av一区二区三区| 亚洲观看高清完整版在线观看| 亚洲精品视频在线看| 亚洲欧美另类小说视频| 亚洲欧美视频一区| 亚洲激情欧美激情| 亚洲综合色网站| 亚洲国产一区二区视频| 亚洲一区二区在线播放相泽| 亚洲国产精品一区二区久久恐怖片| 亚洲男人天堂av网| 亚洲图片有声小说| 日韩中文欧美在线| 麻豆一区二区三区| 国产精品主播直播| 国产91富婆露脸刺激对白| 成人动漫精品一区二区| 色综合天天狠狠| 欧美天堂一区二区三区| 欧美日本精品一区二区三区| 欧美一区二区三区日韩| 久久久久久久久久美女| 国产精品美女久久久久久久| 伊人色综合久久天天人手人婷| 亚洲国产精品一区二区www在线 | **欧美大码日韩| 亚洲综合偷拍欧美一区色| 午夜激情综合网| 久久99精品国产.久久久久久| 久久99热狠狠色一区二区| 国产精品一卡二| 91丨九色丨黑人外教| 欧美日韩一区二区电影| 精品国内二区三区| 日本一区二区综合亚洲| 一级日本不卡的影视| 免费成人深夜小野草| 成人av在线资源| 欧美色大人视频| 久久久一区二区三区捆绑**| 亚洲四区在线观看| 美女网站一区二区| 成人av网在线| 欧美一区二区三级| 国产精品久久综合| 日本视频一区二区| www.在线成人| 日韩一区二区视频| 国产精品国产三级国产aⅴ原创 | 国产综合色在线| 日本久久一区二区三区| 欧美精品一区在线观看| 亚洲一二三区视频在线观看| 国产综合久久久久影院| 色综合久久66| 亚洲精品一区二区精华| 亚洲国产综合色| 成人动漫一区二区在线| 日韩一区二区视频| 一级特黄大欧美久久久| 成人一道本在线| 日韩欧美黄色影院| 亚洲一区二区三区激情| 大胆欧美人体老妇| 精品国产一区二区三区四区四| 亚洲一区在线观看免费| 成人一区在线看| 精品国产区一区| 丝袜国产日韩另类美女| 97aⅴ精品视频一二三区| 久久久久久毛片| 久久国产夜色精品鲁鲁99| 欧美在线观看18| 亚洲女同一区二区| 成人深夜在线观看| 欧美精品一区二区精品网| 视频一区中文字幕| 欧美亚洲综合久久| 亚洲欧美日韩一区二区| 不卡av电影在线播放| 国产女人水真多18毛片18精品视频| 日本人妖一区二区| 欧美精品视频www在线观看| 亚洲精品视频在线| 色综合久久综合| 亚洲欧美一区二区三区久本道91| 成人动漫一区二区三区| 欧美极品少妇xxxxⅹ高跟鞋| 国产麻豆精品95视频| 亚洲精品在线观看网站| 精品一区二区综合| 精品久久久三级丝袜| 久久99精品国产麻豆婷婷| 日韩欧美在线网站| 久久国产夜色精品鲁鲁99| 日韩三级高清在线| 麻豆91免费看| 精品福利一区二区三区| 国产在线国偷精品免费看| 精品国产不卡一区二区三区| 毛片不卡一区二区| 久久综合av免费| 成人手机电影网| 亚洲天堂福利av| 欧美丝袜丝nylons| 日本视频一区二区| 精品欧美一区二区久久| 国产精品影视网| 国产精品久久二区二区| 色噜噜夜夜夜综合网| 午夜影院久久久| 精品国产乱码久久久久久久久 | 国产精品国产三级国产有无不卡| 成人午夜又粗又硬又大| 亚洲人xxxx| 欧美精品乱码久久久久久按摩| 日韩电影一区二区三区四区| 欧美成人欧美edvon| 国产成人在线电影| 一区二区三区欧美在线观看| 337p亚洲精品色噜噜狠狠| 国产综合久久久久久鬼色| 国产精品久久久久久亚洲伦| 日本乱码高清不卡字幕| 久久国产精品免费| 国产精品久久久久aaaa樱花 | 色妹子一区二区| 男人操女人的视频在线观看欧美| 久久精品欧美日韩精品|