Cocos2d-x lua script sample codes - binding

I've been programming with Cocos2d for a while now and I'm pretty familiar with it. But when it comes down to Cocos2d-x lua script, I'm having a really hard time understanding and following the structures. The Cocos2d-x lua template comes with a sample script "hello.lua", which is good, I follow through it and understand it no problem. However, bellowing are my questions,
1, In Cocos2d, you can struct a custom CCSprite class and import"SpriteClass.h" in another class that needs it. And in Cocos2d-x lua, you can create the same custom sprite script and access it in another script via require "scriptname", yeah? So, all you need to write is script and no need to create any classes?
2, I want to learn how to bind C++ the lua in Cocos2d-x lua. I posted this question here and got a pretty good answer, but after reading and searching, I still have trouble figure out where is the binding take place. Should I write it in a .ccp class or .lua script? I also trying to find any samples to study from but I found no luck. Can anyone here post any good source to learn or any sample code I can study?
PS: this question isn't the same as the other one I posted. I'm asking how to separate script so that I don't write everything in one script. As well as some example binding codes I can study.

Related

Audiokit create a blank sequence

I'm new to AudioKit (and Mac programming in general) but hopefully what I want to do is quite simple - the cookbook and documentation allude to the way forward, but don't give me exactly what I'm after.
I want to create a Midi Sequence from scratch and then play and save it. All the examples I've seen load in a file first and then play it, and the one example I saw which did what I wanted was full of deprecated code :(
If anyone could provide some code or point me in the direction of some working code (latest build 27/05/22) I would be so grateful.
Thanks in advance,
Jes

Dart / AngularDart - how to create diagram/flowchart?

Could someone please point me to some tutorial or provide an example code snippet about how to create a diagram/flowchart in Dart? The simple scenario would be to have couple of elements connectable to each other and possibility to read which one is connected where. There are tons of JS examples but for learning purposes I would like to go the Dart way :)
I've been using a wrapper around an JS GraphViz library for a number of projects.
See https://pub.dartlang.org/packages/pubviz - Here's the output: http://kevmoo.github.io/pubviz/
Also https://pub.dartlang.org/packages/gviz
It's not super interactive or anything, but it's useful when you just want to visualize a graph structure.

Swift OpenGL ES app template?

I've been looking at a lot of tutorials trying to find a way to make an OpenGL app written in Swift, but I can't seem to find a good template to use.
Most tutorials suggest using a blank one, but then I have to write a ton of files (such as AppDelegate) all from scratch, which I have no clue how to do.
I tried all the links on this, but the first one doesn't even work and the second one is in Objective-C.
Anyone have anything that might help me?
I ended up figuring it out myself by using GLKit and smashing together old tutorials. Since OpenGL is just a bunch of functions, all you really need to do is find the right parameters for your programming language.
For anyone else trying to do this, there's some fairly useful resources here and here, and it's also useful to shove in some ported code from Ray Wenderlich if you get stuck. Good luck!

Using Matlab capabilities in xcode project

I am familiar with Matlab and would like to use what I know to add the functionality I am looking for in my iOS application. The title really says it all, I would like my app to be able to use the mathematics capabilities that matlab provides like integrals, derivatives, cross products, etc. not any graphing or any of that but just basic equation solving things. Is there a way to add this functionality to it while keeping my application agile. I have heard of the matlab coder that allow code to be switched from matlab to c or c++ that could be used for an Xcode project. If this is the best solution, is that a very difficult coder to work with? This is my first application, I have literally been working with Xcode and objective-c for a few weeks but I have the basic framework of my application good to go. I need this to add the real functionality to it and make it very useable. Please go easy on me if any of my questions seem obvious, I'm a nube, I really appreciate your answers.
Josh
As you mentioned, MATLAB Coder can generate C code from your MATLAB function. The header (.h) and source (.c) files can be plugged into your XCode project. The key part of the work is to decide what the input and output of the function should be and how to interface the rest of the XCode project with the Coder-generated function. Also, existing MATLAB code may not be completely compatible with the Coder, so that some modifications to your MATLAB code may be necessary. The Coder has interactive processes that guide you through this process.
If you haven't done so yet, you should start by looking at some examples of MATLAB Coder provided by MathWorks, e.g.,
http://www.mathworks.com/help/coder/examples/c-code-generation-for-a-matlab-kalman-filtering-algorithm.html?prodcode=ME&language=en

Box2D in Objective-C

I am currently running Kobold 1.0.4 and cannot work out how to use Box2D using Objective-C, any help will be appreciated.
I have looked at the Box2d example project with kobold but it uses only c++ i need to do it in objective-c as i am not really confident playing with both.
Change extension of your source files from *.m to *.mm to be able to use c++ classes in them. It will allow you to create and manage box2d objects in your objective-c code
Box2D is written in C++ so one way or another there's no getting around it. Since Box2D's code does the heavy-lifting, the amount of C++ code needed to us it is quite small, you just need to get the boilerplate up for collision handlers and then the code you fill it with can be as objective-C as you want.
If you want something that helps get geometry into your app, PhysicsEditor is a good tool and they have a plist exporter and provide an objective-C class for loading the data. It takes care of a lot of boilerplate, and if you want to do collision geometry for anything interesting it's very helpful.

Resources