📄 classzigclient__c.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_c class Reference</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_c Class Reference</h1>The client class; extend this class (overriding the marked methods) to implement your own "game client" class. <a href="#_details">More...</a><p><code>#include <<a class="el" href="zigclient_8h-source.html">zigclient.h</a>></code><p><a href="classzigclient__c-members.html">List of all members.</a><table border=0 cellpadding=0 cellspacing=0><tr><td></td></tr><tr><td colspan=2><br><h2>Public Methods</h2></td></tr><tr><td nowrap align=right valign=top><a name="a0" doxytag="zigclient_c::zigclient_c"></a> </td><td valign=bottom><a class="el" href="classzigclient__c.html#a0">zigclient_c</a> (<a class="el" href="classconsole__c.html">console_c</a> *conio)</td></tr><tr><td> </td><td><font size=-1><em>ctor. you must pass a <a class="el" href="classconsole__c.html">console_c</a> instance that will be used as output for internal debug messages.</em></font><br><br></td></tr><tr><td nowrap align=right valign=top><a name="a1" doxytag="zigclient_c::~zigclient_c"></a>virtual </td><td valign=bottom><a class="el" href="classzigclient__c.html#a1">~zigclient_c</a> ()</td></tr><tr><td> </td><td><font size=-1><em>dtor</em></font><br><br></td></tr><tr><td nowrap align=right valign=top><a name="a2" doxytag="zigclient_c::zigclient_c"></a> </td><td valign=bottom><a class="el" href="classzigclient__c.html#a2">zigclient_c</a> ()</td></tr><tr><td> </td><td><font size=-1><em>ctor: no console; if you want to set a console later, call <a class="el" href="classzigclient__c.html#a3">set_console()</a>. messages generated by this zigclient between the object construction and the call to <a class="el" href="classzigclient__c.html#a3">set_console()</a> will be sent to the default global console (console_c::con)</em></font><br><br></td></tr><tr><td nowrap align=right valign=top><a name="a3" doxytag="zigclient_c::set_console"></a>void </td><td valign=bottom><a class="el" href="classzigclient__c.html#a3">set_console</a> (<a class="el" href="classconsole__c.html">console_c</a> *conio)</td></tr><tr><td> </td><td><font size=-1><em>set the console (works with the no-args ctor)</em></font><br><br></td></tr><tr><td nowrap align=right valign=top><a name="a4" doxytag="zigclient_c::set_new_ziglets_save_path"></a>void </td><td valign=bottom><a class="el" href="classzigclient__c.html#a4">set_new_ziglets_save_path</a> (string path)</td></tr><tr><td> </td><td><font size=-1><em>configure root path for saving incoming ziglets from server</em></font><br><br></td></tr><tr><td nowrap align=right valign=top><a name="a5" doxytag="zigclient_c::set_shutdown_timeout"></a>void </td><td valign=bottom><a class="el" href="classzigclient__c.html#a5">set_shutdown_timeout</a> (int timeout=5)</td></tr><tr><td> </td><td><font size=-1><em>set the shutdown timeout in seconds. the default value of the paramter is the default value of the timeout (this is called in the constructor)</em></font><br><br></td></tr><tr><td nowrap align=right valign=top><a name="a6" doxytag="zigclient_c::set_server_timeout"></a>void </td><td valign=bottom><a class="el" href="classzigclient__c.html#a6">set_server_timeout</a> (int timeout=30)</td></tr><tr><td> </td><td><font size=-1><em>set time in seconds without receiving packets from the server that will make the client give up on the server and automatically disconnect. the default value of the paramter is the default value of the timeout.</em></font><br><br></td></tr><tr><td nowrap align=right valign=top><a name="a7" doxytag="zigclient_c::set_connect_timeout"></a>void </td><td valign=bottom><a class="el" href="classzigclient__c.html#a7">set_connect_timeout</a> (int timeout=4)</td></tr><tr><td> </td><td><font size=-1><em>set time limit in seconds which the client will keep trying to connect to a server the default value of the paramter is the default value of the timeout.</em></font><br><br></td></tr><tr><td nowrap align=right valign=top><a name="a8" doxytag="zigclient_c::set_default_send_message_policy"></a>void </td><td valign=bottom><a class="el" href="classzigclient__c.html#a8">set_default_send_message_policy</a> (int send_policy)</td></tr><tr><td> </td><td><font size=-1><em>set the default "send policy" value (RSP_CRITICAL, RSP_HIGHEST, etc.) for reliable messages that should be used when the caller of the <a class="el" href="classzigclient__c.html#a44">send_message()</a> method does not specify the "send policy" that should be used.</em></font><br><br></td></tr><tr><td nowrap align=right valign=top><a name="a9" doxytag="zigclient_c::set_max_fps"></a>void </td><td valign=bottom><a class="el" href="classzigclient__c.html#a9">set_max_fps</a> (int maxfps=60)</td></tr><tr><td> </td><td><font size=-1><em>change the maximum FPS rate (that is, the maximum rate of <a class="el" href="classzigclient__c.html#a31">render_frame()</a> calls). if the maximum FPS is reached, the client process will use the extra time to sleep, freeing CPU. the default parameter of this function determines the default value for zigclient_c.</em></font><br><br></td></tr><tr><td nowrap align=right valign=top><a name="a10" doxytag="zigclient_c::get_max_fps"></a>int </td><td valign=bottom><a class="el" href="classzigclient__c.html#a10">get_max_fps</a> ()</td></tr><tr><td> </td><td><font size=-1><em>get value of max_fps</em></font><br><br></td></tr><tr><td nowrap align=right valign=top><a name="a11" doxytag="zigclient_c::set_timing_policy"></a>void </td><td valign=bottom><a class="el" href="classzigclient__c.html#a11">set_timing_policy</a> (int policy=ZIGTIMING_YIELD)</td></tr><tr><td> </td><td><font size=-1><em>set the timing policy. called from constructor to set default.</em></font><br><br></td></tr><tr><td nowrap align=right valign=top><a name="a12" doxytag="zigclient_c::get_fps"></a>double </td><td valign=bottom><a class="el" href="classzigclient__c.html#a12">get_fps</a> ()</td></tr><tr><td> </td><td><font size=-1><em>get current fps rate</em></font><br><br></td></tr><tr><td nowrap align=right valign=top><a name="a13" doxytag="zigclient_c::set_compression"></a>void </td><td valign=bottom><a class="el" href="classzigclient__c.html#a13">set_compression</a> (int minimum_packet_size=-1)</td></tr><tr><td> </td><td><font size=-1><em>configure usage of packet compression. to turn on the sending of compressed packets at any time, pass a value >=0 as argument, which specifies the minimum size that the packet must have, in bytes, to be compressed (pass 0 to compress all outgoing packets). to turn off the sending of compressed packets at any time, call this method with no parameters (or a negative value as parameter). NOTE: this call resets the compression stats.</em></font><br><br></td></tr><tr><td nowrap align=right valign=top><a name="a14" doxytag="zigclient_c::run"></a>bool </td><td valign=bottom><a class="el" href="classzigclient__c.html#a14">run</a> (int threads_prio=ZIGTHREADSPRIO_NET_HIGH)</td></tr><tr><td> </td><td><font size=-1><em>start up and run the client. this call blocks and only returns when the client quits.</em></font><br><br></td></tr><tr><td nowrap align=right valign=top><a name="a15" doxytag="zigclient_c::run_nonblocking"></a>bool </td><td valign=bottom><a class="el" href="classzigclient__c.html#a15">run_nonblocking</a> (int threads_prio=ZIGTHREADSPRIO_NET_HIGH)</td></tr><tr><td> </td><td><font size=-1><em>starts the client in non-blocking mode. the caller thread returns immediatelly. the caller thread may call <a class="el" href="classzigclient__c.html#a16">stop()</a> at a later time to terminate the client. returns false if there was an error. WHAT YOU MUST DO AFTER CALLING THIS METHOD: you must periodically call the <a class="el" href="classzigclient__c.html#a17">process_nonblocking()</a> method, or the client won't fully work. typically, you will do this inside your own "main loop". IMPORTANT: both the <a class="el" href="classzigclient__c.html#a31">render_frame()</a> and <a class="el" href="classzigclient__c.html#a32">poll_input()</a> methods WILL NOT BE CALLED! when running non-blocking, it is YOUR responsibility to deal with the timing of polling input and rendering to the screen (controlling frames-per-second).</em></font><br><br></td></tr><tr><td nowrap align=right valign=top><a name="a16" doxytag="zigclient_c::stop"></a>bool </td><td valign=bottom><a class="el" href="classzigclient__c.html#a16">stop</a> ()</td></tr><tr><td> </td><td><font size=-1><em>stops the client. call this function if you called run_non_blocking(). this method makes sure that the client shuts down.</em></font><br><br></td></tr><tr><td nowrap align=right valign=top><a name="a17" doxytag="zigclient_c::process_nonblocking"></a>int </td><td valign=bottom><a class="el" href="classzigclient__c.html#a17">process_nonblocking</a> ()</td></tr><tr><td> </td><td><font size=-1><em>ONLY IF USING run_non_blocking: call periodically to runs important client logic. IMPORTANT: if you called run_non_blocking() to start running the client, you MUST call this method periodically (on your own code's "main loop" probably) or the client won't fully work. RETURN VALUE: the status code returned by the socket polling code, which is the number of packets read and processed, 0 if no packet was pending for this client, or -1 if client is not connected or if some error occurred while reading.</em></font><br><br></td></tr>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -