renet 0.1.0-universal-darwin
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README +81 -0
- data/examples/Console-Server.rb +47 -0
- data/examples/Gosu-Client.rb +71 -0
- data/ext/renet/enet/callbacks.c +47 -0
- data/ext/renet/enet/callbacks.h +27 -0
- data/ext/renet/enet/compress.c +654 -0
- data/ext/renet/enet/enet.h +540 -0
- data/ext/renet/enet/host.c +479 -0
- data/ext/renet/enet/list.c +75 -0
- data/ext/renet/enet/list.h +43 -0
- data/ext/renet/enet/packet.c +157 -0
- data/ext/renet/enet/peer.c +816 -0
- data/ext/renet/enet/protocol.c +1671 -0
- data/ext/renet/enet/protocol.h +196 -0
- data/ext/renet/enet/time.h +18 -0
- data/ext/renet/enet/types.h +13 -0
- data/ext/renet/enet/unix.c +438 -0
- data/ext/renet/enet/unix.h +45 -0
- data/ext/renet/enet/utility.h +12 -0
- data/ext/renet/enet/win32.c +348 -0
- data/ext/renet/enet/win32.h +58 -0
- data/ext/renet/extconf.rb +21 -0
- data/ext/renet/renet.c +69 -0
- data/ext/renet/renet.h +35 -0
- data/ext/renet/renet_connection.c +322 -0
- data/ext/renet/renet_connection.h +58 -0
- data/ext/renet/renet_server.c +280 -0
- data/ext/renet/renet_server.h +58 -0
- data/lib/renet.rb +10 -0
- metadata +76 -0
@@ -0,0 +1,58 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (c) 2011 Dahrkael <dark.wolf.warrior at gmail.com>
|
3
|
+
* Permission is hereby granted, free of charge,
|
4
|
+
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
5
|
+
* to deal in the Software without restriction, including without limitation the rights to use,
|
6
|
+
* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
|
7
|
+
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
8
|
+
* The above copyright notice and this permission notice shall be included in all copies
|
9
|
+
* or substantial portions of the Software.
|
10
|
+
*
|
11
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
12
|
+
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
13
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
14
|
+
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
15
|
+
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
16
|
+
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
17
|
+
*/
|
18
|
+
|
19
|
+
#ifndef RUBY_ENET_SERVER
|
20
|
+
#define RUBY_ENET_SERVER
|
21
|
+
|
22
|
+
#include "renet.h"
|
23
|
+
|
24
|
+
typedef struct {
|
25
|
+
ENetHost* host;
|
26
|
+
ENetEvent* event;
|
27
|
+
ENetAddress* address;
|
28
|
+
int channels;
|
29
|
+
int n_clients;
|
30
|
+
char* conn_ip;
|
31
|
+
} Server;
|
32
|
+
|
33
|
+
void init_renet_server();
|
34
|
+
|
35
|
+
VALUE renet_server_allocate(VALUE self);
|
36
|
+
void renet_server_deallocate(void* server);
|
37
|
+
|
38
|
+
VALUE renet_server_initialize(VALUE self, VALUE port, VALUE n_peers, VALUE channels, VALUE download, VALUE upload);
|
39
|
+
VALUE renet_server_disconnect_client(VALUE self, VALUE peer_id);
|
40
|
+
VALUE renet_server_send_packet(VALUE self, VALUE peer_id, VALUE data, VALUE flag, VALUE channel);
|
41
|
+
VALUE renet_server_broadcast_packet(VALUE self, VALUE data, VALUE flag, VALUE channel);
|
42
|
+
VALUE renet_server_send_queued_packets(VALUE self);
|
43
|
+
VALUE renet_server_update(VALUE self, VALUE timeout);
|
44
|
+
VALUE renet_server_use_compression(VALUE self, VALUE flag);
|
45
|
+
|
46
|
+
VALUE renet_server_on_connection(VALUE self, VALUE method);
|
47
|
+
void renet_server_execute_on_connection(VALUE peer_id, VALUE ip);
|
48
|
+
|
49
|
+
VALUE renet_server_on_packet_receive(VALUE self, VALUE method);
|
50
|
+
void renet_server_execute_on_packet_receive(VALUE peer_id, enet_uint8* data, enet_uint8 channelID);
|
51
|
+
|
52
|
+
VALUE renet_server_on_disconnection(VALUE self, VALUE method);
|
53
|
+
void renet_server_execute_on_disconnection(VALUE peer_id);
|
54
|
+
|
55
|
+
VALUE renet_server_max_clients(VALUE self);
|
56
|
+
VALUE renet_server_clients_count(VALUE self);
|
57
|
+
|
58
|
+
#endif
|
data/lib/renet.rb
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
begin
|
2
|
+
if defined? RUBY_VERSION and RUBY_VERSION[0..2] == '1.9' then
|
3
|
+
version = '1.9'
|
4
|
+
else
|
5
|
+
version = '1.8'
|
6
|
+
end
|
7
|
+
require "#{File.dirname(__FILE__)}/renet.#{version}.so"
|
8
|
+
rescue LoadError => e
|
9
|
+
require "#{File.dirname(__FILE__)}/renet.#{version}.bundle"
|
10
|
+
end
|
metadata
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: renet
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
prerelease:
|
6
|
+
platform: universal-darwin
|
7
|
+
authors:
|
8
|
+
- Dahrkael
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-07-05 00:00:00.000000000 +02:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
description: Ruby library for games networking. Uses ENet as backend
|
16
|
+
email: dark.wolf.warrior@gmail.com
|
17
|
+
executables: []
|
18
|
+
extensions:
|
19
|
+
- ext/renet/extconf.rb
|
20
|
+
extra_rdoc_files: []
|
21
|
+
files:
|
22
|
+
- README
|
23
|
+
- lib/renet.rb
|
24
|
+
- examples/Console-Server.rb
|
25
|
+
- examples/Gosu-Client.rb
|
26
|
+
- ext/renet/enet/callbacks.h
|
27
|
+
- ext/renet/enet/enet.h
|
28
|
+
- ext/renet/enet/list.h
|
29
|
+
- ext/renet/enet/protocol.h
|
30
|
+
- ext/renet/enet/time.h
|
31
|
+
- ext/renet/enet/types.h
|
32
|
+
- ext/renet/enet/unix.h
|
33
|
+
- ext/renet/enet/utility.h
|
34
|
+
- ext/renet/enet/win32.h
|
35
|
+
- ext/renet/renet.h
|
36
|
+
- ext/renet/renet_connection.h
|
37
|
+
- ext/renet/renet_server.h
|
38
|
+
- ext/renet/enet/callbacks.c
|
39
|
+
- ext/renet/enet/compress.c
|
40
|
+
- ext/renet/enet/host.c
|
41
|
+
- ext/renet/enet/list.c
|
42
|
+
- ext/renet/enet/packet.c
|
43
|
+
- ext/renet/enet/peer.c
|
44
|
+
- ext/renet/enet/protocol.c
|
45
|
+
- ext/renet/enet/unix.c
|
46
|
+
- ext/renet/enet/win32.c
|
47
|
+
- ext/renet/renet.c
|
48
|
+
- ext/renet/renet_connection.c
|
49
|
+
- ext/renet/renet_server.c
|
50
|
+
- ext/renet/extconf.rb
|
51
|
+
has_rdoc: true
|
52
|
+
homepage: https://github.com/Dahrkael/rENet
|
53
|
+
licenses: []
|
54
|
+
post_install_message:
|
55
|
+
rdoc_options: []
|
56
|
+
require_paths:
|
57
|
+
- lib
|
58
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
59
|
+
none: false
|
60
|
+
requirements:
|
61
|
+
- - ! '>='
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '0'
|
64
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
requirements: []
|
71
|
+
rubyforge_project:
|
72
|
+
rubygems_version: 1.5.2
|
73
|
+
signing_key:
|
74
|
+
specification_version: 3
|
75
|
+
summary: Ruby library for games networking. Uses ENet as backend
|
76
|
+
test_files: []
|