motion-template-spritekit 0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +29 -0
- data/ext/extconf.rb +19 -0
- data/template/spritekit-ios/files/Gemfile +4 -0
- data/template/spritekit-ios/files/README.md.erb +1 -0
- data/template/spritekit-ios/files/Rakefile.erb +15 -0
- data/template/spritekit-ios/files/app/app_delegate.rb +9 -0
- data/template/spritekit-ios/files/app/my_scene.rb +29 -0
- data/template/spritekit-ios/files/app/sprite_kit_base.rb +1 -0
- data/template/spritekit-ios/files/app/view_controller.rb +40 -0
- data/template/spritekit-ios/files/resources/Default-568h@2x.png +0 -0
- data/template/spritekit-ios/files/spec/main_spec.rb.erb +9 -0
- metadata +56 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3b41e29bf132b1c998da4f6024ae74706785506f
|
4
|
+
data.tar.gz: ac9182d68e1f2029f800a62bb1ba05613551af97
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 40b54d821945ea69a30b3714f757d4bbc47d9b63446cd2f4a3f83df8bc0a2b58b261f831386c856727b24ccb544a9ecf3e2175a80280d26fa8c11a70b107c68b
|
7
|
+
data.tar.gz: ed824ffe203609e9b11eefb154bdf985b1ad06b02260f552635965fdd1bf0ea09e40989b9705cf0885e3922b51f3bc8cf91d45dbd41f6a1bb55c816430f54b19
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# motion-template-spritekit
|
2
|
+
|
3
|
+
Project template for SpriteKit with RubyMotion
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'motion-template-spritekit'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install motion-template-spritekit
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
$ motion create --template=spritekit-ios <app-name>
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create new Pull Request
|
data/ext/extconf.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# Template Installer
|
2
|
+
require 'fileutils'
|
3
|
+
|
4
|
+
dir = File.expand_path("~/Library/RubyMotion/template/")
|
5
|
+
dir_src_templates = File.expand_path(File.join(File.dirname(__FILE__), "../template"))
|
6
|
+
templates = %w(spritekit-ios)
|
7
|
+
templates.each do |template|
|
8
|
+
src = File.join(dir_src_templates, template)
|
9
|
+
dst = File.join(dir, template)
|
10
|
+
|
11
|
+
FileUtils.mkdir_p(dir) unless File.exist?(dir)
|
12
|
+
FileUtils.rm_f dst if File.exist?(dst)
|
13
|
+
FileUtils.ln_s src, dst
|
14
|
+
end
|
15
|
+
|
16
|
+
|
17
|
+
### dummy ###
|
18
|
+
require 'mkmf'
|
19
|
+
create_makefile('')
|
@@ -0,0 +1 @@
|
|
1
|
+
# <%= name %>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
$:.unshift("/Library/RubyMotion/lib")
|
3
|
+
require 'motion/project/template/ios'
|
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
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: motion-template-spritekit
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '0.1'
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- meganemura
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-11-16 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Project template for SpriteKit with RubyMotion
|
14
|
+
email:
|
15
|
+
- mura2megane@gmail.com
|
16
|
+
executables: []
|
17
|
+
extensions:
|
18
|
+
- ext/extconf.rb
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- README.md
|
22
|
+
- ext/extconf.rb
|
23
|
+
- template/spritekit-ios/files/app/app_delegate.rb
|
24
|
+
- template/spritekit-ios/files/app/my_scene.rb
|
25
|
+
- template/spritekit-ios/files/app/sprite_kit_base.rb
|
26
|
+
- template/spritekit-ios/files/app/view_controller.rb
|
27
|
+
- template/spritekit-ios/files/Gemfile
|
28
|
+
- template/spritekit-ios/files/Rakefile.erb
|
29
|
+
- template/spritekit-ios/files/README.md.erb
|
30
|
+
- template/spritekit-ios/files/resources/Default-568h@2x.png
|
31
|
+
- template/spritekit-ios/files/spec/main_spec.rb.erb
|
32
|
+
homepage: https://github.com/meganemura/motion-template-spritekit
|
33
|
+
licenses:
|
34
|
+
- MIT
|
35
|
+
metadata: {}
|
36
|
+
post_install_message:
|
37
|
+
rdoc_options: []
|
38
|
+
require_paths:
|
39
|
+
- lib
|
40
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
41
|
+
requirements:
|
42
|
+
- - '>='
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '0'
|
45
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - '>='
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0'
|
50
|
+
requirements: []
|
51
|
+
rubyforge_project:
|
52
|
+
rubygems_version: 2.0.3
|
53
|
+
signing_key:
|
54
|
+
specification_version: 4
|
55
|
+
summary: Setup SpriteKit template to user's directory
|
56
|
+
test_files: []
|