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

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

?? demo9_3_16b.cpp

?? 一本外國人寫的關(guān)于3D游戲編程的書的源碼
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
// DEMO9_3_16b.CPP - DirectInput Joystick 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"

// screen size
#define SCREEN_WIDTH      640   // size of window
#define SCREEN_HEIGHT     480

// setup a 640x480 16-bit windowed mode example
#define WINDOW_TITLE      "16-Bit DirectInput Joystick 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 
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
DIJOYSTATE   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,              // position of missle
    missile_y,            
    missile_state;          // 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

if (missile_state==0)
    {
    // enable missile
    missile_state = 1;

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

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

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

} // end Start_Missile

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

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

// test if missile is alive
if (missile_state==1)
   {
   // move the missile upward
   if ((missile_y-=10) < 0)
      {
      missile_state = 0;
      return(1);
      } // end if

   // lock secondary buffer
   DDraw_Lock_Back_Surface();

   // add missile collision here

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
3atv在线一区二区三区| 国产精品日日摸夜夜摸av| 国产精品久久久久久久久免费丝袜| 精品一区二区三区免费毛片爱| 欧美日韩三级在线| 亚洲影院久久精品| 欧美日韩免费在线视频| 国产成人一级电影| 中文字幕日韩一区| 色婷婷久久久亚洲一区二区三区| 亚洲欧美日韩在线不卡| 欧美色图激情小说| 成人久久18免费网站麻豆| 亚洲女人小视频在线观看| 欧美成人女星排名| 高清在线观看日韩| 亚洲精品免费在线观看| 91精品国产欧美一区二区| 激情六月婷婷综合| 中文字幕亚洲精品在线观看| 精品久久久久久久久久久院品网| 777午夜精品视频在线播放| 色婷婷激情一区二区三区| 东方aⅴ免费观看久久av| 免费成人在线观看视频| 久久久国际精品| 一本色道久久加勒比精品| 成人晚上爱看视频| 成人av在线一区二区| 无吗不卡中文字幕| 国产日产欧产精品推荐色| 欧美日韩一区不卡| 欧美视频一区在线| 粉嫩aⅴ一区二区三区四区五区| 久久国产免费看| 亚洲欧美日韩中文播放| 成人免费小视频| 亚洲欧洲制服丝袜| 亚洲美女在线国产| 一区二区三区国产精华| 精品国产欧美一区二区| 欧洲一区二区三区在线| 激情五月播播久久久精品| 蜜桃av噜噜一区| 亚洲欧美色综合| 亚洲免费看黄网站| 亚洲国产成人tv| 国产精品视频第一区| 中文字幕在线不卡视频| 亚洲欧美日韩国产另类专区| 亚洲激情图片qvod| 天堂蜜桃91精品| 亚洲女厕所小便bbb| 亚洲美女在线一区| 日韩成人dvd| 亚洲午夜精品在线| 日韩精品成人一区二区在线| 免费高清视频精品| 国产一区二区三区香蕉| 蜜桃一区二区三区在线观看| 久久国产乱子精品免费女| 国产成人精品www牛牛影视| 成人免费视频视频在线观看免费 | 一区二区三区加勒比av| 亚洲成人av福利| 一区二区三区在线影院| 日本女人一区二区三区| 国产一区二区日韩精品| 99riav久久精品riav| 国产揄拍国内精品对白| 99久久er热在这里只有精品15| 欧美性生交片4| 久久女同精品一区二区| 亚洲猫色日本管| 九色综合狠狠综合久久| 99久久免费国产| 日韩写真欧美这视频| 91精品国产高清一区二区三区蜜臀| 日韩精品一区二区三区视频播放 | 日韩一区和二区| 国产调教视频一区| 国产精品青草久久| 五月婷婷久久综合| 国产aⅴ精品一区二区三区色成熟| 91免费国产视频网站| 99久久亚洲一区二区三区青草| 欧美精选午夜久久久乱码6080| 69成人精品免费视频| 国产精品嫩草影院av蜜臀| 日本视频一区二区| 91女人视频在线观看| 精品国产凹凸成av人网站| 一区二区成人在线视频| 国产精品资源在线看| 国产经典欧美精品| 欧美高清视频在线高清观看mv色露露十八 | 五月激情综合婷婷| 99亚偷拍自图区亚洲| 97国产精品videossex| 日韩一区二区三区电影在线观看 | 国产精品高清亚洲| 精品一区二区三区蜜桃| 欧美色网一区二区| 国产精品大尺度| 精品制服美女久久| 欧美丰满高潮xxxx喷水动漫| 亚洲欧洲精品一区二区精品久久久 | 一区二区三区欧美在线观看| 国产成人免费xxxxxxxx| 日韩午夜精品电影| 午夜精品一区二区三区三上悠亚| 91婷婷韩国欧美一区二区| 久久伊99综合婷婷久久伊| 国产精品乱码一区二区三区软件| 美女视频网站黄色亚洲| 欧美日韩1234| 久久精品视频在线免费观看 | 国产精品夜夜爽| 日韩欧美不卡一区| 石原莉奈在线亚洲三区| 欧美四级电影在线观看| 亚洲欧洲中文日韩久久av乱码| 成人av午夜电影| 国产精品美女视频| 高清视频一区二区| 国产欧美日韩精品一区| 国产成人aaaa| 国产色产综合产在线视频| 国产精品99久久久久久有的能看 | 五月天激情综合网| 欧美视频日韩视频| 亚洲影院久久精品| 欧美群妇大交群中文字幕| 亚洲成在人线在线播放| 欧美日韩在线亚洲一区蜜芽| 婷婷久久综合九色国产成人| 欧美日韩国产一区| 日本少妇一区二区| 精品久久久久久久一区二区蜜臀| 另类的小说在线视频另类成人小视频在线 | 亚洲色图视频免费播放| 国产美女在线观看一区| 久久男人中文字幕资源站| 国产成人免费视频网站高清观看视频| 国产欧美日韩另类一区| 99这里只有精品| 一区二区三区在线观看网站| 欧美性欧美巨大黑白大战| 亚洲一区视频在线| 日韩一区二区三区av| 国产一区二区三区免费观看| 中文字幕精品一区二区三区精品| 五月激情综合婷婷| 日韩精品资源二区在线| 国产超碰在线一区| 亚洲免费观看高清完整版在线| 欧美性xxxxxxxx| 美日韩一级片在线观看| 久久久九九九九| 91在线观看视频| 日韩制服丝袜av| 国产午夜精品久久| 色欧美片视频在线观看| 天涯成人国产亚洲精品一区av| 精品久久久久久综合日本欧美| 成人一区二区三区中文字幕| 亚洲曰韩产成在线| 久久在线观看免费| 91蜜桃免费观看视频| 日本午夜精品一区二区三区电影| 26uuu久久综合| 91婷婷韩国欧美一区二区| 日本视频在线一区| 国产精品色噜噜| 欧美一区二区在线免费播放| 成人综合日日夜夜| 日韩精品每日更新| 日本一区二区三区国色天香| 欧美日韩美女一区二区| 国内精品视频666| 亚洲制服丝袜av| 欧美r级在线观看| 日本乱人伦一区| 亚洲线精品一区二区三区 | 国产精品视频第一区| 欧美久久婷婷综合色| 国产91在线看| 午夜精品久久一牛影视| 中文字幕欧美三区| 日韩免费一区二区三区在线播放| 成人午夜视频在线| 久久精品久久综合| 亚洲国产一区二区在线播放| 欧美激情一区二区在线| 欧美一级夜夜爽| 欧美性感一区二区三区| 成熟亚洲日本毛茸茸凸凹| 麻豆免费看一区二区三区| 一区二区三区高清不卡| 国产精品免费观看视频|