Giter VIP home page Giter VIP logo

dmc-corona-library's Introduction

Overview

The DMC Corona Library is a collection of classes and utilities for use with Lua and Corona SDK.

Main Library Documentation: http://docs.davidmccuskey.com/display/docs/DMC+Corona+Library

Current Files

dmc_autostore.lua

This module contains a data-storage manager which makes saving application data painlessly easy simply because it doesn't have an API! Instead, any modifications which you make to your data structure will trigger the save mechanism. Super simple!!

dmc_autostore has these features:

  • allows saving of structured data (ie, JSON), not just key/value pairs

    Saving application or game data can get ugly with key/value storage. dmc_autostore saves data with a flexible JSON structure which can be modified on-the-fly.

  • simplicity in data storage -- there is NO API !!

    dmc_autostore saves modifications to data automatically. There is no API to learn in order to load or save data. Any change to your data structure will trigger the save mechanism.

  • AutoStore is configurable

    There are several parameters available to configure, the most important are the two timers which regulate how quickly data modifications will be written to storage.

Documentation

http://docs.davidmccuskey.com/display/docs/dmc_autostore.lua

Examples

There is a detailed example in the folder examples/dmc_autostore/ which shows how to use the dmc_autostore library.

dmc_objects.lua

This file contains several methods and object classes which together form an object-oriented framework to use when programming in Lua with Corona SDK. Though it's not just for Corona - the top-level object classes can be used when developing software in plain Lua.

When doing OOP, these classes provide:

  • a classical model of object oriented programming

    dmc_objects is structured after the classical inheritance model, thus is easy to learn and use by people with varying levels of experience. This also helps give a solid organizational structure when using a language that is relatively unstructured.

  • a simple structure for doing OOP in Lua and Corona SDK

    The framework also abstracts the details of doing inheritance in Lua so that both experienced and inexperienced users of the language can focus on the code being written, and not the gory details of the language - ie, there is no need to learn about Lua metatables until you want to know. All of that is taken care of so you can get things done.

  • fast execution through structure and optimizations

    Because of the way Lua performs lookups for properties and methods, there can be a small performance penalty when using objects with many levels of inheritance. The solution for this is to get an object's properties and methods as close to the object as possible (ie, ON the object). dmc_objects does this for you so you can get the execution speed without having to sacrifice the benefit of code organization provided by object-oriented programming.

  • a mechanism for getters and setters

    The object model in dmc_objects was built to provide getters and setters in your object classes ! Go ahead, you can say it, "Yay, getters and setters !!!"

  • superClass() and superCall()

    Among other object-related methods, dmc_objects has superClass() to access an object's parent, and superCall() which allows you to call an overridden method on a super class !

  • an API similar to Corona display objects

    The core Corona Object API and Corona Physics Body API have been added to the pertinent base classes in dmc_objects. This allows you to treat your custom objects as if they were native Corona Display Objects โ€ .

  • object printing support

    There is flexible, built-in support to print objects during debugging.

โ€  You can treat them like Corona objects 99.5% of the time. Don't worry, the other 0.5% is easy to understand. :)

Documentation

Quick Guide: http://docs.davidmccuskey.com/display/docs/Quick+Guide+-+dmc_objects

API: http://docs.davidmccuskey.com/display/docs/dmc_objects.lua

Main Docs: http://docs.davidmccuskey.com/display/docs/dmc_buttons+Documentation

Examples

There are several examples in the folder examples/dmc_objects/ which show how to setup OOP structures in Lua. Among these are some original Corona examples which have been modified to use dmc_objects and fit into an OOP style of programming. These will make it easier to see how to move your projects to be object-oriented as well.

dmc_buttons.lua

This file contains classes to create different types of graphical buttons and button groups. It can create:

  • a Push button with optional text label
  • a Radio/Toggle button (on/off state) with optional text label
  • Toggle Group which allows either none or one selection of a group of buttons
  • Radio Group which allows single selection of a group of buttons

The code in this file is also great if you're looking for an example of multi-level class inheritance in Lua. If you want an easier example of multi-level inheritance, see examples/dmc_objects/DMC-Multishapes/.

Documentation

Quick Guide: http://docs.davidmccuskey.com/display/docs/Quick+Guide+-+dmc_buttons

API: http://docs.davidmccuskey.com/display/docs/dmc_buttons.lua

Main Docs: http://docs.davidmccuskey.com/display/docs/dmc_buttons+Documentation

Examples

There are examples in the folder examples/dmc_buttons/ which show how to use the dmc_buttons library. Other examples use the button class as well - check in examples/dmc_objects/.

dmc_touchmanager.lua

This module controls how touch events are processed within an application made with the Corona SDK. Unlike the default (broken?) multi-touch behavior in the Corona SDK, it will allow you to track any amount of events and un/set focus any one of them to or from an object.

Documentation

Quick Guide: http://docs.davidmccuskey.com/display/docs/Quick+Guide+-+dmc_touchmanager

Examples

There are examples in the folder examples/dmc_touchmanager/ which show how to use the dmc_touchmanager library.

dmc_trajectory.lua

The main intent of this module is to provide an easy way to have objects follow ballistic trajectories. The library module has a single, simple method to do this, but it also has other methods which can be used to obtain raw trajectory calculations if desired.

Documentation

Quick Guide: http://docs.davidmccuskey.com/display/docs/Quick+Guide+-+dmc_buttons

Examples

There are examples in the folder examples/dmc_trajectory/ which show how to use the dmc_trajectory library.

dmc_utils.lua

This file is a small, but growing list of helpful utility functions. At the moment they are mostly concerned with tables. It provides these functions:

  • extend() - copy one table into another ( similar to jQuery extend() )
  • hasOwnProperty() - check if a property is directly on an object ( similar to JavaScript hasOwnProperty )
  • propertyIn() - check property existence in a list
  • destroy() - generic table destruction
  • createObjectCallback() - create a callback closure to call any method on your object
  • print() - multi-level object printing

Documentation

API: http://docs.davidmccuskey.com/display/docs/dmc_utils.lua

Examples

As of yet there are no specific examples for dmc_utils, however the other files in this library make use of it. Check them for examples.

License

(The MIT License)

Copyright (C) 2011-2013 David McCuskey. All Rights Reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

dmc-corona-library's People

Contributors

dmccuskey avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.