📄 zigclient_8h-source.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>zigclient.h Source File</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.2.18 --><center><a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> </center><hr><h1>zigclient.h</h1><a href="zigclient_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/*</span>00002 <span class="comment"> ZIG - An extendable, portable game engine focused on networking & scripting</span>00003 <span class="comment"> Project Home: http://zige.sourceforge.net</span>00004 <span class="comment"> Copyright (C) 2002 F醔io Reis Cecin <fcecin AT inf DOT ufrgs DOT br></span>00005 <span class="comment"></span>00006 <span class="comment"> This library is free software; you can redistribute it and/or</span>00007 <span class="comment"> modify it under the terms of the GNU Lesser General Public</span>00008 <span class="comment"> License as published by the Free Software Foundation; either</span>00009 <span class="comment"> version 2.1 of the License, or (at your option) any later version.</span>00010 <span class="comment"></span>00011 <span class="comment"> This library is distributed in the hope that it will be useful,</span>00012 <span class="comment"> but WITHOUT ANY WARRANTY; without even the implied warranty of</span>00013 <span class="comment"> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</span>00014 <span class="comment"> Lesser General Public License for more details.</span>00015 <span class="comment"></span>00016 <span class="comment"> You should have received a copy of the GNU Lesser General Public</span>00017 <span class="comment"> License along with this library; if not, write to the Free Software</span>00018 <span class="comment"> Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA </span>00019 <span class="comment">*/</span>00029 <span class="preprocessor">#ifndef _ZIG_HEADER_ZIGCLIENT_H_</span>00030 <span class="preprocessor"></span><span class="preprocessor">#define _ZIG_HEADER_ZIGCLIENT_H_</span>00031 <span class="preprocessor"></span>00032 <span class="preprocessor">#include "client.h"</span>00033 <span class="preprocessor">#include "console.h"</span>00034 <span class="preprocessor">#include "zigletman.h"</span>00035 <span class="preprocessor">#include "address.h"</span>00036 <span class="preprocessor">#include "pfilesys.h"</span>00037 00038 <span class="comment">//some internal #define switches to control the implementation</span>00039 <span class="preprocessor">#include "zigdefs.h"</span>00040 00041 <span class="comment">//if defined in zigdefs.h...</span>00042 <span class="preprocessor">#ifdef ZIG_SERIALIZE_CALLBACKS</span>00043 <span class="preprocessor"></span><span class="preprocessor">#define ZIGCLIENT_SERIALIZE_CALLBACKS</span>00044 <span class="preprocessor"></span><span class="preprocessor">#endif</span>00045 <span class="preprocessor"></span>00046 <span class="keyword">using</span> <span class="keyword">namespace </span>std;00047 00048 <span class="comment">// default net tick for client, will be overriden with server's net tick rate on connect</span>00049 <span class="preprocessor">#define ZIGCLIENT_DEFAULT_TICK 0.1</span>00050 <span class="preprocessor"></span>00055 00056 <span class="keyword">enum</span> {00057 00059 <a class="code" href="zigclient_8h.html#a12a1">ZIGCLIENT_DISCONNECTED</a> = 0,00060 00062 <a class="code" href="zigclient_8h.html#a12a2">ZIGCLIENT_DISCONNECTED_TIMEOUT</a>,00063 00065 <a class="code" href="zigclient_8h.html#a12a3">ZIGCLIENT_DISCONNECTED_PROTOCOL_VIOLATION</a>,00066 00068 <a class="code" href="zigclient_8h.html#a12a4">ZIGCLIENT_DISCONNECTED_FILE_DOWNLOAD_ERROR</a>,00069 00071 <a class="code" href="zigclient_8h.html#a12a5">ZIGCLIENT_DISCONNECTED_SOCKET_ERROR</a>, <span class="comment">//generated by LEETCLIENT</span>00072 00074 <a class="code" href="zigclient_8h.html#a12a6">ZIGCLIENT_DISCONNECTED_LIMIT_CRITICALS</a>,00075 00077 <a class="code" href="zigclient_8h.html#a12a7">ZIGCLIENT_DISCONNECTED_LIMIT_RELDELTA</a>,00078 00080 <a class="code" href="zigclient_8h.html#a12a8">ZIGCLIENT_DISCONNECTED_LIMIT_ACKDELTA</a>00081 };00082 00084 <span class="keyword">enum</span> {00085 00087 <a class="code" href="zigclient_8h.html#a13a9">ZIGCLIENT_CONNECTFAILED</a> = 0, 00088 00090 <a class="code" href="zigclient_8h.html#a13a10">ZIGCLIENT_CONNECTFAILED_ZIGNET_VERSION_MISMATCH</a>,00091 00093 <a class="code" href="zigclient_8h.html#a13a11">ZIGCLIENT_CONNECTFAILED_UNKNOWN</a>00094 };00095 00097 <span class="comment">//the client. extending the client_behavior_i inteface for simplicity's sake</span><a name="l00098"></a><a class="code" href="classzigclient__c.html">00098</a> <span class="keyword">class </span><a class="code" href="classzigclient__c.html">zigclient_c</a> : <span class="keyword">public</span> client_behavior_i {00099 <span class="keyword">public</span>:00100 00102 <a class="code" href="classzigclient__c.html#a2">zigclient_c</a>(<a class="code" href="classconsole__c.html">console_c</a> *conio);00103 00105 <span class="keyword">virtual</span> <a class="code" href="classzigclient__c.html#a1">~zigclient_c</a>();00106 00110 <a class="code" href="classzigclient__c.html#a2">zigclient_c</a>();00111 00113 <span class="keywordtype">void</span> <a class="code" href="classzigclient__c.html#a3">set_console</a>(<a class="code" href="classconsole__c.html">console_c</a> *conio);00114 00115 <span class="comment">// ----------------------------------------------------------------------------------------</span>00116 <span class="comment">// BASIC CONFIGURATION AND START/STOP METHODS:</span>00117 <span class="comment">// ----------------------------------------------------------------------------------------</span>00118 <a name="l00120"></a><a class="code" href="classzigclient__c.html#a4">00120</a> <span class="keywordtype">void</span> <a class="code" href="classzigclient__c.html#a4">set_new_ziglets_save_path</a>(string path) { ziglets_default_save_path = path; }00121 <a name="l00124"></a><a class="code" href="classzigclient__c.html#a5">00124</a> <span class="keywordtype">void</span> <a class="code" href="classzigclient__c.html#a5">set_shutdown_timeout</a>(<span class="keywordtype">int</span> timeout = 5) { shutdown_timeout = timeout; }00125 <a name="l00128"></a><a class="code" href="classzigclient__c.html#a6">00128</a> <span class="keywordtype">void</span> <a class="code" href="classzigclient__c.html#a6">set_server_timeout</a>(<span class="keywordtype">int</span> timeout = 30) { cfg_server_timeout = timeout; }00129 <a name="l00132"></a><a class="code" href="classzigclient__c.html#a7">00132</a> <span class="keywordtype">void</span> <a class="code" href="classzigclient__c.html#a7">set_connect_timeout</a>(<span class="keywordtype">int</span> timeout = 4) { 00133 cfg_connect_timeout = timeout; 00134 <span class="keywordflow">if</span> (client) client->set_connect_timeout(timeout);00135 }00136 <a name="l00140"></a><a class="code" href="classzigclient__c.html#a8">00140</a> <span class="keywordtype">void</span> <a class="code" href="classzigclient__c.html#a8">set_default_send_message_policy</a>(<span class="keywordtype">int</span> send_policy) { 00141 default_send_message_policy = send_policy; 00142 <span class="keywordflow">if</span> (client) client->set_default_send_message_policy( send_policy );00143 }00144 00148 <span class="keywordtype">void</span> <a class="code" href="classzigclient__c.html#a9">set_max_fps</a>(<span class="keywordtype">int</span> maxfps = 60);00149 <a name="l00151"></a><a class="code" href="classzigclient__c.html#a10">00151</a> <span class="keywordtype">int</span> <a class="code" href="classzigclient__c.html#a10">get_max_fps</a>() { <span class="keywordflow">return</span> max_fps; }00152 <a name="l00154"></a><a class="code" href="classzigclient__c.html#a11">00154</a> <span class="keywordtype">void</span> <a class="code" href="classzigclient__c.html#a11">set_timing_policy</a>(<span class="keywordtype">int</span> policy = <a class="code" href="zig_8h.html#a23a5">ZIGTIMING_YIELD</a>) { timing_policy = policy; }00155 <a name="l00157"></a><a class="code" href="classzigclient__c.html#a12">00157</a> <span class="keywordtype">double</span> <a class="code" href="classzigclient__c.html#a12">get_fps</a>() { <span class="keywordflow">return</span> fps; }00158 <a name="l00164"></a><a class="code" href="classzigclient__c.html#a13">00164</a> <span class="keywordtype">void</span> <a class="code" href="classzigclient__c.html#a13">set_compression</a>(<span class="keywordtype">int</span> minimum_packet_size = -1) { compression_config = minimum_packet_size; <span class="keywordflow">if</span> (client) client->set_compression(compression_config); }00165 00167 <span class="keywordtype">bool</span> <a class="code" href="classzigclient__c.html#a14">run</a>(<span class="keywordtype">int</span> threads_prio = <a class="code" href="zig_8h.html#a25a13">ZIGTHREADSPRIO_NET_HIGH</a>);00168 00177 <span class="keywordtype">bool</span> <a class="code" href="classzigclient__c.html#a15">run_nonblocking</a>(<span class="keywordtype">int</span> threads_prio = <a class="code" href="zig_8h.html#a25a13">ZIGTHREADSPRIO_NET_HIGH</a>);00178 00181 <span class="keywordtype">bool</span> <a class="code" href="classzigclient__c.html#a16">stop</a>();00182 00189 <span class="keywordtype">int</span> <a class="code" href="classzigclient__c.html#a17">process_nonblocking</a>();00190 00194 <span class="keywordtype">void</span> <a class="code" href="classzigclient__c.html#a18">get_server_info</a>(<a class="code" href="classaddress__c.html">address_c</a> server_addr);00195 00199 <span class="keywordtype">void</span> <a class="code" href="classzigclient__c.html#a18">get_server_info</a>(<a class="code" href="classaddress__c.html">address_c</a> &server_addr, <a class="code" href="classbuffer__c.html">buffer_c</a> &custom);00200 00203 <span class="keywordtype">void</span> <a class="code" href="classzigclient__c.html#a20">set_connect_data</a>(<a class="code" href="classbuffer__c.html">buffer_c</a> &data);00204 00210 <span class="keywordtype">bool</span> <a class="code" href="classzigclient__c.html#a21">connect</a>(string server_addr, <span class="keywordtype">int</span> channel_port = LEET_CHANNEL_PORT_PUSH);00211 00216 <span class="keywordtype">bool</span> <a class="code" href="classzigclient__c.html#a21">connect</a>(<a class="code" href="classaddress__c.html">address_c</a> &server_addr, <span class="keywordtype">int</span> channel_port = LEET_CHANNEL_PORT_PUSH);00217
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -