update ftk demo
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1228 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
parent
ae9cf0ea5c
commit
b050da1c2a
|
@ -1,6 +1,5 @@
|
||||||
import os
|
|
||||||
|
|
||||||
Import('env')
|
Import('env')
|
||||||
|
Import('projects')
|
||||||
Import('RTT_ROOT')
|
Import('RTT_ROOT')
|
||||||
Import('rtconfig')
|
Import('rtconfig')
|
||||||
Import('TARGET')
|
Import('TARGET')
|
||||||
|
@ -8,42 +7,31 @@ Import('TARGET')
|
||||||
RTMLINKER = RTT_ROOT + '/tools/rtmlinker.exe '
|
RTMLINKER = RTT_ROOT + '/tools/rtmlinker.exe '
|
||||||
|
|
||||||
# group definitions
|
# group definitions
|
||||||
CPATH = [RTT_ROOT + '/include',
|
group = {}
|
||||||
|
group['CCFLAGS'] = ''
|
||||||
|
group['CPPPATH'] = [RTT_ROOT + '/include',
|
||||||
RTT_ROOT + '/examples/module',
|
RTT_ROOT + '/examples/module',
|
||||||
RTT_ROOT + '/components/external/ftk/ftk/apps/common',
|
|
||||||
RTT_ROOT + '/components/external/ftk/ftk/src/os/rt-thread',
|
RTT_ROOT + '/components/external/ftk/ftk/src/os/rt-thread',
|
||||||
|
RTT_ROOT + '/components/external/ftk/ftk/src/demos',
|
||||||
|
RTT_ROOT + '/components/external/ftk/ftk/apps/common',
|
||||||
RTT_ROOT + '/components/external/ftk/ftk/src',
|
RTT_ROOT + '/components/external/ftk/ftk/src',
|
||||||
RTT_ROOT + '/components/dfs',
|
RTT_ROOT + '/components/dfs',
|
||||||
RTT_ROOT + '/components/dfs/include',
|
RTT_ROOT + '/components/dfs/include',
|
||||||
RTT_ROOT + '/components/libc/newlib']
|
RTT_ROOT + '/components/libc/newlib']
|
||||||
|
group['CPPDEFINES'] = ''
|
||||||
|
|
||||||
src = Glob('*.c')
|
target = 'libftk_demos.so'
|
||||||
|
POST_ACTION = RTMLINKER + ' -l ' + TARGET + ' -o libftk_demos.mo ' + '$TARGET'
|
||||||
|
|
||||||
def GenerateDesktopApp(name):
|
# add group to project list
|
||||||
xml = '<applications>\n<application name=\"%s\" exec=\"/ftk/apps/%s.so\" init=\"ftk_app_%s_create\" />\n</applications>\n' % (name, name, name)
|
projects.append(group)
|
||||||
|
|
||||||
f = file(name + '.desktop', 'wb')
|
src_local = Glob('*.c')
|
||||||
f.write(xml)
|
|
||||||
f.close
|
|
||||||
|
|
||||||
def Demo(env, name):
|
env.Append(CCFLAGS = group['CCFLAGS'])
|
||||||
if name == 'ftk_app_demo':
|
env.Append(CPPPATH = group['CPPPATH'])
|
||||||
return
|
env.Append(CPPDEFINES = group['CPPDEFINES'])
|
||||||
|
|
||||||
target = name + '.so'
|
|
||||||
module_env = env.Clone(CCFLAGS = ' -DRT_THREAD -DFTK_AS_PLUGIN -mcpu=arm920t -O0 -fPIC')
|
module_env = env.Clone(CCFLAGS = ' -DRT_THREAD -DFTK_AS_PLUGIN -mcpu=arm920t -O0 -fPIC')
|
||||||
module_env.Append(CPPPATH = CPATH)
|
module_env.Replace(LINKFLAGS = '-z max-page-size=0x4 -shared -fPIC -e 0 -nostdlib -s')
|
||||||
module_env.Replace(LINKFLAGS = ('-z max-page-size=0x4 -shared -fPIC -e ftk_app_%s_create -nostdlib' % name))
|
module_env.Program(target, src_local)
|
||||||
module_env.Program(name + '.so', [name + '.c', 'ftk_app_demo.o'])
|
|
||||||
POST_ACTION = RTMLINKER + ' -l ' + TARGET + (' -o %s.mo ' % name) + ('ftk_demo/%s.so' % name)
|
|
||||||
module_env.AddPostAction(target, POST_ACTION)
|
module_env.AddPostAction(target, POST_ACTION)
|
||||||
module_env.Clean(target, name + '.desktop')
|
|
||||||
GenerateDesktopApp(name)
|
|
||||||
|
|
||||||
demo_env = env.Clone(CCFLAGS = ' -DRT_THREAD -DFTK_AS_PLUGIN -mcpu=arm920t -O0 -fPIC')
|
|
||||||
demo_env.Append(CPPPATH = CPATH)
|
|
||||||
demo_env.Object('ftk_app_demo.c')
|
|
||||||
|
|
||||||
for item in src:
|
|
||||||
item = item.rstr()
|
|
||||||
Demo(env, item.split('.c')[0])
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ static Ret button_more_clicked(void* ctx, void* obj)
|
||||||
return RET_OK;
|
return RET_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ret on_item_clicked(void* ctx, void* list)
|
static Ret on_item_clicked(void* ctx, void* list)
|
||||||
{
|
{
|
||||||
FtkListItemInfo* info = NULL;
|
FtkListItemInfo* info = NULL;
|
||||||
FtkListModel* model = ftk_list_view_get_model(list);
|
FtkListModel* model = ftk_list_view_get_model(list);
|
||||||
|
|
|
@ -6,14 +6,14 @@ static Ret button_quit_clicked(void* ctx, void* obj)
|
||||||
return RET_OK;
|
return RET_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ret on_move(void* ctx, void* obj)
|
static Ret on_move(void* ctx, void* obj)
|
||||||
{
|
{
|
||||||
ftk_logd("%s: %d %d\n", __func__, ftk_sprite_get_x(obj), ftk_sprite_get_y(obj));
|
ftk_logd("%s: %d %d\n", __func__, ftk_sprite_get_x(obj), ftk_sprite_get_y(obj));
|
||||||
|
|
||||||
return RET_OK;
|
return RET_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ret move_cursor(void* ctx, void* obj)
|
static Ret move_cursor(void* ctx, void* obj)
|
||||||
{
|
{
|
||||||
FtkEvent* event = obj;
|
FtkEvent* event = obj;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue