motion-game 1.1.10 → 1.1.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 42ae17cc05e2be3ca643a70dfc399164016c8461
4
- data.tar.gz: 788f6ef67f7e1cc9e129a0b54e9aa33d7719730c
3
+ metadata.gz: a8400f4a5dd667cdd93f3d15a5936bcbe50fbe78
4
+ data.tar.gz: ccbc62694d3cb4ef5dce97b0b29ce09bc654c107
5
5
  SHA512:
6
- metadata.gz: 2873f6e4b51e7a9f801396427495f66d2d3ebfd27777346830f92360882a7ed4462145872f27e1619adea1af4b5a1cfdb151eb8ee2e61f25c29918b21ef056c4
7
- data.tar.gz: d25db5f1795c5b78bf702fd7257f7161404c402894689f27cb509553c741531d80c53fb1fc2f5035318833b8265c497359a3805bb7ce7cd64c0ce7eb4abc832c
6
+ metadata.gz: 92398d18704422d45ced3d9ded5fbe7aba87ca35eea8f43d136fd7ed2e718017b3ee0e63fd3f81fa901797098c58c83bc151105ad340914343c04b2658dcffad
7
+ data.tar.gz: fd40ffca93ee206159f08ad0953b3cf87f370d2f7d313ba260eb1b2f8959baef5ebfaae37ae263b259bd1f8d8ec80a48f0c17e063b0fa1645047c03d7855a937
data/README.md CHANGED
@@ -95,7 +95,7 @@ $ rake android:device
95
95
 
96
96
  ### API reference
97
97
 
98
- The whole framework API is documented. The [API reference](http://www.rubydoc.info/gems/motion-game/1.1.10) is available online.
98
+ The whole framework API is documented. The [API reference](http://www.rubydoc.info/gems/motion-game/1.1.11) is available online.
99
99
 
100
100
  You can also build the API reference locally:
101
101
 
@@ -110,11 +110,25 @@ The [samples](https://github.com/HipByte/motion-game/tree/master/samples) direct
110
110
 
111
111
  ## License
112
112
 
113
- Copyright (c) 2015, HipByte (info@hipbyte.com) and contributors. All rights reserved.
114
-
115
- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
116
-
117
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
118
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
119
-
120
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
113
+ Copyright (c) 2015, HipByte (info@hipbyte.com) and contributors.
114
+ All rights reserved.
115
+
116
+ Redistribution and use in source and binary forms, with or without
117
+ modification, are permitted provided that the following conditions are met:
118
+
119
+ 1. Redistributions of source code must retain the above copyright notice, this
120
+ list of conditions and the following disclaimer.
121
+ 2. Redistributions in binary form must reproduce the above copyright notice,
122
+ this list of conditions and the following disclaimer in the documentation
123
+ and/or other materials provided with the distribution.
124
+
125
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
126
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
127
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
128
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
129
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
130
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
131
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
132
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
133
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
134
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Binary file
Binary file
Binary file
Binary file
data/doc/API_reference.rb CHANGED
@@ -496,6 +496,12 @@ class Director < Object
496
496
  # @return [Boolean] whether the FPS label is displayed.
497
497
  def show_stats?; end
498
498
 
499
+ # @return [Float] the scale factor of content for multi-resolution.
500
+ attr_accessor :content_scale_factor
501
+
502
+ # @return [GLView] a GLView instance.
503
+ attr_reader :glview
504
+
499
505
  end
500
506
  # This class represents an event received from the accelerometer sensor of
501
507
  # the device, usually from the {Scene#on_accelerate} method.
@@ -526,6 +532,31 @@ class File
526
532
  # @return [String] the content.
527
533
  def self.read; end
528
534
 
535
+ end
536
+
537
+ class GLView < Object
538
+ # Set the design resolution size.
539
+ # @param width [Float] Design resolution width.
540
+ # @param height [Float] Design resolution height.
541
+ # @param policy [Integer] The resolution policy desired, you may choose:
542
+ # 1. {ResolutionPolicy::EXACT_FIT} - Fill screen by stretch-to-fit.
543
+ # 2. {ResolutionPolicy::NO_BORDER} - Full screen without black border.
544
+ # 3. {ResolutionPolicy::SHOW_ALL} - Full screen with black border.
545
+ # @return [self] the receiver.
546
+ def design_resolution_size(width, height, policy); end
547
+
548
+ end
549
+
550
+ class ResolutionPolicy < Object
551
+ # Fill screen by stretch-to-fit.
552
+ EXACT_FIT = 0
553
+
554
+ # Full screen without black border.
555
+ NO_BORDER = 1
556
+
557
+ # Full screen with black border.
558
+ SHOW_ALL = 2
559
+
529
560
  end
530
561
  # This class represents a scene, an independent screen or stage of the
531
562
  # application workflow. A scene is responsible for handling events from the
@@ -563,23 +594,6 @@ class Scene < Node
563
594
  # @return [self] the receiver.
564
595
  def update(delta); end
565
596
 
566
- # Schedules a given block for execution.
567
- # @param delay [Float] the duration of the block, in seconds.
568
- # @param repeat [Integer] the number of times the block should be repeated.
569
- # If {Repeat::FOREVER} (or negative value directly) was given, the animation will loop forever.
570
- # @param interval [Float] the interval between repetitions, in seconds.
571
- # @yield [Float] the given block will be yield with the delta value,
572
- # in seconds.
573
- # @return [String] a token representing the task that can be passed to
574
- # {#unschedule} when needed.
575
- def schedule(delay, repeat=0, interval=0); end
576
-
577
- # Unschedules a task that's currently running.
578
- # @param key [String] a token representing the task to unschedule,
579
- # returned by {#schedule}.
580
- # @return [self] the receiver.
581
- def unschedule(key); end
582
-
583
597
 
584
598
  # @group Events
585
599
 
@@ -777,6 +791,34 @@ class Node < Object
777
791
  # @return [self] the receiver.
778
792
  def delete_from_parent(cleanup=true); end
779
793
 
794
+
795
+ # @endgroup
796
+
797
+ # Schedules a given block for execution.
798
+ # @param delay [Float] the duration of the block, in seconds.
799
+ # @param repeat [Integer] the number of times the block should be repeated.
800
+ # If {Repeat::FOREVER} (or negative value directly) was given, the animation will loop forever.
801
+ # @param interval [Float] the interval between repetitions, in seconds.
802
+ # @yield [Float] the given block will be yield with the delta value,
803
+ # in seconds.
804
+ # @return [String] a token representing the task that can be passed to
805
+ # {#unschedule} when needed.
806
+ def schedule(delay, repeat=0, interval=0); end
807
+
808
+ # Schedules a given block for execution that runs only once, with a delay of 0 or larger.
809
+ # @param delay [Float] the duration of the block, in seconds.
810
+ # @yield [Float] the given block will be yield with the delta value,
811
+ # in seconds.
812
+ # @return [String] a token representing the task that can be passed to
813
+ # {#unschedule} when needed.
814
+ def schedule_once(delay); end
815
+
816
+ # Unschedules a task that's currently running.
817
+ # @param key [String] a token representing the task to unschedule,
818
+ # returned by {#schedule}.
819
+ # @return [self] the receiver.
820
+ def unschedule(key); end
821
+
780
822
  end
781
823
 
782
824
  class Parallax < Node
@@ -1310,6 +1352,55 @@ class Text < Widget
1310
1352
  # @return [:left, :center, :right] the horizontal alignment of the text.
1311
1353
  attr_accessor :horizontal_align
1312
1354
 
1355
+ end
1356
+
1357
+ class TextField < Widget
1358
+
1359
+ # @group Constructors
1360
+
1361
+ # Creates a new Text widget with optional content, font name and size.
1362
+ # @param placeholder [String] text of placeholder.
1363
+ # @param font [String] font name.
1364
+ # @param font_size [Integer] font size.
1365
+ def initialize(placeholder='', font='', font_size=0); end
1366
+
1367
+
1368
+ # @endgroup
1369
+
1370
+ # @return [String] a placeholder string.
1371
+ attr_accessor :placeholder
1372
+
1373
+ # @return [String] name of the font used by the widget.
1374
+ attr_accessor :font
1375
+
1376
+ # @return [Integer] size of the font used by the widget.
1377
+ attr_accessor :font_size
1378
+
1379
+ # @return [String] a string of TextField.
1380
+ attr_accessor :string
1381
+
1382
+ # Query whether password is enabled or not.
1383
+ # @return [Boolean] true if enabled password.
1384
+ def password_enabled?; end
1385
+
1386
+ # Toggle enable password input mode.
1387
+ # @return [Boolean] true if enable password.
1388
+ def password_enabled=(value); end
1389
+
1390
+ # @return [:top, :center, :bottom] the vertical alignment of the text.
1391
+ attr_accessor :vertical_align
1392
+
1393
+ # @return [:left, :center, :right] the horizontal alignment of the text.
1394
+ attr_accessor :horizontal_align
1395
+
1396
+ # Configures a block to be called when a slider event is received on the
1397
+ # widget.
1398
+ # @yield [Symbol] the given block will be called when the event
1399
+ # is received with a +Symbol+ that describes the type of event, which can
1400
+ # be +:attach+, +:detach+, +:insert+ or +:delete+.
1401
+ # @return [self] the receiver.
1402
+ def on_event; end
1403
+
1313
1404
  end
1314
1405
  # A button widget. The {#on_touch} method can be used to set a callback when
1315
1406
  # the button is activated. Example:
@@ -1321,7 +1412,9 @@ class Button < Widget
1321
1412
 
1322
1413
  # Creates a new Button widget with an optional title.
1323
1414
  # @param title [String] title for the button.
1324
- def initialize(title=''); end
1415
+ # @param font [String] name of the font the button widget should use.
1416
+ # @param font_size [Integer] size of the font the button widget should use.
1417
+ def initialize(title='', font='', font_size=0); end
1325
1418
 
1326
1419
 
1327
1420
  # @endgroup
@@ -1355,7 +1448,106 @@ class Button < Widget
1355
1448
  def load_texture_disabled(name); end
1356
1449
 
1357
1450
  end
1451
+ # RadioButton is a specific type of two-states button that is similar to CheckBox.
1452
+ class RadioButton < Widget
1453
+
1454
+ # @group Constructors
1455
+
1456
+ # Creates a new RadioButton widget.
1457
+ # @param background [String] a background texture name.
1458
+ # @param cross [String] a cross texture name.
1459
+ # @return [RadioButton] a RadioButton instance.
1460
+ def initialize(background, cross); end
1461
+
1462
+
1463
+ # @endgroup
1464
+
1465
+ # Get selected state of radio button.
1466
+ # @return [Boolean] true if radio button is selected.
1467
+ def selected?; end
1468
+
1469
+ # Set selected state for radio button.
1470
+ # @param value [Boolean] true that radio button is selected, false otherwise.
1471
+ def selected=(value); end
1472
+
1473
+ end
1474
+ # RadioButtonGroup groups designated radio buttons to make them interact to each other.
1475
+ class RadioButtonGroup < Widget
1476
+
1477
+ # @group Constructors
1478
+
1479
+ # Create and return a empty RadioButtonGroup instance
1480
+ # @return [RadioButtonGroup] a RadioButtonGroup instance.
1481
+ def initialize; end
1482
+
1483
+
1484
+ # @endgroup
1485
+
1486
+ # Add a radio button into this group.
1487
+ # @param button [RadioButton] a RadioButton.
1488
+ # @return [self] the receiver.
1489
+ def add(button); end
1490
+
1491
+ # This is alias method of {#add}.
1492
+ def <<(button); end
1493
+
1494
+ # Select a radio button.
1495
+ # @param value [RadioButton, Integer] Select a radio button by RadioButton instance if it was given.
1496
+ # If Integer value was given, select a radio button by index.
1497
+ # @return [self] the receiver.
1498
+ def select(value); end
1499
+
1500
+ # Get the index of selected radio button.
1501
+ # @return [Integer] the index of selected radio button.
1502
+ def selected; end
1503
+
1504
+ end
1505
+ # A checkbox widget. The {#on_selected} method can be used to set a callback when
1506
+ # the checkbox is selected. Example:
1507
+ # check_box = CheckBox.new(
1508
+ # "check_box_normal.png",
1509
+ # "check_box_normal_press.png",
1510
+ # "check_box_active.png",
1511
+ # "check_box_normal_disable.png",
1512
+ # "check_box_active_disable.png")
1513
+ # check_box.on_selected { |type| puts "selected!" if type == :selected }
1514
+ class CheckBox < Widget
1358
1515
 
1516
+ # @group Constructors
1517
+
1518
+ # Creates a new CheckBox widget.
1519
+ # @param background [String] a background texture name.
1520
+ # @param cross [String] a cross texture name.
1521
+ # @return [CheckBox] a CheckBox instance.
1522
+ def initialize(background, cross); end
1523
+
1524
+
1525
+ # @endgroup
1526
+
1527
+ # Get selected state of checkbox.
1528
+ # @return [Boolean] true if checkbox is selected.
1529
+ def selected?; end
1530
+
1531
+ # Set selected state for checkbox.
1532
+ # @param value [Boolean] true that checkbox is selected, false otherwise.
1533
+ def selected=(value); end
1534
+
1535
+ # Configures a block to be called when a touch event is received on the
1536
+ # widget.
1537
+ # @yield [Symbol] the given block will be called when the event
1538
+ # is received with a +Symbol+ that describes the type of event, which can
1539
+ # be +:selected+ or +:unselected+
1540
+ # @return [self] the receiver.
1541
+ def on_selected; end
1542
+
1543
+ end
1544
+ # A slider widget. The {#on_changed} method can be used to set a callback when
1545
+ # the slider is changed. Example:
1546
+ # slider = Slider.new
1547
+ # slider.load_bar_texture("slider_bar.png")
1548
+ # slider.load_slid_ball_textures("slider_normal_ball.png", "", "")
1549
+ # slider.load_progress_bar_texture("slider_progress.png");
1550
+ # slider.on_changed { puts slider.progress }
1359
1551
  class Slider < Widget
1360
1552
 
1361
1553
  # @group Constructors
@@ -1370,6 +1562,47 @@ class Slider < Widget
1370
1562
  # value from +1+ to +100+.
1371
1563
  attr_accessor :progress
1372
1564
 
1565
+ # Load texture for slider bar.
1566
+ # @param value [String] a texture name.
1567
+ # @return [self] the receiver.
1568
+ def load_bar_texture(value); end
1569
+
1570
+ # Load textures for slider ball.
1571
+ # @param normal [String] a ball normal normal state texture.
1572
+ # @param pressed [String] a ball selected selected state texture.
1573
+ # @param disabled [String] a ball disabled dark state texture.
1574
+ # @return [self] the receiver.
1575
+ def load_slid_ball_textures(normal, pressed, disabled); end
1576
+
1577
+ # Load texture for slider progress bar.
1578
+ # @param value [String] a texture name.
1579
+ # @return [self] the receiver.
1580
+ def load_progress_bar_texture(value); end
1581
+
1582
+ # Configures a block to be called when a slider event is received on the
1583
+ # widget.
1584
+ # @yield the block will be called when a slider event is received.
1585
+ # @return [self] the receiver.
1586
+ def on_changed; end
1587
+
1588
+ end
1589
+ # A loading bar widget.
1590
+ class LoadingBar < Widget
1591
+
1592
+ # @group Constructors
1593
+
1594
+
1595
+ # @endgroup
1596
+
1597
+ # @return [Integer] the progress direction of the slider, as a percentage
1598
+ # value from +1+ to +100+.
1599
+ attr_accessor :progress
1600
+
1601
+ # Load texture for loading bar.
1602
+ # @param value [String] a texture name.
1603
+ # @return [self] the receiver.
1604
+ def load_texture(value); end
1605
+
1373
1606
  end
1374
1607
 
1375
1608
  class Layout < Widget
@@ -2,4 +2,17 @@ source 'https://rubygems.org'
2
2
 
3
3
  gem 'rake'
4
4
  gem 'motion-game'
5
- # Add your dependencies here:
5
+ # Add your dependencies for all platform here:
6
+
7
+
8
+ group :ios do
9
+ # Add your dependencies for only iOS platform in this group:
10
+ end
11
+
12
+ group :tvos do
13
+ # Add your dependencies for only tvOS platform in this group:
14
+ end
15
+
16
+ group :android do
17
+ # Add your dependencies for only Android platform in this group:
18
+ end
@@ -1,6 +1,10 @@
1
1
  class Application < MG::Application
2
2
  def start
3
- MG::Director.shared.run(MainScene.new)
3
+ director = MG::Director.shared
4
+ size = director.size
5
+ director.glview.design_resolution_size(size.width, size.height, MG::ResolutionPolicy::SHOW_ALL)
6
+ director.content_scale_factor = 1.0
7
+ director.run(MG::MainScene.new)
4
8
  end
5
9
 
6
10
  def resume
@@ -1,7 +1,9 @@
1
- class MainScene < MG::Scene
2
- def initialize
3
- label = MG::Text.new("Hello World", "Arial", 96)
4
- label.anchor_point = [0, 0]
5
- add label
1
+ module MG
2
+ class MainScene < Scene
3
+ def initialize
4
+ label = Text.new("Hello World", "Arial", 96)
5
+ label.anchor_point = [0, 0]
6
+ add label
7
+ end
6
8
  end
7
- end
9
+ end
@@ -1,5 +1,11 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
+ begin
4
+ require 'bundler'
5
+ Bundler.require(:default, :android)
6
+ rescue LoadError
7
+ end
8
+
3
9
  Motion::Project::App.setup do |app|
4
10
  # Use `rake android:config' to see complete project settings.
5
11
  app.name = '<%= name %>'
@@ -1,5 +1,11 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
+ begin
4
+ require 'bundler'
5
+ Bundler.require(:default, :ios)
6
+ rescue LoadError
7
+ end
8
+
3
9
  Motion::Project::App.setup do |app|
4
10
  # Use `rake ios:config' to see complete project settings.
5
11
  app.name = '<%= name %>'
@@ -1,5 +1,11 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
+ begin
4
+ require 'bundler'
5
+ Bundler.require(:default, :tvos)
6
+ rescue LoadError
7
+ end
8
+
3
9
  Motion::Project::App.setup do |app|
4
10
  # Use `rake tvos:config' to see complete project settings.
5
11
  app.name = '<%= name %>'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: motion-game
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.10
4
+ version: 1.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - HipByte
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-22 00:00:00.000000000 Z
11
+ date: 2016-12-29 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: motion-game allows you to write cross-platform native mobile games in
14
14
  Ruby.
@@ -86,7 +86,7 @@ files:
86
86
  - template/motion-game/files/resources/Default-736h@3x.png
87
87
  homepage: https://github.com/HipByte/motion-game
88
88
  licenses:
89
- - BSD
89
+ - BSD-2-Clause
90
90
  metadata:
91
91
  rubymotion_template_dir: template
92
92
  post_install_message:
@@ -105,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
105
105
  version: '0'
106
106
  requirements: []
107
107
  rubyforge_project:
108
- rubygems_version: 2.5.2
108
+ rubygems_version: 2.6.8
109
109
  signing_key:
110
110
  specification_version: 4
111
111
  summary: Cross-platform mobile game engine for RubyMotion