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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? demo12_8.cpp

?? 一本外國人寫的關于3D游戲編程的書的源碼
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
// DEMO12_8.CPP - path finding racing 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 "WINCLASS"  // class name

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

#define NUM_WAYPOINTS 30 // number of waypoints in path

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

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

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

typedef struct WAYPOINT_TYP
        {
        float x,y;

        } WAYPOINT, *WAYPOINT_PTR;


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

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

BITMAP_IMAGE background_bmp;   // holds the background

BOB          car; // this little race car

int wind_sound_id = -1;        // the ambient wind
int car_sound_id = -1;         // the engine of the car

int vector_display_on = 1;     // used to toggle the informational vector rendering

// the way point list hand compiled :)
WAYPOINT path[NUM_WAYPOINTS] = { 

{332,122}, 
{229,108}, 
{155,97}, 
{104,100}, 
{67,119}, 
{46,159}, 
{55,229}, 
{74,283}, 
{132,364}, 
{206,407}, 
{268,412}, 
{291,405}, 
{303,379}, 
{312,274}, 
{336,244}, 
{383,233}, 
{417,240}, 
{434,278}, 
{426,328}, 
{407,388}, 
{418,415}, 
{452,429}, 
{501,419}, 
{534,376}, 
{562,263}, 
{562,188}, 
{556,112}, 
{530,100}, 
{484,97},
{404,116},};                     


// 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
						  "Waypoint Path finding 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

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

int Find_Nearest_Waypoint(float x, float y)
{
// this function finds the nearest waypoint to the sent position

int near_id = 0;
int near_dist = 1000,
    test_dist;

for (int index=0; index<NUM_WAYPOINTS; index++)
    {
    // is this waypoint closer?
    if ((test_dist = Fast_Distance_2D(path[index].x - x,path[index].y - y)) < near_dist)
       {
       // set as nearest waypoint
       near_id = index;
       near_dist = test_dist;   
       } // end if

    } // end for index

// test if user want to see all those lines
if (vector_display_on==1)
   {
   // draw it
   DDraw_Lock_Back_Surface();
   Draw_Line(path[near_id].x, path[near_id].y - 8,path[near_id].x, path[near_id].y + 8,
              250, back_buffer, back_lpitch); 

   Draw_Line(path[near_id].x-8, path[near_id].y ,path[near_id].x+8, path[near_id].y,
              250, back_buffer, back_lpitch); 
   DDraw_Unlock_Back_Surface();
   } // end if

// return it
return(near_id);

} // end Find_Nearest_Waypoint

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

void Draw_Waypoints(int mode=1)
{
// this function draws the waypoints and the path network

// lock back surface
DDraw_Lock_Back_Surface();

for (int index=0; index < NUM_WAYPOINTS; index++)
    {
    // draw network line too?
    if (mode > 0)
       Draw_Line(path[index].x, path[index].y,
                 path[(index+1)%NUM_WAYPOINTS].x, path[(index+1)%NUM_WAYPOINTS].y,
                 249,   
                 back_buffer, back_lpitch); // video buffer and memory pitch

   Draw_Pixel(path[index].x, path[index].y, 250, back_buffer, back_lpitch);
   Draw_Pixel(path[index].x+1, path[index].y, 250, back_buffer, back_lpitch);
   Draw_Pixel(path[index].x, path[index].y+1, 250, back_buffer, back_lpitch);
   Draw_Pixel(path[index].x+1, path[index].y+1, 250, back_buffer, back_lpitch);

    } // end for index

// lock back surface
DDraw_Unlock_Back_Surface();

} // end Draw_Waypoints

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

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲视频狠狠干| 中文字幕一区二区三区在线播放| 国产精品影视天天线| 亚洲黄色免费电影| 日本一区二区三区在线观看| 欧美日韩另类一区| caoporn国产精品| 免费av网站大全久久| 亚洲卡通动漫在线| 国产欧美精品区一区二区三区| 欧美中文字幕不卡| 成人av一区二区三区| 久久99精品国产麻豆不卡| 一区二区欧美视频| 国产精品国产自产拍高清av| 56国语精品自产拍在线观看| 91网站最新网址| 精品一二三四区| 婷婷综合在线观看| 亚洲欧美日韩国产综合| 久久这里只有精品6| 欧美电影在线免费观看| 一本在线高清不卡dvd| 国产成人午夜视频| 美女视频一区二区| 日韩精品免费专区| 亚洲一区电影777| 亚洲美女精品一区| 日韩理论片中文av| 国产精品每日更新在线播放网址| 久久婷婷综合激情| 精品国产乱码久久久久久图片| 在线不卡a资源高清| 在线免费观看视频一区| 一本大道综合伊人精品热热| 91亚洲资源网| 91丨porny丨国产| 色综合色狠狠综合色| 91免费观看在线| 91久久精品一区二区二区| 一本久久精品一区二区| 99久久国产综合精品女不卡| 成+人+亚洲+综合天堂| 不卡高清视频专区| av成人老司机| 一本一道波多野结衣一区二区| 99精品1区2区| 欧美在线视频你懂得| 91久久免费观看| 欧美日韩久久久一区| 7777精品伊人久久久大香线蕉的| 在线观看网站黄不卡| 欧美视频日韩视频| 欧美一区二区女人| 精品久久久久久久久久久久久久久| 欧美xfplay| 亚洲国产精品av| 亚洲精品videosex极品| 午夜私人影院久久久久| 日本欧美一区二区| 国产综合色在线| 成人app在线观看| 在线一区二区三区四区五区| 欧美精品一二三区| 久久影院午夜片一区| 国产精品国产自产拍高清av王其| 亚洲精品综合在线| 日本在线不卡视频一二三区| 国产在线精品视频| 99久久久久免费精品国产 | 亚洲自拍偷拍综合| 五月天欧美精品| 另类小说图片综合网| 国产美女精品在线| 99这里只有精品| 欧美日韩第一区日日骚| 欧美精品一区二区三区蜜桃视频| 中文字幕精品三区| 亚洲第一福利视频在线| 久久国产视频网| 99精品视频在线观看| 69堂国产成人免费视频| 久久久久久久久久久99999| 中文字幕在线不卡视频| 七七婷婷婷婷精品国产| 成人免费毛片aaaaa**| 欧美日韩综合色| 久久久久久99久久久精品网站| 最近中文字幕一区二区三区| 日本不卡123| 99久久国产免费看| 欧美变态tickling挠脚心| 亚洲欧美日韩精品久久久久| 黄一区二区三区| 在线观看国产一区二区| 久久精品亚洲精品国产欧美 | av一二三不卡影片| 欧美一级片在线看| 17c精品麻豆一区二区免费| 麻豆精品精品国产自在97香蕉| 不卡的电影网站| 日韩美女视频在线| 亚洲成人精品一区| 成人免费黄色在线| 日韩精品一区二| 亚洲一区二区高清| 不卡的av中国片| www国产亚洲精品久久麻豆| 亚洲bt欧美bt精品| 99re热视频精品| 欧美激情一区二区三区不卡| 美洲天堂一区二卡三卡四卡视频| 色一区在线观看| 国产精品欧美一区二区三区| 极品少妇xxxx精品少妇偷拍| 欧美少妇性性性| 亚洲精品伦理在线| 国产999精品久久| 久久先锋影音av鲁色资源网| 日本中文一区二区三区| 欧美日韩国产精品自在自线| 亚洲精品乱码久久久久久日本蜜臀| 国产suv精品一区二区883| 精品va天堂亚洲国产| 免费人成精品欧美精品| 欧美日韩精品欧美日韩精品| 一区二区三区高清| 色婷婷亚洲一区二区三区| 国产精品免费丝袜| 成人一区二区三区视频 | 亚洲国产激情av| 国产经典欧美精品| 国产婷婷一区二区| 国产寡妇亲子伦一区二区| 久久综合久久99| 国产一区二区三区综合| 国产亚洲午夜高清国产拍精品| 国产一区三区三区| 久久久久99精品国产片| 国产69精品久久久久毛片| 久久精品亚洲麻豆av一区二区| 国内精品伊人久久久久影院对白| 欧美va天堂va视频va在线| 激情文学综合插| 久久久蜜臀国产一区二区| 久久精品国产99久久6| 久久人人超碰精品| 夫妻av一区二区| 综合久久综合久久| 在线看日韩精品电影| 亚洲一区中文日韩| 91精品国产91久久久久久一区二区 | 欧美日韩国产首页| 奇米四色…亚洲| 欧美v国产在线一区二区三区| 国产一区二区三区在线观看免费 | 欧美久久婷婷综合色| 看片网站欧美日韩| 久久久久久久精| caoporn国产精品| 亚洲成人7777| 精品国产一区a| www.亚洲免费av| 午夜国产精品影院在线观看| 日韩亚洲欧美在线| 成人涩涩免费视频| 一区二区三区四区蜜桃| 欧美精品久久一区| 国产伦精品一区二区三区视频青涩| 中文字幕欧美日韩一区| 日本韩国欧美国产| 奇米影视在线99精品| 国产偷v国产偷v亚洲高清| 91啪九色porn原创视频在线观看| 视频一区中文字幕国产| 国产农村妇女精品| 欧美午夜电影在线播放| 国产一区二区三区四区五区入口 | 一区二区在线电影| 欧美一区二区三区免费在线看 | 成人99免费视频| 性久久久久久久久久久久| 久久亚洲一区二区三区明星换脸 | 91看片淫黄大片一级| 日本美女一区二区三区| 国产精品三级av| 欧洲亚洲精品在线| 国产精品1区二区.| 亚洲第一激情av| 国产精品久久国产精麻豆99网站| 欧美日韩高清一区二区不卡| 成人网页在线观看| 蜜桃免费网站一区二区三区| 国产精品久久久久久亚洲毛片| 91精品一区二区三区久久久久久 | 色婷婷综合久久久中文字幕| 久久99精品一区二区三区| 亚洲色图另类专区| 精品国产99国产精品| 色一情一乱一乱一91av|