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

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

?? demo13_1_16b.cpp

?? 一本外國(guó)人寫的關(guān)于3D游戲編程的書的源碼
?? CPP
字號(hào):
// DEMO13_1_16b.CPP - constant velocity demo
// 16-bit version. make sure your desktop is in 16-bit mode!
// 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

// setup a 640x480 16-bit windowed mode example
#define WINDOW_TITLE      "16-Bit Constant Velocity 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

#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

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

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

// 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, "SKYSCROLL24.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 bitmaps
Load_Bitmap_File(&bitmap16bit, "CHOP24.BMP");

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

// 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_BOB16(&chopper[0], &bitmap16bit, 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(&bitmap16bit);

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

// 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
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_Bitmap16(&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_BOB16(&chopper[index], chopper[index].varsI[0], chopper[index].varsI[1],lpddsback);

// draw the title
Draw_Text_GDI("(16-Bit Version) 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();

    } // 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一区二区三区免费野_久草精品视频
国产精品水嫩水嫩| 91麻豆高清视频| 日韩欧美成人激情| 一区二区国产视频| 一本高清dvd不卡在线观看| 久久久久国产精品人| 韩国成人精品a∨在线观看| 国产精品996| 欧美mv和日韩mv的网站| 蜜桃av噜噜一区| 日韩一区二区精品葵司在线| 免播放器亚洲一区| 日韩午夜激情电影| 日韩av中文在线观看| 91麻豆精品国产91久久久资源速度| 一区二区三区电影在线播| 成人av影视在线观看| 久久亚洲私人国产精品va媚药| 天堂蜜桃一区二区三区| 欧美日韩精品一区二区在线播放| 亚洲成人自拍网| 宅男在线国产精品| 麻豆国产精品官网| 国产欧美一区二区精品久导航| 国产99久久久国产精品潘金| 国产精品国产三级国产普通话99 | 午夜私人影院久久久久| 欧美日韩国产美女| 久久99精品国产麻豆不卡| 久久久久免费观看| 972aa.com艺术欧美| 亚洲午夜免费电影| 日韩欧美国产一区二区在线播放| 麻豆免费看一区二区三区| xnxx国产精品| av在线免费不卡| 午夜成人在线视频| 精品国产伦理网| 成人高清视频在线观看| 亚洲国产精品久久久男人的天堂| 7777精品伊人久久久大香线蕉| 久久er99热精品一区二区| 国产欧美一区二区在线观看| 欧洲视频一区二区| 奇米在线7777在线精品| 国产精品国产a| 欧美日韩精品是欧美日韩精品| 激情国产一区二区| 亚洲精品欧美在线| 久久先锋影音av| 国产精品888| 亚洲亚洲精品在线观看| 26uuu色噜噜精品一区二区| 一本久久综合亚洲鲁鲁五月天| 日本欧美一区二区三区| 久久久激情视频| 在线观看日产精品| 国产专区欧美精品| 亚洲国产精品久久艾草纯爱| 久久精品在线观看| 欧美写真视频网站| 丰满放荡岳乱妇91ww| 日韩av中文字幕一区二区三区| 最近日韩中文字幕| 久久免费美女视频| 欧美一级夜夜爽| 欧洲av在线精品| 高清国产午夜精品久久久久久| 日本在线观看不卡视频| 一区二区在线观看免费视频播放| 久久综合久久久久88| 欧美日韩精品专区| 91丨国产丨九色丨pron| 国产福利不卡视频| 美腿丝袜亚洲色图| 亚洲国产精品久久人人爱蜜臀 | 成人免费福利片| 日韩黄色小视频| 亚洲在线免费播放| 综合久久一区二区三区| 久久久高清一区二区三区| 欧美一级理论性理论a| 色av综合在线| 99久久免费国产| 成人污污视频在线观看| 国内精品视频一区二区三区八戒| 欧美日韩亚洲国产综合| 九一九一国产精品| 三级精品在线观看| 亚洲尤物视频在线| 亚洲国产精品一区二区www| 亚洲免费观看在线视频| 最近中文字幕一区二区三区| 国产精品久久久久久久久快鸭| 国产亚洲欧美日韩日本| 国产欧美日韩三区| 91精品国产乱码| 欧美午夜寂寞影院| 91在线porny国产在线看| 国产成人综合自拍| 成人亚洲精品久久久久软件| 成人h动漫精品一区二区| 国产91综合一区在线观看| 国产精品资源网站| 成人影视亚洲图片在线| 成人免费视频一区二区| 99视频精品在线| 一本一本大道香蕉久在线精品| 色老汉一区二区三区| 91官网在线免费观看| 在线精品亚洲一区二区不卡| 欧美日韩免费观看一区三区| 69堂国产成人免费视频| 精品国产一区二区三区忘忧草| 2020国产精品自拍| 《视频一区视频二区| 亚洲一二三区视频在线观看| 日本免费新一区视频| 国产一区二区不卡老阿姨| 成人白浆超碰人人人人| 在线视频国内自拍亚洲视频| 91精品国产综合久久久蜜臀图片 | 久久综合九色综合欧美亚洲| 欧美高清在线精品一区| 一区二区三区在线视频观看58| 亚洲一区电影777| 国产资源在线一区| 91网站在线观看视频| 欧美高清精品3d| 国产亚洲精品aa| 亚洲三级小视频| 日韩av中文字幕一区二区三区| 国产一区二区成人久久免费影院 | 亚洲欧美成人一区二区三区| 亚洲mv在线观看| 国产精品456露脸| 欧美午夜电影在线播放| 26uuu另类欧美亚洲曰本| 亚洲欧美成人一区二区三区| 免费看精品久久片| 91性感美女视频| 欧美成人a视频| 国产精品视频第一区| 亚洲精品日韩综合观看成人91| 亚洲v中文字幕| 国产91在线看| 欧美一二三区在线| 成人免费视频在线观看| 久久99精品视频| 欧美日韩黄色影视| 亚洲国产精华液网站w| 日本不卡不码高清免费观看| 色综合久久天天综合网| 久久久三级国产网站| 天堂成人国产精品一区| 成人伦理片在线| 精品欧美久久久| 性做久久久久久免费观看| 国产一区二区在线看| 制服丝袜激情欧洲亚洲| 一区二区在线观看免费| 成人毛片在线观看| 精品福利av导航| 日韩精品欧美成人高清一区二区| 99re这里只有精品视频首页| 亚洲精品一区二区三区蜜桃下载| 婷婷综合五月天| 欧美性高清videossexo| 亚洲色图视频免费播放| 国产二区国产一区在线观看| 日韩欧美一卡二卡| 视频一区国产视频| 成人av在线一区二区三区| 久久久久久久久久看片| 日韩成人伦理电影在线观看| 91啪亚洲精品| 亚洲欧洲av在线| 国产一区999| 国产视频一区二区在线| 国产精品影视网| 久久久五月婷婷| 国产成人免费9x9x人网站视频| 欧美成人bangbros| 激情图区综合网| 久久久九九九九| 国产传媒欧美日韩成人| 国产日韩精品一区| 国产成人啪免费观看软件| 久久亚洲私人国产精品va媚药| 国产91露脸合集magnet| 亚洲麻豆国产自偷在线| 制服丝袜中文字幕一区| 国产精品1024| 亚洲综合一区在线| 日韩欧美电影在线| 99久久婷婷国产综合精品电影| 亚洲一区二区免费视频| 2021中文字幕一区亚洲| 91蜜桃在线免费视频| 美日韩一级片在线观看|