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

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

?? demo12_7_16b.cpp

?? 一本外國(guó)人寫的關(guān)于3D游戲編程的書的源碼
?? CPP
?? 第 1 頁(yè) / 共 5 頁(yè)
字號(hào):
// DEMO12_7_16b.CPP - memory demo
// 16-bit version
// to compile make sure to include DDRAW.LIB, DSOUND.LIB,
// DINPUT.LIB, WINMM.LIB, and of course 
// T3DLIB1.CPP,T3DLIB2.CPP,T3DLIB3.CPP,

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

#define INITGUID

#define WIN32_LEAN_AND_MEAN  

#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>  // directX includes
#include <dsound.h>
#include <dmksctrl.h>
#include <dmusici.h>
#include <dmusicc.h>
#include <dmusicf.h>
#include <dinput.h>
#include "T3DLIB1.h" // game library includes
#include "T3DLIB2.h"
#include "T3DLIB3.h"

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

// defines for windows 
#define WINDOW_CLASS_NAME "WINCLASS"  // class name

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

// defines for ants
#define NUM_ANTS         16 // just change this to whatever, but only 8 ants will be displayed
                            // on HUD
#define ANT_ANIM_UP      0
#define ANT_ANIM_RIGHT   1
#define ANT_ANIM_DOWN    2
#define ANT_ANIM_LEFT    3
#define ANT_ANIM_DEAD    4

// states of ant
#define ANT_WANDERING             0   // moving around randomly
#define ANT_EATING                1   // at a mnm eating it
#define ANT_RESTING               2   // sleeping :)
#define ANT_SEARCH_FOOD           3   // hungry and searching for food
       
// these are the substates that occur during a search for food
        #define ANT_SEARCH_FOOD_S1_SCAN         31  // substate 1
        #define ANT_SEARCH_FOOD_S2_WANDER       32  // substate 2
        #define ANT_SEARCH_FOOD_S3_VECTOR_2CELL 33  // substate 3
        #define ANT_SEARCH_FOOD_S4_VECTOR_2FOOD 34  // substate 4
        #define ANT_SEARCH_FOOD_S5              35  // substate 5
        #define ANT_SEARCH_FOOD_S6              36  // substate 6
        #define ANT_SEARCH_FOOD_S7              37  // substate 7

#define ANT_COMMUNICATING         4   // talking to another ant  
#define ANT_DEAD                  5   // this guy is dead, got too hungry

#define ANT_INDEX_HUNGER_LEVEL       0  // the current hunger level of ant
#define ANT_INDEX_HUNGER_TOLERANCE   1  // the death tolerance of hunger
#define ANT_INDEX_AI_STATE           2  // the artificial intelligence state
#define ANT_INDEX_AI_SUBSTATE        3  // generic substate
#define ANT_INDEX_DIRECTION          4  // direction of motion
#define ANT_INDEX_LAST_TALKED_WITH   5  // last ant talked to
#define ANT_INDEX_MNM_BEING_DEVOURED 6  // the index of mnm being eaten
#define ANT_INDEX_FOOD_TARGET_X      7  // x,y target position of cell or off actual food
#define ANT_INDEX_FOOD_TARGET_Y      8    
#define ANT_INDEX_FOOD_TARGET_ID     9  // the id of the actual piece of food

#define ANT_MEMORY_RESIDUAL_RATE     0.2 // inversely proportional to plasticity of ant memory

#define BITE_SIZE                    5 // bite size of one mouthful in energy units

// defines for food
#define NUM_MNMS         32

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

// game console
int Game_Init(void *parms=NULL);
int Game_Shutdown(void *parms=NULL);
int Game_Main(void *parms=NULL);

// ants stuff
void Move_Ants(void);
void Init_Ants(void);
void Draw_Ants(void);

void Draw_Food(void);

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

// this is the food
typedef struct MNM_TYP
{
int x,y;     // position of mnm
float energy;  // when this is 0, the mnm is dead

} MNM, *MNM_PTR;


typedef struct ANT_MEMORY_TYP
{

float cell[16][16];     // the actual memory
int   ilayer[16][16];   // used as an input layer to help display engine show
                        // areas during communication and forgetfulness

} ANT_MEMORY, *ANT_MEMORY_PTR;


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

#define RAND_RANGE(x,y) ( (x) + (rand()%((y)-(x)+1)))


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

HWND main_window_handle           = NULL; // save the window handle
HINSTANCE main_instance           = NULL; // save the instance
char buffer[256];                          // used to print text

BITMAP_IMAGE background_bmp;   // holds the background

BOB          ants[NUM_ANTS],   // the ants
             mnm;              // the little food mnm image

MNM food[NUM_MNMS];            // the array of mnms

ANT_MEMORY ants_mem[NUM_ANTS]; // each ant has a 256 cell memory, 16x16 structure

int niceday_sound_id = -1;     // the ambient wind


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

// what is the message 
switch(msg)
	{	
	case WM_CREATE: 
        {
		// do initialization stuff here
		return(0);
		} break;

    case WM_PAINT:
         {
         // start painting
         hdc = BeginPaint(hwnd,&ps);

         // end painting
         EndPaint(hwnd,&ps);
         return(0);
        } break;

	case WM_DESTROY: 
		{
		// kill the application			
		PostQuitMessage(0);
		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)
{
// this is the winmain function

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

// perform all game console specific initialization
Game_Init();

// enter main event loop
while(1)
	{
	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

// shutdown game and release all resources
Game_Shutdown();

// return to Windows like this
return(msg.wParam);

} // end WinMain

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

// T3D GAME PROGRAMMING CONSOLE FUNCTIONS ////////////////

int Game_Init(void *parms)
{
// this function is where you do all the initialization 
// for your game

int index; // looping variable

// seed the random number generator
srand(Get_Clock());

// initialize directdraw, very important that in the call
// to setcooperativelevel that the flag DDSCL_MULTITHREADED is used
// which increases the response of directX graphics to
// take the global critical section more frequently
DDraw_Init(WINDOW_WIDTH, WINDOW_HEIGHT, WINDOW_BPP, WINDOWED_APP);

// load background image
Load_Bitmap_File(&bitmap16bit, "SIDEWALK224.BMP");
Create_Bitmap(&background_bmp,0,0,640,480,16);
Load_Image_Bitmap16(&background_bmp, &bitmap16bit,0,0,BITMAP_EXTRACT_MODE_ABS);
Unload_Bitmap_File(&bitmap16bit);

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人av午夜电影| 国产精品99久久久久| 欧美无砖砖区免费| 亚洲精品国产精品乱码不99 | 欧美成人激情免费网| 奇米精品一区二区三区在线观看一| 欧美老年两性高潮| 免费高清在线一区| 久久免费的精品国产v∧| 国产v日产∨综合v精品视频| 国产精品久久久久永久免费观看 | 久久国产三级精品| 久久人人超碰精品| 成人av电影在线播放| 一区二区三区欧美激情| 91麻豆精品91久久久久久清纯 | 国产剧情在线观看一区二区| 国产亚洲欧美一区在线观看| 93久久精品日日躁夜夜躁欧美| 一区二区三区四区高清精品免费观看 | 国产亚洲美州欧州综合国| 国产很黄免费观看久久| 国产精品美女久久久久久久| 欧日韩精品视频| 免费成人av资源网| 国产精品美日韩| 欧美日韩国产精选| 狠狠狠色丁香婷婷综合激情 | 久久超碰97人人做人人爱| 国产亲近乱来精品视频| 色综合婷婷久久| 琪琪久久久久日韩精品| 国产欧美精品在线观看| 欧美日韩黄色一区二区| 国产精品77777| 亚洲一区二区视频在线观看| 久久综合久久久久88| 91视频免费看| 久久成人免费电影| 一区二区久久久久久| 久久久久久一二三区| 欧美午夜片在线观看| 国产精品资源在线| 亚洲国产你懂的| 国产精品三级在线观看| 日韩久久久久久| 欧美色男人天堂| 国产jizzjizz一区二区| 日产国产欧美视频一区精品| 中文字幕在线观看一区二区| 91精品午夜视频| 91视频xxxx| 国产乱对白刺激视频不卡 | 日精品一区二区三区| 国产精品久久久久久妇女6080 | 欧美mv和日韩mv国产网站| 91免费版pro下载短视频| 精品一区二区三区免费播放| 一区二区三区欧美久久| 中文字幕在线观看不卡| 国产三级三级三级精品8ⅰ区| 欧美久久久久久久久久| 色婷婷av久久久久久久| 成人aaaa免费全部观看| 国产一二精品视频| 另类综合日韩欧美亚洲| 日本美女视频一区二区| 亚洲一区二区三区四区五区黄| 中文欧美字幕免费| 久久久青草青青国产亚洲免观| 日韩午夜激情av| 4438x成人网最大色成网站| 欧美亚洲丝袜传媒另类| 在线观看成人免费视频| 色综合久久久久久久| 91视频91自| 色婷婷国产精品| 色欲综合视频天天天| 色综合天天做天天爱| 91免费观看国产| 91福利视频在线| 在线观看91视频| 欧美日韩一二三| 欧美日韩一区二区三区视频| 欧美性xxxxxxxx| 欧美日韩激情一区二区三区| 欧美日韩aaaaaa| 欧美一区二区三区精品| 日韩免费观看高清完整版 | 欧美日韩一区久久| 欧美日韩精品三区| 欧美一区二区不卡视频| 日韩欧美一级二级三级| 精品福利一区二区三区| 精品av久久707| 国产精品天美传媒| 最新日韩av在线| 亚洲自拍偷拍九九九| 五月天视频一区| 裸体歌舞表演一区二区| 黄色小说综合网站| 白白色亚洲国产精品| 91浏览器在线视频| 91精品国产综合久久福利软件 | 国产伦精品一区二区三区视频青涩| 国产精品中文字幕日韩精品| 成人国产精品视频| 91麻豆产精品久久久久久| 欧美日韩黄色一区二区| 精品精品国产高清a毛片牛牛| 国产日本欧美一区二区| 亚洲黄色性网站| 精品一区免费av| 成人av网站在线观看免费| 欧美色综合影院| 精品少妇一区二区三区在线播放| 国产女人水真多18毛片18精品视频| 亚洲欧美日本韩国| 日本怡春院一区二区| 成人亚洲一区二区一| 欧美写真视频网站| 国产精品网站导航| 亚洲国产日韩一级| 国产成人h网站| 欧美吻胸吃奶大尺度电影| 精品国产91洋老外米糕| 亚洲精品国产无天堂网2021| 久久99热狠狠色一区二区| 一本大道久久精品懂色aⅴ| 日韩美女一区二区三区四区| 亚洲男人电影天堂| 国产精品69毛片高清亚洲| 欧美性色黄大片手机版| 欧美激情中文不卡| 日韩成人精品在线观看| 99精品欧美一区二区三区综合在线| 日韩一卡二卡三卡| 亚洲乱码一区二区三区在线观看| 精品一区二区三区免费| 欧美日韩免费在线视频| 中文字幕第一区第二区| 免费看欧美女人艹b| 一本到高清视频免费精品| 26uuu亚洲综合色欧美 | 蜜臀av性久久久久蜜臀aⅴ流畅| 国产suv精品一区二区6| 欧美xxxxx裸体时装秀| 亚洲成人综合在线| 暴力调教一区二区三区| 久久亚洲春色中文字幕久久久| 亚洲国产一区在线观看| 91蜜桃在线观看| 欧美激情综合在线| 国产一区二三区好的| 欧美一级在线视频| 亚洲mv大片欧洲mv大片精品| 色菇凉天天综合网| 国产精品久久久久7777按摩| 国产成人在线视频网址| 精品国产凹凸成av人网站| 五月婷婷久久综合| 欧美日韩小视频| 一区二区在线观看视频| av电影在线观看一区| 国产精品午夜在线| 成人av电影在线网| 国产精品久久久久久久午夜片| 国产精品资源站在线| 精品国产一二三| 激情深爱一区二区| 久久综合九色综合97婷婷| 激情综合网av| 精品国产一区二区三区av性色| 捆绑调教一区二区三区| 日韩午夜电影在线观看| 久久国产精品免费| 久久久精品综合| 国产精品99久久久久| 国产精品看片你懂得| 成人开心网精品视频| 国产精品激情偷乱一区二区∴| av电影天堂一区二区在线| 最新国产成人在线观看| 91精品福利在线| 亚洲综合一二区| 欧美精品乱码久久久久久按摩 | 91丨porny丨在线| 一区二区三区在线观看网站| 在线观看av一区| 免费人成在线不卡| 2023国产精品| a在线欧美一区| 性做久久久久久免费观看| 欧美一级日韩一级| 国产suv精品一区二区三区| 亚洲免费观看视频| 欧美日韩黄色影视| 国产一区二区电影| 亚洲激情在线激情| 日韩视频国产视频|