rubymotion-community / joybox Goto Github PK
View Code? Open in Web Editor NEWCocos2D & Box2D Wrapper for Ruby Motion - Currently out of date an unmaintained :-(
License: MIT License
Cocos2D & Box2D Wrapper for Ruby Motion - Currently out of date an unmaintained :-(
License: MIT License
Whenever I try to use the TileMap class in an application I get a crash. With the debugger enabled I get the following message.
123 /Users/JuanKaram/Downloads/cocos2d-iphone/cocos2d/CCTMXXMLParser.m: No such file or directory.
Program received signal EXC_ARITHMETIC, Arithmetic exception.
0x0003e6e0 in -[CCTMXTilesetInfo rectForGID:] (self=0xc04e110, _cmd=0x45638f, gid=<value temporarily unavailable, due to optimizations>) at /Users/JuanKaram/Downloads/cocos2d-iphone/cocos2d/CCTMXXMLParser.m:123
in /Users/JuanKaram/Downloads/cocos2d-iphone/cocos2d/CCTMXXMLParser.m
Current language: auto; currently objective-c
Here's the code I'm using, in case i'm doing something insane..
include Joybox::Core
class MainScene < Joybox::Scene
def on_enter
self << TLayer.new
end
end
class TLayer < Joybox::Layer
include Joybox::TMX
def on_enter
tile_map = TileMap.new file_name: "testmap1.tmx"
self << tile_map
end
end
This also occurs when I try to use the cocos CCTMXTiledMap class directly.
Hi,
I'm working on a project with CocosBuilder integration. Code connection from a CCBI file to a ruby class is OK.
The only problem is CCBReader cannot link variable from CCBI files to the ruby class: CCBReader: Couldn't find member variable: nodeCredit
The code that failed
class HomeLayer < Joybox::Core::Layer
attr_accessor :nodeCredit
# The below callback is OK
def didLoadFromCCB
load_audio
end
end
I suspect the problem comes from how CCBReader retrieve Ivar from another class: Ivar ivar = class_getInstanceVariable([target class],[memberVarAssignmentName UTF8String]);
. Below is the suspected code:
if (memberVarAssignmentType)
{
id target = NULL;
if (memberVarAssignmentType == kCCBTargetTypeDocumentRoot) target = actionManager.rootNode;
else if (memberVarAssignmentType == kCCBTargetTypeOwner) target = owner;
if (target)
{
Ivar ivar = class_getInstanceVariable([target class],[memberVarAssignmentName UTF8String]);
NSLOG("class: %@", [target class]);
if (ivar)
{
object_setIvar(target,ivar,node);
}
else
{
NSLog(@"CCBReader: Couldn't find member variable: %@", memberVarAssignmentName);
}
}
}
Kindly help with this. Thanks!
I get these errors randomly when running a game in the simulator. Just re-running rake fixes it.
(main)> Stack dump:
0. Running pass 'X86 Machine Code Emitter' on function '@glgRunProcessor5'
((null))> rake aborted!
main)> Stack dump:
0. Running pass 'X86 Machine Code Emitter' on function '@gleLLVMVecPrimMultiRender1'
((null))> rake aborted!
Any idea how to resolve this error?
Simulate ./build/iPhoneSimulator-6.1-Development/Joybox.app
(main)> Cannot define method `nodeToParentTransform' because no Objective-C stub was pre-compiled for types `{CGAffineTransform=ffffff}@:'. Make sure you properly link with the framework or library that defines this message.
*** simulator session ended with error: Error Domain=DTiPhoneSimulatorErrorDomain Code=1 "The simulated application quit." UserInfo=0x10060ca40 {NSLocalizedDescription=The simulated application quit., DTiPhoneSimulatorUnderlyingErrorCodeKey=-1}
rake aborted!
Command failed with status (1): [DYLD_FRAMEWORK_PATH="/Applications/Xcode.a...]
/Library/RubyMotion/lib/motion/project.rb:102:in `block in <top (required)>'
/Users/iansari/.rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `eval'
/Users/iansari/.rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `<main>'
I wanted to access the method ClearForces
on World. However, it is not available in Joybox. Please tell me if I have figured this out correctly to add this functionality (and other functionality in Box2D).
I have this code.
class PersonSprite < Joybox::Physics::PhysicsSprite
def move_left
self.runAction @walking_action unless self.running_actions?
self.flip x: true, y: false
end
def move_right
self.runAction @walking_action unless self.running_actions?
self.flip x: false, y: false
end
end
move_left working and move_right is not.
2014-01-27 07:39:47.361 Code Red[15426:8003] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CCRepeatForever duration]: unrecognized selector sent to instance 0x7f88087d4330'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff8408541c __exceptionPreprocess + 172
1 libobjc.A.dylib 0x00007fff87122e75 objc_exception_throw + 43
2 CoreFoundation 0x00007fff840882ed -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x00007fff83fe35b2 ___forwarding___ + 1010
4 CoreFoundation 0x00007fff83fe3138 _CF_forwarding_prep_0 + 120
5 Code Red 0x000000010a3d8fe5 -[CCSequence initOne:two:] + 46
6 Code Red 0x000000010a3d8fa0 +[CCSequence actionOne:two:] + 48
7 Code Red 0x000000010a3d8f47 +[CCSequence actionWithArray:] + 116
I´m trying to set a constant speed on a sprites body. I create a Dynamic body and set a linear_velocity. Should it not move with a constant speed then?
Currently, Structs found in Cocos2d are inaccessible such as ccTexParams. When previously vendoring cocos2d myself, I would resolve this by editing the bridge support file, and captializing the first two letters making it CCTexParams. This may not be the best solution, as I think the bridge supports are automatically generated and may be overridden.
I'm trying to use CCControlExtension (https://github.com/YannickL/CCControlExtension) with a Joybox project. I've copied the directory into vendor and added this to my Rakefile:
Motion::Project::App.setup do |app|
# Other stuff
# ...
app.vendor_project('vendor/CCControlExtension', :static)
end
...but it doesn't like that:
Compile vendor/CCControlExtension/CCControl/CCControl.m
In file included from CCControl/CCControl.m:27:
CCControl/CCControl.h:28:9: fatal error: 'cocos2d.h' file not found
#import "cocos2d.h"
^
Is there a way to point the header file to Joybox's Cocos2D? Or some other fix, perhaps? Thanks.
Hey.
Getting this error when trying to run an app in the simulator:
(main)> 2013-05-15 21:48:27.231 square[34838:c07] sprite.rb:19:in `new:': undefined method `position=' for nil:NilClass (NoMethodError)
from background_layer.rb:4:in `on_enter'
from layer.rb:23:in `onEnter'
from node.rb:7:in `<<:'
from game_scene.rb:3:in `on_enter'
from scene.rb:10:in `onEnter'
2013-05-15 21:48:27.233 square[34838:c07] *** Terminating app due to uncaught exception 'NoMethodError', reason: 'sprite.rb:19:in `new:': undefined method `position=' for nil:NilClass (NoMethodError)
from background_layer.rb:4:in `on_enter'
from layer.rb:23:in `onEnter'
from node.rb:7:in `<<:'
from game_scene.rb:3:in `on_enter'
from scene.rb:10:in `onEnter'
Here is the background_layer file.
class BackgroundLayer < Joybox::Core::Layer
def on_enter
background = Sprite.new(file_name: "images/background.png",
position: [Screen.half_width, Screen.half_height])
self << background
end
end
Tried all the troubleshooting techniques from the readme but no luck.
Any ideas on what it is?
I installed Joybox to do the default tutorial, and I started getting errors on rake.
Removing Joybox with the recommended method left my RubyMotion install giving these errors:
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require': cannot load such file -- /Users/george/Library/RubyMotion/command/joybox_generate_command.rb (LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from /Library/RubyMotion/lib/motion/project/command.rb:82:in `block in <top (required)>'
from /Library/RubyMotion/lib/motion/project/command.rb:82:in `each'
from /Library/RubyMotion/lib/motion/project/command.rb:82:in `<top (required)>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from /Library/RubyMotion/lib/motion/command.rb:156:in `<top (required)>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from /Library/RubyMotion/lib/motion/../../bin/motion:12:in `<main>'
This error persists through reinstall. What the heck is Joybox doing?
Hi, I'm getting this error:
|⇒ rake --trace
** Invoke default (first_time)
** Invoke simulator (first_time)
** Invoke build:simulator (first_time)
** Execute build:simulator
rake aborted!
stack level too deep
/usr/local/var/rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/rake-10.0.4/lib/rake/task.rb:188
Tasks: TOP => default => simulator => build:simulator
But If I remove sugarcube
from my Gemfile
the build works well.
Gemfile:
source 'https://rubygems.org'
ruby "2.0.0"
gem 'rake'
gem 'teacup'
gem 'formotion'
gem 'bubble-wrap', :require => 'bubble-wrap/core'
gem 'sugarcube'
gem 'motion-cocoapods', :git => 'git://github.com/HipByte/motion-cocoapods.git', :tag => '1.3.0.rc1'
gem 'joybox', :git => 'git://github.com/rubymotion/Joybox.git'
Rakefile:
# -*- coding: utf-8 -*-
$:.unshift("/Library/RubyMotion/lib")
require 'motion/project'
require 'bundler'
require 'rubygems'
Bundler.setup
Bundler.require
require 'motion-cocoapods'
Motion::Project::App.setup do |app|
app.name = 'globe'
end
Will Joybox get support for the latest release of Cocos2D (Cocos2D V3 RC1 release) posted on the 21st of January http://www.cocos2d-iphone.org/cocos2d-v3-rc1-release/ interested in using SpriteBuilder for a side project.
thx.
I discover a problem with the CCNode : it can't access to class of Joybox in the initialize.
I was looking to a proper way to embed entities in my code and I write a player entity class with CCNode as a super class. Easier to have variable with his life, score in that class than in the game logic.
When I try to initialize the class, the sprite creation fails
class PlayerEntity < CCNode
attr_accessor :sprite
def initialize
self.sprite = Joybox::Core::Sprite.new(
file_name: 'sprites/player.png',
position: [Screen.half_width, Screen.half_height]
)
end
end
The solution is to make a different method to construct the properties of it and call that method in the scene
class PlayerEntity < CCNode
attr_accessor :sprite
def initSprite
self.sprite = Sprite.new(
file_name: 'sprites/player.png',
position: [Screen.half_width, Screen.half_height]
)
end
end
class MenuLayer < Joybox::Core::Layer
def on_enter
@player = PlayerEntity.new
@player.initSprite
self << @player.sprite
end
def on_exit
# Tear down
end
end
Is it normal ? That's not very handy.
the last version is aug, 2013?
not sure whether to use this framework...
Joybox seems does not contains CocosDenshion.
We can't use SimpleAudioEngine.
uninitialized constant AppDelegate::SimpleAudioEngine (NameError)
Of course, I can use CocosDenshion by vendor_project.
app.vendor_project 'vendor/CocosDenshion', :static
However, I want to use it by Joybox only!
I'm having the above issue with Joybox when I run rake on a blank template (or any template) I am using rubymotion 2.22. I have tried the following:
gem uninstall joybox -a
gem install joybox
rm .repl_history
rake clean
rake
If you add a ttf font file to the resources that has an ampersand in the font name (the font name as specified in the ttf definition, not the filename - although that crashes as well) then the simulator will refuse to install the application.
The following error is produced
$ rake simulator
Build ./build/iPhoneSimulator-6.1-Development
Build /Users/donaldhutchison/.rvm/gems/ruby-1.9.3-p327/gems/joybox-1.0.0/vendor/vendor-ios/cocos_2d
Build /Users/donaldhutchison/.rvm/gems/ruby-1.9.3-p327/gems/joybox-1.0.0/vendor/vendor-ios/box_2d
Compile ./app/scenes/menu_scene.rb
Link ./build/iPhoneSimulator-6.1-Development/circle-jerk.app/circle-jerk
Create ./build/iPhoneSimulator-6.1-Development/circle-jerk.dSYM
Simulate ./build/iPhoneSimulator-6.1-Development/circle-jerk.app
*** simulator session started with error: Error Domain=DTiPhoneSimulatorErrorDomain Code=1 "iOS Simulator failed to install the application." UserInfo=0x102001820 {NSLocalizedDescription=iOS Simulator failed to install the application., DTiPhoneSimulatorUnderlyingErrorCodeKey=-1}
rake aborted!
Command failed with status (1): [DYLD_FRAMEWORK_PATH="/Applications/Xcode.a...]
Here's a font with that infernal symbol for the sake of testing http://www.dafont.com/c-c-red-alert-inet.font
motion create --template=joybox-osx crash-test
cd crash-test
rake
$ rake
Build ./build/MacOSX-10.8-Development
Build /Users/burtlo/.rvm/gems/ruby-1.9.3-p429@gaming/gems/joybox-1.0.0/vendor/vendor-osx/cocos_2d
Build /Users/burtlo/.rvm/gems/ruby-1.9.3-p429@gaming/gems/joybox-1.0.0/vendor/vendor-osx/box_2d
Run ./build/MacOSX-10.8-Development/memo-test.app/Contents/MacOS/memo-test
(main)> 2013-05-22 13:27:18.427 memo-test[51131:707] gl_view.rb:47:in `viewDidMoveToSuperview': undefined method `bounds' for nil:NilClass (NoMethodError)
2013-05-22 13:27:18.428 memo-test[51131:707] gl_view.rb:47:in `viewDidMoveToSuperview': undefined method `bounds' for nil:NilClass (NoMethodError)
2013-05-22 13:27:18.429 memo-test[51131:707] (
0 CoreFoundation 0x00007fff86c1fb06 __exceptionPreprocess + 198
1 libobjc.A.dylib 0x00007fff833b13f0 objc_exception_throw + 43
2 memo-test 0x00000001024c4253 _ZL10__vm_raisev + 371
3 memo-test 0x00000001024c4323 rb_vm_raise + 163
4 memo-test 0x00000001024031d9 rb_exc_raise + 9
5 memo-test 0x00000001024c5165 rb_vm_method_missing + 677
6 memo-test 0x00000001024b462c rb_vm_dispatch + 3228
7 memo-test 0x00000001024b5d7a rb_vm_trigger_method_missing + 746
8 memo-test 0x00000001024b501e rb_vm_dispatch + 5774
9 memo-test 0x00000001023064ac vm_dispatch + 540
10 memo-test 0x0000000102308342 rb_scope__viewDidMoveToSuperview__ + 226
11 memo-test 0x0000000102308469 __unnamed_22 + 9
12 AppKit 0x00007fff87aa1a5d -[NSView _setSuperview:] + 1956
13 AppKit 0x00007fff87aa42ce -[NSView removeFromSuperview] + 421
14 AppKit 0x00007fff87bd1a7f -[NSView removeFromSuperviewWithoutNeedingDisplay] + 39
15 AppKit 0x00007fff87ac255b -[NSView _finalizeWithReferenceCounting] + 965
16 AppKit 0x00007fff87ac216e -[NSView dealloc] + 42
17 libobjc.A.dylib 0x00007fff833aa230 _ZN12_GLOBAL__N_119AutoreleasePoolPage3popEPv + 464
18 CoreFoundation 0x00007fff86bbcd72 _CFAutoreleasePoolPop + 34
19 Foundation 0x00007fff87003ada -[NSAutoreleasePool drain] + 154
20 AppKit 0x00007fff87ac42ae -[NSApplication run] + 736
21 AppKit 0x00007fff87a68c06 NSApplicationMain + 869
22 memo-test 0x00000001022f2097 main + 231
23 libdyld.dylib 0x00007fff8b2fb7e1 start + 0
)
2013-05-22 13:27:18.430 memo-test[51131:707] *** -[NSAutoreleasePool drain]: This pool has already been drained, do not release it (double release).
Both labels and sprites are rendering very blurry. I have the proper -hd suffixes setup and still the same result. Even if the there was a problem with the sprite rendering, the labels should still be fully crisp in retina mode right? Is this a known issues or am I just setting something up incorrectly?
I want to run rotate action with PhysicsSprite.
However, it does not work.
I think we need this solution.
http://www.cocos2d-iphone.org/forum/topic/12183
We need world->getBodyList() and body->getUserData().
How about it?
My game being consistently crashing, I ran a serie of memory leak tests, just to discover that extend Joybox::Common::Initialize
prevents deallocation of objects.
Since it is used in almost every Joybox classes, almost everything is retained and barely nothing in deallocated.
Besides, I don't understand the point of this extension since RubyMotion has already an initializer by default for all classes.
I removed all extend Joybox::Common::Initialize
and my game works fine, without memory leaks.
Hi All,
The left menu on joybox.io doesn't scroll and all of the options aren't visible in the sidebar on an 11'" macbook air. I didn't see where in the stylesheet that class was defined, but I thought y'all would appreciate a heads up.
This project is really neat, as an aside.
~Earl
Cross-posted: https://groups.google.com/forum/?fromgroups#!topic/joybox-wrapper/_5B6m8mwAqE
My code:
class StartMenuLayer < Joybox::Core::Layer
def on_enter
MenuLabel.default_font_size = 40
self << start_bg
self << start_menu
end
def start_bg
@bg ||= begin
Joybox::Core::Sprite.new(file_name: "CAP-StartBG", position: CGPointMake(0, 0))
end
end
def start_menu
@menu ||= begin
start_image = MenuImage.new image_file_name: "CAP-MenuButtonStart" do |menu_item|
Joybox.director << ReadyScene.new
end
Menu.new items: [ start_image ], position: CGPointMake(300, 200)
end
end
def on_exit
# Perform any state clean if needed
end
end
Error:
sprite.rb:19:in `new:': undefined method `position=' for nil:NilClass (NoMethodError)
from start_menu_layer.rb:11:in `start_bg'
from start_menu_layer.rb:5:in `on_enter'
from layer.rb:23:in `onEnter'
from node.rb:7:in `<<:'
from start_scene.rb:4:in `on_enter'
from scene.rb:10:in `onEnter'
Any ideas? Love the framework so far.
We need Box2D.framwork's source code to contributing.
For example, I want to porting b2RevoluteJoint
into Joybox.
However, I can't get(and change) Box2D.framework source in your repository.
rake simulator
Build ./build/iPhoneSimulator-7.0-Development
Build /Users/jwaldrip/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/joybox-1.1.1/vendor/vendor-ios/cocos_2d
Build /Users/jwaldrip/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/joybox-1.1.1/vendor/vendor-ios/cocos_denshion
Build /Users/jwaldrip/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/joybox-1.1.1/vendor/vendor-ios/cocos_builder_reader
Build /Users/jwaldrip/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/joybox-1.1.1/vendor/vendor-ios/box_2d
Build /Users/jwaldrip/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/joybox-1.1.1/vendor/vendor-ios/kazmath
Simulate ./build/iPhoneSimulator-7.0-Development/Asteroids.app
2013-09-17 22:03:20.647 Asteroids[4403:80b] Cannot find executable for CFBundle 0x9e4f130 </Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk/System/Library/AccessibilityBundles/CertUIFramework.axbundle> (not loaded)
(main)> %
I haven't been able to load it for a couple of weeks. Since the Github documentation links to it for full examples, it's quite hard for me to get started learning Joybox. If the site's moved, please let us know the new address. Cheers!
I have been using structure like below in 1.0.0 with good success (simplified example):
body = @world.new_body position: position, type: KDynamicBodyType do
...
end
body.define_singleton_method :object_type do
'block'
end
@world.when_collide body do |target, is_touching|
if target.respond_to? :object_type
... do something depending on the object_type
end
end
I noticed that master had support to additional Box2D methods, so I switched over to master, but there the similar approach doesn't work there. I also switched code to use setUserData+userData as it was now supported in master, but userData on the target object is always nil.
Has there been some regression, or should I switch to some other approach for identifying the game objects from the body?
I'm playing around with an isometric map I created with Tiled. As far as I can tell, Joybox (and maybe Cocos2D) doesn't handle the isometric angle when I make calls like contains_point? and coordinate_for_point.
In the map above, Joybox reports the very top-left corner of the screen (black space) as [0,0] in coordinate_for_point. The left corner of the actual map returns [0,4] or [0,5], depending on where you click. This makes sense, but it seems undesirable.
I would expect the left corner of the map (or some other sensible choice) to be [0,0], the bottom corner to be [0,9], the right corner to be [9,9], and so on. (I could also see the bottom corner being [9,0] -- as long as it's consistent, it seems fine.)
Staggered isometric maps would throw another wrench into these works. I'm not sure how I'd solve that yet, but I'm open to ideas.
Are there any plans to support this sort of coordinate system within Joybox? (Does Cocos2D support it?) I imagine that I'd need a lot of other methods on or coordinating with an IsometricTileMap for strategy-style games -- path-finding, for example -- so maybe it makes more sense as a separate gem if I get that far.
Thoughts?
Edit: To be clear, I have No Idea What I'm Doing™ when it comes to isometric games.
When I installed joybox from rubygems, app crashes with this message at world.new_body.
Objective-C stub for message `createBodyInPosition:type:' type `@@:{CGPoint=ff}i' not precompiled. Make sure you properly link with the framework or library that defines this message.
When I built joybox on github repository, there is no problem.
I found the difference to repository's one and rubygems's one.
<method selector='createBodyInPosition:type:'>
- <arg declared_type='id' index='0' type='@' name='position'/>
- <arg declared_type='B2DBodyTypes' index='1' type='i' name='bodyType'/>
- <retval declared_type='B2DBody*' type='@'/>
+ <arg name='position' index='0' type='{CGPoint=ff}' declared_type='CGPoint'/>
+ <arg name='bodyType' index='1' type='i' declared_type='B2DBodyTypes'/>
+ <retval type='@' declared_type='B2DBody*'/>
</method>
Could you update rubygem's one?
Hi! I can't access to run_action method with Core::Layer
Error message:
layer.rb:23:in
onEnter': undefined method run_action' for #<MyLayer:0xc154ba0> (NoMethodError)
my full code:
class AppDelegate
def application(application, didFinishLaunchingWithOptions:launchOptions)
@director = Joybox::Configuration.setup do
director display_stats: true
end
@navigation_controller = UINavigationController.alloc.initWithRootViewController(@director)
@navigation_controller.navigationBarHidden = true
@window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)
@window.setRootViewController(@navigation_controller)
@window.makeKeyAndVisible
@director.runWithScene(MyScene.new)
true
end
def applicationWillResignActive(app)
@director.pause if @navigation_controller.visibleViewController == @director
end
def applicationDidBecomeActive(app)
@director.resume if @navigation_controller.visibleViewController == @director
end
def applicationDidEnterBackground(app)
@director.stop_animation if @navigation_controller.visibleViewController == @director
end
def applicationWillEnterForeground(app)
@director.start_animation if @navigation_controller.visibleViewController == @director
end
def applicationWillTerminate(app)
@director.end
end
def applicationDidReceiveMemoryWarning(app)
@director.purge_cached_data
end
def applicationSignificantTimeChange(app)
@director.set_next_delta_time_zero true
end
end
class MyScene < Joybox::Core::Scene
def on_enter
layer = MyLayer.new
self << layer
end
end
class MyLayer < Joybox::Core::Layer
def on_enter
self.run_action(Move.by)
end
end
If I use CCLayer instead Core::Layer, it doesn't crash.
class MyLayer < CCLayer
def onEnter
super
runAction(Move.by)
end
end
I am not able to get the on_mouse_entered
, on_mouse_moved
and on_mouse_exited
events to fire within my layer:
class HeroLayer < Joybox::Core::Layer
def on_enter
setup_events
end
def setup_events
on_mouse_down do |event, button|
puts "on_mouse_down #{event} #{button}"
end
on_mouse_dragged do |event, button|
puts "on_mouse_dragged #{event} #{button}"
end
on_mouse_up do |event, button|
puts "on_mouse_up #{event} #{button}"
end
on_mouse_scroll do |event, button|
puts "on_mouse_scroll #{event}"
end
on_mouse_entered do |event|
puts "on_mouse_entered"
end
on_mouse_moved do |event|
puts "on_mouse_moved"
end
on_mouse_exited do |event|
puts "on_mouse_exited"
end
on_key_down do |event|
puts "on_key_down #{event}"
puts "#{event.keyCode} #{event.characters} #{event.charactersIgnoringModifiers} #{event.modifierFlags}"
end
on_key_up do |event|
puts "on_key_up #{event}"
puts "#{event.keyCode} #{event.characters} #{event.charactersIgnoringModifiers} #{event.modifierFlags}"
end
end
end
i'm trying to load a texture package file and always i have the same error:
sprite.rb:14:in new:': undefined method
position=' for nil:NilClass (NoMethodError)
motion create --template=joybox-ios testjoybox
cd testjoybox/
rake
Cannot define method
vertices' because no Objective-C stub was pre-compiled for types ^{CGPoint=ff}@:'. Make sure you properly link with the framework or library that defines this message.
motion --version
2.22
Undefined symbols for architecture armv7
there have no arm 7 in libCocosBuilderReader.a libCocosDenshion.a
so it can't compile to real devices
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.