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

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

?? demo12_2_16b.cpp

?? 一本外國人寫的關(guān)于3D游戲編程的書的源碼
?? CPP
字號(hào):
// DEMO12_2_16b.CPP - tracking demo
// 16-bit version
// 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

// setup a 640x480 16-bit windowed mode example
#define WINDOW_TITLE      "16-Bit Tracking Demo"
#define WINDOW_WIDTH      640   // size of window
#define WINDOW_HEIGHT     480

#define WINDOW_BPP        16    // bitdepth of window (8,16,24 etc.)
                                // note: if windowed and not
                                // fullscreen then bitdepth must
                                // be same as system bitdepth
                                // also if 8-bit the a pallete
                                // is created and attached

#define WINDOWED_APP      1     // 0 not windowed, 1 windowed

// 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
             arch;             // to do the 3d arch effect

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

WNDCLASSEX winclass; // this will hold the class we create
HWND	   hwnd;	 // generic window handle
MSG		   msg;		 // generic message
HDC        hdc;      // graphics device context

// first fill in the window class stucture
winclass.cbSize         = sizeof(WNDCLASSEX);
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;
winclass.hIconSm        = LoadIcon(NULL, IDI_APPLICATION);

// save hinstance in global
main_instance = hinstance;

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

// create the window
if (!(hwnd = CreateWindowEx(NULL,                  // extended style
                            WINDOW_CLASS_NAME,     // class
						    WINDOW_TITLE, // title
						    (WINDOWED_APP ? (WS_OVERLAPPED | WS_SYSMENU | WS_CAPTION) : (WS_POPUP | WS_VISIBLE)), 
					 	    0,0,	  // initial x,y
						    WINDOW_WIDTH,WINDOW_HEIGHT,  // initial width, height
						    NULL,	  // handle to parent 
						    NULL,	  // handle to menu
						    hinstance,// instance of this application
						    NULL)))	// extra creation parms
return(0);

// save main window handle
main_window_handle = hwnd;

if (WINDOWED_APP)
{
// now resize the window, so the client area is the actual size requested
// since there may be borders and controls if this is going to be a windowed app
// if the app is not windowed then it won't matter
RECT window_rect = {0,0,WINDOW_WIDTH-1,WINDOW_HEIGHT-1};

// make the call to adjust window_rect
AdjustWindowRectEx(&window_rect,
     GetWindowStyle(main_window_handle),
     GetMenu(main_window_handle) != NULL,
     GetWindowExStyle(main_window_handle));

// save the global client offsets, they are needed in DDraw_Flip()
window_client_x0 = -window_rect.left;
window_client_y0 = -window_rect.top;

// now resize the window with a call to MoveWindow()
MoveWindow(main_window_handle,
           0, // x position
           0, // y position
           window_rect.right - window_rect.left, // width
           window_rect.bottom - window_rect.top, // height
           TRUE);

// show the window, so there's no garbage on first render
ShowWindow(main_window_handle, SW_SHOW);
} // end if windowed

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

// initialize directdraw, very important that in the call
// to setcooperativelevel that the flag DDSCL_MULTITHREADED is used
// which increases the response of directX graphics to
// take the global critical section more frequently
DDraw_Init(WINDOW_WIDTH, WINDOW_HEIGHT, WINDOW_BPP, WINDOWED_APP);

// load background image
Load_Bitmap_File(&bitmap16bit, "GHOSTBACK_24.BMP");
Create_Bitmap(&background_bmp,0,0,640,480,16);
Load_Image_Bitmap16(&background_bmp, &bitmap16bit,0,0,BITMAP_EXTRACT_MODE_ABS);
Unload_Bitmap_File(&bitmap16bit);

// load the bat bitmaps
Load_Bitmap_File(&bitmap16bit, "BATS8_2_24.BMP");

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

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

// create the arch bob
Create_BOB(&arch,320,200, 128,152, 1, BOB_ATTR_SINGLE_FRAME | BOB_ATTR_VISIBLE, DDSCAPS_SYSTEMMEMORY,0,16);

// load the arch
Load_Frame_BOB16(&arch, &bitmap16bit, 0,1,18, BITMAP_EXTRACT_MODE_ABS);

// unload arch and bat bitmap
Unload_Bitmap_File(&bitmap16bit);


// load the ghost bitmaps
Load_Bitmap_File(&bitmap16bit, "GHOSTS8_24.BMP");

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

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

// unload ghost
Unload_Bitmap_File(&bitmap16bit);

// 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);

// hide the mouse
if (!WINDOWED_APP)
    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 tracking algorithm

// 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;

// 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_Bitmap16(&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_BOB16(&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_BOB16(&ghost, lpddsback);

// draw the arches to create a 3D effect
Set_Pos_BOB(&arch, 18, 270);
Draw_BOB16(&arch, lpddsback);

Set_Pos_BOB(&arch, 496, 270);
Draw_BOB16(&arch, lpddsback);

// draw title
Draw_Text_GDI("(16-Bit Version) GOING BATS! - Tracking 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();

    } // end if

// return success
return(1);

} // end Game_Main

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

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲h动漫在线| 国产精品国产三级国产a| 午夜精品久久久久久久99水蜜桃| 欧洲一区二区av| 一区二区三区中文在线观看| 欧美三级午夜理伦三级中视频| 亚洲第一会所有码转帖| 91精品国产91热久久久做人人| 日本成人在线网站| 337p日本欧洲亚洲大胆色噜噜| 国产麻豆成人传媒免费观看| 国产欧美日韩一区二区三区在线观看 | 亚洲精品网站在线观看| 色狠狠桃花综合| 日韩av一级片| 久久精品视频在线看| 97成人超碰视| 日日欢夜夜爽一区| 精品久久久久久久久久久久包黑料 | **欧美大码日韩| 欧美日韩黄色影视| 国产一区在线视频| 成人免费在线视频观看| 欧美日韩一级黄| 国产电影一区在线| 亚洲主播在线观看| 精品捆绑美女sm三区| 成人av电影在线| 日韩黄色在线观看| 中文字幕不卡在线观看| 欧美日韩另类一区| 国产精品综合在线视频| 亚洲香蕉伊在人在线观| 久久综合九色综合久久久精品综合| caoporm超碰国产精品| 免费观看在线色综合| 国产精品理论片| 7777精品伊人久久久大香线蕉超级流畅 | 一区二区三区产品免费精品久久75| 日韩免费高清电影| 色婷婷综合五月| 国产综合久久久久久鬼色| 一区二区三区四区视频精品免费| 欧美精品一区二区久久婷婷| 在线免费观看日本欧美| 国产sm精品调教视频网站| 日韩中文欧美在线| 亚洲视频在线一区二区| 26uuu亚洲综合色欧美| 欧美性大战久久久| 99精品视频中文字幕| 国内偷窥港台综合视频在线播放| 亚洲成人免费看| 成人欧美一区二区三区小说 | 国产精品网站导航| 日韩精品在线看片z| 在线看国产日韩| 91香蕉视频mp4| 国产成人av一区二区三区在线 | 日韩福利视频导航| 亚洲一区二区三区视频在线 | 福利91精品一区二区三区| 日日噜噜夜夜狠狠视频欧美人| 亚洲三级电影网站| 国产精品色婷婷| 国产欧美一区二区在线| 精品国产乱码91久久久久久网站| 欧美日韩精品三区| 欧美在线不卡一区| 色综合色狠狠天天综合色| 成人av在线影院| 成人精品国产一区二区4080| 国产激情一区二区三区| 国产精品69久久久久水密桃| 国产精品资源在线观看| 韩国成人在线视频| 国产一区二区日韩精品| 国产成人综合亚洲91猫咪| 国产成人av电影在线| 国产成人福利片| 成人性色生活片免费看爆迷你毛片| 国产精品一线二线三线精华| 国产福利一区二区三区视频在线| 国产成人自拍在线| 99久久伊人久久99| 91美女在线看| 欧美三级视频在线播放| 911国产精品| 精品免费国产一区二区三区四区| 久久综合久久综合久久| 国产欧美日韩不卡免费| 国产精品电影一区二区三区| 亚洲靠逼com| 视频在线在亚洲| 国产在线视视频有精品| 成人一级视频在线观看| 在线欧美日韩精品| 日韩欧美一级特黄在线播放| 亚洲精品一区二区三区在线观看 | 亚洲男女一区二区三区| 怡红院av一区二区三区| 午夜成人免费电影| 国模少妇一区二区三区| 成人国产一区二区三区精品| 91热门视频在线观看| 欧美日韩不卡在线| 精品欧美一区二区三区精品久久| 欧美国产成人在线| 亚洲精品日韩专区silk| 麻豆freexxxx性91精品| 国产精品一级片| 91国内精品野花午夜精品| 91精品国产91综合久久蜜臀| 国产网站一区二区三区| 亚洲综合色丁香婷婷六月图片| 爽好多水快深点欧美视频| 国产成人精品www牛牛影视| 欧美在线免费播放| 精品国产乱码91久久久久久网站| 亚洲欧洲综合另类| 国产在线一区观看| 欧美婷婷六月丁香综合色| 久久综合九色综合久久久精品综合| 依依成人精品视频| 国产一区二区0| 欧洲av一区二区嗯嗯嗯啊| 精品毛片乱码1区2区3区| 一区二区三区在线播| 国产乱码精品一区二区三区忘忧草| 91啪九色porn原创视频在线观看| 91精品国产入口| 日韩美女久久久| 激情综合五月婷婷| 欧美日韩一区二区三区在线看 | 精品一区二区在线视频| 91成人在线免费观看| 久久蜜桃av一区二区天堂| 亚洲国产精品久久不卡毛片 | 精品国产制服丝袜高跟| 亚洲福利视频一区二区| 日韩一级片在线播放| 在线综合+亚洲+欧美中文字幕| 久久久国产一区二区三区四区小说| 亚洲精品国产成人久久av盗摄 | 99精品视频一区二区三区| 91精品国产全国免费观看| 国产精品成人免费精品自在线观看| 人人狠狠综合久久亚洲| 色婷婷av一区二区三区软件| 国产欧美一区二区精品秋霞影院| 青青草国产成人av片免费 | 日本乱码高清不卡字幕| 国产欧美视频一区二区三区| 精品亚洲成a人在线观看| 欧美日韩电影一区| 一级做a爱片久久| 99vv1com这只有精品| 国产欧美日韩另类视频免费观看| 久久66热偷产精品| 欧美一级日韩免费不卡| 午夜成人免费视频| 欧美精品一二三区| 婷婷综合另类小说色区| 欧美在线一区二区| 亚洲妇熟xx妇色黄| 欧美性猛交xxxxxxxx| 亚洲18色成人| 欧美剧情片在线观看| 天天综合网天天综合色| 在线不卡中文字幕播放| 亚洲18女电影在线观看| 欧美伦理视频网站| 免费欧美日韩国产三级电影| 日韩午夜中文字幕| 久久国产精品区| 久久综合久久综合久久综合| 国产成人久久精品77777最新版本 国产成人鲁色资源国产91色综 | 三级亚洲高清视频| 91精品国模一区二区三区| 五月天精品一区二区三区| 日韩午夜激情电影| 香蕉av福利精品导航| 日韩精品中文字幕一区二区三区 | 宅男噜噜噜66一区二区66| 日韩av电影免费观看高清完整版 | 国产精品99久久久久| 日韩美女视频在线| 久久av资源网| 欧美日本在线看| 日韩vs国产vs欧美| 精品精品国产高清a毛片牛牛| 日韩激情一区二区| 欧美一区二区人人喊爽| 人人超碰91尤物精品国产| 久久女同性恋中文字幕| 91蝌蚪porny| 日本不卡一二三| 久久久久亚洲综合| 在线观看中文字幕不卡| 另类小说综合欧美亚洲|