update module construction
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1422 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
parent
477dec24b4
commit
ea5421567c
|
@ -1,38 +0,0 @@
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
import rtconfig
|
|
||||||
|
|
||||||
RTT_ROOT = os.path.normpath(os.getcwd() + '/../..')
|
|
||||||
sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')]
|
|
||||||
import building
|
|
||||||
|
|
||||||
target = RTT_ROOT + '/bsp/mini2440/rtthread-mini2440'
|
|
||||||
projects = []
|
|
||||||
|
|
||||||
AddOption('--target',
|
|
||||||
dest='target',
|
|
||||||
type='string',
|
|
||||||
help='set target project: mdk')
|
|
||||||
|
|
||||||
if GetOption('target'):
|
|
||||||
SetOption('no_exec', 1)
|
|
||||||
|
|
||||||
TARGET = target + '.' + rtconfig.TARGET_EXT
|
|
||||||
|
|
||||||
env = Environment(tools = ['mingw'],
|
|
||||||
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
|
|
||||||
CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
|
|
||||||
AR = rtconfig.AR, ARFLAGS = '-rc',
|
|
||||||
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
|
|
||||||
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
|
|
||||||
|
|
||||||
Export('env')
|
|
||||||
Export('RTT_ROOT')
|
|
||||||
Export('rtconfig')
|
|
||||||
Export('projects')
|
|
||||||
Export('TARGET')
|
|
||||||
|
|
||||||
SConscript(RTT_ROOT + '/examples/module/tetris/SConscript', duplicate=0)
|
|
||||||
SConscript(RTT_ROOT + '/examples/module/basicapp/SConscript', duplicate=0)
|
|
||||||
SConscript(RTT_ROOT + '/examples/module/extension/SConscript', duplicate=0)
|
|
||||||
SConscript(RTT_ROOT + '/examples/module/extapp/SConscript', duplicate=0)
|
|
|
@ -1,32 +0,0 @@
|
||||||
Import('env')
|
|
||||||
Import('projects')
|
|
||||||
Import('RTT_ROOT')
|
|
||||||
Import('rtconfig')
|
|
||||||
Import('TARGET')
|
|
||||||
|
|
||||||
RTMLINKER = RTT_ROOT + '/tools/rtmlinker.exe '
|
|
||||||
|
|
||||||
# group definitions
|
|
||||||
group = {}
|
|
||||||
group['name'] = 'examples'
|
|
||||||
group['src'] = Glob('*.c')
|
|
||||||
group['CCFLAGS'] = ''
|
|
||||||
group['CPPPATH'] = [RTT_ROOT + '/include', RTT_ROOT + '/examples/module']
|
|
||||||
group['CPPDEFINES'] = ''
|
|
||||||
|
|
||||||
target = 'basicapp.so'
|
|
||||||
POST_ACTION = RTMLINKER + '-l ' + TARGET + ' -o basicapp.mo ' + '$TARGET'
|
|
||||||
|
|
||||||
# add group to project list
|
|
||||||
projects.append(group)
|
|
||||||
|
|
||||||
src_local = Glob('basicapp.c')
|
|
||||||
|
|
||||||
env.Append(CCFLAGS = group['CCFLAGS'])
|
|
||||||
env.Append(CPPPATH = group['CPPPATH'])
|
|
||||||
env.Append(CPPDEFINES = group['CPPDEFINES'])
|
|
||||||
module_env = env.Clone(CCFLAGS = ' -mcpu=arm920t -O0 -fPIC')
|
|
||||||
module_env.Replace(LINKFLAGS = '-z max-page-size=0x4 -shared -fPIC -e rt_application_init -nostdlib -s')
|
|
||||||
module_env.Program(target, src_local)
|
|
||||||
module_env.AddPostAction(target, POST_ACTION)
|
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
EXEC_PATH = '/home/shaolin/CodeSourcery/Sourcery_G++_Lite/bin'
|
||||||
|
RTT_ROOT = os.path.normpath(os.getcwd() + '/../../..')
|
||||||
|
sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')]
|
||||||
|
PREFIX = 'arm-none-eabi-'
|
||||||
|
env = Environment(tools = ['mingw'],
|
||||||
|
AS = PREFIX + 'gcc',
|
||||||
|
ASFLAGS = '',
|
||||||
|
CC = PREFIX + 'gcc',
|
||||||
|
CCFLAGS = '-mcpu=arm920t -O0 -fPIC' ,
|
||||||
|
AR = PREFIX + 'ar',
|
||||||
|
ARFLAGS = '-rc',
|
||||||
|
LINK = PREFIX + 'ld',
|
||||||
|
LINKFLAGS = '-z max-page-size=0x4 -shared -fPIC -e rt_application_init -nostdlib -s',
|
||||||
|
CPPPATH = [
|
||||||
|
RTT_ROOT + '/include',
|
||||||
|
RTT_ROOT + '/bsp/mini2440'
|
||||||
|
])
|
||||||
|
env.PrependENVPath('PATH', EXEC_PATH)
|
||||||
|
|
||||||
|
target = 'basicapp.so'
|
||||||
|
src = Glob('*.c')
|
||||||
|
|
||||||
|
env.Program(target, src)
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
Import('env')
|
|
||||||
Import('projects')
|
|
||||||
Import('RTT_ROOT')
|
|
||||||
Import('rtconfig')
|
|
||||||
Import('TARGET')
|
|
||||||
|
|
||||||
RTMLINKER = RTT_ROOT + '/tools/rtmlinker.exe '
|
|
||||||
|
|
||||||
# group definitions
|
|
||||||
group = {}
|
|
||||||
group['name'] = 'examples'
|
|
||||||
group['src'] = Glob('*.c')
|
|
||||||
group['CCFLAGS'] = ''
|
|
||||||
group['CPPPATH'] = [RTT_ROOT + '/include', RTT_ROOT + '/examples/module', RTT_ROOT + '/components/libdl']
|
|
||||||
group['CPPDEFINES'] = ''
|
|
||||||
|
|
||||||
target = 'extapp.so'
|
|
||||||
POST_ACTION = RTMLINKER + '-l ' + TARGET + ' -o extapp.mo ' + '$TARGET'
|
|
||||||
|
|
||||||
# add group to project list
|
|
||||||
projects.append(group)
|
|
||||||
|
|
||||||
src_local = Glob('extapp.c')
|
|
||||||
|
|
||||||
env.Append(CCFLAGS = group['CCFLAGS'])
|
|
||||||
env.Append(CPPPATH = group['CPPPATH'])
|
|
||||||
env.Append(CPPDEFINES = group['CPPDEFINES'])
|
|
||||||
module_env = env.Clone(CPPDEFINE = 'RT_MODULE')
|
|
||||||
module_env = env.Clone(CCFLAGS = ' -mcpu=arm920t -O0 -fPIC')
|
|
||||||
module_env.Replace(LINKFLAGS = '-z max-page-size=0x4 -shared -fPIC -e rt_application_init -nostdlib -s')
|
|
||||||
module_env.Program(target, src_local)
|
|
||||||
module_env.AddPostAction(target, POST_ACTION)
|
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
EXEC_PATH = '/home/shaolin/CodeSourcery/Sourcery_G++_Lite/bin'
|
||||||
|
RTT_ROOT = os.path.normpath(os.getcwd() + '/../../..')
|
||||||
|
sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')]
|
||||||
|
PREFIX = 'arm-none-eabi-'
|
||||||
|
env = Environment(tools = ['mingw'],
|
||||||
|
AS = PREFIX + 'gcc',
|
||||||
|
ASFLAGS = '',
|
||||||
|
CC = PREFIX + 'gcc',
|
||||||
|
CCFLAGS = '-mcpu=arm920t -O0 -fPIC' ,
|
||||||
|
AR = PREFIX + 'ar',
|
||||||
|
ARFLAGS = '-rc',
|
||||||
|
LINK = PREFIX + 'ld',
|
||||||
|
LINKFLAGS = '-z max-page-size=0x4 -shared -fPIC -e rt_application_init -nostdlib -s',
|
||||||
|
CPPPATH = [RTT_ROOT + '/include', RTT_ROOT + '/examples/module', RTT_ROOT + '/bsp/mini2440', RTT_ROOT + '/components/libdl'])
|
||||||
|
env.PrependENVPath('PATH', EXEC_PATH)
|
||||||
|
|
||||||
|
target = 'extapp.so'
|
||||||
|
src = Glob('extapp.c')
|
||||||
|
|
||||||
|
env.Program(target, src)
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
EXEC_PATH = '/home/shaolin/CodeSourcery/Sourcery_G++_Lite/bin'
|
||||||
|
RTT_ROOT = os.path.normpath(os.getcwd() + '/../../..')
|
||||||
|
sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')]
|
||||||
|
PREFIX = 'arm-none-eabi-'
|
||||||
|
env = Environment(tools = ['mingw'],
|
||||||
|
AS = PREFIX + 'gcc',
|
||||||
|
ASFLAGS = '',
|
||||||
|
CC = PREFIX + 'gcc',
|
||||||
|
CCFLAGS = '-mcpu=arm920t -O0 -fPIC' ,
|
||||||
|
AR = PREFIX + 'ar',
|
||||||
|
ARFLAGS = '-rc',
|
||||||
|
LINK = PREFIX + 'ld',
|
||||||
|
LINKFLAGS = '-z max-page-size=0x4 -shared -fPIC -e 0 -nostdlib -s',
|
||||||
|
CPPPATH = [
|
||||||
|
RTT_ROOT + '/include',
|
||||||
|
RTT_ROOT + '/bsp/mini2440'
|
||||||
|
])
|
||||||
|
env.PrependENVPath('PATH', EXEC_PATH)
|
||||||
|
|
||||||
|
target = 'extension.so'
|
||||||
|
src = Glob('*.c')
|
||||||
|
|
||||||
|
env.Program(target, src)
|
||||||
|
|
|
@ -1,39 +0,0 @@
|
||||||
Import('env')
|
|
||||||
Import('projects')
|
|
||||||
Import('RTT_ROOT')
|
|
||||||
Import('rtconfig')
|
|
||||||
Import('TARGET')
|
|
||||||
|
|
||||||
RTMLINKER = RTT_ROOT + '/tools/rtmlinker.exe '
|
|
||||||
|
|
||||||
# group definitions
|
|
||||||
group = {}
|
|
||||||
group['CCFLAGS'] = ''
|
|
||||||
group['CPPPATH'] = [RTT_ROOT + '/include',
|
|
||||||
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',
|
|
||||||
RTT_ROOT + '/components/dfs',
|
|
||||||
RTT_ROOT + '/components/dfs/include',
|
|
||||||
RTT_ROOT + '/components/libc/newlib']
|
|
||||||
group['CPPDEFINES'] = ''
|
|
||||||
|
|
||||||
target = 'calculator.so'
|
|
||||||
POST_ACTION = RTMLINKER + ' -l ' + TARGET + ' -o calculator.mo ' + '$TARGET'
|
|
||||||
|
|
||||||
# add group to project list
|
|
||||||
projects.append(group)
|
|
||||||
|
|
||||||
src_local = Split("""
|
|
||||||
ftk_app_calc.c
|
|
||||||
""")
|
|
||||||
|
|
||||||
env.Append(CCFLAGS = group['CCFLAGS'])
|
|
||||||
env.Append(CPPPATH = group['CPPPATH'])
|
|
||||||
env.Append(CPPDEFINES = group['CPPDEFINES'])
|
|
||||||
module_env = env.Clone(CCFLAGS = ' -DRT_THREAD -mcpu=arm920t -O0 -fPIC')
|
|
||||||
module_env.Replace(LINKFLAGS = '-z max-page-size=0x4 -shared -fPIC -e 0 -nostdlib -s')
|
|
||||||
module_env.Program(target, src_local)
|
|
||||||
module_env.AddPostAction(target, POST_ACTION)
|
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
EXEC_PATH = '/home/shaolin/CodeSourcery/Sourcery_G++_Lite/bin'
|
||||||
|
RTT_ROOT = os.path.normpath(os.getcwd() + '/../../..')
|
||||||
|
sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')]
|
||||||
|
PREFIX = 'arm-none-eabi-'
|
||||||
|
env = Environment(tools = ['mingw'],
|
||||||
|
AS = PREFIX + 'gcc',
|
||||||
|
ASFLAGS = '',
|
||||||
|
CC = PREFIX + 'gcc',
|
||||||
|
CCFLAGS = '-DRT_THREAD -DFTK_AS_PLUGIN -mcpu=arm920t -O0 -fPIC' ,
|
||||||
|
AR = PREFIX + 'ar',
|
||||||
|
ARFLAGS = '-rc',
|
||||||
|
LINK = PREFIX + 'ld',
|
||||||
|
LINKFLAGS = '-z max-page-size=0x4 -shared -fPIC -e 0 -nostdlib -s',
|
||||||
|
CPPPATH = [
|
||||||
|
RTT_ROOT + '/include',
|
||||||
|
RTT_ROOT + '/bsp/mini2440',
|
||||||
|
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/dfs',
|
||||||
|
RTT_ROOT + '/components/dfs/include',
|
||||||
|
RTT_ROOT + '/components/libc/newlib'
|
||||||
|
])
|
||||||
|
env.PrependENVPath('PATH', EXEC_PATH)
|
||||||
|
|
||||||
|
target = 'calculator.so'
|
||||||
|
src = Glob('*.c')
|
||||||
|
|
||||||
|
env.Program(target, src)
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#include "ftk_xul.h"
|
#include "ftk_xul.h"
|
||||||
#include "ftk_expr.h"
|
#include "ftk_expr.h"
|
||||||
#include "ftk_app_calc.h"
|
#include "ftk_app_calc.h"
|
||||||
#include "ftk_animator_expand.h"
|
|
||||||
|
|
||||||
typedef struct _PrivInfo
|
typedef struct _PrivInfo
|
||||||
{
|
{
|
||||||
|
@ -73,6 +72,7 @@ static FtkWidget* ftk_calc_create_window(void)
|
||||||
FtkBitmap* bitmap_focus = NULL;
|
FtkBitmap* bitmap_focus = NULL;
|
||||||
char path[FTK_MAX_PATH+1] = {0};
|
char path[FTK_MAX_PATH+1] = {0};
|
||||||
FtkWidget* win = ftk_app_window_create();
|
FtkWidget* win = ftk_app_window_create();
|
||||||
|
ftk_window_set_animation_hint(win, "app_main_window");
|
||||||
width = ftk_widget_width(win);
|
width = ftk_widget_width(win);
|
||||||
height = ftk_widget_height(win);
|
height = ftk_widget_height(win);
|
||||||
entry = ftk_entry_create(win, 0, 0, width, 30);
|
entry = ftk_entry_create(win, 0, 0, width, 30);
|
||||||
|
|
|
@ -1,37 +0,0 @@
|
||||||
Import('env')
|
|
||||||
Import('projects')
|
|
||||||
Import('RTT_ROOT')
|
|
||||||
Import('rtconfig')
|
|
||||||
Import('TARGET')
|
|
||||||
|
|
||||||
RTMLINKER = RTT_ROOT + '/tools/rtmlinker.exe '
|
|
||||||
|
|
||||||
# group definitions
|
|
||||||
group = {}
|
|
||||||
group['CCFLAGS'] = ''
|
|
||||||
group['CPPPATH'] = [RTT_ROOT + '/include',
|
|
||||||
RTT_ROOT + '/examples/module',
|
|
||||||
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/dfs',
|
|
||||||
RTT_ROOT + '/components/dfs/include',
|
|
||||||
RTT_ROOT + '/components/libc/newlib']
|
|
||||||
group['CPPDEFINES'] = ''
|
|
||||||
|
|
||||||
target = 'libftk_demos.so'
|
|
||||||
POST_ACTION = RTMLINKER + ' -l ' + TARGET + ' -o libftk_demos.mo ' + '$TARGET'
|
|
||||||
|
|
||||||
# add group to project list
|
|
||||||
projects.append(group)
|
|
||||||
|
|
||||||
src_local = Glob('*.c')
|
|
||||||
|
|
||||||
env.Append(CCFLAGS = group['CCFLAGS'])
|
|
||||||
env.Append(CPPPATH = group['CPPPATH'])
|
|
||||||
env.Append(CPPDEFINES = group['CPPDEFINES'])
|
|
||||||
module_env = env.Clone(CCFLAGS = ' -DRT_THREAD -DFTK_AS_PLUGIN -mcpu=arm920t -O0 -fPIC')
|
|
||||||
module_env.Replace(LINKFLAGS = '-z max-page-size=0x4 -shared -fPIC -e 0 -nostdlib -s')
|
|
||||||
module_env.Program(target, src_local)
|
|
||||||
module_env.AddPostAction(target, POST_ACTION)
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
EXEC_PATH = '/home/shaolin/CodeSourcery/Sourcery_G++_Lite/bin'
|
||||||
|
RTT_ROOT = os.path.normpath(os.getcwd() + '/../../..')
|
||||||
|
sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')]
|
||||||
|
PREFIX = 'arm-none-eabi-'
|
||||||
|
env = Environment(tools = ['mingw'],
|
||||||
|
AS = PREFIX + 'gcc',
|
||||||
|
ASFLAGS = '',
|
||||||
|
CC = PREFIX + 'gcc',
|
||||||
|
CCFLAGS = '-DRT_THREAD -DFTK_AS_PLUGIN -mcpu=arm920t -O0 -fPIC' ,
|
||||||
|
AR = PREFIX + 'ar',
|
||||||
|
ARFLAGS = '-rc',
|
||||||
|
LINK = PREFIX + 'ld',
|
||||||
|
LINKFLAGS = '-z max-page-size=0x4 -shared -fPIC -e 0 -nostdlib -s',
|
||||||
|
CPPPATH = [
|
||||||
|
RTT_ROOT + '/include',
|
||||||
|
RTT_ROOT + '/bsp/mini2440',
|
||||||
|
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/dfs',
|
||||||
|
RTT_ROOT + '/components/dfs/include',
|
||||||
|
RTT_ROOT + '/components/libc/newlib'
|
||||||
|
])
|
||||||
|
env.PrependENVPath('PATH', EXEC_PATH)
|
||||||
|
|
||||||
|
target = 'libftk_demos.so'
|
||||||
|
src = Glob('*.c')
|
||||||
|
|
||||||
|
env.Program(target, src)
|
||||||
|
|
|
@ -1,104 +0,0 @@
|
||||||
#include "ftk.h"
|
|
||||||
#include "ftk_animator_alpha.h"
|
|
||||||
|
|
||||||
static void create_ani_window(int type, int sync);
|
|
||||||
|
|
||||||
static Ret button_fast_clicked(void* ctx, void* obj)
|
|
||||||
{
|
|
||||||
create_ani_window(1, 0);
|
|
||||||
|
|
||||||
return RET_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Ret button_slow_clicked(void* ctx, void* obj)
|
|
||||||
{
|
|
||||||
create_ani_window(0, 0);
|
|
||||||
|
|
||||||
return RET_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Ret button_quit_clicked(void* ctx, void* obj)
|
|
||||||
{
|
|
||||||
FtkWidget* win = ctx;
|
|
||||||
ftk_widget_unref(win);
|
|
||||||
ftk_logd("%s: close window %s\n", __func__, ftk_widget_get_text(win));
|
|
||||||
|
|
||||||
return RET_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void create_ani_window(int type, int sync)
|
|
||||||
{
|
|
||||||
FtkGc gc = {0};
|
|
||||||
char filename[FTK_MAX_PATH+1] = {0};
|
|
||||||
FtkWidget* win = ftk_app_window_create();
|
|
||||||
FtkAnimator* ani = ftk_animator_alpha_create(1);
|
|
||||||
|
|
||||||
gc.mask = FTK_GC_BITMAP;
|
|
||||||
|
|
||||||
ftk_snprintf(filename, FTK_MAX_PATH, "%s/jpeg1.jpg",
|
|
||||||
ftk_config_get_test_data_dir(ftk_default_config()));
|
|
||||||
gc.bitmap = ftk_bitmap_factory_load(ftk_default_bitmap_factory(), filename);
|
|
||||||
ftk_widget_set_gc(win, FTK_WIDGET_NORMAL, &gc);
|
|
||||||
ftk_gc_reset(&gc);
|
|
||||||
|
|
||||||
ftk_animator_set_param(ani, 0, 0, 0xff, type ? 0x60 : 0x20, type ? 200 : 1000);
|
|
||||||
ftk_animator_start(ani, win, 0);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void create_app_window(void)
|
|
||||||
{
|
|
||||||
char title[32] = {0};
|
|
||||||
int width = 0;
|
|
||||||
int height = 0;
|
|
||||||
FtkWidget* win = ftk_app_window_create();
|
|
||||||
FtkWidget* button = NULL;
|
|
||||||
|
|
||||||
width = ftk_widget_width(win);
|
|
||||||
height = ftk_widget_height(win);
|
|
||||||
|
|
||||||
button = ftk_button_create(win, 5, height/6, width/2-5, 50);
|
|
||||||
ftk_widget_set_text(button, "Fast");
|
|
||||||
ftk_button_set_clicked_listener(button, button_fast_clicked, win);
|
|
||||||
|
|
||||||
button = ftk_button_create(win, width/2, height/6, width/2-5, 50);
|
|
||||||
ftk_widget_set_text(button, "Slow");
|
|
||||||
ftk_button_set_clicked_listener(button, button_slow_clicked, win);
|
|
||||||
|
|
||||||
|
|
||||||
button = ftk_button_create(win, width/4-2, height/6 + 180, width/2-5, 50);
|
|
||||||
ftk_widget_set_text(button, "Quit");
|
|
||||||
ftk_button_set_clicked_listener(button, button_quit_clicked, win);
|
|
||||||
|
|
||||||
ftk_snprintf(title, sizeof(title), "Alpha Demo");
|
|
||||||
ftk_widget_set_text(win, title);
|
|
||||||
FTK_QUIT_WHEN_WIDGET_CLOSE(win);
|
|
||||||
|
|
||||||
ftk_widget_show_all(win, 1);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef FTK_AS_PLUGIN
|
|
||||||
#include "ftk_app_demo.h"
|
|
||||||
FTK_HIDE int FTK_MAIN(int argc, char* argv[]);
|
|
||||||
FtkApp* ftk_app_demo_alpha_create()
|
|
||||||
{
|
|
||||||
return ftk_app_demo_create(_("alpha"), ftk_main);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
#define FTK_HIDE extern
|
|
||||||
#endif /*FTK_AS_PLUGIN*/
|
|
||||||
|
|
||||||
FTK_HIDE int FTK_MAIN(int argc, char* argv[])
|
|
||||||
{
|
|
||||||
FTK_INIT(argc, argv);
|
|
||||||
|
|
||||||
create_app_window();
|
|
||||||
|
|
||||||
FTK_RUN();
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
|
@ -50,6 +50,7 @@ FTK_HIDE int FTK_MAIN(int argc, char* argv[])
|
||||||
FTK_INIT(argc, argv);
|
FTK_INIT(argc, argv);
|
||||||
|
|
||||||
win = ftk_app_window_create();
|
win = ftk_app_window_create();
|
||||||
|
ftk_window_set_animation_hint(win, "app_main_window");
|
||||||
width = ftk_widget_width(win);
|
width = ftk_widget_width(win);
|
||||||
height = ftk_widget_height(win);
|
height = ftk_widget_height(win);
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@ FTK_HIDE int FTK_MAIN(int argc, char* argv[])
|
||||||
FTK_INIT(argc, argv);
|
FTK_INIT(argc, argv);
|
||||||
|
|
||||||
win = ftk_app_window_create();
|
win = ftk_app_window_create();
|
||||||
|
ftk_window_set_animation_hint(win, "app_main_window");
|
||||||
width = ftk_widget_width(win);
|
width = ftk_widget_width(win);
|
||||||
height = ftk_widget_height(win);
|
height = ftk_widget_height(win);
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@ FTK_HIDE int FTK_MAIN(int argc, char* argv[])
|
||||||
FTK_INIT(argc, argv);
|
FTK_INIT(argc, argv);
|
||||||
|
|
||||||
win = ftk_app_window_create();
|
win = ftk_app_window_create();
|
||||||
|
ftk_window_set_animation_hint(win, "app_main_window");
|
||||||
width = ftk_widget_width(win);
|
width = ftk_widget_width(win);
|
||||||
height = ftk_widget_height(win);
|
height = ftk_widget_height(win);
|
||||||
|
|
||||||
|
|
|
@ -92,6 +92,7 @@ FTK_HIDE int FTK_MAIN(int argc, char* argv[])
|
||||||
FTK_INIT(argc, argv);
|
FTK_INIT(argc, argv);
|
||||||
|
|
||||||
win = ftk_app_window_create();
|
win = ftk_app_window_create();
|
||||||
|
ftk_window_set_animation_hint(win, "app_main_window");
|
||||||
width = ftk_widget_width(win);
|
width = ftk_widget_width(win);
|
||||||
height = ftk_widget_height(win);
|
height = ftk_widget_height(win);
|
||||||
|
|
||||||
|
|
|
@ -62,6 +62,7 @@ FTK_HIDE int FTK_MAIN(int argc, char* argv[])
|
||||||
FTK_INIT(argc, argv);
|
FTK_INIT(argc, argv);
|
||||||
|
|
||||||
win = ftk_app_window_create();
|
win = ftk_app_window_create();
|
||||||
|
ftk_window_set_animation_hint(win, "app_main_window");
|
||||||
width = ftk_widget_width(win);
|
width = ftk_widget_width(win);
|
||||||
height = ftk_widget_height(win);
|
height = ftk_widget_height(win);
|
||||||
entry = ftk_entry_create(win, 10, 30, ftk_widget_width(win) - 20, 30);
|
entry = ftk_entry_create(win, 10, 30, ftk_widget_width(win) - 20, 30);
|
||||||
|
|
|
@ -1,189 +0,0 @@
|
||||||
#include "ftk.h"
|
|
||||||
#include "ftk_animator_expand.h"
|
|
||||||
|
|
||||||
static void create_ani_window(int type, int sync);
|
|
||||||
|
|
||||||
static Ret button_to_east_south_clicked(void* ctx, void* obj)
|
|
||||||
{
|
|
||||||
create_ani_window(FTK_ANI_TO_EAST_SOUTH, 1);
|
|
||||||
|
|
||||||
return RET_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Ret button_to_east_north_clicked(void* ctx, void* obj)
|
|
||||||
{
|
|
||||||
create_ani_window(FTK_ANI_TO_EAST_NORTH, 1);
|
|
||||||
|
|
||||||
return RET_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Ret button_to_right_clicked(void* ctx, void* obj)
|
|
||||||
{
|
|
||||||
create_ani_window(FTK_ANI_TO_RIGHT, 0);
|
|
||||||
|
|
||||||
return RET_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Ret button_to_down_clicked(void* ctx, void* obj)
|
|
||||||
{
|
|
||||||
create_ani_window(FTK_ANI_TO_DOWN, 0);
|
|
||||||
|
|
||||||
return RET_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Ret button_to_up_clicked(void* ctx, void* obj)
|
|
||||||
{
|
|
||||||
create_ani_window(FTK_ANI_TO_UP, 0);
|
|
||||||
|
|
||||||
return RET_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Ret button_to_brink_clicked(void* ctx, void* obj)
|
|
||||||
{
|
|
||||||
create_ani_window(FTK_ANI_TO_BRINK, 0);
|
|
||||||
|
|
||||||
return RET_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Ret button_close_clicked(void* ctx, void* obj)
|
|
||||||
{
|
|
||||||
FtkWidget* win = ctx;
|
|
||||||
ftk_logd("%s: close window %s\n", __func__, ftk_widget_get_text(win));
|
|
||||||
ftk_widget_unref(win);
|
|
||||||
|
|
||||||
return RET_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Ret button_quit_clicked(void* ctx, void* obj)
|
|
||||||
{
|
|
||||||
FtkWidget* win = ctx;
|
|
||||||
ftk_widget_unref(win);
|
|
||||||
ftk_logd("%s: close window %s\n", __func__, ftk_widget_get_text(win));
|
|
||||||
|
|
||||||
return RET_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void create_ani_window(int type, int sync)
|
|
||||||
{
|
|
||||||
int delta = 0;
|
|
||||||
int width = 0;
|
|
||||||
int height = 0;
|
|
||||||
FtkWidget* button = NULL;
|
|
||||||
FtkGc gc = {0};
|
|
||||||
char filename[FTK_MAX_PATH+1] = {0};
|
|
||||||
FtkWidget* win = ftk_app_window_create();
|
|
||||||
FtkAnimator* ani = ftk_animator_expand_create(1);
|
|
||||||
|
|
||||||
gc.mask = FTK_GC_BITMAP;
|
|
||||||
width = ftk_widget_width(win);
|
|
||||||
height = ftk_widget_height(win);
|
|
||||||
delta = height/6;
|
|
||||||
|
|
||||||
button = ftk_button_create(win, width/3, height/3, width/3, 50);
|
|
||||||
ftk_widget_set_text(button, "关闭");
|
|
||||||
ftk_widget_show(button, 1);
|
|
||||||
ftk_button_set_clicked_listener(button, button_close_clicked, win);
|
|
||||||
|
|
||||||
ftk_snprintf(filename, FTK_MAX_PATH, "%s/jpeg1.jpg",
|
|
||||||
ftk_config_get_test_data_dir(ftk_default_config()));
|
|
||||||
gc.bitmap = ftk_bitmap_factory_load(ftk_default_bitmap_factory(), filename);
|
|
||||||
ftk_widget_set_gc(win, FTK_WIDGET_NORMAL, &gc);
|
|
||||||
ftk_gc_reset(&gc);
|
|
||||||
|
|
||||||
switch(type)
|
|
||||||
{
|
|
||||||
case FTK_ANI_TO_RIGHT:
|
|
||||||
case FTK_ANI_TO_EAST_SOUTH:
|
|
||||||
case FTK_ANI_TO_EAST_NORTH:
|
|
||||||
{
|
|
||||||
ftk_animator_set_param(ani, type, 100, width, delta, 200);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case FTK_ANI_TO_BRINK:
|
|
||||||
case FTK_ANI_TO_DOWN:
|
|
||||||
{
|
|
||||||
ftk_animator_set_param(ani, type, 100, height, delta, 200);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case FTK_ANI_TO_UP:
|
|
||||||
{
|
|
||||||
ftk_animator_set_param(ani, type, height - 100, ftk_widget_top(win), delta, 200);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:break;
|
|
||||||
}
|
|
||||||
ftk_animator_start(ani, win, 0);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void create_app_window(void)
|
|
||||||
{
|
|
||||||
char title[32] = {0};
|
|
||||||
int width = 0;
|
|
||||||
int height = 0;
|
|
||||||
FtkWidget* win = ftk_app_window_create();
|
|
||||||
FtkWidget* button = NULL;
|
|
||||||
|
|
||||||
width = ftk_widget_width(win);
|
|
||||||
height = ftk_widget_height(win);
|
|
||||||
|
|
||||||
button = ftk_button_create(win, 5, height/6, width/2-5, 50);
|
|
||||||
ftk_widget_set_text(button, "向右伸展");
|
|
||||||
ftk_button_set_clicked_listener(button, button_to_right_clicked, win);
|
|
||||||
|
|
||||||
button = ftk_button_create(win, width/2, height/6, width/2-5, 50);
|
|
||||||
ftk_widget_set_text(button, "Down");
|
|
||||||
ftk_button_set_clicked_listener(button, button_to_down_clicked, win);
|
|
||||||
|
|
||||||
button = ftk_button_create(win, 5, height/6 + 60, width/2-5, 50);
|
|
||||||
ftk_widget_set_text(button, "RightDown");
|
|
||||||
ftk_button_set_clicked_listener(button, button_to_east_south_clicked, win);
|
|
||||||
|
|
||||||
button = ftk_button_create(win, width/2, height/6 + 60, width/2-5, 50);
|
|
||||||
ftk_widget_set_text(button, "RightUp");
|
|
||||||
ftk_button_set_clicked_listener(button, button_to_east_north_clicked, win);
|
|
||||||
|
|
||||||
button = ftk_button_create(win, 5, height/6 + 120, width/2-5, 50);
|
|
||||||
ftk_widget_set_text(button, "Up");
|
|
||||||
ftk_button_set_clicked_listener(button, button_to_up_clicked, win);
|
|
||||||
|
|
||||||
button = ftk_button_create(win, width/2, height/6 + 120, width/2-5, 50);
|
|
||||||
ftk_widget_set_text(button, "Brink");
|
|
||||||
ftk_button_set_clicked_listener(button, button_to_brink_clicked, win);
|
|
||||||
|
|
||||||
button = ftk_button_create(win, width/4-2, height/6 + 180, width/2-5, 50);
|
|
||||||
ftk_widget_set_text(button, "Quit");
|
|
||||||
ftk_button_set_clicked_listener(button, button_quit_clicked, win);
|
|
||||||
|
|
||||||
ftk_snprintf(title, sizeof(title), "Expand Demo");
|
|
||||||
ftk_widget_set_text(win, title);
|
|
||||||
FTK_QUIT_WHEN_WIDGET_CLOSE(win);
|
|
||||||
|
|
||||||
ftk_widget_show_all(win, 1);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef FTK_AS_PLUGIN
|
|
||||||
#include "ftk_app_demo.h"
|
|
||||||
FTK_HIDE int FTK_MAIN(int argc, char* argv[]);
|
|
||||||
FtkApp* ftk_app_demo_expand_create()
|
|
||||||
{
|
|
||||||
return ftk_app_demo_create(_("expand"), ftk_main);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
#define FTK_HIDE extern
|
|
||||||
#endif /*FTK_AS_PLUGIN*/
|
|
||||||
|
|
||||||
FTK_HIDE int FTK_MAIN(int argc, char* argv[])
|
|
||||||
{
|
|
||||||
FTK_INIT(argc, argv);
|
|
||||||
|
|
||||||
create_app_window();
|
|
||||||
|
|
||||||
FTK_RUN();
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
|
@ -67,6 +67,7 @@ FTK_HIDE int FTK_MAIN(int argc, char* argv[])
|
||||||
FTK_INIT(argc, argv);
|
FTK_INIT(argc, argv);
|
||||||
|
|
||||||
win = ftk_app_window_create();
|
win = ftk_app_window_create();
|
||||||
|
ftk_window_set_animation_hint(win, "app_main_window");
|
||||||
width = ftk_widget_width(win);
|
width = ftk_widget_width(win);
|
||||||
height = ftk_widget_height(win);
|
height = ftk_widget_height(win);
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,19 @@
|
||||||
#include "ftk.h"
|
#include "ftk.h"
|
||||||
|
|
||||||
|
static Ret on_prepare_options_menu(void* ctx, FtkWidget* menu_panel)
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
for(i = 0; i < 3; i++)
|
||||||
|
{
|
||||||
|
char text[32] = {0};
|
||||||
|
FtkWidget* item = ftk_menu_item_create(menu_panel);
|
||||||
|
ftk_snprintf(text, sizeof(text), "Menu%02d", i);
|
||||||
|
ftk_widget_set_text(item, text);
|
||||||
|
ftk_widget_show(item, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return i > 0 ? RET_OK : RET_FAIL;
|
||||||
|
}
|
||||||
#define IDC_TEST_BUTTON 1000
|
#define IDC_TEST_BUTTON 1000
|
||||||
static Ret button_quit_clicked(void* ctx, void* obj)
|
static Ret button_quit_clicked(void* ctx, void* obj)
|
||||||
{
|
{
|
||||||
|
@ -8,16 +22,31 @@ static Ret button_quit_clicked(void* ctx, void* obj)
|
||||||
return RET_OK;
|
return RET_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char* buttons[] = {"OK", NULL};
|
||||||
static Ret button_unfullscreen_clicked(void* ctx, void* obj)
|
static Ret button_unfullscreen_clicked(void* ctx, void* obj)
|
||||||
{
|
{
|
||||||
|
if(!ftk_window_is_fullscreen(ctx))
|
||||||
|
{
|
||||||
|
ftk_infomation("Infomation", "Windows is not fullscreen.", buttons);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
ftk_window_set_fullscreen(ctx, 0);
|
ftk_window_set_fullscreen(ctx, 0);
|
||||||
|
}
|
||||||
|
|
||||||
return RET_OK;
|
return RET_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Ret button_fullscreen_clicked(void* ctx, void* obj)
|
static Ret button_fullscreen_clicked(void* ctx, void* obj)
|
||||||
{
|
{
|
||||||
|
if(ftk_window_is_fullscreen(ctx))
|
||||||
|
{
|
||||||
|
ftk_infomation("Infomation", "Windows is fullscreen.", buttons);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
ftk_window_set_fullscreen(ctx, 1);
|
ftk_window_set_fullscreen(ctx, 1);
|
||||||
|
}
|
||||||
|
|
||||||
return RET_OK;
|
return RET_OK;
|
||||||
}
|
}
|
||||||
|
@ -42,6 +71,7 @@ FTK_HIDE int FTK_MAIN(int argc, char* argv[])
|
||||||
FTK_INIT(argc, argv);
|
FTK_INIT(argc, argv);
|
||||||
|
|
||||||
win = ftk_app_window_create();
|
win = ftk_app_window_create();
|
||||||
|
ftk_window_set_animation_hint(win, "app_main_window");
|
||||||
width = ftk_widget_width(win);
|
width = ftk_widget_width(win);
|
||||||
height = ftk_widget_height(win);
|
height = ftk_widget_height(win);
|
||||||
|
|
||||||
|
@ -62,6 +92,7 @@ FTK_HIDE int FTK_MAIN(int argc, char* argv[])
|
||||||
ftk_widget_set_text(win, "fullscreen");
|
ftk_widget_set_text(win, "fullscreen");
|
||||||
ftk_widget_show_all(win, 1);
|
ftk_widget_show_all(win, 1);
|
||||||
FTK_QUIT_WHEN_WIDGET_CLOSE(win);
|
FTK_QUIT_WHEN_WIDGET_CLOSE(win);
|
||||||
|
ftk_app_window_set_on_prepare_options_menu(win, on_prepare_options_menu, win);
|
||||||
|
|
||||||
FTK_RUN();
|
FTK_RUN();
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@ FTK_HIDE int FTK_MAIN(int argc, char* argv[])
|
||||||
|
|
||||||
FTK_INIT(argc, argv);
|
FTK_INIT(argc, argv);
|
||||||
win = ftk_app_window_create();
|
win = ftk_app_window_create();
|
||||||
|
ftk_window_set_animation_hint(win, "app_main_window");
|
||||||
ftk_widget_set_text(win, "Hello FTK!");
|
ftk_widget_set_text(win, "Hello FTK!");
|
||||||
ftk_widget_show(win, 1);
|
ftk_widget_show(win, 1);
|
||||||
FTK_QUIT_WHEN_WIDGET_CLOSE(win);
|
FTK_QUIT_WHEN_WIDGET_CLOSE(win);
|
||||||
|
|
|
@ -62,6 +62,7 @@ FTK_HIDE int FTK_MAIN(int argc, char* argv[])
|
||||||
FTK_INIT(argc, argv);
|
FTK_INIT(argc, argv);
|
||||||
|
|
||||||
win = ftk_app_window_create();
|
win = ftk_app_window_create();
|
||||||
|
ftk_window_set_animation_hint(win, "app_main_window");
|
||||||
width = ftk_widget_width(win);
|
width = ftk_widget_width(win);
|
||||||
height = ftk_widget_height(win);
|
height = ftk_widget_height(win);
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ FTK_HIDE int FTK_MAIN(int argc, char* argv[])
|
||||||
FTK_INIT(argc, argv);
|
FTK_INIT(argc, argv);
|
||||||
|
|
||||||
win = ftk_app_window_create();
|
win = ftk_app_window_create();
|
||||||
|
ftk_window_set_animation_hint(win, "app_main_window");
|
||||||
|
|
||||||
ftk_snprintf(filename, FTK_MAX_PATH, "%s/earth.png",
|
ftk_snprintf(filename, FTK_MAX_PATH, "%s/earth.png",
|
||||||
ftk_config_get_test_data_dir(ftk_default_config()));
|
ftk_config_get_test_data_dir(ftk_default_config()));
|
||||||
|
|
|
@ -77,6 +77,7 @@ FTK_HIDE int FTK_MAIN(int argc, char* argv[])
|
||||||
|
|
||||||
gc.mask = FTK_GC_BITMAP;
|
gc.mask = FTK_GC_BITMAP;
|
||||||
win = ftk_app_window_create();
|
win = ftk_app_window_create();
|
||||||
|
ftk_window_set_animation_hint(win, "app_main_window");
|
||||||
width = ftk_widget_width(win);
|
width = ftk_widget_width(win);
|
||||||
height = ftk_widget_height(win);
|
height = ftk_widget_height(win);
|
||||||
for(i = 0; i < height/80; i++)
|
for(i = 0; i < height/80; i++)
|
||||||
|
|
|
@ -28,6 +28,7 @@ FTK_HIDE int FTK_MAIN(int argc, char* argv[])
|
||||||
FTK_INIT(argc, argv);
|
FTK_INIT(argc, argv);
|
||||||
|
|
||||||
win = ftk_app_window_create();
|
win = ftk_app_window_create();
|
||||||
|
ftk_window_set_animation_hint(win, "app_main_window");
|
||||||
width = ftk_widget_width(win);
|
width = ftk_widget_width(win);
|
||||||
height = ftk_widget_height(win);
|
height = ftk_widget_height(win);
|
||||||
entry = ftk_entry_create(win, 10, 30, ftk_widget_width(win) - 20, 30);
|
entry = ftk_entry_create(win, 10, 30, ftk_widget_width(win) - 20, 30);
|
||||||
|
|
|
@ -12,7 +12,7 @@ static Ret timeout(void* ctx)
|
||||||
char buffer[32] = {0};
|
char buffer[32] = {0};
|
||||||
if(info->times > 0)
|
if(info->times > 0)
|
||||||
{
|
{
|
||||||
snprintf(buffer, sizeof(buffer), "Quit after %d seconds", info->times);
|
ftk_snprintf(buffer, sizeof(buffer), "Quit after %d seconds", info->times);
|
||||||
ftk_widget_set_text(info->label, buffer);
|
ftk_widget_set_text(info->label, buffer);
|
||||||
info->times--;
|
info->times--;
|
||||||
|
|
||||||
|
@ -43,22 +43,30 @@ FTK_HIDE int FTK_MAIN(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
int width = 0;
|
int width = 0;
|
||||||
int height = 0;
|
int height = 0;
|
||||||
FtkGc gc = {.mask = FTK_GC_BG};
|
FtkGc gc = {0};
|
||||||
TimerInfo* info = NULL;
|
TimerInfo* info = NULL;
|
||||||
|
FtkSource* timer = NULL;
|
||||||
|
FtkWidget* win = NULL;
|
||||||
|
FtkWidget* label = NULL;
|
||||||
|
|
||||||
|
gc.mask = FTK_GC_BG;
|
||||||
|
|
||||||
FTK_INIT(argc, argv);
|
FTK_INIT(argc, argv);
|
||||||
info = (TimerInfo*)FTK_ZALLOC(sizeof(TimerInfo));
|
info = (TimerInfo*)FTK_ZALLOC(sizeof(TimerInfo));
|
||||||
info->times = 5;
|
info->times = 5;
|
||||||
|
|
||||||
FtkSource* timer = ftk_source_timer_create(1000, timeout, info);
|
timer = ftk_source_timer_create(1000, timeout, info);
|
||||||
FtkWidget* win = ftk_app_window_create();
|
win = ftk_app_window_create();
|
||||||
|
ftk_window_set_animation_hint(win, "app_main_window");
|
||||||
|
|
||||||
width = ftk_widget_width(win);
|
width = ftk_widget_width(win);
|
||||||
height = ftk_widget_height(win);
|
height = ftk_widget_height(win);
|
||||||
|
|
||||||
FtkWidget* label = ftk_label_create(win, 10, 10, width - 20, 20);
|
#ifdef WIN32
|
||||||
|
label = ftk_label_create(win, 10, 10, width - 20, 20);
|
||||||
ftk_widget_set_text(label, "中文文本");
|
ftk_widget_set_text(label, "中文文本");
|
||||||
|
#else
|
||||||
|
#endif
|
||||||
label = ftk_label_create(win, 10, 40, width - 20, 20);
|
label = ftk_label_create(win, 10, 40, width - 20, 20);
|
||||||
ftk_widget_set_text(label, "English Text(center)");
|
ftk_widget_set_text(label, "English Text(center)");
|
||||||
ftk_label_set_alignment(label, FTK_ALIGN_CENTER);
|
ftk_label_set_alignment(label, FTK_ALIGN_CENTER);
|
||||||
|
@ -75,8 +83,11 @@ FTK_HIDE int FTK_MAIN(int argc, char* argv[])
|
||||||
label = ftk_label_create(win, 10, height/2, width - 20, 120);
|
label = ftk_label_create(win, 10, height/2, width - 20, 120);
|
||||||
ftk_widget_set_gc(label, FTK_WIDGET_INSENSITIVE, &gc);
|
ftk_widget_set_gc(label, FTK_WIDGET_INSENSITIVE, &gc);
|
||||||
ftk_widget_unset_attr(label, FTK_ATTR_TRANSPARENT);
|
ftk_widget_unset_attr(label, FTK_ATTR_TRANSPARENT);
|
||||||
|
#ifdef WIN32
|
||||||
|
ftk_widget_set_text(label, "The linux mobile development(with background color)");
|
||||||
|
#else
|
||||||
ftk_widget_set_text(label, "中英文混合多行文本显示:the linux mobile development.带有背景颜色。");
|
ftk_widget_set_text(label, "中英文混合多行文本显示:the linux mobile development.带有背景颜色。");
|
||||||
|
#endif
|
||||||
label = ftk_label_create(win, 50, height/2-30, width, 20);
|
label = ftk_label_create(win, 50, height/2-30, width, 20);
|
||||||
info->label = label;
|
info->label = label;
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ static Ret button_more_clicked(void* ctx, void* obj)
|
||||||
return RET_OK;
|
return RET_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Ret on_item_clicked(void* ctx, void* list)
|
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);
|
||||||
|
@ -111,6 +111,7 @@ FTK_HIDE int FTK_MAIN(int argc, char* argv[])
|
||||||
|
|
||||||
button = ftk_button_create(win, width/4, 3 * height/4 + 5, width/4, 60);
|
button = ftk_button_create(win, width/4, 3 * height/4 + 5, width/4, 60);
|
||||||
ftk_widget_set_text(button, "more");
|
ftk_widget_set_text(button, "more");
|
||||||
|
ftk_widget_set_font_size(button, 20);
|
||||||
ftk_button_set_clicked_listener(button, button_more_clicked, model);
|
ftk_button_set_clicked_listener(button, button_more_clicked, model);
|
||||||
|
|
||||||
button = ftk_button_create(win, width/2, 3 * height/4 + 5, width/4, 60);
|
button = ftk_button_create(win, width/2, 3 * height/4 + 5, width/4, 60);
|
||||||
|
|
|
@ -51,7 +51,7 @@ static void create_app_window(void)
|
||||||
{
|
{
|
||||||
int width = 0;
|
int width = 0;
|
||||||
int height = 0;
|
int height = 0;
|
||||||
char title[32] = {0};
|
char title[128] = {0};
|
||||||
FtkWidget* win = ftk_app_window_create();
|
FtkWidget* win = ftk_app_window_create();
|
||||||
FtkWidget* label = NULL;
|
FtkWidget* label = NULL;
|
||||||
FtkWidget* button = NULL;
|
FtkWidget* button = NULL;
|
||||||
|
@ -68,7 +68,10 @@ static void create_app_window(void)
|
||||||
ftk_button_set_clicked_listener(button, button_close_clicked, win);
|
ftk_button_set_clicked_listener(button, button_close_clicked, win);
|
||||||
|
|
||||||
label = ftk_label_create(win, 10, height/2, width-20, 60);
|
label = ftk_label_create(win, 10, height/2, width-20, 60);
|
||||||
ftk_widget_set_text(label, "Press F2 to open menu, Presss F3 close window.");
|
|
||||||
|
ftk_snprintf(title, sizeof(title),
|
||||||
|
"Press F2 to open menu, Presss F3 close window%02d", g_index++);
|
||||||
|
ftk_widget_set_text(label, title);
|
||||||
|
|
||||||
ftk_snprintf(title, sizeof(title), "window%02d", g_index++);
|
ftk_snprintf(title, sizeof(title), "window%02d", g_index++);
|
||||||
ftk_widget_set_text(win, title);
|
ftk_widget_set_text(win, title);
|
||||||
|
|
|
@ -52,7 +52,7 @@ static void create_app_window(void)
|
||||||
ftk_widget_set_text(button, "关闭窗口");
|
ftk_widget_set_text(button, "关闭窗口");
|
||||||
ftk_button_set_clicked_listener(button, button_close_clicked, win);
|
ftk_button_set_clicked_listener(button, button_close_clicked, win);
|
||||||
|
|
||||||
snprintf(title, sizeof(title), "window%02d", g_index++);
|
ftk_snprintf(title, sizeof(title), "window%02d", g_index++);
|
||||||
label = ftk_label_create(win, width/4, height/2, width/2, 30);
|
label = ftk_label_create(win, width/4, height/2, width/2, 30);
|
||||||
ftk_widget_set_text(label, title);
|
ftk_widget_set_text(label, title);
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ FTK_HIDE int FTK_MAIN(int argc, char* argv[])
|
||||||
height = ftk_widget_height(win);
|
height = ftk_widget_height(win);
|
||||||
|
|
||||||
width = width - 20;
|
width = width - 20;
|
||||||
progress_bar = ftk_progress_bar_create(win, 10, height/6, width, 20);
|
progress_bar = ftk_progress_bar_create(win, 10, height/6, width, 32);
|
||||||
ftk_progress_bar_set_percent(progress_bar, 20);
|
ftk_progress_bar_set_percent(progress_bar, 20);
|
||||||
timer = ftk_source_timer_create(1000, update_progress, progress_bar);
|
timer = ftk_source_timer_create(1000, update_progress, progress_bar);
|
||||||
ftk_main_loop_add_source(ftk_default_main_loop(), timer);
|
ftk_main_loop_add_source(ftk_default_main_loop(), timer);
|
||||||
|
@ -70,7 +70,7 @@ FTK_HIDE int FTK_MAIN(int argc, char* argv[])
|
||||||
ftk_widget_set_user_data(progress_bar, on_window_destroy, timer);
|
ftk_widget_set_user_data(progress_bar, on_window_destroy, timer);
|
||||||
ftk_progress_bar_set_interactive(progress_bar, 1);
|
ftk_progress_bar_set_interactive(progress_bar, 1);
|
||||||
|
|
||||||
progress_bar = ftk_progress_bar_create(win, 10, height/2, width, 20);
|
progress_bar = ftk_progress_bar_create(win, 10, height/2, width, 32);
|
||||||
ftk_progress_bar_set_percent(progress_bar, 20);
|
ftk_progress_bar_set_percent(progress_bar, 20);
|
||||||
timer = ftk_source_timer_create(1000, update_progress, progress_bar);
|
timer = ftk_source_timer_create(1000, update_progress, progress_bar);
|
||||||
ftk_main_loop_add_source(ftk_default_main_loop(), timer);
|
ftk_main_loop_add_source(ftk_default_main_loop(), timer);
|
||||||
|
|
|
@ -6,14 +6,14 @@ static Ret button_quit_clicked(void* ctx, void* obj)
|
||||||
return RET_OK;
|
return RET_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Ret on_move(void* ctx, void* obj)
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Ret move_cursor(void* ctx, void* obj)
|
Ret move_cursor(void* ctx, void* obj)
|
||||||
{
|
{
|
||||||
FtkEvent* event = obj;
|
FtkEvent* event = obj;
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ static Ret update_time(void* ctx)
|
||||||
struct tm* t = localtime(&now);
|
struct tm* t = localtime(&now);
|
||||||
panel = ftk_default_status_panel();
|
panel = ftk_default_status_panel();
|
||||||
|
|
||||||
snprintf(text, sizeof(text)-1, "%2d:%2d", t->tm_hour, t->tm_min);
|
ftk_snprintf(text, sizeof(text)-1, "%2d:%2d", t->tm_hour, t->tm_min);
|
||||||
|
|
||||||
item = ftk_widget_lookup(panel, IDC_TIME_ITEM);
|
item = ftk_widget_lookup(panel, IDC_TIME_ITEM);
|
||||||
|
|
||||||
|
|
|
@ -1,137 +0,0 @@
|
||||||
#include "ftk.h"
|
|
||||||
#include "ftk_animator_zoom.h"
|
|
||||||
|
|
||||||
static void create_ani_window(int type, int sync);
|
|
||||||
|
|
||||||
static Ret button_to_zoom_in_clicked(void* ctx, void* obj)
|
|
||||||
{
|
|
||||||
create_ani_window(FTK_ANI_ZOOM_IN, 1);
|
|
||||||
|
|
||||||
return RET_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Ret button_to_zoom_out_clicked(void* ctx, void* obj)
|
|
||||||
{
|
|
||||||
create_ani_window(FTK_ANI_ZOOM_OUT, 1);
|
|
||||||
|
|
||||||
return RET_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Ret button_close_clicked(void* ctx, void* obj)
|
|
||||||
{
|
|
||||||
FtkWidget* win = ctx;
|
|
||||||
ftk_logd("%s: close window %s\n", __func__, ftk_widget_get_text(win));
|
|
||||||
ftk_widget_unref(win);
|
|
||||||
|
|
||||||
return RET_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Ret button_quit_clicked(void* ctx, void* obj)
|
|
||||||
{
|
|
||||||
FtkWidget* win = ctx;
|
|
||||||
ftk_widget_unref(win);
|
|
||||||
ftk_logd("%s: close window %s\n", __func__, ftk_widget_get_text(win));
|
|
||||||
|
|
||||||
return RET_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void create_ani_window(int type, int sync)
|
|
||||||
{
|
|
||||||
int delta = 0;
|
|
||||||
int width = 0;
|
|
||||||
int height = 0;
|
|
||||||
FtkWidget* button = NULL;
|
|
||||||
FtkGc gc = {0};
|
|
||||||
char filename[FTK_MAX_PATH+1] = {0};
|
|
||||||
FtkWidget* win = ftk_app_window_create();
|
|
||||||
FtkAnimator* ani = ftk_animator_zoom_create(1);
|
|
||||||
|
|
||||||
gc.mask = FTK_GC_BITMAP;
|
|
||||||
width = ftk_widget_width(win);
|
|
||||||
height = ftk_widget_height(win);
|
|
||||||
delta = height/6;
|
|
||||||
|
|
||||||
button = ftk_button_create(win, width/3, height/3, width/3, 50);
|
|
||||||
ftk_widget_set_text(button, "关闭");
|
|
||||||
ftk_widget_show(button, 1);
|
|
||||||
ftk_button_set_clicked_listener(button, button_close_clicked, win);
|
|
||||||
|
|
||||||
ftk_snprintf(filename, FTK_MAX_PATH, "%s/jpeg1.jpg",
|
|
||||||
ftk_config_get_test_data_dir(ftk_default_config()));
|
|
||||||
gc.bitmap = ftk_bitmap_factory_load(ftk_default_bitmap_factory(), filename);
|
|
||||||
ftk_widget_set_gc(win, FTK_WIDGET_NORMAL, &gc);
|
|
||||||
ftk_gc_reset(&gc);
|
|
||||||
|
|
||||||
switch(type)
|
|
||||||
{
|
|
||||||
case FTK_ANI_ZOOM_IN:
|
|
||||||
{
|
|
||||||
ftk_animator_set_param(ani, type, 10, 100, delta, 200);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case FTK_ANI_ZOOM_OUT:
|
|
||||||
{
|
|
||||||
ftk_animator_set_param(ani, type, 10, 100, delta, 200);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:break;
|
|
||||||
}
|
|
||||||
ftk_animator_start(ani, win, 0);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void create_app_window(void)
|
|
||||||
{
|
|
||||||
char title[32] = {0};
|
|
||||||
int width = 0;
|
|
||||||
int height = 0;
|
|
||||||
FtkWidget* win = ftk_app_window_create();
|
|
||||||
FtkWidget* button = NULL;
|
|
||||||
|
|
||||||
width = ftk_widget_width(win);
|
|
||||||
height = ftk_widget_height(win);
|
|
||||||
|
|
||||||
button = ftk_button_create(win, 5, height/6 + 60, width/2-5, 50);
|
|
||||||
ftk_widget_set_text(button, "ZoomIn");
|
|
||||||
ftk_button_set_clicked_listener(button, button_to_zoom_in_clicked, win);
|
|
||||||
|
|
||||||
button = ftk_button_create(win, width/2, height/6 + 60, width/2-5, 50);
|
|
||||||
ftk_widget_set_text(button, "ZoomOut");
|
|
||||||
ftk_button_set_clicked_listener(button, button_to_zoom_out_clicked, win);
|
|
||||||
|
|
||||||
button = ftk_button_create(win, width/4-2, height/6 + 180, width/2-5, 50);
|
|
||||||
ftk_widget_set_text(button, "Quit");
|
|
||||||
ftk_button_set_clicked_listener(button, button_quit_clicked, win);
|
|
||||||
|
|
||||||
ftk_snprintf(title, sizeof(title), "Zoom Demo");
|
|
||||||
ftk_widget_set_text(win, title);
|
|
||||||
FTK_QUIT_WHEN_WIDGET_CLOSE(win);
|
|
||||||
|
|
||||||
ftk_widget_show_all(win, 1);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef FTK_AS_PLUGIN
|
|
||||||
#include "ftk_app_demo.h"
|
|
||||||
FTK_HIDE int FTK_MAIN(int argc, char* argv[]);
|
|
||||||
FtkApp* ftk_app_demo_zoom_create()
|
|
||||||
{
|
|
||||||
return ftk_app_demo_create(_("zoom"), ftk_main);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
#define FTK_HIDE extern
|
|
||||||
#endif /*FTK_AS_PLUGIN*/
|
|
||||||
|
|
||||||
FTK_HIDE int FTK_MAIN(int argc, char* argv[])
|
|
||||||
{
|
|
||||||
FTK_INIT(argc, argv);
|
|
||||||
|
|
||||||
create_app_window();
|
|
||||||
|
|
||||||
FTK_RUN();
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,30 +1,26 @@
|
||||||
<application name="alpha" exec="libftk_demos.so" init="ftk_app_demo_alpha_create" />
|
<application name="button" exec="ftk_demos" init="ftk_app_demo_button_create" />
|
||||||
<application name="button" exec="libftk_demos.so" init="ftk_app_demo_button_create" />
|
<application name="check_button" exec="ftk_demos" init="ftk_app_demo_check_button_create" />
|
||||||
<application name="cairo" exec="libftk_demos.so" init="ftk_app_demo_cairo_create" />
|
<application name="combo_box" exec="ftk_demos" init="ftk_app_demo_combo_box_create" />
|
||||||
<application name="check_button" exec="libftk_demos.so" init="ftk_app_demo_check_button_create" />
|
<application name="dialog" exec="ftk_demos" init="ftk_app_demo_dialog_create" />
|
||||||
<application name="combo_box" exec="libftk_demos.so" init="ftk_app_demo_combo_box_create" />
|
<application name="entry" exec="ftk_demos" init="ftk_app_demo_entry_create" />
|
||||||
<application name="dialog" exec="libftk_demos.so" init="ftk_app_demo_dialog_create" />
|
<application name="file_browser" exec="ftk_demos" init="ftk_app_demo_file_browser_create" />
|
||||||
<application name="entry" exec="libftk_demos.so" init="ftk_app_demo_entry_create" />
|
<application name="fullscreen" exec="ftk_demos" init="ftk_app_demo_fullscreen_create" />
|
||||||
<application name="expand" exec="libftk_demos.so" init="ftk_app_demo_expand_create" />
|
<application name="hello" exec="ftk_demos" init="ftk_app_demo_hello_create" />
|
||||||
<application name="file_browser" exec="libftk_demos.so" init="ftk_app_demo_file_browser_create" />
|
<application name="icon_view" exec="ftk_demos" init="ftk_app_demo_icon_view_create" />
|
||||||
<application name="fullscreen" exec="libftk_demos.so" init="ftk_app_demo_fullscreen_create" />
|
<application name="image_button" exec="ftk_demos" init="ftk_app_demo_image_button_create" />
|
||||||
<application name="hello" exec="libftk_demos.so" init="ftk_app_demo_hello_create" />
|
<application name="image" exec="ftk_demos" init="ftk_app_demo_image_create" />
|
||||||
<application name="icon_view" exec="libftk_demos.so" init="ftk_app_demo_icon_view_create" />
|
<application name="ime" exec="ftk_demos" init="ftk_app_demo_ime_create" />
|
||||||
<application name="image_button" exec="libftk_demos.so" init="ftk_app_demo_image_button_create" />
|
<application name="label" exec="ftk_demos" init="ftk_app_demo_label_create" />
|
||||||
<application name="image" exec="libftk_demos.so" init="ftk_app_demo_image_create" />
|
<application name="listview" exec="ftk_demos" init="ftk_app_demo_listview_create" />
|
||||||
<application name="ime" exec="libftk_demos.so" init="ftk_app_demo_ime_create" />
|
<application name="menu" exec="ftk_demos" init="ftk_app_demo_menu_create" />
|
||||||
<application name="label" exec="libftk_demos.so" init="ftk_app_demo_label_create" />
|
<application name="msgbox" exec="ftk_demos" init="ftk_app_demo_msgbox_create" />
|
||||||
<application name="listview" exec="libftk_demos.so" init="ftk_app_demo_listview_create" />
|
<application name="multi_win" exec="ftk_demos" init="ftk_app_demo_multi_win_create" />
|
||||||
<application name="menu" exec="libftk_demos.so" init="ftk_app_demo_menu_create" />
|
<application name="popup" exec="ftk_demos" init="ftk_app_demo_popup_create" />
|
||||||
<application name="msgbox" exec="libftk_demos.so" init="ftk_app_demo_msgbox_create" />
|
<application name="progress_bar" exec="ftk_demos" init="ftk_app_demo_progress_bar_create" />
|
||||||
<application name="multi_win" exec="libftk_demos.so" init="ftk_app_demo_multi_win_create" />
|
<application name="scroll_bar" exec="ftk_demos" init="ftk_app_demo_scroll_bar_create" />
|
||||||
<application name="popup" exec="libftk_demos.so" init="ftk_app_demo_popup_create" />
|
<application name="sprite" exec="ftk_demos" init="ftk_app_demo_sprite_create" />
|
||||||
<application name="progress_bar" exec="libftk_demos.so" init="ftk_app_demo_progress_bar_create" />
|
<application name="statusbar" exec="ftk_demos" init="ftk_app_demo_statusbar_create" />
|
||||||
<application name="scroll_bar" exec="libftk_demos.so" init="ftk_app_demo_scroll_bar_create" />
|
<application name="text_view" exec="ftk_demos" init="ftk_app_demo_text_view_create" />
|
||||||
<application name="sprite" exec="libftk_demos.so" init="ftk_app_demo_sprite_create" />
|
<application name="transparent" exec="ftk_demos" init="ftk_app_demo_transparent_create" />
|
||||||
<application name="statusbar" exec="libftk_demos.so" init="ftk_app_demo_statusbar_create" />
|
<application name="wait_box" exec="ftk_demos" init="ftk_app_demo_wait_box_create" />
|
||||||
<application name="text_view" exec="libftk_demos.so" init="ftk_app_demo_text_view_create" />
|
<application name="tab" exec="ftk_demos" init="ftk_app_demo_tab_create" />
|
||||||
<application name="transparent" exec="libftk_demos.so" init="ftk_app_demo_transparent_create" />
|
|
||||||
<application name="wait_box" exec="libftk_demos.so" init="ftk_app_demo_wait_box_create" />
|
|
||||||
<application name="zoom" exec="libftk_demos.so" init="ftk_app_demo_zoom_create" />
|
|
||||||
<application name="tab" exec="libftk_demos.so" init="ftk_app_demo_tab_create" />
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<window value="Entry Label" animator="$FTK_ANI_TO_UP" visible="1">
|
<window value="Entry Label" visible="1">
|
||||||
<label id="1" x="5" y="5" w="$ww/4" h="30" value="Name" />
|
<label id="1" x="5" y="5" w="$ww/4" h="30" value="Name" />
|
||||||
<entry id="2" x="$ww/4+5" y="5" w="3*$ww/4-15" h="30" value="Li XianJing" />
|
<entry id="2" x="$ww/4+5" y="5" w="3*$ww/4-15" h="30" value="Li XianJing" />
|
||||||
|
|
||||||
|
|
|
@ -1,44 +0,0 @@
|
||||||
/* RT-Thread config file */
|
|
||||||
#ifndef __RTTHREAD_CFG_H__
|
|
||||||
#define __RTTHREAD_CFG_H__
|
|
||||||
|
|
||||||
/* RT_NAME_MAX*/
|
|
||||||
#define RT_NAME_MAX 32
|
|
||||||
|
|
||||||
/* RT_ALIGN_SIZE*/
|
|
||||||
#define RT_ALIGN_SIZE 4
|
|
||||||
|
|
||||||
/* SECTION: IPC */
|
|
||||||
/* Using Semaphore */
|
|
||||||
#define RT_USING_SEMAPHORE
|
|
||||||
|
|
||||||
/* Using Mutex */
|
|
||||||
#define RT_USING_MUTEX
|
|
||||||
|
|
||||||
/* Using Event */
|
|
||||||
#define RT_USING_EVENT
|
|
||||||
|
|
||||||
/* Using MailBox */
|
|
||||||
#define RT_USING_MAILBOX
|
|
||||||
|
|
||||||
/* Using Message Queue */
|
|
||||||
#define RT_USING_MESSAGEQUEUE
|
|
||||||
|
|
||||||
/* SECTION: Memory Management */
|
|
||||||
/* Using Memory Pool Management*/
|
|
||||||
#define RT_USING_MEMPOOL
|
|
||||||
|
|
||||||
/* SECTION: Device System */
|
|
||||||
/* Using Device System */
|
|
||||||
#define RT_USING_DEVICE
|
|
||||||
|
|
||||||
/* Using Module System */
|
|
||||||
#define RT_USING_MODULE
|
|
||||||
|
|
||||||
/* name length of RTGUI object */
|
|
||||||
#define RTGUI_NAME_MAX 16
|
|
||||||
|
|
||||||
/* Using newlib as libc */
|
|
||||||
#define RT_USING_NEWLIB
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,27 +0,0 @@
|
||||||
import SCons.cpp
|
|
||||||
|
|
||||||
EXEC_PATH = 'E:/Program Files/CodeSourcery/Sourcery G++ Lite/bin'
|
|
||||||
BUILD = 'debug'
|
|
||||||
|
|
||||||
# toolchains
|
|
||||||
PREFIX = 'arm-none-eabi-'
|
|
||||||
CC = PREFIX + 'gcc'
|
|
||||||
AS = PREFIX + 'gcc'
|
|
||||||
AR = PREFIX + 'ar'
|
|
||||||
LINK = PREFIX + 'ld'
|
|
||||||
TARGET_EXT = 'axf'
|
|
||||||
SIZE = PREFIX + 'size'
|
|
||||||
OBJDUMP = PREFIX + 'objdump'
|
|
||||||
OBJCPY = PREFIX + 'objcopy'
|
|
||||||
CFLAGS = ''
|
|
||||||
AFLAGS = ''
|
|
||||||
LFLAGS = ''
|
|
||||||
|
|
||||||
CPATH = ''
|
|
||||||
LPATH = ''
|
|
||||||
|
|
||||||
if BUILD == 'debug':
|
|
||||||
CFLAGS += ' -O0 -gdwarf-2'
|
|
||||||
AFLAGS += ' -gdwarf-2'
|
|
||||||
else:
|
|
||||||
CFLAGS += ' -O2'
|
|
|
@ -1,40 +0,0 @@
|
||||||
Import('env')
|
|
||||||
Import('projects')
|
|
||||||
Import('RTT_ROOT')
|
|
||||||
Import('rtconfig')
|
|
||||||
Import('TARGET')
|
|
||||||
|
|
||||||
RTMLINKER = RTT_ROOT + '/tools/rtmlinker.exe '
|
|
||||||
|
|
||||||
# group definitions
|
|
||||||
group = {}
|
|
||||||
group['CCFLAGS'] = ''
|
|
||||||
group['CPPPATH'] = [RTT_ROOT + '/include',
|
|
||||||
RTT_ROOT + '/examples/module',
|
|
||||||
RTT_ROOT + '/components/rtgui/include',
|
|
||||||
RTT_ROOT + '/components/rgtui/common',
|
|
||||||
RTT_ROOT + '/components/rtgui/server',
|
|
||||||
RTT_ROOT + '/components/rtgui/widgets']
|
|
||||||
group['CPPDEFINES'] = ''
|
|
||||||
|
|
||||||
target = 'tetris.so'
|
|
||||||
POST_ACTION = RTMLINKER + ' -l ' + TARGET + ' -o tetris.mo ' + '$TARGET'
|
|
||||||
|
|
||||||
# add group to project list
|
|
||||||
projects.append(group)
|
|
||||||
|
|
||||||
src_local = Split("""
|
|
||||||
application.c
|
|
||||||
tetris_ui.c
|
|
||||||
tetris_modal.c
|
|
||||||
tetris_view.c
|
|
||||||
""")
|
|
||||||
|
|
||||||
env.Append(CCFLAGS = group['CCFLAGS'])
|
|
||||||
env.Append(CPPPATH = group['CPPPATH'])
|
|
||||||
env.Append(CPPDEFINES = group['CPPDEFINES'])
|
|
||||||
module_env = env.Clone(CCFLAGS = ' -mcpu=arm920t -O0 -fPIC')
|
|
||||||
module_env.Replace(LINKFLAGS = '-z max-page-size=0x4 -shared -fPIC -e rt_application_init -nostdlib -s')
|
|
||||||
module_env.Program(target, src_local)
|
|
||||||
module_env.AddPostAction(target, POST_ACTION)
|
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
EXEC_PATH = '/home/shaolin/CodeSourcery/Sourcery_G++_Lite/bin'
|
||||||
|
RTT_ROOT = os.path.normpath(os.getcwd() + '/../../..')
|
||||||
|
sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')]
|
||||||
|
PREFIX = 'arm-none-eabi-'
|
||||||
|
env = Environment(tools = ['mingw'],
|
||||||
|
AS = PREFIX + 'gcc',
|
||||||
|
ASFLAGS = '',
|
||||||
|
CC = PREFIX + 'gcc',
|
||||||
|
CCFLAGS = '-mcpu=arm920t -O0 -fPIC' ,
|
||||||
|
AR = PREFIX + 'ar',
|
||||||
|
ARFLAGS = '-rc',
|
||||||
|
LINK = PREFIX + 'ld',
|
||||||
|
LINKFLAGS = '-z max-page-size=0x4 -shared -fPIC -e rt_application_init -nostdlib -s',
|
||||||
|
CPPPATH = [
|
||||||
|
RTT_ROOT + '/include',
|
||||||
|
RTT_ROOT + '/bsp/mini2440',
|
||||||
|
RTT_ROOT + '/components/rtgui/include',
|
||||||
|
RTT_ROOT + '/components/rgtui/common',
|
||||||
|
RTT_ROOT + '/components/rtgui/server',
|
||||||
|
RTT_ROOT + '/components/rtgui/widgets'
|
||||||
|
])
|
||||||
|
env.PrependENVPath('PATH', EXEC_PATH)
|
||||||
|
|
||||||
|
target = 'tetris.so'
|
||||||
|
src = Glob('*.c')
|
||||||
|
|
||||||
|
env.Program(target, src)
|
||||||
|
|
Loading…
Reference in New Issue