coronate 0.0.3 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.md +24 -6
- data/bin/coronate +2 -1
- data/lib/coronate/builder/app_builder.rb +27 -0
- data/lib/coronate/builder/ebook_builder.rb +25 -0
- data/lib/coronate/builder/game_builder.rb +25 -0
- data/lib/coronate/builder/project_builder.rb +21 -0
- data/lib/coronate/builder/scene_builder.rb +13 -0
- data/lib/coronate/builder/templates/app/build.settings.tt +41 -0
- data/lib/coronate/builder/templates/app/config.lua.tt +29 -0
- data/lib/coronate/builder/templates/app/icon1-down.png +0 -0
- data/lib/coronate/builder/templates/app/icon1-down@2x.png +0 -0
- data/lib/coronate/builder/templates/app/icon1.png +0 -0
- data/lib/coronate/builder/templates/app/icon1@2x.png +0 -0
- data/lib/coronate/builder/templates/app/icon2-down.png +0 -0
- data/lib/coronate/builder/templates/app/icon2-down@2x.png +0 -0
- data/lib/coronate/builder/templates/app/icon2.png +0 -0
- data/lib/coronate/builder/templates/app/icon2@2x.png +0 -0
- data/lib/coronate/builder/templates/app/main.lua.tt +39 -0
- data/lib/coronate/builder/templates/app/view1.lua.tt +88 -0
- data/lib/coronate/builder/templates/app/view2.lua.tt +89 -0
- data/lib/coronate/builder/templates/ebook/build.settings.tt +41 -0
- data/lib/coronate/builder/templates/ebook/config.lua.tt +29 -0
- data/lib/coronate/builder/templates/ebook/coronaicon-big.png +0 -0
- data/lib/coronate/builder/templates/ebook/cover.jpg +0 -0
- data/lib/coronate/builder/templates/ebook/main.lua.tt +14 -0
- data/lib/coronate/builder/templates/ebook/moon.png +0 -0
- data/lib/coronate/builder/templates/ebook/page1.lua.tt +225 -0
- data/lib/coronate/builder/templates/ebook/pagebg1.png +0 -0
- data/lib/coronate/builder/templates/ebook/space.jpg +0 -0
- data/lib/coronate/builder/templates/ebook/sun.png +0 -0
- data/lib/coronate/builder/templates/ebook/title.lua.tt +97 -0
- data/lib/coronate/builder/templates/game/background.jpg +0 -0
- data/lib/coronate/builder/templates/game/build.settings.tt +41 -0
- data/lib/coronate/builder/templates/game/button-over.png +0 -0
- data/lib/coronate/builder/templates/game/button.png +0 -0
- data/lib/coronate/builder/templates/game/config.lua.tt +29 -0
- data/lib/coronate/builder/templates/game/crate.png +0 -0
- data/lib/coronate/builder/templates/game/grass.png +0 -0
- data/lib/coronate/builder/templates/game/level1.lua.tt +102 -0
- data/lib/coronate/builder/templates/game/logo.png +0 -0
- data/lib/coronate/builder/templates/game/main.lua.tt +14 -0
- data/lib/coronate/builder/templates/game/menu.lua.tt +115 -0
- data/lib/coronate/{templates → builder/templates/project}/build.settings.tt +0 -0
- data/lib/coronate/{templates → builder/templates/project}/config.tt +15 -0
- data/lib/coronate/{templates → builder/templates/project}/endingScene.tt +0 -0
- data/lib/coronate/{templates → builder/templates/project}/main.tt +0 -0
- data/lib/coronate/{templates → builder/templates/project}/menuScene.tt +0 -0
- data/lib/coronate/{templates → builder/templates/project}/settingsScene.tt +0 -0
- data/lib/coronate/{templates → builder/templates/project}/titleScene.tt +0 -0
- data/lib/coronate/{templates → builder/templates/project}/utils.tt +0 -0
- data/lib/coronate/builder/templates/scene/scene.tt +148 -0
- data/lib/coronate/cli.rb +56 -17
- metadata +51 -11
- data/lib/coronate/templates/scene.tt +0 -82
@@ -0,0 +1,148 @@
|
|
1
|
+
-- Create a scene object to tie functions to.
|
2
|
+
local storyboard = require( "storyboard" )
|
3
|
+
local scene = storyboard.newScene()
|
4
|
+
|
5
|
+
-- ============================================================================
|
6
|
+
-- Called when the scene's view does not exist.
|
7
|
+
-- ============================================================================
|
8
|
+
function scene:createScene(inEvent)
|
9
|
+
utils:log("Scene", "createScene()");
|
10
|
+
local group = self.view
|
11
|
+
|
12
|
+
-----------------------------------------------------------------------------
|
13
|
+
|
14
|
+
-- CREATE display objects and add them to 'group' here.
|
15
|
+
-- Example use-case: Restore 'group' from previously saved state.
|
16
|
+
|
17
|
+
-----------------------------------------------------------------------------
|
18
|
+
end -- End createScene().
|
19
|
+
|
20
|
+
|
21
|
+
-- ============================================================================
|
22
|
+
-- Called BEFORE scene has moved on screen.
|
23
|
+
-- ============================================================================
|
24
|
+
function scene:willEnterScene(inEvent)
|
25
|
+
utils:log("Scene", "willEnterScene()");
|
26
|
+
local group = self.view
|
27
|
+
|
28
|
+
-----------------------------------------------------------------------------
|
29
|
+
|
30
|
+
-- CREATE display objects and add them to 'group' here.
|
31
|
+
-- Example use-case: Restore 'group' from previously saved state.
|
32
|
+
|
33
|
+
-----------------------------------------------------------------------------
|
34
|
+
end -- End willEnterScene().
|
35
|
+
|
36
|
+
|
37
|
+
-- ============================================================================
|
38
|
+
-- Called AFTER scene has moved on screen.
|
39
|
+
-- ============================================================================
|
40
|
+
function scene:enterScene(inEvent)
|
41
|
+
utils:log("Scene", "enterScene()");
|
42
|
+
local group = self.view
|
43
|
+
|
44
|
+
-----------------------------------------------------------------------------
|
45
|
+
|
46
|
+
-- CREATE display objects and add them to 'group' here.
|
47
|
+
-- Example use-case: Restore 'group' from previously saved state.
|
48
|
+
|
49
|
+
-----------------------------------------------------------------------------
|
50
|
+
end -- End enterScene().
|
51
|
+
|
52
|
+
|
53
|
+
-- ============================================================================
|
54
|
+
-- Called BEFORE scene moves off screen.
|
55
|
+
-- ============================================================================
|
56
|
+
function scene:exitScene(inEvent)
|
57
|
+
utils:log("Scene", "exitScene()");
|
58
|
+
local group = self.view
|
59
|
+
|
60
|
+
-----------------------------------------------------------------------------
|
61
|
+
|
62
|
+
-- CREATE display objects and add them to 'group' here.
|
63
|
+
-- Example use-case: Restore 'group' from previously saved state.
|
64
|
+
|
65
|
+
-----------------------------------------------------------------------------
|
66
|
+
end -- End exitScene().
|
67
|
+
|
68
|
+
|
69
|
+
-- ============================================================================
|
70
|
+
-- Called AFTER scene has moved off screen.
|
71
|
+
-- ============================================================================
|
72
|
+
function scene:didExitScene(inEvent)
|
73
|
+
utils:log("Scene", "didExitScene()");
|
74
|
+
local group = self.view
|
75
|
+
|
76
|
+
-----------------------------------------------------------------------------
|
77
|
+
|
78
|
+
-- CREATE display objects and add them to 'group' here.
|
79
|
+
-- Example use-case: Restore 'group' from previously saved state.
|
80
|
+
|
81
|
+
-----------------------------------------------------------------------------
|
82
|
+
end -- End didExitScene().
|
83
|
+
|
84
|
+
|
85
|
+
-- ============================================================================
|
86
|
+
-- Called prior to the removal of scene's "view" (display group).
|
87
|
+
-- ============================================================================
|
88
|
+
function scene:destroyScene(inEvent)
|
89
|
+
utils:log("Scene", "destroyScene()");
|
90
|
+
local group = self.view
|
91
|
+
|
92
|
+
-----------------------------------------------------------------------------
|
93
|
+
|
94
|
+
-- CREATE display objects and add them to 'group' here.
|
95
|
+
-- Example use-case: Restore 'group' from previously saved state.
|
96
|
+
|
97
|
+
-----------------------------------------------------------------------------
|
98
|
+
end -- End destroyScene().
|
99
|
+
|
100
|
+
|
101
|
+
-- ============================================================================
|
102
|
+
-- Handle touch events for this scene.
|
103
|
+
-- ============================================================================
|
104
|
+
function scene:touch(inEvent)
|
105
|
+
utils:log("Scene", "touch()");
|
106
|
+
local group = self.view
|
107
|
+
|
108
|
+
-----------------------------------------------------------------------------
|
109
|
+
|
110
|
+
-- CREATE display objects and add them to 'group' here.
|
111
|
+
-- Example use-case: Restore 'group' from previously saved state.
|
112
|
+
|
113
|
+
-----------------------------------------------------------------------------
|
114
|
+
|
115
|
+
-- Only trigger when a finger is lifted.
|
116
|
+
if inEvent.phase == "ended" then
|
117
|
+
storyboard.gotoScene("menuScene", "crossFade", 500);
|
118
|
+
end
|
119
|
+
|
120
|
+
return true;
|
121
|
+
|
122
|
+
end -- End touch().
|
123
|
+
|
124
|
+
|
125
|
+
-- ============================================================================
|
126
|
+
-- enterFrame event processing.
|
127
|
+
-- ============================================================================
|
128
|
+
function scene:enterFrame(inEvent)
|
129
|
+
utils:log("Scene", "enterFrame()");
|
130
|
+
local group = self.view
|
131
|
+
|
132
|
+
-----------------------------------------------------------------------------
|
133
|
+
|
134
|
+
-- CREATE display objects and add them to 'group' here.
|
135
|
+
-- Example use-case: Restore 'group' from previously saved state.
|
136
|
+
|
137
|
+
-----------------------------------------------------------------------------
|
138
|
+
end -- End enterFrame().
|
139
|
+
|
140
|
+
-- Add scene lifecycle event handlers.
|
141
|
+
scene:addEventListener("createScene", scene);
|
142
|
+
scene:addEventListener("willEnterScene", scene);
|
143
|
+
scene:addEventListener("enterScene", scene);
|
144
|
+
scene:addEventListener("exitScene", scene);
|
145
|
+
scene:addEventListener("didExitScene", scene);
|
146
|
+
scene:addEventListener("destroyScene", scene);
|
147
|
+
|
148
|
+
return scene;
|
data/lib/coronate/cli.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
require "thor"
|
2
2
|
|
3
|
-
|
4
|
-
include Thor::Actions
|
3
|
+
%w[project app game ebook scene].each { |mb| require_relative "builder/#{mb}_builder" }
|
5
4
|
|
5
|
+
class Coronate::CLI < Thor
|
6
|
+
include Thor::Actions
|
7
|
+
include Coronate::Builder::ProjectBuilder, Coronate::Builder::AppBuilder, Coronate::Builder::GameBuilder, Coronate::Builder::EbookBuilder, Coronate::Builder::SceneBuilder
|
6
8
|
|
7
9
|
def self.source_root
|
8
10
|
File.dirname(__FILE__)
|
@@ -10,27 +12,64 @@ class CLI < Thor
|
|
10
12
|
|
11
13
|
desc "scene [NAME]", "generate an scene"
|
12
14
|
def scene(name='scene1')
|
13
|
-
|
15
|
+
build_scene({
|
16
|
+
:name => name,
|
17
|
+
:width => options[:width],
|
18
|
+
:height => options[:height],
|
19
|
+
:landscape => options[:landscape]
|
20
|
+
})
|
14
21
|
end
|
15
22
|
|
16
23
|
desc "project [NAME]", "generate a corona project"
|
17
|
-
|
18
24
|
method_option :width, :type => :numeric, :default => 320, :required => false, :aliases => "-w", :desc => "width"
|
19
25
|
method_option :height, :type => :numeric, :default => 480, :required => false, :aliases => "-h", :desc => "height"
|
20
|
-
method_option :landscape, :type => :boolean, :default =>
|
26
|
+
method_option :landscape, :type => :boolean, :default => false, :required => false, :aliases => "-l", :desc => "landscape or not"
|
21
27
|
def project(name='project1')
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
template 'templates/titleScene.tt', "#{name}/titleScene.lua"
|
29
|
-
template 'templates/endingScene.tt', "#{name}/endingScene.lua"
|
30
|
-
template 'templates/settingsScene.tt', "#{name}/settingsScene.lua"
|
31
|
-
template 'templates/menuScene.tt', "#{name}/menuScene.lua"
|
32
|
-
template 'templates/config.tt', "#{name}/config.lua"
|
33
|
-
template 'templates/build.settings.tt', "#{name}/build.settings"
|
28
|
+
build_project({
|
29
|
+
:name => name,
|
30
|
+
:width => options[:width],
|
31
|
+
:height => options[:height],
|
32
|
+
:landscape => options[:landscape]
|
33
|
+
})
|
34
34
|
end
|
35
35
|
|
36
|
+
desc "game [NAME]", "generate a corona game project"
|
37
|
+
method_option :width, :type => :numeric, :default => 320, :required => false, :aliases => "-w", :desc => "width"
|
38
|
+
method_option :height, :type => :numeric, :default => 480, :required => false, :aliases => "-h", :desc => "height"
|
39
|
+
method_option :landscape, :type => :boolean, :default => false, :required => false, :aliases => "-l", :desc => "landscape or not"
|
40
|
+
def game(name='game1')
|
41
|
+
build_game({
|
42
|
+
:name => name,
|
43
|
+
:width => options[:width],
|
44
|
+
:height => options[:height],
|
45
|
+
:landscape => options[:landscape]
|
46
|
+
})
|
47
|
+
end
|
48
|
+
|
49
|
+
desc "ebook [NAME]", "generate a corona ebook project"
|
50
|
+
method_option :width, :type => :numeric, :default => 320, :required => false, :aliases => "-w", :desc => "width"
|
51
|
+
method_option :height, :type => :numeric, :default => 480, :required => false, :aliases => "-h", :desc => "height"
|
52
|
+
method_option :landscape, :type => :boolean, :default => false, :required => false, :aliases => "-l", :desc => "landscape or not"
|
53
|
+
def ebook(name='ebook1')
|
54
|
+
build_ebook({
|
55
|
+
:name => name,
|
56
|
+
:width => options[:width],
|
57
|
+
:height => options[:height],
|
58
|
+
:landscape => options[:landscape]
|
59
|
+
})
|
60
|
+
end
|
61
|
+
|
62
|
+
desc "app [NAME]", "generate a corona app project"
|
63
|
+
method_option :width, :type => :numeric, :default => 320, :required => false, :aliases => "-w", :desc => "width"
|
64
|
+
method_option :height, :type => :numeric, :default => 480, :required => false, :aliases => "-h", :desc => "height"
|
65
|
+
method_option :landscape, :type => :boolean, :default => false, :required => false, :aliases => "-l", :desc => "landscape or not"
|
66
|
+
def app(name='app1')
|
67
|
+
build_app({
|
68
|
+
:name => name,
|
69
|
+
:width => options[:width],
|
70
|
+
:height => options[:height],
|
71
|
+
:landscape => options[:landscape]
|
72
|
+
})
|
73
|
+
end
|
74
|
+
|
36
75
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coronate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eiffel Qiu
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-11-
|
11
|
+
date: 2013-11-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -90,16 +90,56 @@ extra_rdoc_files:
|
|
90
90
|
- README.md
|
91
91
|
files:
|
92
92
|
- lib/coronate.rb
|
93
|
+
- lib/coronate/builder/app_builder.rb
|
94
|
+
- lib/coronate/builder/ebook_builder.rb
|
95
|
+
- lib/coronate/builder/game_builder.rb
|
96
|
+
- lib/coronate/builder/project_builder.rb
|
97
|
+
- lib/coronate/builder/scene_builder.rb
|
98
|
+
- lib/coronate/builder/templates/app/build.settings.tt
|
99
|
+
- lib/coronate/builder/templates/app/config.lua.tt
|
100
|
+
- lib/coronate/builder/templates/app/icon1-down.png
|
101
|
+
- lib/coronate/builder/templates/app/icon1-down@2x.png
|
102
|
+
- lib/coronate/builder/templates/app/icon1.png
|
103
|
+
- lib/coronate/builder/templates/app/icon1@2x.png
|
104
|
+
- lib/coronate/builder/templates/app/icon2-down.png
|
105
|
+
- lib/coronate/builder/templates/app/icon2-down@2x.png
|
106
|
+
- lib/coronate/builder/templates/app/icon2.png
|
107
|
+
- lib/coronate/builder/templates/app/icon2@2x.png
|
108
|
+
- lib/coronate/builder/templates/app/main.lua.tt
|
109
|
+
- lib/coronate/builder/templates/app/view1.lua.tt
|
110
|
+
- lib/coronate/builder/templates/app/view2.lua.tt
|
111
|
+
- lib/coronate/builder/templates/ebook/build.settings.tt
|
112
|
+
- lib/coronate/builder/templates/ebook/config.lua.tt
|
113
|
+
- lib/coronate/builder/templates/ebook/coronaicon-big.png
|
114
|
+
- lib/coronate/builder/templates/ebook/cover.jpg
|
115
|
+
- lib/coronate/builder/templates/ebook/main.lua.tt
|
116
|
+
- lib/coronate/builder/templates/ebook/moon.png
|
117
|
+
- lib/coronate/builder/templates/ebook/page1.lua.tt
|
118
|
+
- lib/coronate/builder/templates/ebook/pagebg1.png
|
119
|
+
- lib/coronate/builder/templates/ebook/space.jpg
|
120
|
+
- lib/coronate/builder/templates/ebook/sun.png
|
121
|
+
- lib/coronate/builder/templates/ebook/title.lua.tt
|
122
|
+
- lib/coronate/builder/templates/game/background.jpg
|
123
|
+
- lib/coronate/builder/templates/game/build.settings.tt
|
124
|
+
- lib/coronate/builder/templates/game/button-over.png
|
125
|
+
- lib/coronate/builder/templates/game/button.png
|
126
|
+
- lib/coronate/builder/templates/game/config.lua.tt
|
127
|
+
- lib/coronate/builder/templates/game/crate.png
|
128
|
+
- lib/coronate/builder/templates/game/grass.png
|
129
|
+
- lib/coronate/builder/templates/game/level1.lua.tt
|
130
|
+
- lib/coronate/builder/templates/game/logo.png
|
131
|
+
- lib/coronate/builder/templates/game/main.lua.tt
|
132
|
+
- lib/coronate/builder/templates/game/menu.lua.tt
|
133
|
+
- lib/coronate/builder/templates/project/build.settings.tt
|
134
|
+
- lib/coronate/builder/templates/project/config.tt
|
135
|
+
- lib/coronate/builder/templates/project/endingScene.tt
|
136
|
+
- lib/coronate/builder/templates/project/main.tt
|
137
|
+
- lib/coronate/builder/templates/project/menuScene.tt
|
138
|
+
- lib/coronate/builder/templates/project/settingsScene.tt
|
139
|
+
- lib/coronate/builder/templates/project/titleScene.tt
|
140
|
+
- lib/coronate/builder/templates/project/utils.tt
|
141
|
+
- lib/coronate/builder/templates/scene/scene.tt
|
93
142
|
- lib/coronate/cli.rb
|
94
|
-
- lib/coronate/templates/build.settings.tt
|
95
|
-
- lib/coronate/templates/config.tt
|
96
|
-
- lib/coronate/templates/endingScene.tt
|
97
|
-
- lib/coronate/templates/main.tt
|
98
|
-
- lib/coronate/templates/menuScene.tt
|
99
|
-
- lib/coronate/templates/scene.tt
|
100
|
-
- lib/coronate/templates/settingsScene.tt
|
101
|
-
- lib/coronate/templates/titleScene.tt
|
102
|
-
- lib/coronate/templates/utils.tt
|
103
143
|
- LICENSE.txt
|
104
144
|
- README.md
|
105
145
|
- bin/coronate
|
@@ -1,82 +0,0 @@
|
|
1
|
-
-- Create a scene object to tie functions to.
|
2
|
-
local scene = storyboard.newScene();
|
3
|
-
|
4
|
-
-- ============================================================================
|
5
|
-
-- Called when the scene's view does not exist.
|
6
|
-
-- ============================================================================
|
7
|
-
function scene:createScene(inEvent)
|
8
|
-
utils:log("Scene", "createScene()");
|
9
|
-
end -- End createScene().
|
10
|
-
|
11
|
-
|
12
|
-
-- ============================================================================
|
13
|
-
-- Called BEFORE scene has moved on screen.
|
14
|
-
-- ============================================================================
|
15
|
-
function scene:willEnterScene(inEvent)
|
16
|
-
utils:log("Scene", "willEnterScene()");
|
17
|
-
end -- End willEnterScene().
|
18
|
-
|
19
|
-
|
20
|
-
-- ============================================================================
|
21
|
-
-- Called AFTER scene has moved on screen.
|
22
|
-
-- ============================================================================
|
23
|
-
function scene:enterScene(inEvent)
|
24
|
-
utils:log("Scene", "enterScene()");
|
25
|
-
end -- End enterScene().
|
26
|
-
|
27
|
-
|
28
|
-
-- ============================================================================
|
29
|
-
-- Called BEFORE scene moves off screen.
|
30
|
-
-- ============================================================================
|
31
|
-
function scene:exitScene(inEvent)
|
32
|
-
utils:log("Scene", "exitScene()");
|
33
|
-
end -- End exitScene().
|
34
|
-
|
35
|
-
|
36
|
-
-- ============================================================================
|
37
|
-
-- Called AFTER scene has moved off screen.
|
38
|
-
-- ============================================================================
|
39
|
-
function scene:didExitScene(inEvent)
|
40
|
-
utils:log("Scene", "didExitScene()");
|
41
|
-
end -- End didExitScene().
|
42
|
-
|
43
|
-
|
44
|
-
-- ============================================================================
|
45
|
-
-- Called prior to the removal of scene's "view" (display group).
|
46
|
-
-- ============================================================================
|
47
|
-
function scene:destroyScene(inEvent)
|
48
|
-
utils:log("Scene", "destroyScene()");
|
49
|
-
end -- End destroyScene().
|
50
|
-
|
51
|
-
|
52
|
-
-- ============================================================================
|
53
|
-
-- Handle touch events for this scene.
|
54
|
-
-- ============================================================================
|
55
|
-
function scene:touch(inEvent)
|
56
|
-
utils:log("Scene", "touch()");
|
57
|
-
-- Only trigger when a finger is lifted.
|
58
|
-
if inEvent.phase == "ended" then
|
59
|
-
storyboard.gotoScene("menuScene", "crossFade", 500);
|
60
|
-
end
|
61
|
-
|
62
|
-
return true;
|
63
|
-
|
64
|
-
end -- End touch().
|
65
|
-
|
66
|
-
|
67
|
-
-- ============================================================================
|
68
|
-
-- enterFrame event processing.
|
69
|
-
-- ============================================================================
|
70
|
-
function scene:enterFrame(inEvent)
|
71
|
-
utils:log("Scene", "enterFrame()");
|
72
|
-
end -- End enterFrame().
|
73
|
-
|
74
|
-
-- Add scene lifecycle event handlers.
|
75
|
-
scene:addEventListener("createScene", scene);
|
76
|
-
scene:addEventListener("willEnterScene", scene);
|
77
|
-
scene:addEventListener("enterScene", scene);
|
78
|
-
scene:addEventListener("exitScene", scene);
|
79
|
-
scene:addEventListener("didExitScene", scene);
|
80
|
-
scene:addEventListener("destroyScene", scene);
|
81
|
-
|
82
|
-
return scene;
|