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

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

?? demo13_1.cpp

?? 一本外國人寫的關于3D游戲編程的書的源碼
?? CPP
字號:
// DEMO13_1.CPP - constant velocity demo
// to compile make sure to include DDRAW.LIB, DSOUND.LIB,
// DINPUT.LIB, WINMM.LIB, and of course the T3DLIB files

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

#define NUM_CHOPPERS    24   // number of choppers in simulation

// 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          chopper[NUM_CHOPPERS];  // the fleet

int sound_id = -1;             // general sound

// 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
						  "Constant Velocity 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

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

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

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

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

// load background image
Load_Bitmap_File(&bitmap8bit, "SKYSCROLL8.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 bitmaps
Load_Bitmap_File(&bitmap8bit, "CHOP8.BMP");

// create bob
Create_BOB(&chopper[0],0,120,200,64,3,BOB_ATTR_MULTI_FRAME | BOB_ATTR_VISIBLE, DDSCAPS_SYSTEMMEMORY);

// set animation speed
Set_Anim_Speed_BOB(&chopper[0], 1);

// set motion speed
Set_Vel_BOB(&chopper[0],2+rand()%6,0);

// set position
Set_Pos_BOB(&chopper[0], rand()%SCREEN_WIDTH, rand()%SCREEN_HEIGHT);

// load the bob in 
for (index=0; index < 3; index++)
    Load_Frame_BOB(&chopper[0], &bitmap8bit, index, 0, index, BITMAP_EXTRACT_MODE_CELL);

// now make the remaining 15 clones
for (index=1; index < NUM_CHOPPERS; index++)
    {
    // clone the bob
    Clone_BOB(&chopper[0], &chopper[index]);

    // set new position and velocity
    Set_Vel_BOB(&chopper[index],2+rand()%6,0);
    Set_Pos_BOB(&chopper[index], rand()%SCREEN_WIDTH, rand()%SCREEN_HEIGHT);

    // now here the tricky part, alter the size of the bob, but make sure
    // to keep the aspect ratio the same, so it doesn't look scrunched
    float width  = 200 - 10 * index;
    float height = (float)width*((float)64/(float)200);

    // store new width and height in varsIable cache positions 0,1
    chopper[index].varsI[0] = width;
    chopper[index].varsI[1] = height;

    } // end for index

// unload bitmap image
Unload_Bitmap_File(&bitmap8bit);

// initialize directinput
DInput_Init();

// acquire the keyboard only
DInput_Init_Keyboard();

// initilize DirectSound
DSound_Init();

// load background sounds
sound_id = DSound_Load_WAV("CHOP.WAV");

// start the sounds
DSound_Play(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
for (int index=0; index < NUM_CHOPPERS; index++)
    Destroy_BOB(&chopper[index]);

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

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

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

// scroll the background
Scroll_Bitmap(&background_bmp, -1);

// read keyboard
DInput_Read_Keyboard();

// move and animate the fleet
for (index=0; index<NUM_CHOPPERS; index++)
    {
    // move the chopper
    Move_BOB(&chopper[index]);

    // test for off the screen wrap around
    if (chopper[index].x > SCREEN_WIDTH)
       chopper[index].x = -chopper[index].width;

    // animate the bat
    Animate_BOB(&chopper[index]);

    } // end for index

// draw the choppers
for (index=NUM_CHOPPERS-1; index>=0; index--)
    Draw_Scaled_BOB(&chopper[index], chopper[index].varsI[0], chopper[index].varsI[1],lpddsback);

// draw the title
Draw_Text_GDI("CONSTANT VELOCITY DEMO",10, 10,RGB(0,200,200), lpddsback);

// flip the surfaces
DDraw_Flip();

// sync to 30 fps = 1/30sec = 33 ms
Wait_Clock(33);

// 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_DARKNESS,NULL,0);
    } // end if

// return success
return(1);

} // end Game_Main

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

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
色婷婷综合久久久久中文一区二区| 综合电影一区二区三区| 欧美在线小视频| caoporn国产一区二区| 国产伦精品一区二区三区在线观看| 免费高清成人在线| 久久成人免费网站| 亚洲已满18点击进入久久| 亚洲综合色成人| 日日夜夜免费精品视频| 欧美日韩成人激情| 在线不卡的av| 久久综合久久综合久久综合| 久久综合网色—综合色88| 日韩精品一区在线| 久久久久国产成人精品亚洲午夜| 国产婷婷精品av在线| 1区2区3区精品视频| 亚洲国产视频直播| 麻豆高清免费国产一区| 国产剧情av麻豆香蕉精品| 成人免费视频免费观看| 在线观看成人小视频| 91精品国产美女浴室洗澡无遮挡| 精品三级在线观看| 久久99热狠狠色一区二区| 麻豆精品在线播放| 在线日韩国产精品| 成人视屏免费看| 成人自拍视频在线| 欧美亚洲国产一卡| 欧美xxxxx裸体时装秀| 国产精品国产三级国产专播品爱网| 亚洲人成影院在线观看| 天天色综合天天| 成人av资源下载| 制服丝袜亚洲色图| 中文字幕免费观看一区| 日本不卡视频在线观看| 成人精品视频网站| 91精品国产全国免费观看| 国产精品全国免费观看高清 | 麻豆精品久久久| 蜜臀av一区二区在线免费观看| 国产麻豆精品久久一二三| 欧洲亚洲精品在线| 国产精品亲子乱子伦xxxx裸| 日精品一区二区| 91丝袜呻吟高潮美腿白嫩在线观看| 欧美一区二区在线观看| 亚洲欧美日韩久久| 福利电影一区二区三区| 欧美一区二区久久| 性久久久久久久久| 日本乱人伦aⅴ精品| 国产无遮挡一区二区三区毛片日本| 视频一区免费在线观看| 欧洲色大大久久| 亚洲日本丝袜连裤袜办公室| 国产精品亚洲午夜一区二区三区 | 国产农村妇女毛片精品久久麻豆| 裸体健美xxxx欧美裸体表演| 激情偷乱视频一区二区三区| 欧美在线观看一二区| 欧美成人国产一区二区| 日韩精品电影一区亚洲| 欧美日韩高清在线播放| 亚洲国产一二三| 欧美日韩专区在线| 亚洲妇熟xx妇色黄| 欧美在线一二三四区| 亚洲成人动漫在线免费观看| 色综合激情五月| 亚洲精品视频在线| 欧美羞羞免费网站| 亚洲国产精品自拍| 91超碰这里只有精品国产| 亚洲成人免费视频| 91精品国产综合久久久久久| 日韩**一区毛片| 91精品国产黑色紧身裤美女| 蜜桃av一区二区三区| 欧美成人综合网站| 国产精品一区专区| 中文字幕va一区二区三区| 国产91精品露脸国语对白| 中文字幕五月欧美| 欧美伊人精品成人久久综合97 | 亚洲人精品一区| 在线日韩一区二区| 青青草国产成人av片免费| 日韩欧美第一区| 国产99久久久久久免费看农村| 久久久久国产精品免费免费搜索| 高清shemale亚洲人妖| 伊人性伊人情综合网| 欧美日韩国产天堂| 极品美女销魂一区二区三区免费| 2欧美一区二区三区在线观看视频| 激情综合网av| 国产精品毛片a∨一区二区三区| 日本丶国产丶欧美色综合| 日韩高清欧美激情| 国产精品国产三级国产专播品爱网| 91电影在线观看| 欧美成人在线直播| 亚洲成人激情av| 国产精品青草综合久久久久99| 91看片淫黄大片一级在线观看| 亚洲午夜在线视频| 国产欧美视频一区二区| 欧美唯美清纯偷拍| 久久99久国产精品黄毛片色诱| 亚洲欧洲www| 日韩一级大片在线观看| 成人精品视频一区二区三区 | 欧美日韩国产小视频| 国产成人在线电影| 婷婷中文字幕一区三区| 国产精品午夜免费| 日韩一区二区免费在线电影| 91啪在线观看| 国产精品一区二区在线播放| 亚洲午夜免费电影| 国产精品污www在线观看| 5858s免费视频成人| 91视频一区二区| 色综合久久中文字幕| 天天综合网天天综合色| 亚洲免费在线看| 欧美成人女星排行榜| 欧美性生交片4| 91色婷婷久久久久合中文| 国产在线不卡视频| 日韩电影在线一区二区三区| 亚洲综合激情另类小说区| 精品日韩在线一区| 在线播放中文一区| 欧美日韩情趣电影| 一本大道久久a久久精二百| 成人av在线资源网站| 国产精品一级二级三级| 精品亚洲成a人| 裸体歌舞表演一区二区| 麻豆成人91精品二区三区| 亚洲第一久久影院| 亚洲午夜久久久久久久久电影院 | 91麻豆国产精品久久| 成人免费不卡视频| 成人黄色在线看| 国产麻豆视频精品| 国产xxx精品视频大全| 国产精品一区二区在线观看网站| 狠狠色狠狠色合久久伊人| 极品美女销魂一区二区三区| 蜜桃精品视频在线| 精品一区二区三区的国产在线播放| 看片的网站亚洲| 久久99精品国产91久久来源| 国产一区二区福利视频| 国产一区二区三区电影在线观看| 国产一区二区看久久| 成人午夜在线播放| 一本大道久久a久久精二百| 欧美亚洲综合一区| 欧美一区二区三区的| 精品国产乱码久久久久久影片| 日韩精品在线看片z| 国产清纯白嫩初高生在线观看91| 欧美国产禁国产网站cc| 亚洲女同一区二区| 亚洲国产精品一区二区久久| 天堂一区二区在线| 国产一区二区免费看| 91亚洲国产成人精品一区二三| 欧美日韩激情一区| 2023国产精华国产精品| 中文字幕五月欧美| 美脚の诱脚舐め脚责91| 国产精品 欧美精品| 日本久久电影网| 欧美大度的电影原声| 亚洲色图视频免费播放| 免费av网站大全久久| 国产成人aaaa| 欧美日韩在线一区二区| 久久夜色精品国产噜噜av| 综合激情成人伊人| 亚洲成人精品一区二区| 国产精一区二区三区| 欧美在线综合视频| 欧美不卡一区二区| 亚洲精品中文在线| 韩国av一区二区三区| a亚洲天堂av| 7777精品伊人久久久大香线蕉最新版| 久久久综合激的五月天| 亚洲一区二区综合| av激情综合网| 欧美成人精品高清在线播放|