Application framework for moai.
Terevaka framework aims to solve just several problems:
- Screen density fragmentation
- Screen size fragmentation
- GUI layout builder
Since it is a framework, it will implement convenient application structure.
Also you could notice that many things implemented in a way you already saw in Android native applications. Really, why not? :)
Copy (or clone, or submodule) terevaka into your moai application directory.
Then just import
local terevaka = require('terevaka/terevaka')
Terevaka requires host MOAIEnvironment.screenDpi support. Clone my moai fork to ensure it does. It is done at least for Android and iOS.
- res/layout -> for layouts built using terevaka-ui-builder
- res/drawable-hpx -> for texture packs with lanscape height , example:
- res/drawable-h768px -> lanscape height is 768 px
terevaka.TKResourceManager.loadTexturePack('main') will try to load texture pack 'main.lua' according to best match with res/drawable-h(HEIGHT)px
Call layer:fill ({ resourceName='main-layout', texturePack = self.texturePack }) method to populate layer with sprites from self.texturePack using "res/layout/main-layout.lua" file (file built using terevaka-ui-builder).
Instead of uploading moai on a real device, you can test application appearance by starting moai with appropriate profiles.
moai terevaka/profiles/ipad.lua main.lua
. See terevaka/profiles/ directory for more profiles, it is extremely easy to add a new one.
Use these methods to initialize/release resources on application creation, pausing or resuming
For more help see https://github.com/Nepherhotep/terevaka-samples