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

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

?? demo9_2_16b.cpp

?? 一本外國人寫的關(guān)于3D游戲編程的書的源碼
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
// DEMO9_2_16b.CPP - DirectInput Mouse Demo
// 16-bit version, note that we render in 16-bit
// but since we are basing our color selection on a
// palette we still load an 8-bit palette into a datastructure
// so we can synthesize the palette


// 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 screen
#define SCREEN_HEIGHT     480

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

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

// start up DirectDraw (replace the parms as you desire)
DDraw_Init(WINDOW_WIDTH, WINDOW_HEIGHT, WINDOW_BPP, WINDOWED_APP);

// 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(&bitmap16bit, "PAINT_24.BMP");

// load a palette from a file since 16-bit modes don't have 
// palettes, when rendering from the palette, we will use 
// this data as an RGB lookup to create the colors
Load_Palette_From_File("PALDATA2.PAL", 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,0,16);    

// load the image for the pointer in
Load_Frame_BOB16(&pointer,&bitmap16bit,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,0,16);    

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

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
粉嫩嫩av羞羞动漫久久久| 久久这里只有精品6| 精品国产免费视频| 亚洲高清中文字幕| 99精品欧美一区二区三区综合在线| 91精品国产综合久久蜜臀| 国产精品久久一级| 精品中文字幕一区二区小辣椒| 色婷婷狠狠综合| 亚洲国产成人私人影院tom| 久久不见久久见免费视频7| 91国产福利在线| 日韩理论片一区二区| 国产精品一区二区你懂的| 日韩一区二区在线观看视频播放| 亚洲综合另类小说| 一本色道久久综合精品竹菊| 国产精品美女久久久久av爽李琼 | 国产成人鲁色资源国产91色综| 欧美日韩国产综合久久 | 色狠狠桃花综合| 国产精品剧情在线亚洲| 国产精品自拍三区| 久久精品视频在线看| 国产一区美女在线| 久久精品一区八戒影视| 国产一区在线观看视频| 精品国产乱码久久久久久牛牛| 视频一区欧美日韩| 欧美一区二区三区在线观看| 日本中文字幕不卡| 91精品国产乱| 久久精工是国产品牌吗| 欧美成人性战久久| 国产综合色精品一区二区三区| 精品国产乱码久久久久久夜甘婷婷| 麻豆高清免费国产一区| 久久影院午夜片一区| 国内精品国产三级国产a久久| 久久综合久久综合久久| 国产精品原创巨作av| 亚洲国产精品传媒在线观看| 成人黄色777网| 一区二区三区四区中文字幕| 91成人免费电影| 青青草国产成人99久久| 欧美mv日韩mv| 成人综合激情网| 一区二区免费看| 欧美精品粉嫩高潮一区二区| 日本三级亚洲精品| 久久综合久久99| 色综合久久久久久久久久久| 夜夜爽夜夜爽精品视频| 欧美一区二区三区四区高清| 国产成人欧美日韩在线电影| 综合欧美亚洲日本| 91精品国产综合久久久久久久| 国内外成人在线| 一区二区三区精品久久久| 91精品欧美一区二区三区综合在 | 久久综合av免费| www.亚洲在线| 日韩中文欧美在线| 国产精品系列在线| 91精品国产综合久久久久久久 | 亚洲精选视频在线| 欧美成人艳星乳罩| 97se亚洲国产综合自在线观| 日韩精品福利网| 亚洲欧美综合另类在线卡通| 欧美肥妇free| 99久久夜色精品国产网站| 日本中文一区二区三区| 亚洲欧洲日韩女同| 日韩一级免费一区| 91在线视频播放地址| 免费在线观看成人| 亚洲最色的网站| 国产精品国产三级国产a | 国产精品不卡视频| 欧美一区永久视频免费观看| 91香蕉视频mp4| 国产在线视视频有精品| 日韩在线卡一卡二| 亚洲人成精品久久久久| 国产日韩欧美高清| xvideos.蜜桃一区二区| 欧美日韩一本到| 色天天综合久久久久综合片| 国产成人精品aa毛片| 久久精品国产**网站演员| 亚洲小少妇裸体bbw| 日韩理论片一区二区| 欧美国产精品中文字幕| 久久久亚洲精品石原莉奈| 日韩小视频在线观看专区| 欧美三级电影网| 一本色道久久综合亚洲aⅴ蜜桃| 成人在线视频一区二区| 国产精品亚洲午夜一区二区三区| 午夜欧美2019年伦理| 亚洲综合图片区| 亚洲综合图片区| 亚洲黄色小视频| 亚洲男同性视频| 亚洲人123区| 亚洲伦理在线免费看| 国产精品久久久久毛片软件| 欧美国产视频在线| 久久久久久夜精品精品免费| 久久久美女艺术照精彩视频福利播放| 欧美一区二区三区在线观看视频| 911精品产国品一二三产区| 在线观看日韩高清av| 欧洲一区二区av| 欧美日韩免费电影| 91麻豆精品91久久久久久清纯| 91精品国产欧美一区二区| 日韩一区二区三区四区 | 国产一区二区三区美女| 国产一区日韩二区欧美三区| 国产在线精品一区在线观看麻豆| 国产一区999| 成人毛片在线观看| 91色.com| 欧美丰满高潮xxxx喷水动漫| 日韩一区二区在线观看| 久久综合久久久久88| 国产精品三级在线观看| 亚洲欧美日韩系列| 午夜视频久久久久久| 看片网站欧美日韩| 国产成人h网站| 色老头久久综合| 日韩视频在线观看一区二区| 久久亚洲综合av| 亚洲激情图片qvod| 老色鬼精品视频在线观看播放| 国产资源精品在线观看| 波波电影院一区二区三区| 欧美亚州韩日在线看免费版国语版| 6080日韩午夜伦伦午夜伦| 国产欧美一区二区精品性色超碰| 中文字幕一区二区三区不卡| 亚洲成人动漫av| 国产精品99久久久久久宅男| 在线免费亚洲电影| 欧美va亚洲va国产综合| 国产精品久久久久aaaa樱花| 亚欧色一区w666天堂| 国产99久久久国产精品免费看| 色综合激情五月| 日韩欧美一级二级三级| 最近日韩中文字幕| 麻豆国产欧美一区二区三区| 91视频国产观看| 欧美精品一区二区三区一线天视频| 国产精品久久久久一区| 美女视频第一区二区三区免费观看网站| 2欧美一区二区三区在线观看视频| 国产精品视频一二三区| 午夜精品一区二区三区电影天堂| 国产福利精品一区| 日韩一区二区三区在线视频| 亚洲日本成人在线观看| 国产乱码精品一品二品| 4438x亚洲最大成人网| 亚洲欧美日韩中文字幕一区二区三区| 狠狠色综合日日| 欧美一级日韩一级| 一区二区在线看| 9i看片成人免费高清| 久久精品视频一区| 久久av中文字幕片| 欧美精品一二三区| 一区二区三区中文字幕在线观看| 国产成人在线观看| 欧美精品一区二区不卡| 日日嗨av一区二区三区四区| 欧美亚洲国产一区二区三区va| 国产精品欧美一区二区三区| 国产一区二区三区免费| 日韩你懂的在线播放| 日韩二区三区四区| 欧美日本国产视频| 婷婷国产v国产偷v亚洲高清| 在线观看日韩毛片| 一区二区三区在线看| 成人app网站| 国产精品动漫网站| 99久久免费精品高清特色大片| 久久久精品中文字幕麻豆发布| 精品一区二区三区免费| 日韩欧美另类在线| 蜜臀99久久精品久久久久久软件| 91精品婷婷国产综合久久竹菊| 日韩激情视频网站| 日韩欧美一级二级三级| 久久 天天综合|