glimmer_tetris 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,35 @@
1
+ require 'glimmer-dsl-swt'
2
+ require 'glimmer-cp-bevel'
3
+
4
+ require_relative '../app/glimmer_tetris/model/tetromino'
5
+
6
+ include Glimmer
7
+
8
+ puts 'Building app icon...'
9
+ icon_block_size = 64
10
+ icon_bevel_size = icon_block_size.to_f / 25.to_f
11
+ icon_bevel_pixel_size = 0.16*icon_block_size.to_f
12
+ icon_size = 8
13
+ icon_pixel_size = icon_block_size * icon_size
14
+ tetric_icon_image = image(icon_pixel_size, icon_pixel_size) {
15
+ icon_size.times { |row|
16
+ icon_size.times { |column|
17
+ colored = row >= 1 && column.between?(1, 6)
18
+ color = colored ? color(([:white] + GlimmerTetris::Model::Tetromino::LETTER_COLORS.values).sample) : color(:white)
19
+ x = column * icon_block_size
20
+ y = row * icon_block_size
21
+ bevel(x: x, y: y, base_color: color, size: icon_block_size)
22
+ }
23
+ }
24
+ }
25
+
26
+ puts 'Preparing app icon for saving to file...'
27
+ i = org.eclipse.swt.graphics.Image.new(display.swt_display, 512, 512)
28
+ gc = org.eclipse.swt.graphics.GC.new(i)
29
+ gc.drawImage(tetric_icon_image.swt_image, 0, 0)
30
+ il = ImageLoader.new
31
+ il.data = [i.image_data]
32
+
33
+ puts "Saving #{File.expand_path(File.join('..', 'package','linux', 'Glimmer Tetris.png'), __dir__)}"
34
+ il.save(File.expand_path(File.join('..', 'package','linux', 'Glimmer Tetris.png'), __dir__), swt(:image_png))
35
+ puts 'Done generating app icon.'
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env jruby
2
+
3
+ runner = File.expand_path('../../app/glimmer_tetris/launch.rb', __FILE__)
4
+
5
+ # Detect if inside a JAR file or not
6
+ if runner.include?('uri:classloader')
7
+ require runner
8
+ else
9
+ require 'glimmer/launcher'
10
+
11
+ launcher = Glimmer::Launcher.new([runner] + ARGV)
12
+ launcher.launch
13
+ end
data/config/warble.rb ADDED
@@ -0,0 +1,183 @@
1
+
2
+ # Disable Rake-environment-task framework detection by uncommenting/setting to false
3
+ # Warbler.framework_detection = false
4
+
5
+ # Warbler web application assembly configuration file
6
+ Warbler::Config.new do |config|
7
+ # Features: additional options controlling how the jar is built.
8
+ # Currently the following features are supported:
9
+ # - *gemjar*: package the gem repository in a jar file in WEB-INF/lib
10
+ # - *executable*: embed a web server and make the war executable
11
+ # - *runnable*: allows to run bin scripts e.g. `java -jar my.war -S rake -T`
12
+ # - *compiled*: compile .rb files to .class files
13
+ # config.features = %w(gemjar)
14
+
15
+ # Application directories to be included in the webapp.
16
+ config.dirs = %w(app bin config db docs fonts icons images lib package script sounds vendor videos)
17
+
18
+ # Additional files/directories to include, above those in config.dirs
19
+ config.includes = FileList['LICENSE.txt', 'VERSION']
20
+
21
+ # Additional files/directories to exclude
22
+ # config.excludes = FileList["lib/tasks/*"]
23
+
24
+ # Additional Java .jar files to include. Note that if .jar files are placed
25
+ # in lib (and not otherwise excluded) then they need not be mentioned here.
26
+ # JRuby and JRuby-Rack are pre-loaded in this list. Be sure to include your
27
+ # own versions if you directly set the value
28
+ # config.java_libs += FileList["lib/java/*.jar"]
29
+
30
+ # Loose Java classes and miscellaneous files to be included.
31
+ # config.java_classes = FileList["target/classes/**.*"]
32
+
33
+ # One or more pathmaps defining how the java classes should be copied into
34
+ # the archive. The example pathmap below accompanies the java_classes
35
+ # configuration above. See http://rake.rubyforge.org/classes/String.html#M000017
36
+ # for details of how to specify a pathmap.
37
+ # config.pathmaps.java_classes << "%{target/classes/,}p"
38
+
39
+ # Bundler support is built-in. If Warbler finds a Gemfile in the
40
+ # project directory, it will be used to collect the gems to bundle
41
+ # in your application. If you wish to explicitly disable this
42
+ # functionality, uncomment here.
43
+ # config.bundler = false
44
+
45
+ # An array of Bundler groups to avoid including in the war file.
46
+ # Defaults to ["development", "test", "assets"].
47
+ # config.bundle_without = []
48
+
49
+ # Other gems to be included. If you don't use Bundler or a gemspec
50
+ # file, you need to tell Warbler which gems your application needs
51
+ # so that they can be packaged in the archive.
52
+ # For Rails applications, the Rails gems are included by default
53
+ # unless the vendor/rails directory is present.
54
+ # config.gems += ["activerecord-jdbcmysql-adapter", "jruby-openssl"]
55
+ # config.gems << "tzinfo"
56
+
57
+ # Uncomment this if you don't want to package rails gem.
58
+ # config.gems -= ["rails"]
59
+
60
+ # The most recent versions of gems are used.
61
+ # You can specify versions of gems by using a hash assignment:
62
+ # config.gems["rails"] = "4.2.5"
63
+
64
+ # You can also use regexps or Gem::Dependency objects for flexibility or
65
+ # finer-grained control.
66
+ # config.gems << /^sinatra-/
67
+ # config.gems << Gem::Dependency.new("sinatra", "= 1.4.7")
68
+
69
+ # Include gem dependencies not mentioned specifically. Default is
70
+ # true, uncomment to turn off.
71
+ # config.gem_dependencies = false
72
+
73
+ # Array of regular expressions matching relative paths in gems to be
74
+ # excluded from the war. Defaults to empty, but you can set it like
75
+ # below, which excludes test files.
76
+ # config.gem_excludes = [/^(test|spec)\//]
77
+
78
+ # Pathmaps for controlling how application files are copied into the archive
79
+ # config.pathmaps.application = ["WEB-INF/%p"]
80
+
81
+ # Name of the archive (without the extension). Defaults to the basename
82
+ # of the project directory.
83
+ # config.jar_name = "mywar"
84
+
85
+ # File extension for the archive. Defaults to either 'jar' or 'war'.
86
+ # config.jar_extension = "jar"
87
+
88
+ # Destionation for the created archive. Defaults to project's root directory.
89
+ config.autodeploy_dir = "dist/"
90
+
91
+ # Name of the MANIFEST.MF template for the war file. Defaults to a simple
92
+ # MANIFEST.MF that contains the version of Warbler used to create the war file.
93
+ # config.manifest_file = "config/MANIFEST.MF"
94
+
95
+ # When using the 'compiled' feature and specified, only these Ruby
96
+ # files will be compiled. Default is to compile all \.rb files in
97
+ # the application.
98
+ # config.compiled_ruby_files = FileList['app/**/*.rb']
99
+
100
+ # Determines if ruby files in supporting gems will be compiled.
101
+ # Ignored unless compile feature is used.
102
+ # config.compile_gems = false
103
+
104
+ # When set it specify the bytecode version for compiled class files
105
+ # config.bytecode_version = "1.6"
106
+
107
+ # When set to true, Warbler will override the value of ENV['GEM_HOME'] even it
108
+ # has already been set. When set to false it will use any existing value of
109
+ # GEM_HOME if it is set.
110
+ # config.override_gem_home = true
111
+
112
+ # Allows for specifing custom executables
113
+ # config.executable = ["rake", "bin/rake"]
114
+
115
+ # Sets default (prefixed) parameters for the executables
116
+ # config.executable_params = "do:something"
117
+
118
+ # If set to true, moves jar files into WEB-INF/lib. Prior to version 1.4.2 of Warbler this was done
119
+ # by default. But since 1.4.2 this config defaults to false. It may need to be set to true for
120
+ # web servers that do not explode the WAR file.
121
+ # Alternatively, this option can be set to a regular expression, which will
122
+ # act as a jar selector -- only jar files that match the pattern will be
123
+ # included in the archive.
124
+ # config.move_jars_to_webinf_lib = false
125
+
126
+ # === War files only below here ===
127
+
128
+ # Embedded webserver to use with the 'executable' feature. Currently supported
129
+ # webservers are:
130
+ # - *jetty* - Embedded Jetty from Eclipse
131
+ # config.webserver = 'jetty'
132
+
133
+ # Path to the pre-bundled gem directory inside the war file. Default
134
+ # is 'WEB-INF/gems'. Specify path if gems are already bundled
135
+ # before running Warbler. This also sets 'gem.path' inside web.xml.
136
+ # config.gem_path = "WEB-INF/vendor/bundler_gems"
137
+
138
+ # Files for WEB-INF directory (next to web.xml). This contains
139
+ # web.xml by default. If there is an .erb-File it will be processed
140
+ # with webxml-config. You may want to exclude this file via
141
+ # config.excludes.
142
+ # config.webinf_files += FileList["jboss-web.xml"]
143
+
144
+ # Files to be included in the root of the webapp. Note that files in public
145
+ # will have the leading 'public/' part of the path stripped during staging.
146
+ # config.public_html = FileList["public/**/*", "doc/**/*"]
147
+
148
+ # Pathmaps for controlling how public HTML files are copied into the .war
149
+ # config.pathmaps.public_html = ["%{public/,}p"]
150
+
151
+ # Value of RAILS_ENV for the webapp -- default as shown below
152
+ # config.webxml.rails.env = ENV['RAILS_ENV'] || 'production'
153
+
154
+ # Public ROOT mapping, by default assets are copied into .war ROOT directory.
155
+ # config.public.root = ''
156
+
157
+ # Application booter to use, either :rack or :rails (autodetected by default)
158
+ # config.webxml.booter = :rails
159
+
160
+ # When using the :rack booter, "Rackup" script to use.
161
+ # - For 'rackup.path', the value points to the location of the rackup
162
+ # script in the web archive file. You need to make sure this file
163
+ # gets included in the war, possibly by adding it to config.includes
164
+ # or config.webinf_files above.
165
+ # - For 'rackup', the rackup script you provide as an inline string
166
+ # is simply embedded in web.xml.
167
+ # The script is evaluated in a Rack::Builder to load the application.
168
+ # Examples:
169
+ # config.webxml.rackup.path = 'WEB-INF/hello.ru'
170
+ # config.webxml.rackup = %{require './lib/demo'; run Rack::Adapter::Camping.new(Demo)}
171
+ # config.webxml.rackup = require 'cgi' && CGI::escapeHTML(File.read("config.ru"))
172
+
173
+ # Control the pool of Rails runtimes. Leaving unspecified means
174
+ # the pool will grow as needed to service requests. It is recommended
175
+ # that you fix these values when running a production server!
176
+ # If you're using threadsafe! mode, you probably don't want to set these values,
177
+ # since 1 runtime(default for threadsafe mode) will be enough.
178
+ # config.webxml.jruby.min.runtimes = 2
179
+ # config.webxml.jruby.max.runtimes = 4
180
+
181
+ # JNDI data source name
182
+ # config.webxml.jndi = 'jdbc/rails'
183
+ end
Binary file
Binary file
Binary file
metadata ADDED
@@ -0,0 +1,153 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: glimmer_tetris
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Andy Maleh
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-07-25 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - "~>"
17
+ - !ruby/object:Gem::Version
18
+ version: 4.20.0.0
19
+ name: glimmer-dsl-swt
20
+ prerelease: false
21
+ type: :runtime
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 4.20.0.0
27
+ - !ruby/object:Gem::Dependency
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - "~>"
31
+ - !ruby/object:Gem::Version
32
+ version: 0.1.1
33
+ name: glimmer-cp-bevel
34
+ prerelease: false
35
+ type: :runtime
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.1.1
41
+ - !ruby/object:Gem::Dependency
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: 3.5.0
47
+ name: rspec
48
+ prerelease: false
49
+ type: :development
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 3.5.0
55
+ - !ruby/object:Gem::Dependency
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - '='
59
+ - !ruby/object:Gem::Version
60
+ version: 2.4.9
61
+ name: juwelier
62
+ prerelease: false
63
+ type: :development
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '='
67
+ - !ruby/object:Gem::Version
68
+ version: 2.4.9
69
+ - !ruby/object:Gem::Dependency
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - '='
73
+ - !ruby/object:Gem::Version
74
+ version: 2.0.5
75
+ name: warbler
76
+ prerelease: false
77
+ type: :development
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '='
81
+ - !ruby/object:Gem::Version
82
+ version: 2.0.5
83
+ - !ruby/object:Gem::Dependency
84
+ requirement: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ name: simplecov
90
+ prerelease: false
91
+ type: :development
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description: Glimmer Tetris
98
+ email: 23052+AndyObtiva@users.noreply.github.com
99
+ executables:
100
+ - glimmer_tetris
101
+ extensions: []
102
+ extra_rdoc_files:
103
+ - LICENSE.txt
104
+ - README.md
105
+ files:
106
+ - LICENSE.txt
107
+ - README.md
108
+ - VERSION
109
+ - app/glimmer_tetris.rb
110
+ - app/glimmer_tetris/launch.rb
111
+ - app/glimmer_tetris/model/block.rb
112
+ - app/glimmer_tetris/model/game.rb
113
+ - app/glimmer_tetris/model/past_game.rb
114
+ - app/glimmer_tetris/model/tetromino.rb
115
+ - app/glimmer_tetris/view/app_view.rb
116
+ - app/glimmer_tetris/view/block.rb
117
+ - app/glimmer_tetris/view/high_score_dialog.rb
118
+ - app/glimmer_tetris/view/playfield.rb
119
+ - app/glimmer_tetris/view/score_lane.rb
120
+ - app/glimmer_tetris/view/tetris_menu_bar.rb
121
+ - bin/generate_app_icon.rb
122
+ - bin/glimmer_tetris
123
+ - config/warble.rb
124
+ - package/linux/Glimmer Tetris.png
125
+ - package/macosx/Glimmer Tetris.icns
126
+ - package/windows/Glimmer Tetris.ico
127
+ - vendor/jars/org/yaml/snakeyaml/1.28/snakeyaml-1.28.jar
128
+ homepage: http://github.com/AMaleh/glimmer_tetris
129
+ licenses:
130
+ - MIT
131
+ metadata: {}
132
+ post_install_message:
133
+ rdoc_options: []
134
+ require_paths:
135
+ - vendor
136
+ - lib
137
+ - app
138
+ required_ruby_version: !ruby/object:Gem::Requirement
139
+ requirements:
140
+ - - ">="
141
+ - !ruby/object:Gem::Version
142
+ version: '0'
143
+ required_rubygems_version: !ruby/object:Gem::Requirement
144
+ requirements:
145
+ - - ">="
146
+ - !ruby/object:Gem::Version
147
+ version: '0'
148
+ requirements: []
149
+ rubygems_version: 3.1.6
150
+ signing_key:
151
+ specification_version: 4
152
+ summary: Glimmer Tetris
153
+ test_files: []