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

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

?? demo7_6.cpp

?? 一本外國人寫的關于3D游戲編程的書的源碼
?? CPP
字號:
// DEMO7_6.CPP 16-bit blitter filling demo

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

#define WIN32_LEAN_AND_MEAN  // just say no to MFC

#define INITGUID

#include <windows.h>   // include important windows stuff
#include <windowsx.h> 
#include <mmsystem.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> // include directdraw

// 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      16    // bits per pixel

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

// basic unsigned types
typedef unsigned short USHORT;
typedef unsigned short WORD;
typedef unsigned char  UCHAR;
typedef unsigned char  BYTE;

// MACROS /////////////////////////////////////////////////

#define KEYDOWN(vk_code) ((GetAsyncKeyState(vk_code) & 0x8000) ? 1 : 0)
#define KEYUP(vk_code)   ((GetAsyncKeyState(vk_code) & 0x8000) ? 0 : 1)

// this builds a 16 bit color value in 5.5.5 format (1-bit alpha mode)
#define _RGB16BIT555(r,g,b) ((b & 31) + ((g & 31) << 5) + ((r & 31) << 10))

// this builds a 16 bit color value in 5.6.5 format (green dominate mode)
#define _RGB16BIT565(r,g,b) ((b & 31) + ((g & 63) << 5) + ((r & 31) << 11))

// this builds a 32 bit color value in A.8.8.8 format (8-bit alpha mode)
#define _RGB32BIT(a,r,g,b) ((b) + ((g) << 8) + ((r) << 16) + ((a) << 24))

// initializes a direct draw struct
#define DDRAW_INIT_STRUCT(ddstruct) { memset(&ddstruct,0,sizeof(ddstruct)); ddstruct.dwSize=sizeof(ddstruct); }

// GLOBALS ////////////////////////////////////////////////
HWND      main_window_handle = NULL; // globally track main window
int       window_closed      = 0;    // tracks if window is closed
HINSTANCE hinstance_app      = NULL; // globally track hinstance

// directdraw stuff
LPDIRECTDRAW7         lpdd         = NULL;   // dd4 object
LPDIRECTDRAWSURFACE7  lpddsprimary = NULL;   // dd primary surface
LPDIRECTDRAWSURFACE7  lpddsback    = NULL;   // dd back surface
LPDIRECTDRAWPALETTE   lpddpal      = NULL;   // a pointer to the created dd palette
LPDIRECTDRAWCLIPPER   lpddclipper  = NULL;   // dd clipper
PALETTEENTRY          palette[256];          // color palette
PALETTEENTRY          save_palette[256];     // used to save palettes
DDSURFACEDESC2        ddsd;                  // a direct draw surface description struct
DDBLTFX               ddbltfx;               // used to fill
DDSCAPS2              ddscaps;               // a direct draw surface capabilities struct
HRESULT               ddrval;                // result back from dd calls
DWORD                 start_clock_count = 0; // used for timing

char buffer[80];                             // general printing buffer

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

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

int Game_Main(void *parms = NULL, int num_parms = 0)
{
// this is the main loop of the game, do all your processing
// here

DDBLTFX ddbltfx; // the blitter fx structure
RECT dest_rect;  // used to hold the destination RECT

// make sure this isn't executed again
if (window_closed)
   return(0);

// for now test if user is hitting ESC and send WM_CLOSE
if (KEYDOWN(VK_ESCAPE))
   {
   PostMessage(main_window_handle,WM_CLOSE,0,0);
   window_closed = 1;
   } // end if

// first initialize the DDBLTFX structure
DDRAW_INIT_STRUCT(ddbltfx);

// now set the color word info to the color we desire
// in this case, we are assuming an 8-bit mode, hence,
// well use a color index from 0-255, but if this was a
// 16/24/32 bit example then we would fill the WORD with
// the RGB encoding for the pixel - remember!
ddbltfx.dwFillColor = _RGB16BIT565(rand()%256, rand()%256, rand()%256);

// get a random rectangle
int x1 = rand()%SCREEN_WIDTH;
int y1 = rand()%SCREEN_HEIGHT;
int x2 = rand()%SCREEN_WIDTH;
int y2 = rand()%SCREEN_HEIGHT;

// now set up the RECT structure to fill the region from
// (x1,y1) to (x2,y2) on the destination surface
dest_rect.left   = x1;
dest_rect.top    = y1;
dest_rect.right  = x2;
dest_rect.bottom = y2;

// make the blitter call
if (FAILED(lpddsprimary->Blt(&dest_rect, // pointer to dest RECT
                             NULL, // pointer to source surface
                             NULL, // pointer to source RECT
                             DDBLT_COLORFILL | DDBLT_WAIT, 
                             // do a color fill and wait if you have to
                             &ddbltfx))) // pointer to DDBLTFX holding info
   return(0);

// return success or failure or your own return code here
return(1);

} // end Game_Main

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

int Game_Init(void *parms = NULL, int num_parms = 0)
{
// this is called once after the initial window is created and
// before the main event loop is entered, do all your initialization
// here

// create IDirectDraw interface 7.0 object and test for error
if (FAILED(DirectDrawCreateEx(NULL, (void **)&lpdd, IID_IDirectDraw7, NULL)))
   return(0);

// set cooperation to full screen
if (FAILED(lpdd->SetCooperativeLevel(main_window_handle, 
                                      DDSCL_FULLSCREEN | DDSCL_ALLOWMODEX | 
                                      DDSCL_EXCLUSIVE | DDSCL_ALLOWREBOOT)))
   return(0);

// set display mode 
if (FAILED(lpdd->SetDisplayMode(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP,0,0)))
   return(0);


// clear ddsd and set size
DDRAW_INIT_STRUCT(ddsd); 

// enable valid fields
ddsd.dwFlags = DDSD_CAPS;

// request a complex, flippable
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;

// create the primary surface
if (FAILED(lpdd->CreateSurface(&ddsd, &lpddsprimary, NULL)))
   return(0);

// return success or failure or your own return code here
return(1);

} // end Game_Init

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

int Game_Shutdown(void *parms = NULL, int num_parms = 0)
{
// this is called after the game is exited and the main event
// loop while is exited, do all you cleanup and shutdown here

// now the primary surface
if (lpddsprimary)
   {
   lpddsprimary->Release();
   lpddsprimary = NULL;
   } // end if

// now blow away the IDirectDraw4 interface
if (lpdd)
   {
   lpdd->Release();
   lpdd = NULL;
   } // end if

// return success or failure or your own return code here
return(1);

} // end Game_Shutdown

// 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
hinstance_app = hinstance;

// register the window class
if (!RegisterClassEx(&winclass))
	return(0);

// create the window
if (!(hwnd = CreateWindowEx(NULL,                  // extended style
                            WINDOW_CLASS_NAME,     // class
						    "DirectDraw Blitter Filling 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

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

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品亲子伦对白| 日韩二区三区在线观看| 国产一二精品视频| 欧美mv和日韩mv国产网站| 日韩福利视频网| 91精品国产91综合久久蜜臀| 日韩精品色哟哟| 欧美日韩小视频| 日韩av电影一区| 精品国产乱码久久久久久免费| 美女看a上一区| 久久尤物电影视频在线观看| 国产成人免费9x9x人网站视频| 日本一区二区三区在线不卡| av高清不卡在线| 依依成人综合视频| 欧美片网站yy| 国产一区二区三区综合| 亚洲国产精品ⅴa在线观看| 99久久久免费精品国产一区二区| 亚洲精品国产视频| 欧美巨大另类极品videosbest | 欧美疯狂做受xxxx富婆| 久久精品99国产精品| 亚洲国产高清在线| 日本电影亚洲天堂一区| 日产欧产美韩系列久久99| 久久久亚洲精品石原莉奈| 色香蕉成人二区免费| 日韩精品福利网| 国产精品美女久久久久aⅴ| 欧美性猛交xxxx乱大交退制版 | 91精品国产91久久久久久一区二区 | 亚洲香蕉伊在人在线观| 久久综合国产精品| 91丨porny丨国产| 麻豆成人av在线| 中文字幕亚洲一区二区av在线| 欧美日韩极品在线观看一区| 国产91露脸合集magnet | 日本一区二区三区四区在线视频| 91官网在线免费观看| 蓝色福利精品导航| 亚洲欧美视频一区| 久久久亚洲综合| 欧美日韩国产综合视频在线观看| 成人免费黄色大片| 蜜臀va亚洲va欧美va天堂| 亚洲三级在线播放| 久久久av毛片精品| 欧美乱妇15p| 日本久久精品电影| 成人一道本在线| 麻豆精品视频在线观看免费| 亚洲一区二区欧美激情| 国产情人综合久久777777| 3d成人动漫网站| 91国偷自产一区二区开放时间| 国产xxx精品视频大全| 日本三级亚洲精品| 亚洲一区二区三区中文字幕| 亚洲国产激情av| 精品久久久久久久久久久久包黑料| 在线免费观看日本一区| 白白色 亚洲乱淫| 国产成人精品亚洲午夜麻豆| 麻豆成人免费电影| 美女视频一区二区| 日本欧美在线观看| 婷婷六月综合网| 亚洲一区二区三区四区五区中文 | 欧美v日韩v国产v| 美日韩黄色大片| 中文字幕av一区二区三区免费看 | 奇米综合一区二区三区精品视频| 91精品国产手机| 国产成人一级电影| 亚洲.国产.中文慕字在线| 精品粉嫩超白一线天av| 最新热久久免费视频| 东方欧美亚洲色图在线| 国产麻豆精品在线| 国产自产视频一区二区三区| 国产在线一区观看| 狠狠色狠狠色综合日日91app| 麻豆精品新av中文字幕| 久久国产精品免费| 国产在线精品视频| 国产1区2区3区精品美女| 国产成人免费视| 色综合中文综合网| 国产91综合网| 99久精品国产| 色综合久久综合网97色综合 | 国产片一区二区| 国产精品视频免费| 日韩理论片中文av| 亚洲愉拍自拍另类高清精品| 亚洲第一成人在线| 蜜桃av一区二区三区电影| 国内精品国产成人国产三级粉色 | 成人黄色一级视频| 色狠狠色噜噜噜综合网| 欧美日韩激情一区二区| 欧美白人最猛性xxxxx69交| 久久奇米777| 亚洲人精品午夜| 亚洲午夜久久久久中文字幕久| 午夜影视日本亚洲欧洲精品| 美女一区二区在线观看| 亚洲自拍偷拍欧美| 日韩av在线免费观看不卡| 久久国产精品露脸对白| 在线一区二区三区四区五区 | 日本黄色一区二区| 91福利社在线观看| 欧美三级韩国三级日本三斤| 欧美日韩国产电影| 欧美不卡一二三| 亚洲人成网站在线| 男女男精品视频网| 欧洲一区二区三区免费视频| 国产剧情在线观看一区二区| 91女厕偷拍女厕偷拍高清| 3d成人h动漫网站入口| 国产欧美日韩精品一区| 一个色在线综合| 国产高清精品在线| 欧美日韩国产精品自在自线| 国产日韩欧美麻豆| 午夜婷婷国产麻豆精品| 国产成人av电影在线观看| 欧美亚洲免费在线一区| 欧美精品一区二区在线观看| 亚洲综合一区在线| 国产精品原创巨作av| 欧美精品在线一区二区三区| ...中文天堂在线一区| 久久aⅴ国产欧美74aaa| 91久久精品一区二区| 国产视频一区二区在线观看| 婷婷国产v国产偷v亚洲高清| jlzzjlzz欧美大全| 久久久久国色av免费看影院| 天天影视色香欲综合网老头| 一本大道久久a久久综合婷婷| 久久久久久综合| 免费人成黄页网站在线一区二区| 在线观看精品一区| 中文字幕一区二区三| 粉嫩一区二区三区在线看| 精品国产一区二区三区忘忧草| 亚洲一区二区精品视频| 色婷婷久久一区二区三区麻豆| 国产欧美日韩久久| 国产精品综合二区| 精品噜噜噜噜久久久久久久久试看| 午夜影院在线观看欧美| 欧洲av一区二区嗯嗯嗯啊| 亚洲色图视频免费播放| 国产成人免费网站| 久久综合九色综合欧美亚洲| 久久er精品视频| 精品日韩在线观看| 国内精品伊人久久久久av影院| 日韩精品在线一区二区| 日韩精品一卡二卡三卡四卡无卡| 欧美性感一类影片在线播放| 亚洲一区二区三区视频在线播放| 91免费视频网址| 伊人性伊人情综合网| 色综合色综合色综合| 亚洲欧美日韩国产成人精品影院| 国产色产综合产在线视频| 99在线精品免费| 成人国产精品免费观看| 国产自产2019最新不卡| 亚洲免费在线视频| 日韩视频中午一区| 97aⅴ精品视频一二三区| 亚洲成人免费看| 亚洲日本一区二区| 26uuu亚洲综合色欧美| 在线观看日韩一区| 成人免费看的视频| 日本成人在线电影网| 日韩国产欧美在线播放| 中文字幕在线不卡一区| 99久久精品99国产精品| 一区二区三区精密机械公司| 欧美日韩亚州综合| 麻豆传媒一区二区三区| 久久久久99精品国产片| av一区二区久久| 亚洲人成影院在线观看| 欧美精选一区二区| 国产福利一区二区三区| 亚洲精品第1页| 欧美一级搡bbbb搡bbbb| 国产电影一区二区三区|