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

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

?? demo13_8_16b.cpp

?? 一本外國人寫的關于3D游戲編程的書的源碼
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
// DEMO13_8_16.CPP - 2D collision response demo based on
// 16-bit version, make sure your desktop is in 16-bit mode!
// conservation of momentum and kinetic energy
// 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 2D Collision Response 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_BALLS       10   // number of pool balls
#define BALL_RADIUS     12   // radius of ball


// extents of table
#define TABLE_MIN_X     100
#define TABLE_MAX_X     500
#define TABLE_MIN_Y     50
#define TABLE_MAX_Y     450


// variable lookup indices
#define INDEX_X               0 
#define INDEX_Y               1  
#define INDEX_XV              2 
#define INDEX_YV              3  
#define INDEX_MASS            4

// MACROS ///////////////////////////////////////////////

#define RAND_RANGE(x,y) ( (x) + (rand()%((y)-(x)+1)))
#define DOT_PRODUCT(ux,uy,vx,vy) ((ux)*(vx) + (uy)*(vy))

// 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[256];                 // used to print text

BITMAP_IMAGE background_bmp;      // holds the background
BOB          balls[NUM_BALLS];    // the balls

int ball_ids[8];                  // sound ids for balls

float cof_E  =    1.0;  // coefficient of restitution, < 1 makes them loose energy
                        // during the collision modeling friction, heat, deformation
                        // etc. > 1 is impossible, but makes them gain energy!

// 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 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(&bitmap8bit, "GREENGRID24.BMP");
Create_Bitmap(&background_bmp,0,0,640,480,16);
Load_Image_Bitmap16(&background_bmp, &bitmap8bit,0,0,BITMAP_EXTRACT_MODE_ABS);
Unload_Bitmap_File(&bitmap8bit);

// load the bitmaps
Load_Bitmap_File(&bitmap8bit, "POOLBALLS24.BMP");

// create master ball
Create_BOB(&balls[0],0,0,24,24,6,BOB_ATTR_MULTI_FRAME | BOB_ATTR_VISIBLE, DDSCAPS_SYSTEMMEMORY,0,16);

// load the imagery in
for (index=0; index < 6; index++)
    Load_Frame_BOB16(&balls[0], &bitmap8bit, index, index,0,BITMAP_EXTRACT_MODE_CELL);

// create all the clones
for (index=1; index < NUM_BALLS; index++)
    Clone_BOB(&balls[0], &balls[index]);

// now set the initial conditions of all the balls
for (index=0; index < NUM_BALLS; index++)
    {
    // set position randomly
    balls[index].varsF[INDEX_X] = RAND_RANGE(TABLE_MIN_X+20,TABLE_MAX_X-20);
    balls[index].varsF[INDEX_Y] = RAND_RANGE(TABLE_MIN_Y+20,TABLE_MAX_Y-20);

    // set initial velocity
    balls[index].varsF[INDEX_XV] = RAND_RANGE(-100, 100)/15;
    balls[index].varsF[INDEX_YV] = RAND_RANGE(-100, 100)/15;

    // set mass of ball in virtual kgs :)
    balls[index].varsF[INDEX_MASS] = 1; // 1 for now

    // set ball color
    balls[index].curr_frame = rand()%6;

    } // end for index

// unload bitmap image
Unload_Bitmap_File(&bitmap8bit);

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

// initialize directinput
DInput_Init();

// acquire the keyboard only
DInput_Init_Keyboard();

// initilize DirectSound
DSound_Init();

// load background sounds
ball_ids[0] = DSound_Load_WAV("PBALL.WAV");

// clone sounds
for (index=1; index<8; index++)
    ball_ids[index] = DSound_Replicate_Sound(ball_ids[0]);


// set clipping region
min_clip_x = TABLE_MIN_X;
min_clip_y = TABLE_MIN_Y;
max_clip_x = TABLE_MAX_X;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩av不卡在线观看| 国产一区二区三区| 国内久久婷婷综合| 在线一区二区三区四区| 国产校园另类小说区| 午夜日韩在线观看| 色综合中文字幕国产| 欧美一区二区黄色| 亚洲一区二区三区四区不卡| 国产精品18久久久久久久久| 91精品国产乱| 偷偷要91色婷婷| 色婷婷国产精品| 国产精品欧美极品| 国产剧情av麻豆香蕉精品| 欧美一区欧美二区| 亚欧色一区w666天堂| 色一情一乱一乱一91av| 中文字幕一区二区在线观看| 国产一区在线看| 精品国产3级a| 国产一区二三区| 久久蜜桃av一区精品变态类天堂| 视频一区二区三区在线| 欧美在线视频全部完| 亚洲女女做受ⅹxx高潮| 91在线无精精品入口| 1024成人网色www| 粉嫩13p一区二区三区| 国产欧美日韩一区二区三区在线观看 | 亚洲一区二区四区蜜桃| 97精品久久久久中文字幕| 中文字幕亚洲综合久久菠萝蜜| 国产精品996| 国产精品入口麻豆九色| 波多野结衣精品在线| 亚洲图片激情小说| 色又黄又爽网站www久久| 亚洲日本va在线观看| 91美女在线视频| 亚洲国产精品影院| 91精品在线观看入口| 久久精品国产一区二区三| 精品国产一区二区三区久久久蜜月 | 日韩精品综合一本久道在线视频| 日韩中文字幕91| 综合久久久久久| 欧亚一区二区三区| 日日摸夜夜添夜夜添国产精品| 欧美剧情片在线观看| 青青草一区二区三区| 精品粉嫩超白一线天av| 高清国产一区二区| 一区二区三区中文字幕在线观看| 日本高清免费不卡视频| 免费成人在线网站| 亚洲国产精品高清| 欧美色窝79yyyycom| 青青国产91久久久久久| 国产精品毛片久久久久久| 色菇凉天天综合网| 蜜桃精品视频在线观看| 国产精品二三区| 欧美日韩中文另类| 国产又粗又猛又爽又黄91精品| 国产精品初高中害羞小美女文| 91成人免费电影| 国内精品嫩模私拍在线| 亚洲欧美激情一区二区| 日韩一级片网址| 9人人澡人人爽人人精品| 青青青伊人色综合久久| 亚洲日本青草视频在线怡红院| 欧美剧情电影在线观看完整版免费励志电影| 久久成人免费网站| 一区二区在线看| 久久综合九色综合97婷婷女人| 色婷婷激情综合| 国产成人免费视频网站高清观看视频| 亚洲欧美激情视频在线观看一区二区三区| 日韩一区二区三区观看| 91一区二区三区在线观看| 久久99久久久久久久久久久| 一区二区三区日韩欧美| 国产色一区二区| 欧美一区二区三区视频免费播放 | 亚洲日本va午夜在线影院| 日韩欧美亚洲另类制服综合在线| 色呦呦日韩精品| 高清不卡一区二区在线| 看电视剧不卡顿的网站| 一区二区三区四区在线免费观看| 精品粉嫩超白一线天av| 91精品婷婷国产综合久久竹菊| 99r精品视频| 高清免费成人av| 国产乱人伦偷精品视频免下载| 午夜精品免费在线观看| 亚洲综合一二区| 亚洲欧美国产高清| 国产精品美女视频| 国产日韩精品一区二区浪潮av| 欧美一区二区三区的| 欧美日韩国产首页| 中文字幕精品三区| 精品电影一区二区三区| 欧美不卡在线视频| 日韩三级在线免费观看| 欧美一级生活片| 欧美一级高清片在线观看| 在线播放欧美女士性生活| 欧美性受xxxx| 欧美性大战xxxxx久久久| 91麻豆精品视频| av网站免费线看精品| av午夜一区麻豆| 在线免费不卡视频| 欧美性色欧美a在线播放| 欧美少妇一区二区| 7777精品伊人久久久大香线蕉超级流畅 | av爱爱亚洲一区| 99久久国产综合精品女不卡| av一区二区久久| 色吧成人激情小说| 欧美日韩综合一区| 欧美一区二区三区在| 精品人伦一区二区色婷婷| 日韩精品中文字幕在线不卡尤物| 日韩丝袜情趣美女图片| 精品精品国产高清a毛片牛牛| 久久先锋影音av鲁色资源| 日本一区免费视频| 亚洲乱码国产乱码精品精的特点| 亚洲最新视频在线观看| 日韩精品亚洲一区二区三区免费| 美国精品在线观看| 国产高清不卡一区| 色哟哟亚洲精品| 欧美一区二区久久久| 国产亚洲欧美日韩日本| 亚洲精品午夜久久久| 日本aⅴ免费视频一区二区三区 | 国产精品久久久久久久久免费桃花| 中文字幕亚洲不卡| 三级欧美在线一区| 国产精品小仙女| 91国偷自产一区二区使用方法| 日韩一区二区中文字幕| 国产清纯白嫩初高生在线观看91| 日韩一区在线播放| 麻豆免费看一区二区三区| 成人免费视频网站在线观看| 欧美日韩电影在线| 日本一区二区三区国色天香| 亚洲国产aⅴ成人精品无吗| 国产精品一区免费视频| 欧洲精品在线观看| 久久看人人爽人人| 亚洲国产乱码最新视频| 国产激情一区二区三区桃花岛亚洲 | 欧美成人aa大片| 亚洲男人天堂av网| 国产成人综合在线播放| 91麻豆精品国产自产在线| 日韩精品高清不卡| 成人国产精品免费观看动漫| 制服视频三区第一页精品| 亚洲日本中文字幕区| 精品亚洲国产成人av制服丝袜| 色久优优欧美色久优优| 国产视频911| 国产在线视频精品一区| 91精品国产综合久久精品麻豆| 国产精品久久影院| 国产精品中文有码| 欧美一区二区三区不卡| 亚洲午夜一区二区三区| 不卡在线视频中文字幕| 国产亚洲精品免费| 精品一区二区三区av| 在线播放亚洲一区| 午夜激情一区二区三区| 欧美亚日韩国产aⅴ精品中极品| 国产精品欧美综合在线| 国产suv一区二区三区88区| 日韩久久久久久| 日本午夜精品一区二区三区电影| 欧美在线观看你懂的| 亚洲精品久久嫩草网站秘色| 国产精品一区专区| 精品粉嫩超白一线天av| 精品夜夜嗨av一区二区三区| 日韩欧美二区三区| 日韩av一区二| 91精品婷婷国产综合久久性色 | 国精产品一区一区三区mba桃花 | 国产精品69毛片高清亚洲| 久久久久国产成人精品亚洲午夜| 麻豆精品国产91久久久久久| 日韩一区二区中文字幕|