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

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

?? demo12_4.cpp

?? 游戲的聲音圖像演示程序
?? CPP
字號:
// DEMO12_4.CPP - evasion demo
// to compile make sure to include DDRAW.LIB, DSOUND.LIB,
// DINPUT.LIB, WINMM.LIB, and of course 
// T3DLIB1.CPP,T3DLIB2.CPP,T3DLIB3.CPP,

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

#define INITGUID

#define WIN32_LEAN_AND_MEAN  

#include <windows.h>   // include important windows stuff
#include <windowsx.h> 
#include <mmsystem.h>
#include <iostream.h> // 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>  // directX includes
#include <dsound.h>
#include <dmksctrl.h>
#include <dmusici.h>
#include <dmusicc.h>
#include <dmusicf.h>
#include <dinput.h>
#include "T3DLIB1.h" // game library includes
#include "T3DLIB2.h"
#include "T3DLIB3.h"


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

// defines for windows 
#define WINDOW_CLASS_NAME "WINXCLASS"  // class name

#define WINDOW_WIDTH    320   // size of window
#define WINDOW_HEIGHT   240

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

// game console
int Game_Init(void *parms=NULL);
int Game_Shutdown(void *parms=NULL);
int Game_Main(void *parms=NULL);

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

HWND main_window_handle           = NULL; // save the window handle
HINSTANCE main_instance           = NULL; // save the instance
char buffer[80];                          // used to print text

BITMAP_IMAGE background_bmp;   // holds the background

BOB          bat,              // the ai bat bob
             ghost;            // the player ghost bob

static int ghost_anim[] = {0,1,2,1}; // animation sequence for ghost

int bat_sound_id  = -1,        // sound of bat flapping wings
    wind_sound_id = -1;        // the ambient wind

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

LRESULT CALLBACK WindowProc(HWND hwnd, 
						    UINT msg, 
                            WPARAM wparam, 
                            LPARAM lparam)
{
// this is the main message handler of the system
PAINTSTRUCT	ps;		   // used in WM_PAINT
HDC			hdc;	   // handle to a device context

// what is the message 
switch(msg)
	{	
	case WM_CREATE: 
        {
		// do initialization stuff here
		return(0);
		} break;

    case WM_PAINT:
         {
         // start painting
         hdc = BeginPaint(hwnd,&ps);

         // end painting
         EndPaint(hwnd,&ps);
         return(0);
        } break;

	case WM_DESTROY: 
		{
		// kill the application			
		PostQuitMessage(0);
		return(0);
		} break;

	default:break;

    } // end switch

// process any messages that we didn't take care of 
return (DefWindowProc(hwnd, msg, wparam, lparam));

} // end WinProc

// WINMAIN ////////////////////////////////////////////////

int WINAPI WinMain(	HINSTANCE hinstance,
					HINSTANCE hprevinstance,
					LPSTR lpcmdline,
					int ncmdshow)
{
// this is the winmain function

WNDCLASS winclass;	// this will hold the class we create
HWND	 hwnd;		// generic window handle
MSG		 msg;		// generic message
HDC      hdc;       // generic dc
PAINTSTRUCT ps;     // generic paintstruct

// first fill in the window class stucture
winclass.style			= CS_DBLCLKS | CS_OWNDC | 
                          CS_HREDRAW | CS_VREDRAW;
winclass.lpfnWndProc	= WindowProc;
winclass.cbClsExtra		= 0;
winclass.cbWndExtra		= 0;
winclass.hInstance		= hinstance;
winclass.hIcon			= LoadIcon(NULL, IDI_APPLICATION);
winclass.hCursor		= LoadCursor(NULL, IDC_ARROW);
winclass.hbrBackground	= (HBRUSH)GetStockObject(BLACK_BRUSH);
winclass.lpszMenuName	= NULL; 
winclass.lpszClassName	= WINDOW_CLASS_NAME;

// register the window class
if (!RegisterClass(&winclass))
	return(0);

// create the window, note the use of WS_POPUP
if (!(hwnd = CreateWindow(WINDOW_CLASS_NAME, // class
						  "Evasion Demo",	 // title
						  WS_POPUP | WS_VISIBLE,
					 	  0,0,	   // x,y
						  WINDOW_WIDTH,  // width
                          WINDOW_HEIGHT, // height
						  NULL,	   // handle to parent 
						  NULL,	   // handle to menu
						  hinstance,// instance
						  NULL)))	// creation parms
return(0);

// save the window handle and instance in a global
main_window_handle = hwnd;
main_instance      = hinstance;

// perform all game console specific initialization
Game_Init();

// enter main event loop
while(1)
	{
	if (PeekMessage(&msg,NULL,0,0,PM_REMOVE))
		{ 
		// test if this is a quit
        if (msg.message == WM_QUIT)
           break;
	
		// translate any accelerator keys
		TranslateMessage(&msg);

		// send the message to the window proc
		DispatchMessage(&msg);
		} // end if
    
    // main game processing goes here
    Game_Main();

	} // end while

// shutdown game and release all resources
Game_Shutdown();

// return to Windows like this
return(msg.wParam);

} // end WinMain

// T3D GAME PROGRAMMING CONSOLE FUNCTIONS ////////////////

int Game_Init(void *parms)
{
// this function is where you do all the initialization 
// for your game

int index; // looping variable

// start up DirectDraw (replace the parms as you desire)
DDraw_Init(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP);

// load background image
Load_Bitmap_File(&bitmap8bit, "GHOSTBACK.BMP");
Create_Bitmap(&background_bmp,0,0,640,480);
Load_Image_Bitmap(&background_bmp, &bitmap8bit,0,0,BITMAP_EXTRACT_MODE_ABS);
Set_Palette(bitmap8bit.palette);
Unload_Bitmap_File(&bitmap8bit);

// load the bat bitmaps
Load_Bitmap_File(&bitmap8bit, "BATS8_2.BMP");

// create bat bob
Create_BOB(&bat,320,200, 16,16, 5, BOB_ATTR_MULTI_FRAME | BOB_ATTR_VISIBLE, DDSCAPS_SYSTEMMEMORY);
Set_Anim_Speed_BOB(&bat, 2);

// load the bat in 
for (index=0; index < 5; index++)
    Load_Frame_BOB(&bat, &bitmap8bit, index, index, 0, BITMAP_EXTRACT_MODE_CELL);

// unload bat
Unload_Bitmap_File(&bitmap8bit);

// load the ghost bitmaps
Load_Bitmap_File(&bitmap8bit, "GHOSTS8.BMP");

// create ghost bob
Create_BOB(&ghost,100,200, 64,100, 3, BOB_ATTR_MULTI_ANIM | BOB_ATTR_VISIBLE, DDSCAPS_SYSTEMMEMORY);
Set_Anim_Speed_BOB(&ghost, 10);

// load the ghost in 
for (index=0; index < 3; index++)
    Load_Frame_BOB(&ghost, &bitmap8bit, index, index, 0, BITMAP_EXTRACT_MODE_CELL);

// unload ghost
Unload_Bitmap_File(&bitmap8bit);

// set animation for ghost
Load_Animation_BOB(&ghost, 0, 4, ghost_anim);

// set the animation
Set_Animation_BOB(&ghost,0);

// initialize directinput
DInput_Init();

// acquire the keyboard only
DInput_Init_Keyboard();

// initilize DirectSound
DSound_Init();

// load background sounds
bat_sound_id = DSound_Load_WAV("BAT.WAV");
wind_sound_id = DSound_Load_WAV("WIND.WAV");

// start the sounds
DSound_Play(bat_sound_id, DSBPLAY_LOOPING);
DSound_Play(wind_sound_id, DSBPLAY_LOOPING);

// set clipping rectangle to screen extents so objects dont
// mess up at edges
RECT screen_rect = {0,0,screen_width,screen_height};
lpddclipper = DDraw_Attach_Clipper(lpddsback,1,&screen_rect);

// hide the mouse
ShowCursor(FALSE);

// return success
return(1);

} // end Game_Init

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

int Game_Shutdown(void *parms)
{
// this function is where you shutdown your game and
// release all resources that you allocated

// shut everything down

// kill all the bobs
Destroy_BOB(&bat);
Destroy_BOB(&ghost);

// shutdown directdraw last
DDraw_Shutdown();

// now directsound
DSound_Stop_All_Sounds();
DSound_Shutdown();

// shut down directinput
DInput_Shutdown();

// return success
return(1);
} // end Game_Shutdown


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

void Bat_AI(void)
{
// this function performs the bat ai

// do evasion algorithm

// only evade if bat is within specified distance
// otherwise bat will end up in corner

if ((abs(bat.x-ghost.x) + abs(bat.y-ghost.y))<250)
{
// first x-axis    
if (ghost.x < bat.x)
   bat.x+=2;
else
if (ghost.x > bat.x)
   bat.x-=2;

// now y-axis
if (ghost.y < bat.y)
   bat.y+=2;
else
if (ghost.y > bat.y)
   bat.y-=2;
} // end if
else
    {
    // just move back to center of screen
    // first x-axis    
    if (SCREEN_WIDTH/2 > bat.x)
       bat.x+=1;
    else
    if (SCREEN_WIDTH/2 < bat.x)
       bat.x-=1;
    
    // now y-axis
    if (SCREEN_HEIGHT/2 > bat.y)
       bat.y+=1;
    else
    if (SCREEN_HEIGHT/2 < bat.y)
       bat.y-=1;

    } // end else

// check boundaries
if (bat.x >= SCREEN_WIDTH)
   bat.x = -bat.width;
else
if (bat.x < -bat.width)
   bat.x = SCREEN_WIDTH;

if (bat.y >= SCREEN_HEIGHT)
   bat.y = -bat.height;
else
if (bat.y < -bat.height)
   bat.y = SCREEN_HEIGHT;

} // end Bat_AI

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

int Game_Main(void *parms)
{
// this is the workhorse of your game it will be called
// continuously in real-time this is like main() in C
// all the calls for you game go here!

int index; // looping var

// start the timing clock
Start_Clock();

// clear the drawing surface
DDraw_Fill_Surface(lpddsback, 0);

// lock back buffer and copy background into it
DDraw_Lock_Back_Surface();

// draw background
Draw_Bitmap(&background_bmp, back_buffer, back_lpitch,0);

// unlock back surface
DDraw_Unlock_Back_Surface();

// read keyboard
DInput_Read_Keyboard();

// call the bat AI
Bat_AI();

// the animate the bat
Animate_BOB(&bat);

// draw the bat
Draw_BOB(&bat, lpddsback);

// allow player to move
if (keyboard_state[DIK_RIGHT])
   ghost.x+=4;
else
if (keyboard_state[DIK_LEFT])
   ghost.x-=4;

if (keyboard_state[DIK_UP])
   ghost.y-=4;
else
if (keyboard_state[DIK_DOWN])
   ghost.y+=4;

// test if player is off screen, if so wrap around
if (ghost.x >= SCREEN_WIDTH)
   ghost.x = -ghost.width;
else
if (ghost.x < -ghost.width)
   ghost.x = SCREEN_WIDTH;

if (ghost.y >= SCREEN_HEIGHT)
   ghost.y = -ghost.height;
else
if (ghost.y < -ghost.height)
   ghost.y = SCREEN_HEIGHT;

// the animate the ghost
Animate_BOB(&ghost);

// draw the ghost
Draw_BOB(&ghost, lpddsback);

// draw title
Draw_Text_GDI("GOING BATS! - Evasion Demo",10, 10,RGB(0,255,0), lpddsback);

// flip the surfaces
DDraw_Flip();

// sync to 30ish fps
Wait_Clock(30);

// check of user is trying to exit
if (KEY_DOWN(VK_ESCAPE) || keyboard_state[DIK_ESCAPE])
    {
    PostMessage(main_window_handle, WM_DESTROY,0,0);

    // stop all sounds
    DSound_Stop_All_Sounds();

    // do a screen transition
    Screen_Transitions(SCREEN_REDNESS,NULL,0);

    } // end if

// return success
return(1);

} // end Game_Main

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

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美视频在线播放| 99免费精品在线观看| 在线播放/欧美激情| 亚洲二区在线视频| 欧美日韩极品在线观看一区| 五月天婷婷综合| 日韩一区二区三区av| 精品亚洲成a人| 国产日韩欧美综合一区| zzijzzij亚洲日本少妇熟睡| 亚洲欧美偷拍三级| 欧美日韩在线亚洲一区蜜芽| 日本不卡一二三| 精品国产乱码久久久久久闺蜜| 国产在线播放一区三区四| 国产情人综合久久777777| 99免费精品在线| 五月婷婷另类国产| 久久亚洲精华国产精华液| 不卡欧美aaaaa| 亚洲444eee在线观看| 欧美精品一区二区三区四区| 风间由美一区二区av101| 亚洲激情中文1区| 欧美成人vps| 色婷婷一区二区| 老司机一区二区| 亚洲免费大片在线观看| 日韩三区在线观看| 99久久综合国产精品| 视频一区二区三区在线| 国产亚洲精品bt天堂精选| 97久久精品人人爽人人爽蜜臀| 亚洲成人7777| 国产精品久久久久久久午夜片| 欧美丝袜丝交足nylons图片| 国内精品国产三级国产a久久| 亚洲视频一区二区在线观看| 日韩精品一区国产麻豆| 91蜜桃网址入口| 国产做a爰片久久毛片| 亚洲福利电影网| 亚洲日本在线视频观看| 久久综合色鬼综合色| 欧美日韩另类国产亚洲欧美一级| 丁香六月久久综合狠狠色| 日韩国产精品久久久久久亚洲| 亚洲欧洲精品成人久久奇米网| 日韩网站在线看片你懂的| 在线亚洲一区观看| 国产 欧美在线| 久久99国产精品久久99| 亚洲无人区一区| 亚洲丝袜美腿综合| 国产女人水真多18毛片18精品视频| 日韩一区二区三区在线| 欧美日韩国产成人在线免费| caoporen国产精品视频| 国产mv日韩mv欧美| 国产一区高清在线| 久久国产夜色精品鲁鲁99| 天天影视涩香欲综合网| 亚洲午夜久久久久久久久久久| 亚洲视频一区在线观看| 国产精品国产三级国产aⅴ入口 | 国产精品美女一区二区三区 | 国产精品网站在线| 久久综合狠狠综合久久综合88| 欧美日韩国产一级| 在线亚洲一区二区| 欧美这里有精品| 在线观看一区不卡| 欧美在线免费播放| 欧美丝袜丝交足nylons图片| 欧美视频在线观看一区二区| 欧美亚洲一区二区三区四区| 91久久精品一区二区| 色94色欧美sute亚洲线路二| 色哟哟一区二区三区| 欧美性猛交xxxxxx富婆| 欧洲一区二区三区免费视频| 在线观看日韩毛片| 欧美精品久久99久久在免费线| 在线观看国产91| 欧美人xxxx| 日韩小视频在线观看专区| 日韩午夜在线观看| 欧美精品一区二区久久久| 2023国产精品| 国产精品久久久一本精品| 亚洲视频 欧洲视频| 亚洲一区二区成人在线观看| 日本欧美韩国一区三区| 韩国女主播一区| 成人av网在线| 欧美亚洲图片小说| 日韩欧美国产三级| 亚洲国产岛国毛片在线| 亚洲嫩草精品久久| 日韩精品午夜视频| 国产成人av一区二区| 99re这里只有精品首页| 欧美三级日韩三级| 欧美精品一区二区三区在线播放| 国产精品美女久久久久aⅴ国产馆| 亚洲人亚洲人成电影网站色| 亚洲成人av一区| 国产高清视频一区| 欧美三级资源在线| 26uuu色噜噜精品一区二区| 国产精品久久久久毛片软件| 亚洲国产欧美一区二区三区丁香婷| 蜜桃精品视频在线观看| 丁香啪啪综合成人亚洲小说| 欧美精品一二三区| 国产精品三级视频| 五月综合激情婷婷六月色窝| 欧美另类变人与禽xxxxx| 久久免费电影网| 亚洲与欧洲av电影| 国产成人a级片| 欧美一区二区三区在线看| 国产精品美女久久久久高潮 | 男女性色大片免费观看一区二区 | 中文字幕在线不卡一区二区三区| 午夜精品久久一牛影视| 国产不卡在线一区| 欧美肥大bbwbbw高潮| 一区免费观看视频| 国产在线精品一区二区不卡了| 在线观看一区不卡| 国产精品久久久久永久免费观看| 美女www一区二区| 欧美日韩亚州综合| 中文字幕视频一区二区三区久| 男男视频亚洲欧美| 欧美亚州韩日在线看免费版国语版| 久久久精品影视| 免费久久99精品国产| 欧美视频一区二区三区| 中文字幕一区二区三| 国产99久久久国产精品| 2022国产精品视频| 美女网站在线免费欧美精品| 欧美色中文字幕| 国产精品久久久久影院色老大 | 99久久伊人久久99| 久久亚洲精品小早川怜子| 日韩在线一区二区| 91国偷自产一区二区三区成为亚洲经典| 欧美一区二区女人| 9色porny自拍视频一区二区| 欧美挠脚心视频网站| 中文字幕一区日韩精品欧美| 美女被吸乳得到大胸91| 91在线小视频| 精品日韩欧美在线| 亚洲国产婷婷综合在线精品| 99麻豆久久久国产精品免费 | 99这里只有久久精品视频| 亚洲精品一区二区三区影院| 亚洲一区二区三区四区的| 成人不卡免费av| 亚洲精品一区二区三区在线观看| 久久av中文字幕片| 欧美日韩国产一级| 中文字幕在线观看一区二区| 日韩**一区毛片| 欧美一区二区三区在线视频| 午夜视频在线观看一区二区三区| 99精品在线免费| 亚洲免费观看视频| av在线一区二区三区| 国产精品丝袜一区| 国产成人av电影| 亚洲图片你懂的| 成人的网站免费观看| 久久久久久久久久久久久久久99 | 久久久夜色精品亚洲| 久久爱www久久做| 精品国产在天天线2019| 久久成人综合网| 日韩一区二区视频| 国产一区二区不卡| 久久久噜噜噜久久人人看| 捆绑调教一区二区三区| 欧美日韩国产精品成人| 久久国产欧美日韩精品| 精品1区2区在线观看| 久久成人免费网站| 亚洲欧美综合网| 97久久人人超碰| 亚洲精品伦理在线| 91国产精品成人| 亚洲风情在线资源站| 欧美日韩成人综合在线一区二区| 午夜精品免费在线| 国产偷国产偷亚洲高清人白洁| 国产91丝袜在线播放九色| 国产精品欧美一区喷水|