亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
粉嫩aⅴ一区二区三区四区| 成人一区二区三区视频| 久久久不卡网国产精品二区| 99视频有精品| 久久99久国产精品黄毛片色诱| 中文字幕日韩精品一区| 日韩欧美在线123| 在线精品视频免费播放| 国产精品系列在线观看| 日韩av一区二区三区| 亚洲精品视频观看| 国产精品毛片a∨一区二区三区| 欧美人牲a欧美精品| jlzzjlzz国产精品久久| 精品一区二区精品| 日韩不卡手机在线v区| 一区二区三区精品| 成人欧美一区二区三区| 国产亲近乱来精品视频 | 日韩欧美一区在线观看| 在线观看一区二区视频| 99久久久精品免费观看国产蜜| 国产又黄又大久久| 久久99最新地址| 日韩精品成人一区二区在线| 亚洲一二三四在线观看| 成人欧美一区二区三区视频网页| 国产欧美一区二区三区在线看蜜臀 | 丝袜亚洲另类欧美综合| 亚洲国产日韩精品| 一区二区三区在线观看国产| 亚洲欧美激情插| 国产精品久久久久婷婷| 欧美经典三级视频一区二区三区| 26uuu国产电影一区二区| 精品日韩欧美一区二区| 91精品欧美综合在线观看最新| 欧美精品第一页| 91麻豆精品国产| 日韩一二三四区| 日韩欧美资源站| 精品福利一区二区三区| 精品少妇一区二区三区在线播放| 日韩欧美色电影| 日韩免费福利电影在线观看| 日韩三级视频在线观看| 日韩免费电影一区| 久久久国产精品午夜一区ai换脸| 国产午夜精品久久久久久免费视| 久久亚洲综合色一区二区三区| 久久综合色天天久久综合图片| 久久久国产一区二区三区四区小说| 久久日一线二线三线suv| 久久老女人爱爱| 国产精品成人一区二区艾草| 亚洲视频一区二区在线| 亚洲一区免费观看| 免费成人结看片| 国产精品乡下勾搭老头1| 成人美女在线观看| 欧美性高清videossexo| 7777精品伊人久久久大香线蕉| 欧美一区二区三区不卡| 久久一日本道色综合| 中文字幕欧美一| 亚洲一区二区在线免费观看视频| 日韩精品电影在线观看| 国产一区在线精品| 成人av电影免费在线播放| 色综合久久天天| 日韩视频中午一区| 亚洲国产精品精华液2区45| 一区二区三区欧美| 麻豆91在线观看| va亚洲va日韩不卡在线观看| 欧美午夜精品久久久| 日韩精品自拍偷拍| 亚洲欧美综合在线精品| 亚洲一区影音先锋| 久88久久88久久久| 色婷婷综合久色| 欧美电影免费观看高清完整版在线观看| 国产性做久久久久久| 亚洲一区二区三区中文字幕| 激情综合网av| 色婷婷av一区二区三区gif | 国产精品视频观看| 亚洲国产精品久久艾草纯爱| 极品少妇xxxx精品少妇偷拍| 一本大道久久精品懂色aⅴ| 欧美成va人片在线观看| 日韩伦理免费电影| 韩国欧美国产一区| 欧美日韩国产首页| 国产色产综合色产在线视频| 天堂影院一区二区| 91麻豆文化传媒在线观看| 日韩精品在线看片z| 一区二区三区电影在线播| 国产乱码精品一区二区三区忘忧草| 一本到不卡精品视频在线观看 | 国产精品免费丝袜| 美女视频黄久久| 在线观看欧美黄色| 中文字幕中文字幕一区二区| 免费看日韩精品| 欧美日韩一级视频| 中文字幕中文乱码欧美一区二区| 男人的天堂亚洲一区| 一本在线高清不卡dvd| 欧美国产日韩a欧美在线观看| 青青草97国产精品免费观看无弹窗版| 91同城在线观看| 欧美激情综合网| 国内外成人在线| 欧美一级一区二区| 亚洲国产一区二区三区| 91视频一区二区三区| 国产精品美女久久福利网站| 激情综合亚洲精品| 欧美成人三级在线| 麻豆91精品视频| 日韩一区二区在线免费观看| 亚洲一线二线三线视频| 91同城在线观看| 玉足女爽爽91| 色激情天天射综合网| 欧美国产国产综合| 懂色av一区二区三区免费看| 精品国产一区二区亚洲人成毛片| 久久精品国产精品亚洲精品| 欧美精品1区2区| 全国精品久久少妇| 日韩一级精品视频在线观看| 免费av网站大全久久| 欧美第一区第二区| 麻豆成人免费电影| 337p粉嫩大胆色噜噜噜噜亚洲| 激情五月播播久久久精品| 欧美成人bangbros| 国产精品一级黄| 国产精品情趣视频| 91色乱码一区二区三区| 伊人性伊人情综合网| 欧美三级视频在线| 日韩电影在线观看电影| 日韩欧美国产三级电影视频| 精品一区二区三区在线视频| 欧美精品一区二区三区蜜臀 | 国产一区在线观看麻豆| 国产丝袜美腿一区二区三区| 成人av电影在线| 亚洲精品高清在线观看| 欧美日韩不卡视频| 美国毛片一区二区| 久久久不卡网国产精品一区| 白白色 亚洲乱淫| 亚洲伊人伊色伊影伊综合网 | 最新日韩av在线| 欧美日韩国产高清一区二区| 日韩高清中文字幕一区| 久久综合九色综合久久久精品综合 | 久久99久国产精品黄毛片色诱| 久久久电影一区二区三区| 91在线丨porny丨国产| 亚洲自拍都市欧美小说| 91精品国产一区二区三区| 精品一区二区日韩| 国产精品进线69影院| 欧美艳星brazzers| 久久精品国产亚洲aⅴ| 亚洲欧美怡红院| 91精品国产综合久久久蜜臀图片| 国产伦精品一区二区三区在线观看| 国产精品女人毛片| 欧美日韩你懂的| 国产精品99久久久久久有的能看| 国产精品久久久久桃色tv| 欧美精品一二三| 成人免费视频免费观看| 亚洲成人黄色影院| 久久久www免费人成精品| 在线看国产一区二区| 国产精品白丝jk白祙喷水网站| 亚洲一区二区三区四区在线观看 | 青青草原综合久久大伊人精品优势| 国产欧美日韩另类一区| 欧美日韩在线播放三区| 国产美女在线精品| 亚洲妇女屁股眼交7| 国产亚洲一区二区在线观看| 欧美精品一级二级| 不卡的av中国片| 久久av老司机精品网站导航| 亚洲美女在线国产| 国产三级精品视频| 制服.丝袜.亚洲.另类.中文 | 精品区一区二区| 色狠狠桃花综合| 国产成人综合在线播放|