📄 classzigclient__c.html
字号:
<tr><td nowrap align=right valign=top><a name="a18" doxytag="zigclient_c::get_server_info"></a>void </td><td valign=bottom><a class="el" href="classzigclient__c.html#a18">get_server_info</a> (<a class="el" href="classaddress__c.html">address_c</a> server_addr)</td></tr><tr><td> </td><td><font size=-1><em>send a "serverinfo" request to a server. "server_addr" is the server's address (formats: "IP:PORT" or "HOSTNAME:PORT", ":port" suffix optional). result of this request comes in the "<a class="el" href="classzigclient__c.html#a42">incoming_server_info()</a>" callback.</em></font><br><br></td></tr><tr><td nowrap align=right valign=top><a name="a19" doxytag="zigclient_c::get_server_info"></a>void </td><td valign=bottom><a class="el" href="classzigclient__c.html#a19">get_server_info</a> (<a class="el" href="classaddress__c.html">address_c</a> &server_addr, <a class="el" href="classbuffer__c.html">buffer_c</a> &custom)</td></tr><tr><td> </td><td><font size=-1><em>send a "serverinfo" request to a server. "server_addr" is the server's address. parameter "custom" specifies data to be passed to your game server with the request. result of this request comes in the "<a class="el" href="classzigclient__c.html#a42">incoming_server_info()</a>" callback.</em></font><br><br></td></tr><tr><td nowrap align=right valign=top><a name="a20" doxytag="zigclient_c::set_connect_data"></a>void </td><td valign=bottom><a class="el" href="classzigclient__c.html#a20">set_connect_data</a> (<a class="el" href="classbuffer__c.html">buffer_c</a> &data)</td></tr><tr><td> </td><td><font size=-1><em>set connection custom data. this will be passed "as is" to the gameserver. this will show up as the parameter named "custom" in a <a class="el" href="classzigserver__c.html#a22">zigserver_c::accept_client()</a> call on the server.</em></font><br><br></td></tr><tr><td nowrap align=right valign=top><a name="a21" doxytag="zigclient_c::connect"></a>bool </td><td valign=bottom><a class="el" href="classzigclient__c.html#a21">connect</a> (string server_addr, int channel_port=LEET_CHANNEL_PORT_PUSH)</td></tr><tr><td> </td><td><font size=-1><em>start connection to the server address given by "server_addr" (string parameter, in IP:PORT or HOSTNAME:PORT format, where the ":PORT" suffix is optional. "channel_port" (optional parameter) specifies the port number for accepting incoming TCP connections. if returns "false", couldn't start connection attempt. if returns "true', result of the connection will come in the connection callbacks.</em></font><br><br></td></tr><tr><td nowrap align=right valign=top><a name="a22" doxytag="zigclient_c::connect"></a>bool </td><td valign=bottom><a class="el" href="classzigclient__c.html#a22">connect</a> (<a class="el" href="classaddress__c.html">address_c</a> &server_addr, int channel_port=LEET_CHANNEL_PORT_PUSH)</td></tr><tr><td> </td><td><font size=-1><em>start connection to the server address given by "server_addr" (<a class="el" href="classaddress__c.html">address_c</a>& parameter). "channel_port" (optional parameter) specifies the port number for accepting incoming TCP connections. if returns "false", couldn't start connection attempt. if returns "true', result of the connection will come in the connection callbacks.</em></font><br><br></td></tr><tr><td nowrap align=right valign=top><a name="a23" doxytag="zigclient_c::disconnect"></a>bool </td><td valign=bottom><a class="el" href="classzigclient__c.html#a23">disconnect</a> (int code_reason=0)</td></tr><tr><td> </td><td><font size=-1><em>disconnect if connected. code_reason is an optional int parameter that pops back up unmodified in the disconnected(...) game-client callbacks.</em></font><br><br></td></tr><tr><td nowrap align=right valign=top><a name="a24" doxytag="zigclient_c::is_connected"></a>bool </td><td valign=bottom><a class="el" href="classzigclient__c.html#a24">is_connected</a> ()</td></tr><tr><td> </td><td><font size=-1><em>is connected?</em></font><br><br></td></tr><tr><td nowrap align=right valign=top><a name="a26" doxytag="zigclient_c::send_packet_now"></a>void </td><td valign=bottom><a class="el" href="classzigclient__c.html#a26">send_packet_now</a> ()</td></tr><tr><td> </td><td><font size=-1><em>causes the client to dispatch an input packet to the server on the next "check". if client running in "nonblocking" mode, this means the next call to <a class="el" href="classzigclient__c.html#a17">process_nonblocking()</a>, otherwise, it's when the internal client sender thread feels like it. however, you should be safe calling <a class="el" href="classzigclient__c.html#a26">send_packet_now()</a> multiple times in a row without causing the client to send one packet for every call. see also: <a class="el" href="classzigclient__c.html#a27">zigclient_c::send_input_packet()</a></em></font><br><br></td></tr><tr><td nowrap align=right valign=top><a name="a27" doxytag="zigclient_c::send_input_packet"></a>void </td><td valign=bottom><a class="el" href="classzigclient__c.html#a27">send_input_packet</a> ()</td></tr><tr><td> </td><td><font size=-1><em>causes the client to actually send an input packet to the server, immediately. see also: <a class="el" href="classzigclient__c.html#a26">zigclient_c::send_packet_now()</a></em></font><br><br></td></tr><tr><td nowrap align=right valign=top><a name="a28" doxytag="zigclient_c::input_changed"></a>void </td><td valign=bottom><a class="el" href="classzigclient__c.html#a28">input_changed</a> (<a class="el" href="classbuffer__c.html">buffer_c</a> &udata)</td></tr><tr><td> </td><td><font size=-1><em>game player input changed (the unreliable portion of the outgoing client data) CALL THIS METHOD FROM your implementation of <a class="el" href="classzigclient__c.html#a32">poll_input()</a> when the input changes the data that must be sent to the server. argument is the new unreliable portion of the client's packet to the server. this is done in order to reduce the lag between a keypress and the actual send of the command packet.</em></font><br><br></td></tr><tr><td nowrap align=right valign=top><a name="a29" doxytag="zigclient_c::input_changed_noflush"></a>void </td><td valign=bottom><a class="el" href="classzigclient__c.html#a29">input_changed_noflush</a> (<a class="el" href="classbuffer__c.html">buffer_c</a> &udata)</td></tr><tr><td> </td><td><font size=-1><em>almost the same as <a class="el" href="classzigclient__c.html#a28">input_changed()</a>, but doesn't cause a packet to be dispatched. client will output packets at the preconfigured rate.</em></font><br><br></td></tr><tr><td nowrap align=right valign=top><a name="a30" doxytag="zigclient_c::init"></a>virtual bool </td><td valign=bottom><a class="el" href="classzigclient__c.html#a30">init</a> ()</td></tr><tr><td> </td><td><font size=-1><em>SHOULD OVERRIDE: called at the start of the "run" method. this should initialize stuff needed for the subsequent calls to render_frame and poll_input. for example: loading resources, scripts... return FALSE to cause shutdown (if initialization fails, for example).</em></font><br><br></td></tr><tr><td nowrap align=right valign=top><a name="a31" doxytag="zigclient_c::render_frame"></a>virtual bool </td><td valign=bottom><a class="el" href="classzigclient__c.html#a31">render_frame</a> ()</td></tr><tr><td> </td><td><font size=-1><em>SHOULD OVERRIDE: client's frame renderer - must be implemented in subclass. this function will be called as frequently as possible, in order to maximise client's FPS rate (unless it surpasses the maximum FPS configured). implementors can return "false" to signal the client to shutdown. ** THIS FUNCTION SHOULD RETURN AS QUICKLY AS POSSIBLE! ** or else the client will LAG!</em></font><br><br></td></tr><tr><td nowrap align=right valign=top><a name="a32" doxytag="zigclient_c::poll_input"></a>virtual bool </td><td valign=bottom><a class="el" href="classzigclient__c.html#a32">poll_input</a> ()</td></tr><tr><td> </td><td><font size=-1><em>SHOULD OVERRIDE: client's input polling - must be implemented in subclass. this function will be called as frequently as possible (at least once for every call to <a class="el" href="classzigclient__c.html#a31">render_frame()</a>...). implementors can return "false" to signal the client to shutdown. ** THIS FUNCTION SHOULD RETURN AS QUICKLY AS POSSIBLE! ** or else the client will LAG!</em></font><br><br></td></tr><tr><td nowrap align=right valign=top><a name="a33" doxytag="zigclient_c::finish"></a>virtual void </td><td valign=bottom><a class="el" href="classzigclient__c.html#a33">finish</a> ()</td></tr><tr><td> </td><td><font size=-1><em>SHOULD OVERRIDE: called at the end of the "run" method. implement this to implement some shutdown procedure that is always called.</em></font><br><br></td></tr><tr><td nowrap align=right valign=top><a name="a34" doxytag="zigclient_c::ziglets_preparing"></a>virtual void </td><td valign=bottom><a class="el" href="classzigclient__c.html#a34">ziglets_preparing</a> ()</td></tr><tr><td> </td><td><font size=-1><em>MAY OVERRIDE: called when client is set to "preparing" state, that is, client is now NOT ready (checking, downloading and saving to local filesystem). Only called if your game server is explicitly using "ziglet"-related stuff.</em></font><br><br></td></tr><tr><td nowrap align=right valign=top><a name="a35" doxytag="zigclient_c::ziglets_ready"></a>virtual void </td><td valign=bottom><a class="el" href="classzigclient__c.html#a35">ziglets_ready</a> ()</td></tr><tr><td> </td><td><font size=-1><em>MAY OVERRIDE: called when client is set to "preparing" state, that is, client is now ready (all needed resource files are on local filesystem, ready for loading). Only called if your game server is explicitly using "ziglet"-related stuff.</em></font><br><br></td></tr><tr><td nowrap align=right valign=top><a name="a36" doxytag="zigclient_c::before_send_keyout"></a>virtual void </td><td valign=bottom><a class="el" href="classzigclient__c.html#a36">before_send_keyout</a> ()</td></tr><tr><td> </td><td><font size=-1><em>MAY OVERRIDE: this is called before the client dispatches a packet to the server. this is a chance to change the "keyout" data just before the send. you may call <a class="el" href="classzigclient__c.html#a29">input_changed_noflush()</a> from here.</em></font><br><br></td></tr><tr><td nowrap align=right valign=top><a name="a37" doxytag="zigclient_c::connected"></a>virtual void </td><td valign=bottom><a class="el" href="classzigclient__c.html#a37">connected</a> (<a class="el" href="classbuffer__c.html">buffer_c</a> &hello)=0</td></tr><tr><td> </td><td><font size=-1><em>MUST IMPLEMENT: client has connected sucessfully, custom accept packet data passed.</em></font><br><br></td></tr><tr><td nowrap align=right valign=top><a name="a38" doxytag="zigclient_c::connection_timed_out"></a>virtual void </td><td valign=bottom><a class="el" href="classzigclient__c.html#a38">connection_timed_out</a> ()=0</td></tr><tr><td> </td><td><font size=-1><em>MUST IMPLEMENT: connection attempt timed out.</em></font><br><br></td></tr><tr><td nowrap align=right valign=top><a name="a39" doxytag="zigclient_c::connection_refused"></a>virtual void </td><td valign=bottom><a class="el" href="classzigclient__c.html#a39">connection_refused</a> (<a class="el" href="classbuffer__c.html">buffer_c</a> &reason, int code_reason)=0</td></tr><tr><td> </td><td><font size=-1><em>MUST IMPLEMENT: connection refused. if code_reason == 0, then it's a refusal from the server, and custom "reason" buffer contains the refuse data passed. if code_reason > 0 , then code reason means an error code that tells what went wrong through one of the ZIGCLIENT_CONNECTFAILED_* defines.</em></font><br><br></td></tr><tr><td nowrap align=right valign=top><a name="a40" doxytag="zigclient_c::disconnected"></a>virtual void </td><td valign=bottom><a class="el" href="classzigclient__c.html#a40">disconnected</a> (bool server_initiated, <a class="el" href="classbuffer__c.html">buffer_c</a> &reason, int code_reason, int zig_reason)=0</td></tr><tr><td> </td><td><font size=-1><em>MUST IMPLEMENT: client has been disconnected. if server_initiated == true, then the "reason" buffer may contain disconnect reason data from the server. "code_reason" is the optional parameter "you" (game layer) passed to a <a class="el" href="classzigclient__c.html#a23">disconnect()</a> call (0 is the default). "zig_reason" is one of the ZIGCLIENT_DISCONNECTED_xxx values; for instance, ZIGCLIENT_DISCONNECTED_TIMEOUT means the server timed out (see <a class="el" href="classzigclient__c.html#a6">set_server_timeout()</a>). a zig_reason of 0 means no special reason (it's the default value).</em></font><br><br></td></tr><tr><td nowrap align=right valign=top><a name="a41" doxytag="zigclient_c::incoming_data"></a>virtual void </td><td valign=bottom><a class="el" href="classzigclient__c.html#a41">incoming_data</a> (<a class="el" href="classbuffer__c.html">buffer_c</a> &in, int packet_id)=0</td></tr><tr><td> </td><td><font size=-1><em>MUST IMPLEMENT: incoming data from server!</em></font><br><br></td></tr><tr><td nowrap align=right valign=top><a name="a42" doxytag="zigclient_c::incoming_server_info"></a>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -