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

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

?? demo9_2a_16b.cpp

?? 一本外國人寫的關于3D游戲編程的書的源碼
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
// DEMO9_2a_16b.CPP - DirectInput Mouse Demo library version
// 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"
#include "T3DLIB2.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

// 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_VISIBLE) : (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,WINDOW_HEIGHT};

// 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,
           CW_USEDEFAULT, // x position
           CW_USEDEFAULT, // 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);

// start up DirectInput
DInput_Init();

// initialize the mouse
DInput_Init_Mouse();

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

// 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++)
     Load_Frame_BOB16(&buttons,&bitmap16bit,index, index%4,index/4,BITMAP_EXTRACT_MODE_CELL);  

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

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

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
69av一区二区三区| 欧美一级国产精品| 成人黄色a**站在线观看| 久久99久久99精品免视看婷婷| 午夜国产不卡在线观看视频| 伊人色综合久久天天人手人婷| 亚洲欧美一区二区久久| 亚洲另类春色校园小说| 亚洲欧美日本在线| 一二三区精品视频| 亚洲图片欧美视频| 美女任你摸久久| 国产凹凸在线观看一区二区| 成人夜色视频网站在线观看| 91视频在线看| 欧美男人的天堂一二区| 亚洲天堂成人在线观看| 日日欢夜夜爽一区| 国产成人福利片| 一区二区三区四区中文字幕| 亚洲福利一二三区| 日本美女一区二区三区视频| 蜜桃视频在线观看一区二区| 国产精品一区二区男女羞羞无遮挡| 东方aⅴ免费观看久久av| 99久久亚洲一区二区三区青草 | 欧美三级资源在线| 欧美一区二区三区成人| 国产精品无遮挡| 亚洲成av人片在线观看无码| 老司机精品视频线观看86 | 国产精品国产三级国产三级人妇| 国产精品国产精品国产专区不蜜| 一二三四社区欧美黄| 久久国产尿小便嘘嘘尿| 99国产精品久久久久久久久久| 欧美剧情片在线观看| 国产午夜精品久久| 亚洲一区二区三区四区的| 韩国女主播成人在线| 色噜噜狠狠成人网p站| 欧美精品一区二区三区在线| 一区二区三区电影在线播| 久久99精品久久久久久| 一本色道综合亚洲| 欧美精品一区二区久久久| 亚洲国产视频一区二区| 国产成人啪免费观看软件| 制服视频三区第一页精品| 亚洲精品视频一区| 成人午夜伦理影院| 久久综合色天天久久综合图片| 亚洲高清免费视频| 91最新地址在线播放| 国产日韩欧美亚洲| 久久av老司机精品网站导航| 欧美性色欧美a在线播放| 国产精品素人一区二区| 国产精品中文字幕欧美| 日韩一区二区免费电影| 午夜不卡av在线| 在线观看91精品国产入口| 国产精品嫩草99a| 成人午夜激情片| 久久精品亚洲精品国产欧美| 毛片不卡一区二区| 91精品国产入口| 日本人妖一区二区| 91精品国产全国免费观看| 亚洲综合另类小说| 欧美日韩久久久| 五月天欧美精品| 日韩免费在线观看| 国产一区日韩二区欧美三区| 日韩一级免费观看| 久久99精品久久久久久| 久久综合九色综合欧美就去吻| 蜜桃视频在线观看一区| 精品国产第一区二区三区观看体验| 青青草国产精品97视觉盛宴| 91精品久久久久久久99蜜桃| 久久激情五月婷婷| 久久人人超碰精品| 国产成人精品影视| 中文字幕在线不卡| 欧美亚一区二区| 亚洲一区在线免费观看| 欧美日韩高清在线播放| 奇米综合一区二区三区精品视频| 日韩免费在线观看| 国产夫妻精品视频| 亚洲伦理在线精品| 91精品国产免费久久综合| 另类人妖一区二区av| 国产亚洲欧美色| 成人国产精品免费观看视频| 日韩毛片一二三区| 欧美一区二区视频在线观看2022| 麻豆精品一区二区| 国产精品美女久久久久久久久 | 美腿丝袜亚洲一区| 久久精品亚洲精品国产欧美kt∨ | 极品美女销魂一区二区三区 | 欧美人xxxx| 国产在线播放一区三区四| 国产精品久久久一区麻豆最新章节| 99国产精品久| 青椒成人免费视频| 亚洲欧洲日韩一区二区三区| 欧美日韩中文精品| 国产成人免费av在线| 亚洲影视在线播放| 国产欧美综合在线| 欧美美女网站色| 99精品国产99久久久久久白柏| 亚洲午夜免费视频| 国产精品美日韩| 日韩欧美在线123| 在线观看视频一区二区欧美日韩| 韩国精品主播一区二区在线观看| 亚洲女人小视频在线观看| 亚洲精品一区二区在线观看| 欧美午夜影院一区| 成人涩涩免费视频| 美女尤物国产一区| 依依成人综合视频| 中文字幕欧美日韩一区| 日韩一区二区免费视频| 欧美日韩在线观看一区二区| 国产精品1024| 精品一区二区三区av| 午夜视频在线观看一区二区 | 国产乱国产乱300精品| 亚洲成a人片在线不卡一二三区| 国产欧美日韩在线看| 欧美嫩在线观看| 欧美日韩一级大片网址| 色综合天天综合网天天狠天天 | 久久福利资源站| 亚洲主播在线观看| 一区二区三区在线观看网站| 国产精品无遮挡| 国产精品日韩精品欧美在线| 日韩欧美一区二区不卡| 欧美一区二区啪啪| 欧美一级欧美三级| 91麻豆精品国产91久久久久| 欧美亚洲尤物久久| 欧美丝袜第三区| 欧美日韩一区久久| 欧洲精品视频在线观看| 色综合天天综合| 在线视频国内一区二区| 91精彩视频在线| 91豆麻精品91久久久久久| 色综合久久99| 欧美日韩三级在线| 欧美日韩国产免费| 欧美一区二区三区视频在线观看| 3d成人动漫网站| 欧美成人伊人久久综合网| 精品区一区二区| 久久久久久亚洲综合| 国产精品网站一区| 亚洲另类色综合网站| 亚洲成人激情综合网| 日本网站在线观看一区二区三区| 日韩精品免费专区| 国产美女精品人人做人人爽| 国产福利精品导航| 91福利精品第一导航| 777久久久精品| 国产亲近乱来精品视频| 亚洲女女做受ⅹxx高潮| 免费不卡在线观看| 成人午夜激情影院| 欧美系列亚洲系列| 久久色在线观看| 亚洲欧美另类小说| 久久福利视频一区二区| 成人精品视频.| 欧美精品一二三| 久久久久九九视频| 亚洲国产日韩在线一区模特| 精油按摩中文字幕久久| 色综合久久99| 26uuu色噜噜精品一区| 亚洲免费三区一区二区| 蜜桃视频免费观看一区| 99热在这里有精品免费| 日韩欧美的一区| 亚洲综合色噜噜狠狠| 国产在线麻豆精品观看| 欧美综合亚洲图片综合区| 国产亚洲自拍一区| 性做久久久久久免费观看| 成人动漫一区二区三区| 日韩精品一区二区三区swag| 亚洲一区二区高清| 99re这里只有精品视频首页|