My Codea Libraries

loopspace

2014-06-13

# 1 Introduction

With the advent of the Codea Community project, code sharing in Codea got a whole lot easier. However, my larger projects use a slightly complicated system of libraries that works outside of Codea's dependency mechanism and so it doesn't work automatically with Codea Community. These are the instructions on how to get one of these projects working.

# 2 Instructions

The first thing to do is work out whether or not the particular project uses my libraries. This will be the case if early in the setup function there is a line:



cmodule "<projectname>"


where <projectname> is the name of the project. If this is the case, then it uses one or more of my libraries.

The libraries are all available on Codea Community. I have divided them into distinct projects for ease of maintenance. The libraries are:

• Library Base: This contains what I consider to be base level code. It includes my touch handler, colour manipulation functions, utf8 handling, basic coordinate transformations, and font handling.

• Library UI: This contains the code relating to my user interface routines. This includes menus, various pickers, and input methods.

• Library Graphics: A variety of graphical classes. This includes classes that modify the view, bézier curves, and similar.

• Library Maths: Some mathematical classes. This includes quaternions, complex numbers, and extended matrix and vector classes.

• Library Utilities: Most of my libraries are in the form of classes. These are the exceptions, these are auxiliary functions. There are a variety of these, ranging from adding shapes to a mesh, to some more mathematical routines.

• Library Miscellaneous: These are odds and ends that are most likely only going to be used in a single project but I've put them in a library just in case.

The other project that is needed is toadkick's cmodule library. This handles loading tabs from various projects without needing to add them as a dependency, and ensures that modules don't mess with the global table. I use this as it means that when I load a library, I only need to load the actual modules that I use. I've loaded this to Codea Community to make it possible to download.

It doesn't matter what you call these projects, but you'll need to remember what you called them. Then in one of my projects that uses this system, you need to do the following:

1. Change the <projectname> in the line



cmodule "<projectname>"


to the name that you saved this project to.

2. Change the list of projects in the line



cmodule.path("<library>", "<library>", ...)


to whatever you named the libraries too. It's only necessary to list the corresponding projects, but there is no harm in listing the whole lot.

3. Add the cmodule project as a dependency (whatever you called it).