welcome to ZFFramework, a cross-platform, lightweight, mid-level application framework in C++
everything here starts with "ZF", which stands for "Zero Framework"
- it's not a traditional framework, can be loaded like a dynamic library, plug and play
- designed to be able to run at any platform that supplies C++03 compatible implementation
Homepage:
-
Online docs: http://ZFFramework.com
-
Github repo: https://github.com/ZFFramework/ZFFramework
NOTE: this repo would keep clean (remove unnecessary history) and update frequently, if you want stable or history version, please refer to ZFFrameworkDist
-
minimum requirement
-
powerful reflection, serialzation, styleable logic
- for how powerful ZFFramework is, you may refer to Feature page
- automatic lua binding, no extra bind code or config are necessary
- automatic UI serialization
- stateful property animation
- enhanced global event observer
-
fully modularization, "core + protocol + dynamic implementation" design
support any platform if you are able to supply a native C++ implementation, most of implementation can be replaced easily, and implementation is required only if its owner module being used
-
easy to communicate with native code
even to embed UI elements and native UI elements with each other
-
UI module to write cross-platform UI easily
-
built-in auto scale logic to support multiple screen size
you have no need to write size-dependent code in both app and implementation
- this piece of code shows how to show a hello world on UI and log output
#include "ZFUIWidget.h" // for common UI module
ZFMAIN_ENTRY(params) // app starts from here
{
// show a hello world to log output
zfLogT() << zfText("hello wolrd");
// show a window (full screen by default)
zfblockedAlloc(ZFUIWindow, window);
window->windowShow();
// show a hello world as a text view
zfblockedAlloc(ZFUITextView, textView);
window->childAdd(textView);
textView->layoutParam()->layoutAlignSet(ZFUIAlign::e_LeftInner);
textView->textSet(zfText("hello world"));
// button and click (as observer)
zfblockedAlloc(ZFUIButtonBasic, button);
window->childAdd(button);
button->layoutParam()->layoutAlignSet(ZFUIAlign::e_RightInner);
button->buttonLabelTextSet(zfText("click me"));
ZFLISTENER_LOCAL(onClick, {
ZFUIButtonBasic *button = userData->objectHolded();
zfLogTrimT() << zfText("button clicked:") << button;
})
button->observerAdd(ZFUIButton::EventButtonOnClick(), onClick, button->objectHolder());
return 0;
}
- this piece of code shows equivalent lua code to use ZFFramework, all the lua bindings are automatically done by reflection!
zfLog('hello world')
local window = ZFUIWindow()
window:windowShow()
local textView = zfAlloc('ZFUITextView')
window:childAdd(textView)
textView:layoutParam():layoutAlignSet(ZFUIAlign.e_LeftInner())
textView:textSet('hello wolrd')
local button = ZFUIButtonBasic.ClassData():newInstance()
window:childAdd(button)
button:layoutParam():layoutAlignSet(ZFUIAlign.e_RightInner())
button:buttonLabelTextSet('click me')
button:observerAdd(
ZFUIButton.EventButtonOnClick(),
function (listenerData, userData)
zfLog('button clicked: %s', userData:objectHolded())
end,
button:objectHolder())
-
for the core modlue:
- C++03 compatible compiler (require templates, no boost/RTTI/exceptions required)
- STL containers (require: map/unordered_map/vector/deque/list), or supply custom wrapper
-
for the implementation module:
- depends on the actual platform implementation
- finished
- core module (memory management, reflection, serialization)
- basic UI module (view, window, label, image view, button, layout, scroll view, list view)
- basic algorithm (xml, json, regexp, md5, base64, crc32, encryption, compression)
- common platform implementations (iOS, Android, Qt)
- auto lua binding by reflection
- working
- more useful UI modules
- basic network module
- basic database module
- future
- standalone visual UI editor
- more IDE / compile env integrations
- more platform implementations
- aiming to be portable and can be ported easily, aiming to be lightweighted and able to be embeded easily, aiming to use 20% code to do 80% work
- supply Java-like / ObjectC-like app level APIs to build up small/medium sized app easily
- Download necessary files
- Setup set up necessary environment for ZFFramework
- Tutorial quick tutorial to code with ZFFramework
- FAQ
ZFFramework is under MIT license (see here), feel free to copy or modify or use it
-
project home page: http://ZFFramework.com
-
blog: http://zsaber.com
-
repo: https://github.com/ZFFramework/ZFFramework
Issues or Pull Request are welcome
if you like my work, please consider donate:
contact [email protected] (Chinese or English only) before donate, we would really appreciate for your help