ruby2d 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/ruby2d +6 -0
- data/ext/ruby2d/extconf.rb +4 -1
- data/lib/ruby2d.rb +1 -0
- data/lib/ruby2d/font.rb +54 -0
- data/lib/ruby2d/text.rb +1 -1
- data/lib/ruby2d/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aba47e3b04390bdf27cf2480419d09173683eca948a494790c5bc5c617b9ffbf
|
4
|
+
data.tar.gz: 8dff61a42195fdcb9d87bbfa35981c80a91ad4b4e0a61d72b9821fac479dc913
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 87e61972f9877759df9623c3e5cd4d5141ccb8fd743f59de30359be9c4be37fbf4158a72e8b641f17847af135d5df4d523f28607341ea694a695e5566adb9906
|
7
|
+
data.tar.gz: 301dae8cf14f3b85eb5c9fe0bf6925d058330cbaa9d1ee33dd6b4272cf948b2cf4ecc845c188b0e95e342bd253bea02a07afcc265656ef9657992a8d47dbab35
|
data/bin/ruby2d
CHANGED
@@ -6,6 +6,7 @@ require 'fileutils'
|
|
6
6
|
class String
|
7
7
|
def colorize(c); "\e[#{c}m#{self}\e[0m" end
|
8
8
|
def bold; colorize('1') end
|
9
|
+
def warn; colorize('1;33') end
|
9
10
|
def error; colorize('1;31') end
|
10
11
|
end
|
11
12
|
|
@@ -27,6 +28,7 @@ end
|
|
27
28
|
'triangle',
|
28
29
|
'image',
|
29
30
|
'sprite',
|
31
|
+
'font',
|
30
32
|
'text',
|
31
33
|
'sound',
|
32
34
|
'music'
|
@@ -119,6 +121,9 @@ end
|
|
119
121
|
|
120
122
|
# Build a web-based version of the provided Ruby application
|
121
123
|
def build_web(rb_file)
|
124
|
+
puts "Warning: ".warn + "This feature is currently disabled while it's being upgraded."
|
125
|
+
return
|
126
|
+
|
122
127
|
check_build_src_file(rb_file)
|
123
128
|
|
124
129
|
# Assemble the Ruby 2D library in one `.rb` file and compile to JS
|
@@ -290,6 +295,7 @@ To compile and create a native executable, use:
|
|
290
295
|
|
291
296
|
To build for the web, creating a JavaScript and HTML package, use:
|
292
297
|
build --web <ruby_file>
|
298
|
+
#{"Warning:".warn} #{"This feature is currently disabled while it's being upgraded.".bold}
|
293
299
|
|
294
300
|
To build an iOS or tvOS app, use the following:
|
295
301
|
build --ios <ruby_file>
|
data/ext/ruby2d/extconf.rb
CHANGED
@@ -74,7 +74,10 @@ end
|
|
74
74
|
check_s2d_version
|
75
75
|
|
76
76
|
# Add flags
|
77
|
-
$CFLAGS
|
77
|
+
$CFLAGS << ' -std=c11 -I/usr/local/include'
|
78
|
+
if `cat /etc/os-release` =~ /raspbian/ # Raspberry Pi
|
79
|
+
$CFLAGS << ' -I/opt/vc/include'
|
80
|
+
end
|
78
81
|
$LDFLAGS << ' ' << `bash simple2d --libs`
|
79
82
|
$LDFLAGS.gsub!(/\n/, ' ') # remove newlines in flags, they cause problems
|
80
83
|
|
data/lib/ruby2d.rb
CHANGED
data/lib/ruby2d/font.rb
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
# Ruby2D::Font
|
2
|
+
|
3
|
+
module Ruby2D
|
4
|
+
class Font
|
5
|
+
|
6
|
+
class << self
|
7
|
+
|
8
|
+
# List all fonts, names only
|
9
|
+
def all
|
10
|
+
all_paths.map { |path| path.split('/').last.chomp('.ttf').downcase }.uniq.sort
|
11
|
+
end
|
12
|
+
|
13
|
+
# Find a font file path from its name
|
14
|
+
def path(font_name)
|
15
|
+
all_paths.find { |path| path.downcase.include?(font_name) }
|
16
|
+
end
|
17
|
+
|
18
|
+
# Get all fonts with full file paths
|
19
|
+
def all_paths
|
20
|
+
fonts = `find #{directory} -name *.ttf`.split("\n")
|
21
|
+
fonts = fonts.reject do |f|
|
22
|
+
f.downcase.include?('bold') ||
|
23
|
+
f.downcase.include?('italic') ||
|
24
|
+
f.downcase.include?('oblique') ||
|
25
|
+
f.downcase.include?('narrow') ||
|
26
|
+
f.downcase.include?('black')
|
27
|
+
end
|
28
|
+
fonts.sort_by { |f| f.downcase.chomp '.ttf' }
|
29
|
+
end
|
30
|
+
|
31
|
+
# Get the default font
|
32
|
+
def default
|
33
|
+
if all.include? 'arial'
|
34
|
+
path 'arial'
|
35
|
+
else
|
36
|
+
all_paths.first
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
# Get the fonts directory for the current platform
|
41
|
+
def directory
|
42
|
+
if `uname`.include? 'Darwin' # macOS
|
43
|
+
"/Library/Fonts"
|
44
|
+
elsif `uname`.include? 'Linux'
|
45
|
+
"/usr/share/fonts/truetype"
|
46
|
+
elsif `uname`.include? 'MINGW'
|
47
|
+
"C:/Windows/Fonts"
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
end
|
data/lib/ruby2d/text.rb
CHANGED
data/lib/ruby2d/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby2d
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Black
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-10-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opal
|
@@ -155,6 +155,7 @@ files:
|
|
155
155
|
- lib/ruby2d/color.rb
|
156
156
|
- lib/ruby2d/dsl.rb
|
157
157
|
- lib/ruby2d/exceptions.rb
|
158
|
+
- lib/ruby2d/font.rb
|
158
159
|
- lib/ruby2d/image.rb
|
159
160
|
- lib/ruby2d/line.rb
|
160
161
|
- lib/ruby2d/music.rb
|