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

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

?? demo6_2.cpp

?? windows游戲編程大師源代碼
?? CPP
字號:
// DEMO6_2.CPP basic full-screen DirectDraw demo

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

#define WIN32_LEAN_AND_MEAN  // just say no to MFC

#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      8    // bits per pixel
#define MAX_COLORS      256  // maximum colors

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

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

// GLOBALS ////////////////////////////////////////////////
HWND      main_window_handle = NULL; // globally track main window
HINSTANCE hinstance_app      = NULL; // globally track hinstance

// directdraw stuff

LPDIRECTDRAW          lpdd         = NULL;   // dd object
LPDIRECTDRAW4         lpdd4        = NULL;   // dd4 object
LPDIRECTDRAWSURFACE4  lpddsprimary = NULL;   // dd primary surface
LPDIRECTDRAWSURFACE4  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

// these defined the general clipping rectangle
int min_clip_x = 0,                          // clipping rectangle 
    max_clip_x = SCREEN_WIDTH-1,
    min_clip_y = 0,
    max_clip_y = SCREEN_HEIGHT-1;

// these are overwritten globally by DD_Init()
int screen_width  = SCREEN_WIDTH,            // width of screen
    screen_height = SCREEN_HEIGHT,           // height of screen
    screen_bpp    = SCREEN_BPP;              // bits per pixel


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

// for now test if user is hitting ESC and send WM_CLOSE
if (KEYDOWN(VK_ESCAPE))
   SendMessage(main_window_handle,WM_CLOSE,0,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

// first create base IDirectDraw interface
if (FAILED(DirectDrawCreate(NULL, &lpdd, NULL)))
   {
   // error
   return(0);
   } // end if

// now query for IDirectDraw4
if (FAILED(lpdd->QueryInterface(IID_IDirectDraw4,
                               (LPVOID *)&lpdd4)))
   {
   // error
   return(0);
   } // end if

// set cooperation to full screen
if (FAILED(lpdd4->SetCooperativeLevel(main_window_handle, 
                                      DDSCL_FULLSCREEN | DDSCL_ALLOWMODEX | 
                                      DDSCL_EXCLUSIVE | DDSCL_ALLOWREBOOT)))
   {
   // error
   return(0);
   } // end if

// set display mode to 640x480x8
if (FAILED(lpdd4->SetDisplayMode(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP,0,0)))
   {
   // error
   return(0);
   } // end if


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

// simply blow away the IDirectDraw4 interface
if (lpdd4)
   {
   lpdd4->Release();
   lpdd4 = 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 Full-Screen 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一区二区三区免费野_久草精品视频
成人午夜电影久久影院| 国内精品伊人久久久久av一坑| 欧美日韩精品欧美日韩精品一综合| 午夜欧美2019年伦理| 国产无遮挡一区二区三区毛片日本| 一本色道久久综合狠狠躁的推荐| 日韩精品一区第一页| 国产精品久久久久aaaa| 在线电影院国产精品| 国产成人精品免费| 午夜伊人狠狠久久| 国产精品美女www爽爽爽| 欧美日韩一区成人| 欧美精品日韩综合在线| 国产精品色噜噜| av一区二区久久| 中文字幕av资源一区| 国内不卡的二区三区中文字幕 | 久久久久成人黄色影片| 中文字幕欧美国产| 92国产精品观看| 美女网站一区二区| 精品写真视频在线观看| 亚洲视频精选在线| 国产午夜精品美女毛片视频| 欧美一区永久视频免费观看| 99久久国产综合色|国产精品| 韩国女主播一区| 日本不卡在线视频| 一区二区欧美精品| 国产精品美女久久福利网站| 久久久精品天堂| 精品成人一区二区三区| 91精品国产一区二区三区蜜臀| 欧美在线看片a免费观看| 99精品视频在线观看| 福利电影一区二区| 天使萌一区二区三区免费观看| 精品久久久久久久一区二区蜜臀| 一卡二卡欧美日韩| 欧美日韩高清在线| 91极品视觉盛宴| 色综合久久88色综合天天| av中文字幕不卡| 不卡的电影网站| 欧美一区中文字幕| 日韩免费性生活视频播放| 91精品免费在线| 欧美久久婷婷综合色| 欧美福利一区二区| 欧美一区二区三区在线| 日韩一区二区三区四区| 亚洲精品在线观| 久久综合色婷婷| 国产女人水真多18毛片18精品视频| 久久久三级国产网站| 国产日韩欧美不卡在线| 国产精品天天摸av网| 91在线视频免费观看| 日韩电影一二三区| 久久国内精品视频| 久久精品国产精品亚洲精品| 亚洲一区二区三区精品在线| 国产精品国产三级国产普通话蜜臀 | 精品一区二区三区的国产在线播放 | 国产成人精品午夜视频免费| 国产成人综合在线| 国产不卡在线视频| 99精品热视频| 欧美亚一区二区| 欧美日韩久久一区| 欧美一个色资源| 国产欧美视频一区二区| 亚洲男同性视频| 蜜桃视频第一区免费观看| 国产麻豆一精品一av一免费 | 国产一区二区三区免费| av一区二区三区四区| 欧美日韩一区 二区 三区 久久精品| 欧美精品亚洲一区二区在线播放| 日韩欧美的一区二区| 国产肉丝袜一区二区| 亚洲精品中文字幕在线观看| 蜜臀av一区二区在线观看| 国产成人午夜视频| 欧美午夜一区二区| 国产亚洲成av人在线观看导航| 一区二区三区国产精华| 久久国内精品自在自线400部| 99精品国产一区二区三区不卡 | 国产精品美女一区二区| 亚洲国产成人精品视频| 国产一区在线视频| 欧美唯美清纯偷拍| 欧美激情一二三区| 蜜臀av在线播放一区二区三区| 成人av影院在线| 欧美一区二区三区电影| 国产精品国产自产拍高清av | 欧美一级精品大片| 国产精品久久国产精麻豆99网站 | 国产精品资源在线观看| 亚洲天堂a在线| 成人免费视频免费观看| 日韩小视频在线观看专区| 亚洲靠逼com| 国产69精品久久久久毛片| 欧美日本国产视频| 亚洲电影第三页| 91黄色免费网站| 丝袜国产日韩另类美女| 国产成人8x视频一区二区| 日韩影院免费视频| 国产麻豆9l精品三级站| av电影在线观看完整版一区二区| 欧美午夜片在线看| 久久这里只有精品视频网| 亚洲自拍与偷拍| 粉嫩av一区二区三区粉嫩| 日韩一本二本av| 一个色在线综合| 国产精品影视在线观看| 欧美三级蜜桃2在线观看| 久久精品一区二区三区不卡 | 三级欧美在线一区| 国产在线国偷精品免费看| 欧美日韩一区在线观看| 中文字幕精品一区| 久久成人精品无人区| 欧美亚洲丝袜传媒另类| 一区二区三区久久| 大陆成人av片| 一区精品在线播放| 处破女av一区二区| 久久久亚洲精品一区二区三区| 美国毛片一区二区| 欧美另类z0zxhd电影| 亚洲成人黄色影院| 一本大道av伊人久久综合| 亚洲欧洲综合另类| 不卡的av电影| 亚洲区小说区图片区qvod| 国产在线播精品第三| 欧美一区二区播放| 久久91精品国产91久久小草| 欧美日韩精品一区二区在线播放| 一区二区不卡在线视频 午夜欧美不卡在| 国产成人午夜电影网| 国产精品视频一二三区| 国产在线国偷精品产拍免费yy| 国产情人综合久久777777| 久久99精品国产91久久来源| 欧美视频三区在线播放| 一区二区三区欧美日| 91看片淫黄大片一级| 国产精品不卡在线观看| www.成人网.com| 婷婷开心久久网| 欧美午夜精品免费| 亚洲在线视频一区| 欧美三片在线视频观看| 一区二区三区.www| 欧美精品久久99久久在免费线| 奇米色777欧美一区二区| 8x8x8国产精品| 国产麻豆视频精品| 亚洲色欲色欲www| 在线观看欧美精品| 亚洲成人福利片| 欧美性三三影院| 免费日本视频一区| 欧美精品一区二区三区在线 | 91美女蜜桃在线| 日韩精品国产欧美| 精品国产三级a在线观看| 国产乱子轮精品视频| 久久―日本道色综合久久| 91在线观看污| 亚洲午夜视频在线| 日韩一级片在线播放| 国产美女精品一区二区三区| 一区二区三区四区不卡在线 | 亚洲电影中文字幕在线观看| 在线观看日韩电影| 亚洲午夜电影在线观看| 欧美一级黄色大片| 91亚洲精品久久久蜜桃网站| 一区二区三区精品在线| 制服丝袜成人动漫| 日韩av一区二区在线影视| 国产精品理伦片| 在线观看成人小视频| 日日摸夜夜添夜夜添精品视频| 欧美精品三级日韩久久| 成人黄页毛片网站| 亚洲最大的成人av| 精品美女一区二区| 国产精品资源站在线| 日韩有码一区二区三区| 国产欧美一二三区|