- 博客(57)
- 资源 (6)
- 收藏
- 关注
原创 DirectX9 绘画准备
绘画准备Once we have created a vertex buffer and, optionally, an index buffer, we are almost ready to render its contents, but there are three steps that must be taken first.1. Set the stream source
2015-04-28 17:31:26 500
原创 DirectX9 渲染状态
渲染状态Direct3D encapsulates a variety of rendering states that affect how geometry is rendered. HRESULT IDirect3DDevice9::SetRenderState(D3DRENDERSTATETYPE State, // the state to changeDWORD V
2015-04-28 17:30:33 675
原创 DirectX9 检索关于顶点和索引的信息
检索关于顶点和索引的信息The following example demonstrates the methods used to obtain such information:D3DVERTEXBUFFER_DESC vbDescription;_vertexBuffer->GetDesc(&vbDescription); // get vb infoD3DINDEXBU
2015-04-28 17:22:47 568
原创 DirectX9 进入缓存内存
C++ 进入缓存内存We obtain a pointer to its contents by using theLockmethod. It is important to unlock the buffer when we are done accessing it.HRESULT IDirect3DVertexBuffer9::Lock(UINT OffsetToLock,
2015-04-28 17:08:27 519
原创 DirectX9 创建顶点和索引缓存
C++ 创建顶点和索引缓存We can create a vertex and index buffer with the following two methods:HRESULT IDirect3DDevice9::CreateVertexBuffer(UINT Length,DWORD Usage,DWORD FVF,D3DPOOL PoolIDirect3D
2015-04-28 16:55:33 1187
原创 C++网络聊天室控制台版源代码
用C++和socket网络编程、多线程技术组成的网络聊天室控制台版,1000行之内。之所以在控制台运行而不是用MFC等图形库是为了方便从底层理解socket编程和多线程,只有从深入理解技术原理后才能在广泛的实际应用如鱼得水,而不局限于某个特定图形库提供的网络接口。注意:因为是控制台,所以有些不可避免的显示错误(如输入内容过长影响界面等,但这些仅仅只是控制台上的局限,实际
2015-04-25 13:43:53 6303 21
原创 DirectX9 投影
投影D3DXMATRIX *D3DXMatrixPerspectiveFovLH(D3DXMATRIX* pOut, // returns projection matrixFLOAT fovY, // vertical field of view angle in radiansFLOAT Aspect, // aspect ratio = width / heightFLO
2015-04-18 21:56:15 786
原创 DirectX9 背面消隐
背面消隐If for some reason we are not happy with the default culling behavior, we can change it by changing theD3DRS_CULLMODErender state. Device->SetRenderState(D3DRS_CULLMODE, Value); whereValueca
2015-04-18 21:12:06 1399
原创 DirectX9 观察坐标系
观察坐标系The view space transformation matrix can be computed using the following D3DX function:D3DXMATRIX*D3DXMatrixLookAtLH(D3DXMATRIX* pOut, //pointer to receive resulting view matrixCONST D3DX
2015-04-18 20:54:40 546
原创 DirectX9 世界坐标系
世界坐标The world transformation is represented with a matrix and set with Direct3D using theIDirect3DDevice9::SetTransformmethod withD3DTS_WORLDas the transform type. For example, suppose we want to po
2015-04-18 20:24:22 653
原创 DirectX9 索引
索引We create a vertex list and an index list. The vertex list consists of all the unique vertices, and the index list contains values that index into the vertex list to define how they are to be put
2015-04-18 19:53:44 376
原创 DirectX9 三角形单元
三角形单元A triangle list contains the data for each individual triangle that we wish to draw. Vertex rect[6] = {v0, v1, v2, // triangle0v0, v2, v3}; // triangle1
2015-04-18 19:51:29 503
原创 DirectX9 顶点格式
顶点格式To create a customvertex format, we first create a structure that holds the vertex data that wechoose.struct ColorVertex{float _x, _y, _z; //positionDWORD _color;};structNormalTexVer
2015-04-18 19:42:22 900
原创 DirectX9 初始化Direct3D通用框架
初始化Direct3D通用框架The declaration of IDirect3DDevice9::Clearis:HRESULTIDirect3DDevice9::Clear(DWORD Count,const D3DRECT*pRects,DWORD Flags,D3DCOLOR Color,float Z,DWORD Stencil);Coun
2015-04-18 18:49:58 1464
原创 MUD游戏编程 完成DNS查找
完成DNS查找1、DNS查找下面是gethostbyname函数,它执行DNS查找:struct hostent* gethostbyname( const char* name );hostent结构体原型如下:struct hostent { char* h_name; char** h_aliases; short h_add
2015-04-18 13:15:05 764
原创 MUD游戏编程 Winsock杂项函数
Winsock杂项函数1、将IP地址转换成字符串,并转换回IP地址下面这个函数将字符串类型的IP地址转换成unsigned long类型:unsigned long inet_addr( const char *string );下面这个函数与此相反,将一个数字地址转换成一个字符串:char* inet_ntoa( struct in_addr in );示例:
2015-04-18 12:47:09 565
原创 MUD游戏编程 关闭套接字
关闭套接字首先调用shutdown()函数,其函数声明如下:int shutdown(int socket, int how);第二个参数是关闭此套接字正在采用的方法。0、1、2分别表示关闭接受、关闭接收、同时关闭接收和发送。几乎所有情况都为2。UNIX操作系统可以用close()函数来关闭套接字文件。Windows中要用closesocket()。参数和返回值是相同的
2015-04-18 12:32:43 711
原创 2015.4.18博客说明
本博客的学习笔记分类,仅仅是为了方便自己快速检索与复习回顾,顺便方便大家查询相关资料。正式的教程请自行看书,零散的知识是无法构建完整的知识体系的。本人是2014级东莞理工学院的软件工程大一学生,博客所有内容均为自学。如果你也是志同道合的游戏开发爱好者,可以留言你的QQ号共同交流学习心得:)之前文章格式不统一看起来有点混乱,今天开始统一一下文章的格式,下面是说明:绿色是大
2015-04-18 11:38:46 817 3
原创 MUD游戏编程 接收数据
接收数据下面是recv()函数的函数定义:int recv( int socket, char *buffer, int len, int flags );示例:char buffer[128];int received;received = recv( datasock, buffer, 128, 0 );需要注意的是,recv()也是一个阻塞
2015-04-18 11:16:49 1896
原创 MUD游戏编程 发送数据
发送数据使用send函数即可:int send( int socket, const char *buffer, int len, int flags );第二个参数是指向字符缓冲区的指针。第三个参数是缓冲区中数据的长度。第四个参数是标记,只有编写底层网络程序的编程员才使用。示例:char* string = "hello, Internet!";int
2015-04-18 11:11:42 686
原创 MUD游戏编程 创建TCP数据套接字
创建TCP数据套接字1、创建套接字与创建监听套接字使用相同的函数。int datasock;datasock = socket(AF_INET,SOCK_STREAM,IPPROTO_TCP); 2、连接套接字函数定义:intconnect( int socket, const struct sockaddr *name, int namelen );填充soc
2015-04-18 10:59:13 785
原创 JAVA ArrayList
示例:ArrayList myList = new ArrayList();主要方法:add(Object elem)remove(int index)remove(Object elem)contains(Object elem)isEmpty()indexOf(Object elem)size()get(int dex)
2015-04-18 10:49:31 445
原创 JAVA 数组
JAVA中数组也是对象示例1:int[] nums = new int[7];nums[0]=6;......nums[6]=1;示例2:DOG[] pets = new Dog[7];这里我们虽然有对Dog对象的7个引用,但缺少实际的Dog对象!pets[0] = new Dog();.....pets[6] = new Dog();
2015-04-18 10:36:24 410
原创 MUD游戏编程 创建TCP监听套接字
创建TCP监听套接字1、创建套接字int sock = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP );第一个参数是地址族(Address Family)。第二个参数是套接字类型。SOCK_STREAM表示TCP套接字。UDP使用SOCK_DGRAM。第三个参数是协议。SOCK_STREAM流行协议是IPPROTO_TCP。SOCK_DG
2015-04-18 10:32:10 1155
原创 DirerctX9 初始化Direct3D
Acquiring anIDirect3D9 InterfaceThis is easily doneusing a special Direct3D function, as the following lines of code show:IDirect3D9*_d3d9;_d3d9 =Direct3DCreate9(D3D_SDK_VERSION); Checking f
2015-04-17 23:32:49 900
原创 DirectX9 设备能力
Supposewe wish to check if a hardware device is capable of doing vertex processing inhardware (or in other words, whether the device supports transformation andlighting calculations in hardware). By
2015-04-17 22:14:27 422
原创 DirectX9 深度缓存
In general, most applications work fine with a 24-bit depth buffer, although Direct3D also exposes a 32-bit depth buffer.D3DFMT_D32—Specifies a 32-bit depth bufferD3DFMT_D24S8—Specifies a 24
2015-04-17 21:59:25 1021
原创 DirectX9 内存池
The memory pool is specified by one of the members of theD3DPOOLenumerated type. The memory pools available are:D3DPOOL_DEFAULT—The default memory pool instructs Direct3D to place the resource in th
2015-04-17 21:14:09 651
原创 DirectX9 像素格式
The format of a pixel is defined byspecifying a member of theD3DFORMATenumerated type. Some formats are:D3DFMT_R8G8B8—Specifies a 24-bitpixel format where, startingfrom the leftmost bit, 8 bits
2015-04-17 21:04:50 857
原创 DirectX9 多重采样
MultisamplingD3DMULTISAMPLE_NONE—Specifies nomultisamplingD3DMULTISAMPLE_1_SAMPLE…D3DMULTISAMPLE_16_SAMPLE—Specifiesmultisampling levels from 1 to 16 If you wish to include it, remember touse
2015-04-17 20:51:53 934
原创 DirectX9 表面
we have provided the following code block that locks a surface and colors each pixel red:// Assume _surface is a pointer to an IDirect3DSurface9 interface.// Assumes a 32-bit pixel format fo
2015-04-17 20:37:18 589
原创 DirectX9 平面
D3DXPLANEThe D3DX library uses the followingstructure for a plane:typedef struct D3DXPLANE{#ifdef __cpluspluspublic:D3DXPLANE() {}D3DXPLANE( CONST FLOAT* );D3DXPLANE( CONST D3DXFLOAT
2015-04-16 23:52:03 1000
原创 DirectX9 矩阵
D3DXMatricesTo represent 4×4 matrices in D3DX, weusethe D3DXMATRIX class, defined as follows:typedef struct D3DXMATRIX : publicD3DMATRIX{public:D3DXMATRIX() {};D3DXMATRIX(CONST FLOAT*);
2015-04-16 23:49:01 724
原创 MUD游戏编程 Socket API
Socket API头文件#include “winsock.h”#include “ws2tcpip.h” 初始化API下面列出了初始化和关闭函数:int WSAStartup( WORD wVersionRequested, LPWSADATAlpWSAData );int WSACleanup( void ); 本书最新Winsock版本是2.2,所以
2015-04-16 23:46:11 1602
原创 书名收藏
Computer GraphicsMathematics for 3D Game Programming & Computer Graphics By LengyelNetworkMultiplayer Game ProgrammingBy Todd BarronNetwork Programming for Microsoft Windows By Antho
2015-04-16 18:24:32 668
原创 DirectX9 向量
In the D3DX library, we can use theD3DXVECTOR3class to represent a vectorin 3-space. Its class definition is:typedef struct D3DXVECTOR3 : public D3DVECTOR {public:D3DXVECTOR3() {};D3DXVECTOR3(
2015-04-16 14:27:15 629
原创 windows游戏编程 以PeekMessage为核心的消息循环体系
BOOL PeekMessage(LPMSG IpMsg,HWND hWnd,UINT wMSGfilterMin,UINT wMsgFilterMax,UINT wRemoveMsg);lpMsg接收消息信息的MSG结构指针。hWnd其消息被检查的窗口句柄。wMsgFilterMin指定被检查的消息范围里的第一个消息
2015-04-15 22:49:48 1321
原创 windows 程序设计 System Metrics Display Program No. 3
/*---------------------------------------------------- SYSMETS3.C -- System Metrics Display Program No. 3 (c) Charles Petzold, 1998 ----------------------------------------------
2015-04-11 19:28:29 731
原创 windows程序设计 更好的滚动条
Building a Better ScrollThe syntaxof the SetScrollInfoand GetScrollInfofunctions isSetScrollInfo (hwnd, iBar, &si,bRedraw) ;GetScrollInfo (hwnd, iBar, &si) ;The thirdargument to both functions
2015-04-11 19:27:49 548
原创 windows程序设计 System Metrics Display Program No. 2
The SYSMETS2 programSYSMETS2.C/*---------------------------------------------------- SYSMETS2.C -- System Metrics Display Program No. 2 (c) Charles Petzold, 1998 --------
2015-04-11 19:26:33 825
win7 64位汇编开发环境合集
2015-12-01
DirectX11程序初始化
2015-09-28
泡泡堂 DirectX11 Demo
2015-09-06
C++实现状态驱动智能体设计——消息功能
2015-08-17
有限状态机(FSM)
2015-08-17
C++控制台网络聊天室源代码
2015-04-25
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人