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

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

?? demo12_6_16b.cpp

?? 一本外國人寫的關(guān)于3D游戲編程的書的源碼
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
// DEMO12_6_16b.CPP - pattern demo with tracking instruction
// 16-bit version, make sure desktop is in 16-bit mode!
// 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 Pattern Demo with Tracking"
#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

#define NUM_PATTERNS    4     // number of patterns in system

// pattern instruction opcodes for skelaton

// directional instructions
#define OPC_E    0  // move west
#define OPC_NE   1  // move northeast
#define OPC_N    2  // move north
#define OPC_NW   3  // move northwest
#define OPC_W    4  // move west
#define OPC_SW   5  // move southwest
#define OPC_S    6  // move south
#define OPC_SE   7  // move southeast

// special instructions
#define OPC_STOP        8  // stop for a moment
#define OPC_RAND        9  // select a random direction
#define OPC_TEST_DIST   10 // test distance 
#define OPC_END        -1  // end pattern


#define MIN_LONELYNESS  100 // minimum distance before skelaton
                            // gets lonely for its pet bat

// 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          skelaton;         // the AI skelaton

BOB          bat;                // this time your the bat
int          bat_sound_id  = -1, // sound of bat flapping wings
             laugh_sound_id = -1; // sound of skelaton laughing

// animation sequences for bob
int skelaton_anims[8][4] = { {0,1,0,2},
                             {0+4,1+4,0+4,2+4},
                             {0+8,1+8,0+8,2+8},
                             {0+12,1+12,0+12,2+12},
                             {0+16,1+16,0+16,2+16},
                             {0+20,1+20,0+20,2+20},
                             {0+24,1+24,0+24,2+24},
                             {0+28,1+28,0+28,2+28}, };


// patterns in opcode operand format
int pattern_1[] = {OPC_W, 10, OPC_NW, 10, OPC_N, 10, OPC_NE, 10, 
                   OPC_TEST_DIST, 50, // a distance test
                   OPC_E, 10, OPC_SE, 10, OPC_S, 10, OPC_SW, 10, 
                   OPC_W, 10, OPC_RAND, 10,
                   OPC_TEST_DIST, 50, // a distance test                   
                   OPC_W, 20, OPC_NW, 10, OPC_N, 20, OPC_NE, 10, 
                   OPC_E, 20, OPC_SE, 10, OPC_S, 20, OPC_SW, 10, 
                   OPC_TEST_DIST, 50, // a distance test
                   OPC_W, 10, OPC_END,0};
                   

int pattern_2[] = {OPC_E, 20, OPC_W, 20, OPC_STOP, 20, OPC_NE, 10, 
                   OPC_TEST_DIST, 50, // a distance test                   
                   OPC_W, 10, OPC_NW, 10, OPC_SW, 20, OPC_NW, 20, 
                   OPC_TEST_DIST, 50, // a distance test
                   OPC_SW, 20, OPC_NW, 30, OPC_SW, 10, OPC_S, 50,  
                   OPC_TEST_DIST, 50, // a distance test                   
                   OPC_W, 2, OPC_NW, 2, OPC_N, 2, OPC_NE, 50,  OPC_TEST_DIST, 50, // a distance test
                   OPC_E,2, OPC_SE,2, OPC_S,2, OPC_RAND, 10, OPC_END,0};



int pattern_3[] = { OPC_N, 10, OPC_S, 10, OPC_N, 10, OPC_S, 10, 
                    OPC_TEST_DIST, 50, // a distance test                    
                    OPC_E, 10, OPC_W, 10, OPC_E, 10, OPC_W, 10,
                    OPC_TEST_DIST, 50, // a distance test
                    OPC_NW, 10, OPC_N, 10, OPC_NE, 10, OPC_N, 10, 
                    OPC_TEST_DIST, 60, // a distance test
                    OPC_STOP, 20, OPC_RAND, 5, OPC_E, 50, OPC_S, 50, OPC_W, 50, 
                    OPC_TEST_DIST, 50, // a distance test                    
                    OPC_E, 10, OPC_E, 10, OPC_E, 10, OPC_NW, 100,   OPC_TEST_DIST, 60, // a distance test
                    OPC_STOP, 10, OPC_END,0};


int pattern_4[] = {OPC_W, 100, 
                   OPC_NW, 2,OPC_N, 2,OPC_NE, 2,
                   OPC_E, 100, 
                   OPC_NE, 2,OPC_N, 2,OPC_NW, 2,
                   OPC_TEST_DIST, 50, // a distance test                    
                   OPC_W, 100, 
                   OPC_NW, 2,OPC_N, 2,OPC_NE, 2,
                   OPC_E, 100, 
                   OPC_NE, 2,OPC_N, 2,OPC_NW, 2,
                   OPC_TEST_DIST, 50, // a distance test                    
                   OPC_W, 100, 
                   OPC_NW, 2,OPC_N, 2,OPC_NE, 2,
                   OPC_E, 100, 
                   OPC_NE, 2,OPC_N, 2,OPC_NW, 2,
                   OPC_TEST_DIST, 50, // a distance test
                   OPC_RAND, 10, OPC_RAND, 5,

                   OPC_SW, 2,OPC_S, 2,OPC_SE, 2,
                   OPC_E, 100, 
                   OPC_TEST_DIST, 50, // a distance test
                   OPC_SE, 2,OPC_S, 2,OPC_SW, 2,
                   OPC_W, 100,
                   OPC_TEST_DIST, 50, // a distance test
                   OPC_SW, 2,OPC_S, 2,OPC_SE, 2,
                   OPC_E, 100, 
                   OPC_SE, 2,OPC_S, 2,OPC_SW, 2,
                   OPC_W, 100,
                   OPC_TEST_DIST, 50, // a distance test
                   OPC_SW, 2,OPC_S, 2,OPC_SE, 2,
                   OPC_E, 100, 
                   OPC_TEST_DIST, 50, // a distance test
                   OPC_SE, 2,OPC_S, 2,OPC_SW, 2,
                   OPC_W, 100, OPC_END,0};

// master pattern array
int *patterns[NUM_PATTERNS] = {pattern_1, pattern_2, pattern_3, pattern_4};

int *curr_pattern=NULL;  // current pattern being processed

int opcode,                   // general opcode
    operand,                  // general operand
    skelaton_ip     =0,       // pattern instruction pointer for skelaton
    skelaton_counter=0,       // counter of pattern control
    skelaton_pattern_index;   // the current pattern being executed

// used as a index to string lookup to help print out
char *opcode_names[] = {"OPC_E",
                        "OPC_NE", 
                        "OPC_N",    
                        "OPC_NW",   
                        "OPC_W",    
                        "OPC_SW",   
                        "OPC_S",    
                        "OPC_SE",   
                        "OPC_STOP", 
                        "OPC_RAND", 
                        "OPC_TEST_DIST"};  
// sound stuff

// 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
int skelaton_anim[2];

char filename[80]; // used to build up filenames

// 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, "DUNGEON24.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, "BATS2_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);

// unload bat
Unload_Bitmap_File(&bitmap16bit);


// create skelaton bob
if (!Create_BOB(&skelaton,0,0,56,72,32,
           BOB_ATTR_VISIBLE | BOB_ATTR_MULTI_ANIM,DDSCAPS_SYSTEMMEMORY,0,16))
   return(0);

// load the frames in 8 directions, 4 frames each
// each set of frames has a walk and a fire, frame sets
// are loaded in counter clockwise order looking down
// from a birds eys view or the x-z plane
for (int direction = 0; direction < 8; direction++)
    { 
    // build up file name
    sprintf(filename,"SKELSP%d_24.BMP",direction);

    // load in new bitmap file
    Load_Bitmap_File(&bitmap16bit,filename);
 
    Load_Frame_BOB16(&skelaton,&bitmap16bit,0+direction*4,0,0,BITMAP_EXTRACT_MODE_CELL);  
    Load_Frame_BOB16(&skelaton,&bitmap16bit,1+direction*4,1,0,BITMAP_EXTRACT_MODE_CELL);  
    Load_Frame_BOB16(&skelaton,&bitmap16bit,2+direction*4,2,0,BITMAP_EXTRACT_MODE_CELL);  
    Load_Frame_BOB16(&skelaton,&bitmap16bit,3+direction*4,0,1,BITMAP_EXTRACT_MODE_CELL);  

    // unload the bitmap file
    Unload_Bitmap_File(&bitmap16bit);

    // set the animation sequences for skelaton
    Load_Animation_BOB(&skelaton,direction,4,skelaton_anims[direction]);

    } // end for direction

// set up stating state of skelaton
Set_Animation_BOB(&skelaton, 0);
Set_Anim_Speed_BOB(&skelaton, 4);
Set_Vel_BOB(&skelaton, 0,0);
Set_Pos_BOB(&skelaton, 0, 128);

// 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");
laugh_sound_id = DSound_Load_WAV("LAUGH.WAV");

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

// hide the mouse
if (!WINDOWED_APP)
   ShowCursor(FALSE);

// seed random number generate
srand(Start_Clock());

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

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲人快播电影网| 成人动漫视频在线| 亚洲一二三级电影| 日韩不卡一区二区三区| 精品亚洲成av人在线观看| 国产69精品一区二区亚洲孕妇| 91在线你懂得| 欧美变态凌虐bdsm| 亚洲欧美综合色| 图片区小说区区亚洲影院| 国产精品夜夜嗨| 在线免费观看视频一区| 欧美sm极限捆绑bd| 国产suv精品一区二区三区| 亚洲精品国产精华液| 国产成人高清视频| 日韩精品一区二区三区在线观看 | 国产亚洲一区二区三区四区 | 日本麻豆一区二区三区视频| 亚洲精品在线一区二区| 亚洲一二三区视频在线观看| 日韩欧美中文字幕公布| 无码av免费一区二区三区试看| 精品久久国产字幕高潮| 波多野结衣91| 国产亚洲成年网址在线观看| 99久久免费精品| 美女mm1313爽爽久久久蜜臀| 欧美老人xxxx18| 伊人开心综合网| 欧美成人伊人久久综合网| 成人av手机在线观看| 亚洲国产一区二区在线播放| 久久精品亚洲麻豆av一区二区 | 国产乱理伦片在线观看夜一区| 国产精品久久久久天堂| 丁香激情综合五月| 国产视频在线观看一区二区三区| 色综合视频一区二区三区高清| 国产亚洲综合色| 欧美色男人天堂| 亚洲444eee在线观看| 欧美色视频在线| 成人综合日日夜夜| 精品亚洲aⅴ乱码一区二区三区| 亚洲免费在线看| 国产视频亚洲色图| 777欧美精品| 国产一区在线观看麻豆| 国产午夜精品美女毛片视频| 欧美日韩国产中文| 日韩有码一区二区三区| 欧美一区二区免费| 国产一区二区伦理| 亚洲国产精品久久一线不卡| 国产精品嫩草久久久久| 不卡的av中国片| 国产真实乱对白精彩久久| 中国色在线观看另类| 精品国偷自产国产一区| 88在线观看91蜜桃国自产| 欧美午夜寂寞影院| 免费在线成人网| 日韩精品一区国产麻豆| 欧美视频中文字幕| 欧美最猛性xxxxx直播| 一本久久a久久精品亚洲| 成人免费观看av| 国产suv精品一区二区6| 国内成+人亚洲+欧美+综合在线| 香蕉乱码成人久久天堂爱免费| 亚洲激情欧美激情| 一区二区三区不卡视频| 777xxx欧美| 欧美电影影音先锋| 欧美丰满少妇xxxbbb| 欧美精品三级在线观看| 欧美精品第1页| 欧美高清视频在线高清观看mv色露露十八 | 欧美xxx久久| 精品国产一区二区三区忘忧草| 91精品婷婷国产综合久久竹菊| 欧美日韩国产一区| 91精品国产高清一区二区三区 | av一区二区三区在线| 91在线你懂得| 欧美色中文字幕| 91精品国产综合久久久蜜臀粉嫩 | 日本一区二区三区国色天香 | 在线视频一区二区三| 色婷婷av一区二区三区大白胸 | 亚洲色图清纯唯美| 精品福利二区三区| 久久婷婷成人综合色| 欧美区一区二区三区| 欧美电影在哪看比较好| 日韩欧美国产三级| 久久久久国产一区二区三区四区 | 91丨九色丨蝌蚪丨老版| 黄色日韩网站视频| 不卡av在线网| 欧美艳星brazzers| 欧美不卡视频一区| 亚洲婷婷国产精品电影人久久| 亚洲综合小说图片| 亚洲人午夜精品天堂一二香蕉| 亚洲愉拍自拍另类高清精品| 美女视频第一区二区三区免费观看网站 | 国产91精品精华液一区二区三区| 色婷婷综合久久久中文一区二区| 欧美精品日韩一区| 国产精品网曝门| 午夜精品久久久久久久蜜桃app| 国产一区二区在线观看视频| 91视频观看视频| 日韩欧美一区二区久久婷婷| 国产精品美女www爽爽爽| 亚洲一区二区三区自拍| 国产精一品亚洲二区在线视频| 91国内精品野花午夜精品 | 一区二区三区免费网站| 麻豆精品一区二区av白丝在线| aaa亚洲精品| 日韩欧美亚洲国产另类| 亚洲四区在线观看| 精品一区二区成人精品| 欧美日韩国产天堂| 中文字幕免费观看一区| 中文字幕亚洲在| 蜜臀av性久久久久蜜臀aⅴ| 99在线精品观看| 久久久国际精品| 日本女优在线视频一区二区| av高清久久久| 久久久www免费人成精品| 亚洲第一成年网| 91电影在线观看| 中文字幕精品一区二区三区精品| 日本成人在线一区| 色天使色偷偷av一区二区| 国产欧美日产一区| 久久精品国产一区二区| 国产曰批免费观看久久久| 欧美三级欧美一级| 亚洲码国产岛国毛片在线| 成人黄色小视频| 久久精品综合网| 韩国成人在线视频| 日韩视频一区二区在线观看| 亚洲夂夂婷婷色拍ww47| 在线观看91视频| 一区二区三区不卡视频在线观看| www..com久久爱| 国产清纯美女被跳蛋高潮一区二区久久w | 91在线精品秘密一区二区| 国产欧美一区视频| 韩国视频一区二区| 精品国产乱码久久久久久蜜臀| 天天av天天翘天天综合网色鬼国产| 欧美在线一二三四区| 亚洲黄色av一区| 色婷婷精品久久二区二区蜜臀av| 亚洲欧美中日韩| 91亚洲精品乱码久久久久久蜜桃| 中文字幕不卡一区| 丁香网亚洲国际| 亚洲视频 欧洲视频| 91小视频免费看| 亚洲狠狠爱一区二区三区| 欧美性色综合网| 亚洲成人动漫一区| 91精品婷婷国产综合久久性色| 日韩av一区二区三区| 日韩情涩欧美日韩视频| 国产一区在线不卡| 日本一区二区三区四区| 99国内精品久久| 亚洲一区av在线| 91精品国产一区二区三区| 麻豆国产欧美日韩综合精品二区| 精品欧美黑人一区二区三区| 国产盗摄一区二区三区| 中文字幕在线播放不卡一区| 91视视频在线观看入口直接观看www| 亚洲免费在线观看| 在线免费观看一区| 免费观看30秒视频久久| 亚洲精品在线免费观看视频| 成人精品鲁一区一区二区| 亚洲日本乱码在线观看| 欧美日韩精品免费观看视频| 理论电影国产精品| 中文字幕欧美区| 欧美日韩在线直播| 狂野欧美性猛交blacked| 国产精品久久午夜夜伦鲁鲁| 欧美性一二三区| 国内不卡的二区三区中文字幕 | 懂色av中文一区二区三区| 自拍偷拍亚洲欧美日韩|