rong-server 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,40 @@
1
+ require 'rong/elements/entities'
2
+
3
+ module Rong
4
+ module Server
5
+ class Game
6
+ attr_reader :ball,
7
+ :board_height,
8
+ :board_length,
9
+ :listeners,
10
+ :paddles,
11
+ :scores
12
+
13
+ def initialize(length, height, state=Rong::Elements::Entities::GameState.new)
14
+ @ball = Rong::Elements::Entities::Ball.new(state.ball_position.first, state.ball_position.last)
15
+ @board_length = length
16
+ @board_height = height
17
+ @paddles = [Rong::Elements::Entities::Paddle.new(state.first_paddle_position),
18
+ Rong::Elements::Entities::Paddle.new(state.second_paddle_position)]
19
+ @scores = [0, 0]
20
+ @listeners = []
21
+ @game_state = state
22
+ end
23
+
24
+ def add_listener(listener)
25
+ @listeners << listener
26
+ end
27
+
28
+ def current_game_state
29
+ @game_state
30
+ end
31
+
32
+ def update_listeners
33
+ listeners.each do |l|
34
+ l.update_game_state(current_game_state)
35
+ end
36
+ end
37
+
38
+ end
39
+ end
40
+ end
@@ -0,0 +1 @@
1
+ require 'rong/server/game'
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 1
7
+ - 2
8
8
  - 0
9
- version: 0.1.0
9
+ version: 0.2.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Matt Yoho
@@ -14,10 +14,39 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-08-19 00:00:00 -04:00
17
+ date: 2010-09-03 00:00:00 -05:00
18
18
  default_executable:
19
- dependencies: []
20
-
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: rong-elements
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ - 2
30
+ - 0
31
+ version: 0.2.0
32
+ type: :runtime
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ name: rspec
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ~>
40
+ - !ruby/object:Gem::Version
41
+ segments:
42
+ - 2
43
+ - 0
44
+ - 0
45
+ - beta
46
+ - 19
47
+ version: 2.0.0.beta.19
48
+ type: :development
49
+ version_requirements: *id002
21
50
  description: Rong-server is the server component for Rong, a Ruby implementation of Pong that consists of a server module for managing games, a client module for for interfacing with the server, and hopefully a few client implementations for playing some rad Pong, brah.
22
51
  email: mby@mattyoho.com
23
52
  executables: []
@@ -26,8 +55,9 @@ extensions: []
26
55
 
27
56
  extra_rdoc_files: []
28
57
 
29
- files: []
30
-
58
+ files:
59
+ - lib/rong/server/game.rb
60
+ - lib/rong/server.rb
31
61
  has_rdoc: true
32
62
  homepage: http://github.com/mattyoho/rong
33
63
  licenses: []