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

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

?? demo9_4_16b.cpp

?? 一本外國人寫的關于3D游戲編程的書的源碼
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
// DEMO9_4_16B.CPP - DirectInput Force Feedback Demo
// 16-bit version

// INCLUDES ///////////////////////////////////////////////

#define WIN32_LEAN_AND_MEAN  

#define INITGUID // if not done elsewhere

#include <windows.h>   // include important windows stuff
#include <windowsx.h> 
#include <mmsystem.h>
#include <objbase.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 <dinput.h>
#include "T3DLIB1.H"

// DEFINES ////////////////////////////////////////////////

// defines for windows 
#define WINDOW_CLASS_NAME "WINCLASS1"

// default screen size
#define SCREEN_WIDTH    640  // size of screen
#define SCREEN_HEIGHT   480
#define SCREEN_BPP      8    // bits per pixel

// setup a 640x480 16-bit windowed mode example
#define WINDOW_TITLE      "16-Bit DirectInput Force Feedback 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 BITMAP_ID            0x4D42 // universal id for a bitmap
#define MAX_COLORS_PALETTE   256

#define BUTTON_SPRAY    0    // defines for each button
#define BUTTON_PENCIL   1
#define BUTTON_ERASE    2
#define BUTTON_EXIT     3


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


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

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

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

// windows vars
HWND      main_window_handle = NULL; // globally track main window
int       window_closed      = 0;    // tracks if window is closed
HINSTANCE main_instance      = NULL; // globally track hinstance

char buffer[80];                // used to print text

// directinput globals
LPDIRECTINPUT8        lpdi      = NULL;    // dinput object
LPDIRECTINPUTDEVICE8  lpdikey   = NULL;    // dinput keyboard
LPDIRECTINPUTDEVICE8  lpdimouse = NULL;    // dinput mouse
LPDIRECTINPUTDEVICE8  lpdijoy   = NULL;    // dinput joystick 
LPDIRECTINPUTEFFECT  lpdieffect = NULL;   // force feedback effect object 
GUID                 joystickGUID;        // guid for main joystick
char                 joyname[80];         // name of joystick

// these contain the target records for all di input packets
UCHAR        keyboard_state[256]; // contains keyboard state table
DIMOUSESTATE mouse_state;         // contains state of mouse
DIJOYSTATE2  joy_state;           // contains state of joystick

// demo globals

BITMAP_IMAGE playfield;       // used to hold playfield
BITMAP_IMAGE mushrooms[4];    // holds mushrooms
BOB          blaster;         // holds bug blaster

int blaster_anim[5] = {0,1,2,1,0};  // blinking animation

// lets use a line segment for the missle
int missile_x[32],              // position of missle
    missile_y[32],            
    missile_state[32];          // state of missle 0 off, 1 on

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

int Start_Missile(void);
int Move_Missile(void);
int Draw_Missile(void);

// 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
char buffer[80];        // used to print strings

// what is the message 
switch(msg)
	{	
	case WM_CREATE: 
        {
		// do initialization stuff here
        // return success
		return(0);
		} break;
   
	case WM_PAINT: 
		{
		// simply validate the window 
   	    hdc = BeginPaint(hwnd,&ps);	 
        
        // end painting
        EndPaint(hwnd,&ps);

        // return success
		return(0);
   		} break;

	case WM_DESTROY: 
		{

		// kill the application, this sends a WM_QUIT message 
		PostQuitMessage(0);

        // return success
		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)
{

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

// initialize game here
Game_Init();

// enter main event loop
while(TRUE)
	{
    // test if there is a message in queue, if so get it
	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

// closedown game here
Game_Shutdown();

// return to Windows like this
return(msg.wParam);

} // end WinMain

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

BOOL CALLBACK DI_Enum_Joysticks(LPCDIDEVICEINSTANCE lpddi,
								LPVOID guid_ptr) 
{
// this function enumerates the joysticks, but
// stops at the first one and returns the
// instance guid of it, so we can create it

*(GUID*)guid_ptr = lpddi->guidInstance; 

// copy name into global
strcpy(joyname, (char *)lpddi->tszProductName);

// stop enumeration after one iteration
return(DIENUM_STOP);

} // end DI_Enum_Joysticks

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

int Start_Missile(void)
{
// this function starts the missle, if it is currently off


for (int index = 0; index<32; index++)
{
if (missile_state[index]==0)
    {
    // enable missile
    missile_state[index] = 1;

    // computer position of missile
    missile_x[index] = blaster.x + 16;
    missile_y[index] = blaster.y-4;

    // return success
    return(1);
    } // end if

} // end for

// couldn't start missile
return(0);

} // end Start_Missile

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

int Move_Missile(void)
{
// this function moves the missle 

// test if missile is alive
for (int index=0; index<32; index++)
    {
    if (missile_state[index]==1)
       {
       // move the missile upward
       if ((missile_y[index]-=10) < 0)
          {
          missile_state[index] = 0;
          continue;
          } // end if

   // lock secondary buffer
   DDraw_Lock_Back_Surface();

   // add missile collision here

   // unlock surface
   DDraw_Unlock_Back_Surface();
   } // end if

} // end for

// return failure
return(0);

} // end Move_Missle

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

int Draw_Missile(void)
{
// this function draws the missile 

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩欧美一区二区视频| 91一区二区在线观看| 一区二区三国产精华液| 国产精品视频yy9299一区| 国产婷婷色一区二区三区在线| 日韩精品一区二区三区中文不卡| 欧美一区二区福利视频| 91精品国产综合久久久久久久久久| 欧美片在线播放| 欧美一区二区美女| 精品91自产拍在线观看一区| 精品国产人成亚洲区| 国产三级三级三级精品8ⅰ区| 精品国产一区二区亚洲人成毛片| 欧美精品一区二区三区蜜臀| 久久久精品国产99久久精品芒果| 国产日韩精品视频一区| 专区另类欧美日韩| 亚洲成av人片在线观看| 免费在线观看视频一区| 国产一区二区主播在线| 成人国产精品免费观看视频| jvid福利写真一区二区三区| 欧美在线free| 欧美精品一区二区三区久久久 | 91女人视频在线观看| 91小视频在线免费看| 91精品国产麻豆国产自产在线| 精品嫩草影院久久| 中文字幕一区二区三区乱码在线| 天堂午夜影视日韩欧美一区二区| 另类人妖一区二区av| www.成人在线| 日韩欧美一级在线播放| 国产精品久久久久久久蜜臀| 日韩国产在线一| av中文字幕不卡| 欧美成va人片在线观看| 一区二区三区在线观看网站| 精品一区二区在线看| 91精彩视频在线| 精品成a人在线观看| 怡红院av一区二区三区| 国产精品一区专区| 国产欧美视频一区二区三区| 国产精品一区久久久久| 97久久精品人人爽人人爽蜜臀| 91电影在线观看| 精品欧美一区二区在线观看| 亚洲一区二区在线观看视频| 国产精品88av| 日韩欧美卡一卡二| 午夜久久久久久久久久一区二区| youjizz久久| 久久久亚洲精品石原莉奈| 偷窥少妇高潮呻吟av久久免费| 99在线热播精品免费| 久久久综合精品| 九色porny丨国产精品| 欧美日韩中字一区| 亚洲精品大片www| 91亚洲精品久久久蜜桃网站 | 国产主播一区二区三区| 久久色.com| 日本亚洲一区二区| 欧美性一二三区| 亚洲一区二区三区不卡国产欧美| a在线欧美一区| 中日韩免费视频中文字幕| 狠狠色综合日日| 久久一夜天堂av一区二区三区| 老司机免费视频一区二区| 制服丝袜中文字幕一区| 午夜av电影一区| 欧美一区二区三区喷汁尤物| 日本美女视频一区二区| 日韩欧美区一区二| 国产真实乱偷精品视频免| 精品动漫一区二区三区在线观看| 美洲天堂一区二卡三卡四卡视频 | 精品美女一区二区| 国产制服丝袜一区| 中文字幕乱码亚洲精品一区| 成人免费高清视频在线观看| 中文字幕在线视频一区| 91在线小视频| 亚洲mv在线观看| 欧美一级午夜免费电影| 国产一区高清在线| 国产精品私人自拍| 在线视频一区二区免费| 日韩和欧美一区二区| 久久久久久久久蜜桃| 成人高清视频免费观看| 亚洲一线二线三线视频| 欧美一区二区三区人| 国产成人精品亚洲777人妖| 亚洲女与黑人做爰| 91精品国产欧美日韩| 国产精品18久久久久久久久| 亚洲视频一二三| 欧美日韩久久久| 国产老肥熟一区二区三区| 中文字幕在线不卡视频| 欧美日韩国产美| 成人小视频免费在线观看| 亚洲国产精品久久人人爱蜜臀| 欧美一区二区视频网站| 成人网页在线观看| 天天综合网 天天综合色| 国产人伦精品一区二区| 欧美日韩国产精品成人| 高清久久久久久| 日韩电影在线观看一区| 中文字幕av资源一区| 欧美一区二区观看视频| 91在线你懂得| 国产精品白丝jk黑袜喷水| 亚洲图片自拍偷拍| 中文字幕的久久| 日韩欧美国产一区二区在线播放 | 精彩视频一区二区三区| 一区二区视频在线| 久久精品一区二区三区不卡 | 99re视频精品| 国产在线观看免费一区| 日韩二区三区四区| 亚洲老妇xxxxxx| 欧美激情在线免费观看| 日韩精品一区二区三区蜜臀 | 91麻豆国产在线观看| 国产乱人伦精品一区二区在线观看 | 国产日本欧美一区二区| 日韩视频一区在线观看| 欧美性受xxxx黑人xyx性爽| eeuss影院一区二区三区| 国产麻豆成人精品| 精品午夜一区二区三区在线观看| 午夜精品一区二区三区电影天堂| 亚洲免费观看在线视频| 国产精品久久久久久久久快鸭| 久久一二三国产| 精品对白一区国产伦| 精品少妇一区二区三区免费观看| 在线91免费看| 91精品国产综合久久福利| 欧美色成人综合| 精品视频在线看| 欧美日韩一区二区三区在线| 99这里只有久久精品视频| 99热99精品| 色狠狠桃花综合| 欧美三区在线观看| 91精品国产美女浴室洗澡无遮挡| 欧美丝袜第三区| 91精品国产一区二区三区香蕉| 91精品综合久久久久久| 日韩一区二区三区免费观看| 日韩欧美黄色影院| 国产女人18水真多18精品一级做 | 欧美色综合久久| 3751色影院一区二区三区| 91精品一区二区三区在线观看| 欧美一区二区三区视频在线 | aa级大片欧美| 91精品1区2区| 日韩写真欧美这视频| 久久精品人人做| 亚洲欧美激情插| 性做久久久久久久免费看| 美女尤物国产一区| 丁香桃色午夜亚洲一区二区三区| 波多野结衣视频一区| 欧美撒尿777hd撒尿| 精品国内二区三区| 中文字幕一区二区视频| 丝袜亚洲另类欧美综合| 国产一区999| 欧美中文字幕一区二区三区| 精品国精品国产| 亚洲欧美电影院| 精品一区二区三区免费毛片爱 | 欧美三级电影在线观看| 7777精品伊人久久久大香线蕉完整版| 91精品国产aⅴ一区二区| 久久精品综合网| 午夜欧美2019年伦理| 成人免费高清在线| 欧美精品丝袜中出| 国产精品人妖ts系列视频| 亚洲r级在线视频| 99久久国产综合色|国产精品| 在线电影院国产精品| 国产精品久久久久一区二区三区共| 亚洲高清视频中文字幕| 北条麻妃国产九九精品视频| 日韩一级高清毛片| 亚洲综合色成人| av不卡一区二区三区| 久久综合999|