motion-template-spritekit 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +6 -1
- data/Rakefile +5 -0
- data/ext/extconf.rb +1 -1
- data/motion-template-spritekit.gemspec +1 -1
- data/template/spritekit-tvos/files/Gemfile +4 -0
- data/template/spritekit-tvos/files/README.md.erb +1 -0
- data/template/spritekit-tvos/files/Rakefile.erb +15 -0
- data/template/spritekit-tvos/files/app/app_delegate.rb +9 -0
- data/template/spritekit-tvos/files/app/my_scene.rb +29 -0
- data/template/spritekit-tvos/files/app/sprite_kit_base.rb +1 -0
- data/template/spritekit-tvos/files/app/view_controller.rb +40 -0
- data/template/spritekit-tvos/files/resources/Spaceship.png +0 -0
- data/template/spritekit-tvos/files/spec/main_spec.rb.erb +9 -0
- metadata +16 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9bb4ae24d66357254a37780f6d82196ef988801
|
4
|
+
data.tar.gz: 72d7e2d897efb585ec6d64e30232921f69bcc54a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e992763d9e220aaa65da7109ab4a333a374034ebcdb6a3b05333fde1ceb347262b02ec02b8bbf46ae363552f9eec00cdd672bf4f8a803152943bdcb0fd2fa66
|
7
|
+
data.tar.gz: 9b9aae8daf325c77d68940ce487d2f854e6109895524d70a5596e7865cada7374d7b36ec0d276ed051da2a1cec7d38fec9221008eb4e3fe755a9619ba28ec4cb
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
# motion-template-spritekit
|
1
|
+
# motion-template-spritekit
|
2
|
+
[![Gem Version](https://img.shields.io/gem/v/motion-template-spritekit.svg)](http://badge.fury.io/rb/motion-template-spritekit)
|
2
3
|
|
3
4
|
SpriteKit project template for RubyMotion
|
4
5
|
|
@@ -18,6 +19,10 @@ Install it yourself as:
|
|
18
19
|
|
19
20
|
$ motion create --template=spritekit-osx <app-name>
|
20
21
|
|
22
|
+
### tvOS
|
23
|
+
|
24
|
+
$ motion create --template=spritekit-tvos <app-name>
|
25
|
+
|
21
26
|
## In Addition
|
22
27
|
|
23
28
|
If you need original `Spaceship.png` image, please copy from your own.
|
data/Rakefile
ADDED
data/ext/extconf.rb
CHANGED
@@ -3,7 +3,7 @@ require 'fileutils'
|
|
3
3
|
|
4
4
|
dir = File.expand_path("~/Library/RubyMotion/template/")
|
5
5
|
dir_src_templates = File.expand_path(File.join(File.dirname(__FILE__), "../template"))
|
6
|
-
templates = %w(spritekit-ios spritekit-osx)
|
6
|
+
templates = %w(spritekit-ios spritekit-osx spritekit-tvos)
|
7
7
|
templates.each do |template|
|
8
8
|
src = File.join(dir_src_templates, template)
|
9
9
|
dst = File.join(dir, template)
|
@@ -0,0 +1 @@
|
|
1
|
+
# <%= name %>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
$:.unshift("/Library/RubyMotion/lib")
|
3
|
+
require 'motion/project/template/tvos'
|
4
|
+
|
5
|
+
begin
|
6
|
+
require 'bundler'
|
7
|
+
Bundler.require
|
8
|
+
rescue LoadError
|
9
|
+
end
|
10
|
+
|
11
|
+
Motion::Project::App.setup do |app|
|
12
|
+
# Use `rake config' to see complete project settings.
|
13
|
+
app.name = '<%= name %>'
|
14
|
+
app.frameworks += ["SpriteKit"]
|
15
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
class AppDelegate
|
2
|
+
def application(application, didFinishLaunchingWithOptions:launchOptions)
|
3
|
+
scene_view = ViewController.alloc.init
|
4
|
+
@window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)
|
5
|
+
@window.rootViewController = scene_view
|
6
|
+
@window.makeKeyAndVisible
|
7
|
+
true
|
8
|
+
end
|
9
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
class MyScene < SKScene
|
2
|
+
def initWithSize(size)
|
3
|
+
super
|
4
|
+
|
5
|
+
self.backgroundColor = SKColor.colorWithRed(0.15, green: 0.15, blue: 0.3, alpha: 1.0)
|
6
|
+
my_label = SKLabelNode.labelNodeWithFontNamed("Chalkduster")
|
7
|
+
my_label.text = "Hello, World!"
|
8
|
+
my_label.fontSize = 30
|
9
|
+
my_label.position = CGPointMake(CGRectGetMidX(self.frame),
|
10
|
+
CGRectGetMidY(self.frame))
|
11
|
+
self.addChild(my_label)
|
12
|
+
self
|
13
|
+
end
|
14
|
+
|
15
|
+
def touchesBegan(touches, withEvent: event)
|
16
|
+
touches.each do |touch|
|
17
|
+
location = touch.locationInNode(self)
|
18
|
+
sprite = SKSpriteNode.spriteNodeWithImageNamed("Spaceship")
|
19
|
+
sprite.position = location
|
20
|
+
action = SKAction.rotateByAngle(Math::PI, duration: 1)
|
21
|
+
sprite.runAction(SKAction.repeatActionForever(action))
|
22
|
+
self.addChild(sprite)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def update(current_time)
|
27
|
+
# Called before each frame is rendered
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
SKColor = UIColor
|
@@ -0,0 +1,40 @@
|
|
1
|
+
class ViewController < UIViewController
|
2
|
+
|
3
|
+
def loadView
|
4
|
+
bounds = UIScreen.mainScreen.bounds
|
5
|
+
self.view = SKView.alloc.initWithFrame(bounds)
|
6
|
+
end
|
7
|
+
|
8
|
+
def viewDidLoad
|
9
|
+
super
|
10
|
+
|
11
|
+
# Configure the view.
|
12
|
+
sk_view = self.view
|
13
|
+
sk_view.showsFPS = true
|
14
|
+
sk_view.showsNodeCount = true
|
15
|
+
|
16
|
+
# Create and configure the scene.
|
17
|
+
scene = MyScene.sceneWithSize(sk_view.bounds.size)
|
18
|
+
scene.scaleMode = SKSceneScaleModeAspectFill
|
19
|
+
|
20
|
+
# Present the scene.
|
21
|
+
sk_view.presentScene(scene)
|
22
|
+
end
|
23
|
+
|
24
|
+
def shouldAutorotate
|
25
|
+
true
|
26
|
+
end
|
27
|
+
|
28
|
+
def supportedInterfaceOrientations
|
29
|
+
if UIDevice.currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPhone
|
30
|
+
UIInterfaceOrientationMaskAllButUpsideDown
|
31
|
+
else
|
32
|
+
UIInterfaceOrientationMaskAll
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def didReceiveMemoryWarning
|
37
|
+
super
|
38
|
+
# Release any cached data, images, etc that aren't in use.
|
39
|
+
end
|
40
|
+
end
|
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: motion-template-spritekit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- meganemura
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-11-27 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: SpriteKit project templates for RubyMotion (iOS/OSX)
|
14
14
|
email:
|
@@ -18,10 +18,11 @@ extensions:
|
|
18
18
|
- ext/extconf.rb
|
19
19
|
extra_rdoc_files: []
|
20
20
|
files:
|
21
|
-
- .gitignore
|
21
|
+
- ".gitignore"
|
22
22
|
- Gemfile
|
23
23
|
- LICENSE.txt
|
24
24
|
- README.md
|
25
|
+
- Rakefile
|
25
26
|
- ext/extconf.rb
|
26
27
|
- motion-template-spritekit.gemspec
|
27
28
|
- template/spritekit-ios/files/.gitignore
|
@@ -47,6 +48,15 @@ files:
|
|
47
48
|
- template/spritekit-osx/files/resources/Credits.rtf
|
48
49
|
- template/spritekit-osx/files/resources/Spaceship.png
|
49
50
|
- template/spritekit-osx/files/spec/main_spec.rb.erb
|
51
|
+
- template/spritekit-tvos/files/Gemfile
|
52
|
+
- template/spritekit-tvos/files/README.md.erb
|
53
|
+
- template/spritekit-tvos/files/Rakefile.erb
|
54
|
+
- template/spritekit-tvos/files/app/app_delegate.rb
|
55
|
+
- template/spritekit-tvos/files/app/my_scene.rb
|
56
|
+
- template/spritekit-tvos/files/app/sprite_kit_base.rb
|
57
|
+
- template/spritekit-tvos/files/app/view_controller.rb
|
58
|
+
- template/spritekit-tvos/files/resources/Spaceship.png
|
59
|
+
- template/spritekit-tvos/files/spec/main_spec.rb.erb
|
50
60
|
homepage: https://github.com/meganemura/motion-template-spritekit
|
51
61
|
licenses:
|
52
62
|
- MIT
|
@@ -57,17 +67,17 @@ require_paths:
|
|
57
67
|
- lib
|
58
68
|
required_ruby_version: !ruby/object:Gem::Requirement
|
59
69
|
requirements:
|
60
|
-
- -
|
70
|
+
- - ">="
|
61
71
|
- !ruby/object:Gem::Version
|
62
72
|
version: '0'
|
63
73
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
64
74
|
requirements:
|
65
|
-
- -
|
75
|
+
- - ">="
|
66
76
|
- !ruby/object:Gem::Version
|
67
77
|
version: '0'
|
68
78
|
requirements: []
|
69
79
|
rubyforge_project:
|
70
|
-
rubygems_version: 2.
|
80
|
+
rubygems_version: 2.2.2
|
71
81
|
signing_key:
|
72
82
|
specification_version: 4
|
73
83
|
summary: Setup SpriteKit template to user's directory
|