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

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

?? demo4_9.cpp

?? 一本外國(guó)人寫(xiě)的關(guān)于3D游戲編程的書(shū)的源碼
?? CPP
字號(hào):
// DEMO4_9.CPP - Starfield demo based on T3D console

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

// DEFINES ////////////////////////////////////////////////

// defines for windows 
#define WINDOW_CLASS_NAME "WINCLASS1"
#define WINDOW_WIDTH      400
#define WINDOW_HEIGHT     300

// starfield defines
#define NUM_STARS            256

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

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

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

typedef struct STAR_TYP
        {
        int x,y;        // position of star
        int vel;        // horizontal velocity of star
        COLORREF col;   // color of star
        } STAR, *STAR_PTR;

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

void Erase_Stars(void);
void Draw_Stars(void);
void Move_Stars(void);
void Init_Stars(void);

// GLOBALS ////////////////////////////////////////////////

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

HDC       global_dc          = NULL; // tracks a global dc

char buffer[80];                     // general printing buffer

STAR stars[256];                     // holds the starfield

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

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

void Init_Stars(void)
{
// this function initializes all the stars

for (int index=0; index < NUM_STARS; index++)
    {
    // select random position
    stars[index].x = rand()%WINDOW_WIDTH;
    stars[index].y = rand()%WINDOW_HEIGHT;

    // set random velocity   
    stars[index].vel = 1 + rand()%16;

    // set intensity which is inversely prop to velocity for 3D effect
    // note, I am mixing equal amounts of RGB to make black -> bright white    
    int intensity = 15*(17 - stars[index].vel);
    stars[index].col = RGB(intensity, intensity, intensity); 

    } // end for index

} // end Init_Stars

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

void Erase_Stars(void)
{
// this function erases all the stars
for (int index=0; index < NUM_STARS; index++)
    SetPixel(global_dc, stars[index].x, stars[index].y, RGB(0,0,0));

} // end Erase_Stars

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

void Draw_Stars()
{
// this function draws all the stars
for (int index=0; index < NUM_STARS; index++)
    SetPixel(global_dc, stars[index].x, stars[index].y, stars[index].col);


} // end Draw_Stars

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

void Move_Stars(void)
{
// this function moves all the stars and wraps them around the 
// screen boundaries
for (int index=0; index < NUM_STARS; index++)
    {
    // move the star and test for edge
    stars[index].x+=stars[index].vel;

    if (stars[index].x >= WINDOW_WIDTH)
        stars[index].x -= WINDOW_WIDTH;
    
    } // end for index

} // end Move_Stars

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

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

// get the time
DWORD start_time = GetTickCount();

// erase the stars
Erase_Stars();

// move the stars
Move_Stars();

// draw the stars
Draw_Stars();

// lock to 30 fps
while((start_time - GetTickCount() < 33));

// 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 get the dc to the window
global_dc = GetDC(main_window_handle);

// initialize the star field here
Init_Stars();

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

// release the global dc
ReleaseDC(main_window_handle, global_dc);

// 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
						    "T3D Game Console Star Demo", // title
						    WS_OVERLAPPEDWINDOW | WS_VISIBLE,
					 	    0,0,	  // initial x,y
						    400,300,  // 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

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

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美—级在线免费片| 国产成人在线网站| 成人免费在线视频| 国产欧美一区二区三区鸳鸯浴| 欧美一级理论片| 91精品欧美一区二区三区综合在| 色婷婷国产精品| 91影视在线播放| 99久久婷婷国产综合精品 | 欧美精品一区二区三区在线| 欧美精品日韩精品| 91精品国产色综合久久不卡蜜臀 | 亚洲精品成人a在线观看| 中文字幕在线观看一区| 中文字幕亚洲一区二区av在线 | 日产欧产美韩系列久久99| 亚洲 欧美综合在线网络| 亚洲亚洲精品在线观看| 天天色天天操综合| 精品一区二区三区在线观看国产| 看电影不卡的网站| 懂色中文一区二区在线播放| 国产91在线观看丝袜| 色8久久精品久久久久久蜜 | 99精品国产热久久91蜜凸| 国产超碰在线一区| 91影视在线播放| 欧美精选一区二区| 精品成人在线观看| 国产精品福利在线播放| 亚洲精品视频在线看| 强制捆绑调教一区二区| 国产精品一区二区在线观看网站 | 亚洲.国产.中文慕字在线| 精品中文字幕一区二区小辣椒| 国产美女在线观看一区| 91网址在线看| 精品美女一区二区| 国产精品二区一区二区aⅴ污介绍| 亚洲韩国一区二区三区| 精品亚洲免费视频| 91成人国产精品| 日韩欧美一区二区三区在线| 国产欧美日本一区二区三区| 亚洲国产综合色| 国产精品1区二区.| 欧美日韩高清一区二区| 国产精品久久久久毛片软件| 亚洲电影第三页| 成人精品国产一区二区4080| 91精品国产综合久久福利| 亚洲人成在线观看一区二区| 麻豆国产91在线播放| 欧美在线观看一区| 中文一区在线播放| 另类小说综合欧美亚洲| 在线看国产日韩| 国产精品久久久爽爽爽麻豆色哟哟| 日韩中文字幕一区二区三区| av综合在线播放| 久久青草欧美一区二区三区| 日本视频一区二区三区| 在线观看亚洲成人| 国产精品国模大尺度视频| 国产一区二区三区最好精华液| 欧美日韩国产综合一区二区三区| 中文字幕一区视频| 国产一区二区伦理片| 日韩国产精品久久久久久亚洲| 日本精品一区二区三区四区的功能| 蜜桃久久精品一区二区| 日本二三区不卡| 亚洲视频精选在线| 成人精品在线视频观看| 久久久久九九视频| 国产成人自拍高清视频在线免费播放| 日韩一区二区三区在线视频| 亚洲成av人片一区二区三区| 色婷婷av一区二区三区软件| 中文字幕精品三区| 成人免费视频播放| 欧美国产精品久久| 国产98色在线|日韩| 中文在线免费一区三区高中清不卡| 国产精品自拍网站| 久久精品视频在线看| 国产69精品久久99不卡| 2014亚洲片线观看视频免费| 韩国av一区二区三区| 久久麻豆一区二区| 北条麻妃国产九九精品视频| 欧美国产亚洲另类动漫| 91小视频在线免费看| 亚洲一区二区三区中文字幕| 欧美怡红院视频| 免费观看日韩av| 欧美电影免费观看高清完整版在| 亚洲人妖av一区二区| 国产98色在线|日韩| 久久久亚洲欧洲日产国码αv| 国产在线播放一区三区四| 国产精品午夜电影| 丰满亚洲少妇av| 亚洲女爱视频在线| 欧美福利一区二区| 精品一区二区三区不卡| 欧美激情一区不卡| 欧美日韩精品欧美日韩精品一| 人人超碰91尤物精品国产| 精品国产污污免费网站入口| 国产成人亚洲精品青草天美| 国产精品女人毛片| 欧美日韩视频在线第一区| 狠狠色丁香婷婷综合| 亚洲色大成网站www久久九九| 欧美精品日韩精品| 成人av在线一区二区三区| 亚洲成人av在线电影| 久久久精品黄色| 欧美性做爰猛烈叫床潮| 韩国av一区二区三区四区| 一区二区三区精密机械公司| 欧美一区国产二区| 成人高清在线视频| 麻豆91精品视频| 亚洲码国产岛国毛片在线| 91麻豆精品91久久久久久清纯| 国产不卡一区视频| 午夜欧美一区二区三区在线播放| 亚洲精品一区二区精华| 欧美亚洲动漫精品| 成人精品国产福利| 麻豆精品新av中文字幕| 一区二区三区在线播| 欧美激情一区二区三区四区| 日韩三级免费观看| 日本二三区不卡| 99久久婷婷国产综合精品 | 51午夜精品国产| 97久久精品人人澡人人爽| 黄色日韩三级电影| 午夜视频在线观看一区二区| 综合欧美一区二区三区| 国产午夜精品在线观看| 日韩欧美综合一区| 91精品中文字幕一区二区三区| 色综合久久久网| heyzo一本久久综合| 丁香啪啪综合成人亚洲小说| 麻豆视频一区二区| 免费不卡在线观看| 青青青爽久久午夜综合久久午夜| 亚洲美女屁股眼交| 亚洲激情一二三区| 一区二区三区日本| 洋洋成人永久网站入口| 亚洲免费看黄网站| 综合分类小说区另类春色亚洲小说欧美 | 国产免费成人在线视频| 久久影院午夜论| 久久综合九色综合97婷婷女人| 日韩欧美中文一区二区| 欧美大白屁股肥臀xxxxxx| 色94色欧美sute亚洲线路一久| 免费看日韩a级影片| 欧美激情一区在线观看| 欧美视频完全免费看| 午夜影院久久久| 亚洲欧洲日韩一区二区三区| 亚洲国产精品t66y| 中文字幕一区二区三中文字幕| 国产精品水嫩水嫩| 综合久久国产九一剧情麻豆| 亚洲免费观看高清完整| 亚洲一区二区在线免费观看视频| 无码av免费一区二区三区试看| 热久久一区二区| 国产成a人亚洲| 91久久精品日日躁夜夜躁欧美| 91成人网在线| 精品福利在线导航| 国产精品久久午夜夜伦鲁鲁| 亚洲伊人色欲综合网| 蜜桃av一区二区在线观看| 成人夜色视频网站在线观看| 在线观看免费视频综合| 精品国产制服丝袜高跟| 色综合一个色综合亚洲| 强制捆绑调教一区二区| 自拍偷拍亚洲激情| 午夜精品影院在线观看| 国产精品一二三四五| 色欧美乱欧美15图片| 日韩免费视频一区| 国产精品色噜噜| 奇米精品一区二区三区四区 | 免费欧美高清视频| 成人一级黄色片| 91精品国产综合久久久蜜臀粉嫩| 欧美国产激情一区二区三区蜜月|