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

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

?? demo12_7.cpp

?? 游戲的聲音圖像演示程序
?? CPP
?? 第 1 頁 / 共 5 頁
字號(hào):
// DEMO12_7.CPP - memory demo
// 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

#define WINDOW_WIDTH    320   // size of window
#define WINDOW_HEIGHT   240

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

WNDCLASS winclass;	// this will hold the class we create
HWND	 hwnd;		// generic window handle
MSG		 msg;		// generic message
HDC      hdc;       // generic dc
PAINTSTRUCT ps;     // generic paintstruct

// first fill in the window class stucture
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;

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

// create the window, note the use of WS_POPUP
if (!(hwnd = CreateWindow(WINDOW_CLASS_NAME, // class
						  "Memory and Learning Demo",	 // title
						  WS_POPUP | WS_VISIBLE,
					 	  0,0,	   // x,y
						  WINDOW_WIDTH,  // width
                          WINDOW_HEIGHT, // height
						  NULL,	   // handle to parent 
						  NULL,	   // handle to menu
						  hinstance,// instance
						  NULL)))	// creation parms
return(0);

// save the window handle and instance in a global
main_window_handle = hwnd;
main_instance      = hinstance;

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

// start up DirectDraw (replace the parms as you desire)
DDraw_Init(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP);

// load background image
Load_Bitmap_File(&bitmap8bit, "SIDEWALK28.BMP");
Create_Bitmap(&background_bmp,0,0,640,480);
Load_Image_Bitmap(&background_bmp, &bitmap8bit,0,0,BITMAP_EXTRACT_MODE_ABS);
Set_Palette(bitmap8bit.palette);
Unload_Bitmap_File(&bitmap8bit);

// load the ant bitmaps
Load_Bitmap_File(&bitmap8bit, "ANTIMG8.BMP");

// create master ant
Create_BOB(&ants[0],320,200, 24,24, 9, BOB_ATTR_MULTI_ANIM | BOB_ATTR_VISIBLE, DDSCAPS_SYSTEMMEMORY);

// load the ants in 
for (index=0; index < 9; index++)
    Load_Frame_BOB(&ants[0], &bitmap8bit, index, index, 0, BITMAP_EXTRACT_MODE_CELL);


// set the animations
int ant_anim_up[3]    = {0,1,-1};
int ant_anim_right[3] = {2,3,-1};
int ant_anim_down[3]  = {4,5,-1};
int ant_anim_left[3]  = {6,7,-1};
int ant_anim_dead[2]  = {8,-1};

Load_Animation_BOB(&ants[0],0,2, ant_anim_up);
Load_Animation_BOB(&ants[0],1,2, ant_anim_right);
Load_Animation_BOB(&ants[0],2,2, ant_anim_down);
Load_Animation_BOB(&ants[0],3,2, ant_anim_left);
Load_Animation_BOB(&ants[0],4,2, ant_anim_dead);

Set_Anim_Speed_BOB(&ants[0],3);
Set_Animation_BOB(&ants[0], ANT_ANIM_UP);

// clone the ants
for (index=1; index < NUM_ANTS; index++)
    Clone_BOB(&ants[0], &ants[index]);

// initialize the ants
Init_Ants();

// create the mnm
Create_BOB(&mnm,0,0, 8,8, 1, BOB_ATTR_SINGLE_FRAME | BOB_ATTR_VISIBLE, DDSCAPS_SYSTEMMEMORY);

// load the mnm 
Load_Frame_BOB(&mnm, &bitmap8bit, 0, 1, 141, BITMAP_EXTRACT_MODE_ABS);


// position all the mnms
int num_piles = 3+rand()%3;
int curr_mnm = 0;

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲综合丁香婷婷六月香| 久久久久久久电影| 一区二区成人在线| 色欧美日韩亚洲| 亚洲精品高清在线观看| 欧美主播一区二区三区| 亚洲成人免费观看| 日韩精品一区二区在线| 国产盗摄精品一区二区三区在线| 欧美激情在线看| xnxx国产精品| 午夜精品久久久久久久蜜桃app| 欧美日韩精品一区二区天天拍小说 | 日韩精品一区二区三区视频| 另类小说综合欧美亚洲| 欧美极品aⅴ影院| 在线欧美日韩国产| 麻豆免费精品视频| 中文字幕一区二区三区色视频| 欧美私人免费视频| 国产在线不卡一区| 亚洲自拍偷拍图区| 亚洲美女在线一区| 69堂成人精品免费视频| 国产主播一区二区三区| 综合激情成人伊人| 日韩你懂的在线播放| av亚洲产国偷v产偷v自拍| 亚洲成av人片一区二区| 国产日韩欧美高清| 欧美丝袜自拍制服另类| 国产99一区视频免费| 午夜不卡av在线| 国产精品美女久久久久久2018| 欧美美女视频在线观看| 不卡的av网站| 麻豆成人免费电影| 亚洲一二三级电影| 国产精品国产三级国产aⅴ原创| 欧美精品九九99久久| www.亚洲免费av| 精品一区二区三区免费观看| 亚洲人一二三区| 久久众筹精品私拍模特| 69久久99精品久久久久婷婷| av电影一区二区| 国产尤物一区二区| 青青草精品视频| 亚洲综合丝袜美腿| 成人免费在线观看入口| 久久先锋影音av鲁色资源网| 欧美日韩国产免费一区二区 | 日韩免费观看高清完整版 | 性做久久久久久| 国产精品毛片a∨一区二区三区| 欧美成人精品高清在线播放| 欧美日韩一级大片网址| 99国产欧美另类久久久精品| 国产综合成人久久大片91| 日韩二区三区在线观看| 一卡二卡欧美日韩| 亚洲欧美自拍偷拍色图| 国产人久久人人人人爽| 久久只精品国产| 精品国产精品网麻豆系列| 欧美一区二区三区视频免费 | 99久久精品国产网站| 国产精品综合二区| 狠狠久久亚洲欧美| 精品在线播放免费| 美女视频一区在线观看| 日韩av中文在线观看| 亚洲成人1区2区| 天堂久久久久va久久久久| 亚洲国产日韩一区二区| 一区二区成人在线观看| 亚洲一区二区三区四区五区中文| 一区二区三区中文字幕| 亚洲成人免费av| 天天爽夜夜爽夜夜爽精品视频| 五月天国产精品| 肉丝袜脚交视频一区二区| 蜜臀99久久精品久久久久久软件| 日本网站在线观看一区二区三区| 日本美女视频一区二区| 精品亚洲免费视频| 国产 欧美在线| 91农村精品一区二区在线| 在线这里只有精品| 欧美日韩国产色站一区二区三区| 91精品国产麻豆| 精品成人佐山爱一区二区| 久久久久久综合| 国产精品美女久久福利网站| 亚洲精品v日韩精品| 亚洲国产精品久久一线不卡| 日本中文一区二区三区| 国产成人免费在线视频| 91丝袜高跟美女视频| 欧美色图激情小说| 51午夜精品国产| 久久精品网站免费观看| 一区二区三区.www| 日本不卡高清视频| 国产成人在线看| 欧美亚洲综合网| 欧美成人激情免费网| 欧美极品另类videosde| 亚洲第一会所有码转帖| 国产在线看一区| 一本一本大道香蕉久在线精品| 欧美三级视频在线| 久久日一线二线三线suv| 亚洲欧美日韩国产中文在线| 日韩精品乱码av一区二区| 国产精品主播直播| 欧美在线免费观看视频| 日韩欧美电影在线| 有坂深雪av一区二区精品| 久久爱另类一区二区小说| 91丨porny丨户外露出| 欧美精品日韩一本| 中国色在线观看另类| 天天操天天干天天综合网| 风间由美一区二区三区在线观看| 欧美日韩一级二级| 国产精品亲子乱子伦xxxx裸| 五月激情综合婷婷| 91一区二区在线| 日韩精品中文字幕在线不卡尤物 | 亚洲一区二区三区激情| 国产精品一品二品| 欧美日韩不卡一区| 亚洲免费在线电影| 国产一区二区三区黄视频 | 国产日韩高清在线| 日韩av不卡一区二区| 成人av网站在线观看免费| 欧美一区二区三区影视| 亚洲精品一卡二卡| 不卡在线观看av| 久久精品亚洲精品国产欧美| 蜜臀久久99精品久久久画质超高清| 色婷婷综合久久久久中文一区二区| 久久综合精品国产一区二区三区 | 欧美性猛交一区二区三区精品| 国产欧美一区二区精品性色| 精品一区二区三区在线播放| 欧美色手机在线观看| 亚洲欧洲精品一区二区三区 | 91日韩精品一区| 久久久国际精品| 久久99精品久久久久久国产越南| 欧美性xxxxxx少妇| 亚洲一区二区三区视频在线| 91亚洲精品一区二区乱码| 亚洲国产精品成人综合色在线婷婷| 六月婷婷色综合| 欧美一区二区三区日韩视频| 婷婷中文字幕综合| 欧洲一区二区三区在线| 亚洲免费在线电影| 91高清在线观看| 亚洲午夜日本在线观看| 在线视频欧美区| 亚洲专区一二三| 欧美色网一区二区| 亚洲1区2区3区视频| 欧美综合一区二区三区| 亚洲综合自拍偷拍| 色激情天天射综合网| 亚洲欧美日韩国产另类专区| 色欧美片视频在线观看| 国产精品久久久久久久久久久免费看| 国产成a人亚洲精品| 国产精品国产三级国产普通话99| 99久久精品一区二区| 一二三区精品福利视频| 欧美日韩国产中文| 美女网站色91| 国产欧美日韩精品一区| aaa欧美大片| 亚洲一区二区欧美激情| 7777精品伊人久久久大香线蕉| 蜜臀av亚洲一区中文字幕| 久久新电视剧免费观看| www.久久精品| 亚洲国产精品综合小说图片区| 在线播放91灌醉迷j高跟美女| 免费在线成人网| 国产欧美一区二区三区鸳鸯浴| av男人天堂一区| 午夜精品在线看| 久久久国产精品不卡| 97久久精品人人爽人人爽蜜臀| 亚洲午夜免费电影| 久久久久久一级片| 91黄视频在线| 经典三级在线一区| 一区二区三区日韩精品|