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

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

?? demo12_7_16b.cpp

?? 一本外國人寫的關于3D游戲編程的書的源碼
?? CPP
?? 第 1 頁 / 共 5 頁
字號:
// 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);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品亚洲专一区二区三区| 欧美在线不卡一区| 色综合天天综合网天天狠天天 | 亚洲精品日日夜夜| 日韩中文字幕麻豆| 国产成人av影院| 日韩三级伦理片妻子的秘密按摩| 国产欧美一区二区三区在线看蜜臀| 天天操天天色综合| 色婷婷综合激情| 国产欧美日本一区二区三区| 日本午夜精品视频在线观看 | 国产精品一卡二卡在线观看| 在线国产电影不卡| 成人免费在线视频| 精彩视频一区二区| 欧美一级高清片| 一区二区在线观看免费| 91最新地址在线播放| 久久久久久久国产精品影院| 日韩av不卡一区二区| 成人午夜电影网站| 精品国产乱码久久| 精彩视频一区二区三区| 日韩视频一区二区在线观看| 亚洲成人午夜电影| 在线观看日产精品| 亚洲色图色小说| 成人av资源在线| 国产精品久久久久四虎| www.激情成人| 国产日韩三级在线| 国产黄色成人av| 久久久五月婷婷| 国产一区二区三区在线观看免费| 日韩女优毛片在线| 蜜臂av日日欢夜夜爽一区| 91精品国产综合久久小美女| 日韩电影在线观看电影| 91精品国产综合久久久蜜臀粉嫩 | 丝袜脚交一区二区| 777色狠狠一区二区三区| 亚洲国产欧美在线人成| 欧美日韩国产系列| 秋霞电影一区二区| 欧美精品一区二区三区四区| 国产精品一区二区在线看| 国产亚洲污的网站| av成人免费在线| 一区二区三区在线高清| 91麻豆精品国产91久久久| 毛片av一区二区三区| 久久久久久久久久久久电影| 不卡电影一区二区三区| 亚洲另类中文字| 91精品国产高清一区二区三区蜜臀 | 日本欧美加勒比视频| 精品久久人人做人人爽| 99视频精品在线| 亚洲a一区二区| 精品国一区二区三区| 99v久久综合狠狠综合久久| 亚洲第一福利视频在线| 精品三级在线观看| 91丨九色porny丨蝌蚪| 夜夜嗨av一区二区三区四季av| 56国语精品自产拍在线观看| 国产美女av一区二区三区| 亚洲免费色视频| 精品久久久网站| 欧美在线影院一区二区| 国产资源在线一区| 亚洲一线二线三线久久久| 欧美电影免费观看高清完整版在 | 国产精品正在播放| 夜夜嗨av一区二区三区 | 欧美日韩在线播放一区| 精品一区二区三区在线观看| 亚洲你懂的在线视频| 久久影院午夜片一区| 欧美三级视频在线观看| 丁香啪啪综合成人亚洲小说| 三级一区在线视频先锋| 中文字幕一区二区三区乱码在线 | 欧美一区二区三区视频免费| eeuss影院一区二区三区| 免费成人深夜小野草| 一区二区三区免费看视频| 国产日韩欧美一区二区三区综合| 4hu四虎永久在线影院成人| 99精品视频在线播放观看| 国产主播一区二区| 日本不卡123| 亚洲不卡在线观看| 亚洲欧美偷拍卡通变态| 中文久久乱码一区二区| 精品福利一区二区三区免费视频| 欧美日韩高清在线播放| 色久优优欧美色久优优| 国产精品一区二区免费不卡| 精品在线一区二区| 日本视频中文字幕一区二区三区| 一区二区三国产精华液| 日韩美女久久久| 《视频一区视频二区| 中文字幕免费一区| 久久免费精品国产久精品久久久久 | 久久精品国产精品青草| 日产国产欧美视频一区精品| 日韩中文字幕区一区有砖一区| 亚洲国产sm捆绑调教视频 | 国产精品国产三级国产普通话三级 | 美腿丝袜亚洲一区| 麻豆免费精品视频| 极品少妇xxxx偷拍精品少妇| 国产尤物一区二区在线| 国产精品小仙女| 国产精品一区三区| 成人精品视频网站| 成人午夜大片免费观看| 成人精品国产一区二区4080| 成人黄色网址在线观看| 成人免费观看av| 99免费精品在线| 色哟哟一区二区| 4438成人网| www日韩大片| 国产精品视频一二三区 | 奇米影视7777精品一区二区| 奇米在线7777在线精品| 国产精一区二区三区| 粉嫩av亚洲一区二区图片| 91小视频在线免费看| 欧美色大人视频| 日韩精品一区二区三区在线| 精品国产麻豆免费人成网站| 欧美激情在线一区二区三区| 日韩毛片视频在线看| 亚洲国产一区二区a毛片| 麻豆精品一区二区av白丝在线| 水蜜桃久久夜色精品一区的特点| 男女性色大片免费观看一区二区| 精品一区二区三区在线观看国产| 成人美女视频在线观看| 欧美视频一区二区三区在线观看 | 日韩视频一区二区| 日本一二三不卡| 亚洲福利一二三区| 国产最新精品精品你懂的| 99精品视频在线观看| 6080yy午夜一二三区久久| 国产欧美一区二区三区鸳鸯浴| 亚洲男同性视频| 国产自产2019最新不卡| 欧美在线观看18| 欧美激情一区二区三区四区| 亚洲激情综合网| 国产一区二区免费视频| 欧美日韩国产综合久久| 久久久久久久久97黄色工厂| 午夜在线成人av| 成人国产免费视频| 日韩亚洲欧美成人一区| 亚洲激情图片qvod| 粉嫩av一区二区三区在线播放| 欧美日韩高清一区二区三区| 国产精品乱码久久久久久| 日韩va欧美va亚洲va久久| 91美女片黄在线观看91美女| 欧美精品一区二区三区在线播放| 一区二区三区久久久| 国产成人免费视频网站高清观看视频| 欧美日韩一区二区在线观看| 国产精品国产馆在线真实露脸| 精品一区二区在线视频| 欧美日韩国产精品成人| 亚洲欧美视频一区| 懂色av一区二区三区蜜臀| 欧美大片顶级少妇| 日韩电影在线免费看| 欧美在线观看18| 一片黄亚洲嫩模| 色婷婷精品大在线视频| 中文字幕不卡一区| 国产麻豆欧美日韩一区| 欧美不卡一区二区| 日本va欧美va精品发布| 欧美日本视频在线| 亚洲国产精品久久一线不卡| 色综合天天综合网国产成人综合天 | 石原莉奈在线亚洲二区| 欧美日韩免费视频| 亚洲综合成人网| 在线观看av不卡| 亚洲精品高清视频在线观看| 色www精品视频在线观看| 亚洲精品videosex极品| 在线一区二区三区四区五区| 一区二区三区鲁丝不卡| 欧美性xxxxx极品少妇|