pario 0.4.2 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -11,13 +11,13 @@ Pario is a Gosu Game framework that helps to give you structure and a start for
11
11
 
12
12
  Other Requirements
13
13
  * sudo gem update --system
14
- * ruby patchlevel 330, you may experience issues. Working on instructions to upgrade ruby on a system.
14
+ * ruby patchlevel 330 or highter, you may experience issues. Working on instructions to upgrade ruby on a system.
15
15
 
16
16
  == Getting Started
17
17
 
18
18
  1. At the command prompt, create a new Pario application:
19
19
 
20
- pario create my_game
20
+ pario new my_game
21
21
 
22
22
  where my_game is the game name.
23
23
 
@@ -28,6 +28,8 @@ Pario is a Gosu Game framework that helps to give you structure and a start for
28
28
  3. Add more classes to the game:
29
29
 
30
30
  pario add my_class
31
+
32
+ * Pario will create more than one class of you have more: pario add star background player
31
33
 
32
34
  == Learning Ruby
33
35
 
data/lib/docs/README CHANGED
@@ -5,21 +5,18 @@ Pario is a Gosu Game framework that helps to give you structure and a start for
5
5
  == Getting Started
6
6
 
7
7
  1. At the command prompt, create a new Pario game
8
- <tt>gosu create my_game</tt> (where <tt>my_game</tt> is the game name)
8
+ <tt>pario new my_game</tt> (where <tt>my_game</tt> is the game name)
9
9
 
10
- 2. Change the directory to <tt>myapp</tt> and start the game
11
- <tt>gosu play</tt>
10
+ 2. Change the directory to <tt>my_game</tt> and start the game
11
+ <tt>cd my_game</tt>
12
+ <tt>pario play</tt>
12
13
 
13
- 3. NOT YET IMPLEMENTED: To create more classes for your game (which will appear in the game folder)
14
+ 3. To create more classes for your game (which will appear in the game folder)
14
15
  <tt>gosu add my_class</tt> (where <tt>my_class</tt> is the name of your class)
15
16
 
16
- Also, just as <tt>create</tt>, subsequent words will become subclasses of the first named class.
17
+ Also, just as <tt>new</tt>, subsequent words will more classes.
17
18
  However, the game folder will not create subfolders but relate the classes automatically.
18
- <tt>gosu create my_class menu background</tt>
19
-
20
- |-- my_class.rb
21
- | |-- menu.rb
22
- | `-- background.rb
19
+ <tt>pario new my_class menu background</tt>
23
20
 
24
21
  == Learning Ruby
25
22
 
@@ -41,7 +38,7 @@ MyApp
41
38
  |-- media
42
39
 
43
40
  config
44
- A basic configuration file is created for you. Configuration is a place where game setup information goes (like window size or fonts). Feel free to add to it.
41
+ A basic configuration file is created for you. Configuration is a place where game setup information goes (like window size or fonts). Feel free to add to it. COMING SOON.
45
42
 
46
43
  game
47
44
  Holds all of the code that's deals with your particular game.
data/lib/pario/cli.rb CHANGED
@@ -1,9 +1,11 @@
1
1
  require 'pario'
2
2
  require 'optparse'
3
3
  require 'erb'
4
+ require 'fileutils'
4
5
 
5
6
  module Pario
6
7
  class Cli
8
+ include FileUtils
7
9
 
8
10
  Directories = %w{game lib media config}
9
11
 
@@ -44,10 +46,14 @@ module Pario
44
46
  create_directories
45
47
  create_base_files
46
48
  copy_files
49
+ build_config_yaml
47
50
  end
48
51
 
49
52
  def copy_files
50
- # TODO copy over README, LICENSE and pario_background
53
+ cp File.join(File.expand_path(File.dirname(__FILE__)), "..", "util.rb"), "../lib/util.rb"
54
+ cp File.join(File.expand_path(File.dirname(__FILE__)), "media", "pario_background.png"), "../media/pario_background.png"
55
+ cp File.join(File.expand_path(File.dirname(__FILE__)), "..", "docs", "README"), "../README"
56
+ cp File.join(File.expand_path(File.dirname(__FILE__)), "..", "docs", "LICENSE"), "../LICENSE"
51
57
  end
52
58
 
53
59
  # Set game name
@@ -81,6 +87,12 @@ module Pario
81
87
  main_file = File.open("main.rb", "w+")
82
88
  main_file.puts main_class
83
89
  end
90
+
91
+ def build_config_yaml
92
+ Dir.chdir('../config')
93
+ config_file = File.open("config.yml", "w+")
94
+ config_file.puts config_yaml
95
+ end
84
96
 
85
97
  def build_extra_classes
86
98
  Dir.chdir("game") unless Dir.getwd.split("/").last == "game"
@@ -89,6 +101,14 @@ module Pario
89
101
  class_file.puts class_template(new_class)
90
102
  end
91
103
  end
104
+
105
+ def config_yaml
106
+ template = ERB.new <<-EOF
107
+ screen_width: 600
108
+ screen_height: 800
109
+ EOF
110
+ template.result(binding)
111
+ end
92
112
 
93
113
  def class_template(name)
94
114
  template = ERB.new <<-EOF
@@ -104,11 +124,17 @@ template.result(binding)
104
124
  main_template = ERB.new <<-EOF
105
125
  require 'rubygems'
106
126
  require 'gosu'
127
+ require 'yaml'
107
128
 
108
129
  Dir.glob(File.join("game", "*.rb")).each {|file| require file }
130
+ Dir.glob(File.join("lib", "*.rb")).each {|file| require file }
109
131
 
132
+ config = YAML::load(File.open("config/config.yml"))
110
133
 
111
- game = #{game_name_capitalize}.new(800, 600)
134
+ #Add lib includes here
135
+ include Util
136
+
137
+ game = #{game_name_capitalize}.new(config["screen_height"], config["screen_width"])
112
138
  game.show
113
139
  EOF
114
140
  main_template.result(binding)
@@ -119,6 +145,7 @@ game_template = ERB.new <<-EOF
119
145
  class #{game_name_capitalize} < Gosu::Window
120
146
  def initialize(window_width, window_height)
121
147
  super(window_width,window_height,0)
148
+ @background_image = background_image "media/pario_background.png"
122
149
  end
123
150
 
124
151
  def update
@@ -128,7 +155,7 @@ class #{game_name_capitalize} < Gosu::Window
128
155
 
129
156
  def draw
130
157
  # Code to draw what you see goes here
131
- # TODO: Need more details
158
+ @background_image.draw 0,0,0
132
159
  end
133
160
  end
134
161
  EOF
data/lib/pario/version.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  module Pario #:nodoc:
2
2
  module Version
3
3
  MAJOR = '0'
4
- MINOR = '4'
5
- MICRO = '2'
4
+ MINOR = '5'
5
+ MICRO = '0'
6
6
 
7
7
  STRING = [MAJOR, MINOR, MICRO].compact.join('.')
8
8
  end
data/lib/util.rb CHANGED
@@ -1,21 +1,11 @@
1
1
  module Util
2
-
3
- # module Font
4
- # def initialize(window, size, obj=nil, name=nil)
5
- # super window, Gosu::default_font_name, size.to_i
6
- # end
7
- # def draw(text, color)
8
- # super text, 0, 0, 99, 1, 1, color
9
- # # @font.draw("Score: 0", 10, 10, 0, 1.0, 1.0, 0xffffff00)
10
- # end
11
- # end
12
-
2
+
13
3
  def background_image(pic)
14
4
  Gosu::Image.new(self, pic, true)
15
5
  end
16
6
 
17
7
  #########################
18
- # There are more key hooks than the ones below, this is just a start
8
+ # There are more keys than the ones below, this is just a start
19
9
  # TODO: link here to a key map of all of the possiblities
20
10
  # EXAMPLE:
21
11
  # if key_pressed? :left
metadata CHANGED
@@ -5,9 +5,9 @@ version: !ruby/object:Gem::Version
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 4
9
- - 2
10
- version: 0.4.2
8
+ - 5
9
+ - 0
10
+ version: 0.5.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Bill Davenport
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-02-22 00:00:00 -05:00
19
+ date: 2011-02-23 00:00:00 -05:00
20
20
  default_executable: pario
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency