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

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

?? demo9_2.cpp

?? 一本外國(guó)人寫的關(guān)于3D游戲編程的書的源碼
?? CPP
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
// DEMO9_2.CPP - DirectInput Mouse Demo

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

#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
BOB          buttons,           // a bob with all the buttons
             pointer;           // a pointer bob
BITMAP_IMAGE cpanel;            // the control panel
BITMAP_IMAGE canvas;            // off screen drawing canvas

int mouse_x,                    // used to track mouse
    mouse_y;
    
UCHAR mouse_color=100;          // color of mouse brush

int command_state=0;            // state of user command

// position of control buttons
int buttons_x[] = {509, 559, 509, 559};
int buttons_y[] = {344, 344, 383, 383};

// on/off state of buttons
int buttons_state[] = {0,1,0,0};

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

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
						    "DirectInput Mouse Demo", // title
						    WS_POPUP | WS_VISIBLE,
					 	    0,0,	  // initial x,y
						    SCREEN_WIDTH,SCREEN_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;

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

// GAME PROGRAMMING CONSOLE FUNCTIONS ////////////////

int Game_Init(void *parms,  int num_parms)
{
// this function is where you do all the initialization 
// for your game

int index;         // looping var
char filename[80]; // used to build up files names

// initialize directdraw
DDraw_Init(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP);

// first create the direct input object
DirectInput8Create(main_instance,DIRECTINPUT_VERSION,IID_IDirectInput8, (void **)&lpdi,NULL);

// create a mouse device  /////////////////////////////////////
lpdi->CreateDevice(GUID_SysMouse, &lpdimouse, NULL);

// set cooperation level
lpdimouse->SetCooperativeLevel(main_window_handle, DISCL_NONEXCLUSIVE | DISCL_BACKGROUND);

// set data format
lpdimouse->SetDataFormat(&c_dfDIMouse);

// acquire the mouse
lpdimouse->Acquire();

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

// set the global mouse position
mouse_x = screen_height/2;
mouse_y = screen_height/2;

// load the master bitmap in with all the graphics
Load_Bitmap_File(&bitmap8bit, "PAINT.BMP");
Set_Palette(bitmap8bit.palette);

// make sure all the surfaces are clean before starting
DDraw_Fill_Surface(lpddsback, 0);
DDraw_Fill_Surface(lpddsprimary, 0);

// create the pointer bob
Create_BOB(&pointer,mouse_x,mouse_y,32,34,1,
           BOB_ATTR_VISIBLE | BOB_ATTR_SINGLE_FRAME,DDSCAPS_SYSTEMMEMORY);    

// load the image for the pointer in
Load_Frame_BOB(&pointer,&bitmap8bit,0,0,2,BITMAP_EXTRACT_MODE_CELL);  

// create the button bob
Create_BOB(&buttons,0,0,32,34,8,
           BOB_ATTR_VISIBLE | BOB_ATTR_MULTI_FRAME,DDSCAPS_SYSTEMMEMORY);    

// load buttons in, two banks of 4, all the off's, then all the on's
for (index=0; index<8; index++)
     Load_Frame_BOB(&buttons,&bitmap8bit,index, index%4,index/4,BITMAP_EXTRACT_MODE_CELL);  

// create the bitmap to hold the control panel
Create_Bitmap(&cpanel,500,0,104,424);
Load_Image_Bitmap(&cpanel, &bitmap8bit,150,0,BITMAP_EXTRACT_MODE_ABS);

// create the drawing canvas bitmap
Create_Bitmap(&canvas,0,0,500,SCREEN_HEIGHT);
memset(canvas.buffer,0,canvas.width*canvas.height);
canvas.attr = BITMAP_ATTR_LOADED;

// clear out the canvas
// memset(canvas.buffer,0,canvas.width*canvas.height);

// set clipping rectangle to screen extents so mouse cursor
// doens't 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

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

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久色在线观看| 日韩一区二区影院| 中文字幕一区二区三区蜜月| 高清不卡在线观看av| 亚洲国产精品成人综合色在线婷婷| 国产成人精品一区二| 综合欧美亚洲日本| 欧美日韩国产一区| 久久99久久精品欧美| 亚洲精品一区二区三区精华液 | 2020国产成人综合网| 久久国产尿小便嘘嘘| 欧美激情一区在线观看| 在线免费精品视频| 久久99国内精品| 亚洲特级片在线| 日韩一区二区在线观看视频| 国产成a人无v码亚洲福利| 亚洲视频综合在线| 91超碰这里只有精品国产| 国产一区二区三区免费播放 | 一区二区三区在线免费播放| 欧美精选在线播放| 国产成人免费9x9x人网站视频| 亚洲啪啪综合av一区二区三区| 69久久夜色精品国产69蝌蚪网| 激情六月婷婷综合| 亚洲婷婷综合色高清在线| 制服视频三区第一页精品| 国产成人在线免费观看| 亚洲人成伊人成综合网小说| 欧美zozo另类异族| 91久久精品国产91性色tv| 精品一区二区综合| 一区二区三区成人| 国产欧美日韩麻豆91| 欧美精品99久久久**| 成人综合在线观看| 蜜桃久久久久久久| 一区二区高清在线| 亚洲国产高清在线观看视频| 91麻豆精品国产91久久久久久| 成人激情免费网站| 黄色成人免费在线| 午夜久久久久久久久久一区二区| 国产精品久久久久久久久搜平片 | 色妞www精品视频| 国产一区二区三区高清播放| 亚洲成人777| 亚洲码国产岛国毛片在线| 久久久久久久性| 欧美一区二区私人影院日本| 91伊人久久大香线蕉| 国产激情一区二区三区| 免费一级欧美片在线观看| 亚洲乱码一区二区三区在线观看| 久久精品网站免费观看| 精品三级在线观看| 337p亚洲精品色噜噜噜| 欧美在线视频全部完| 色综合天天综合网国产成人综合天| 国内外成人在线| 久久www免费人成看片高清| 青娱乐精品视频| 日韩国产一二三区| 午夜久久电影网| 丝袜亚洲精品中文字幕一区| 亚洲高清免费在线| 亚洲高清不卡在线观看| 亚洲一区二区中文在线| 夜夜精品视频一区二区| 亚洲最新在线观看| 一区二区三区91| 亚洲一卡二卡三卡四卡五卡| 亚洲欧洲99久久| 一区二区三区四区不卡在线 | 国产日韩v精品一区二区| 久久综合久色欧美综合狠狠| 精品粉嫩aⅴ一区二区三区四区| 日韩一级大片在线观看| 日韩午夜激情视频| 精品久久人人做人人爽| 久久久久久久久久久久久夜| 欧美激情一区二区三区四区| 国产精品久久久久久久蜜臀| 最新不卡av在线| 亚洲国产视频直播| 五月天激情综合网| 久久国产精品72免费观看| 精品一区二区三区不卡| 国产精品自拍在线| 99久久婷婷国产综合精品| 91丨porny丨最新| 欧美专区在线观看一区| 日韩限制级电影在线观看| 精品成人佐山爱一区二区| 久久久国产精品午夜一区ai换脸| 国产精品亲子伦对白| 国产精品自拍一区| 成人av电影免费在线播放| 在线观看欧美精品| 欧美一区二区性放荡片| 国产日韩欧美综合一区| 亚洲综合一二区| 久久精品国产精品亚洲精品| 成人涩涩免费视频| 欧美色综合久久| 2020国产成人综合网| 亚洲免费观看高清完整版在线观看熊| 一区二区三区色| 国产一区二三区好的| 99r国产精品| 日韩限制级电影在线观看| 国产精品伦理在线| 亚洲成人综合网站| 福利一区二区在线| 欧美精品乱码久久久久久| 亚洲国产精品成人久久综合一区 | 国产婷婷精品av在线| 一区二区三区欧美亚洲| 国产一区二区在线观看免费| 色婷婷久久综合| 久久久久国产免费免费| 亚洲五码中文字幕| 激情久久五月天| 欧美在线一二三四区| 欧美国产日韩在线观看| 日韩精品亚洲一区| 91蜜桃在线观看| 久久久久久日产精品| 肉色丝袜一区二区| 91免费国产视频网站| 久久综合色之久久综合| 天天综合天天综合色| 91片黄在线观看| 欧美激情中文字幕| 久久99久久精品| 欧美一区二视频| 亚洲综合成人在线| 成人av电影在线网| 国产日韩精品一区二区浪潮av| 日韩电影一二三区| 欧美日韩在线免费视频| 亚洲天堂2016| 波多野结衣亚洲一区| 久久久国产精品麻豆| 精品写真视频在线观看| 555夜色666亚洲国产免| 亚洲一区中文在线| 色综合天天性综合| 国产视频一区在线播放| 久久国产尿小便嘘嘘| 日韩欧美一区二区免费| 日本三级亚洲精品| 欧美精品日韩一本| 香蕉成人伊视频在线观看| 欧美性一区二区| 亚洲最大色网站| 在线免费av一区| 亚洲影院免费观看| 在线观看免费视频综合| 亚洲人123区| 在线看一区二区| 一区二区不卡在线播放| 欧美日韩在线不卡| 午夜电影一区二区| 在线综合亚洲欧美在线视频| 日韩精品视频网站| 日韩欧美亚洲国产另类| 精品亚洲欧美一区| www欧美成人18+| 国产精华液一区二区三区| 国产拍揄自揄精品视频麻豆| 日韩欧美黄色影院| 久久成人免费网| 久久久久久日产精品| 成人一区二区视频| 中文字幕制服丝袜成人av| 91丨国产丨九色丨pron| 亚洲永久精品大片| 欧美一区二区三区在线视频| 捆绑调教美女网站视频一区| 精品噜噜噜噜久久久久久久久试看| 国产剧情在线观看一区二区| 久久精品亚洲精品国产欧美| 97se亚洲国产综合在线| 亚洲午夜在线电影| 日韩欧美第一区| 国产成人免费av在线| 亚洲欧美国产77777| 欧美老人xxxx18| 国产麻豆一精品一av一免费| 亚洲欧美在线另类| 欧美老肥妇做.爰bbww| 黑人巨大精品欧美一区| 亚洲欧美在线另类| 欧美一级黄色片| 91一区二区三区在线播放| 亚洲妇女屁股眼交7| 久久蜜桃一区二区|