summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authorqiuyiuestc <[email protected]>2010-09-23 11:03:09 +0000
committerqiuyiuestc <[email protected]>2010-09-23 11:03:09 +0000
commite8db9d735bee95329cfffbae9fb6c2311479c829 (patch)
tree669e49419b6da31c4d94f97fa2ae32d15bd43237 /components
parent3013432806a9fd1887cf94ed39898d3ede69d53f (diff)
update tetris module
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@930 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'components')
-rw-r--r--components/SConscript4
-rw-r--r--components/module/basicapp/SConscript2
-rw-r--r--components/module/tetris/SConscript2
-rw-r--r--components/module/tetris/application.c4
-rw-r--r--components/module/tetris/tetris_modal.c2
-rw-r--r--components/module/tetris/tetris_ui.c5
-rw-r--r--components/module/tetris/tetris_view.c22
7 files changed, 17 insertions, 24 deletions
diff --git a/components/SConscript b/components/SConscript
index 427c0caeda..a1d0b568c6 100644
--- a/components/SConscript
+++ b/components/SConscript
@@ -27,8 +27,4 @@ if 'RT_USING_MODBUS' in dir(rtconfig) and rtconfig.RT_USING_MODBUS:
if 'RT_USING_RTGUI' in dir(rtconfig) and rtconfig.RT_USING_RTGUI:
objs = objs + SConscript('rtgui/SConscript')
-# build each modules
-if rtconfig.CROSS_TOOL == 'gcc' and rtconfig.RT_USING_MODULE:
- SConscript('module/basicapp/SConscript')
-
Return('objs')
diff --git a/components/module/basicapp/SConscript b/components/module/basicapp/SConscript
index f7b811fc9a..207b35fb94 100644
--- a/components/module/basicapp/SConscript
+++ b/components/module/basicapp/SConscript
@@ -11,7 +11,7 @@ group = {}
group['name'] = 'examples'
group['src'] = Glob('*.c')
group['CCFLAGS'] = ''
-group['CPPPATH'] = ['']
+group['CPPPATH'] = [RTT_ROOT + '/include', RTT_ROOT + '/components/module']
group['CPPDEFINES'] = ''
target = 'basicapp.so'
diff --git a/components/module/tetris/SConscript b/components/module/tetris/SConscript
index 8f7844e7db..9ac380ebb8 100644
--- a/components/module/tetris/SConscript
+++ b/components/module/tetris/SConscript
@@ -18,7 +18,7 @@ group['CPPPATH'] = [RTT_ROOT + '/include',
group['CPPDEFINES'] = ''
target = 'tetris.so'
-POST_ACTION = RTMLINKER + ' -D 1 -l ' + TARGET + ' -o tetris.mo ' + '$TARGET'
+POST_ACTION = RTMLINKER + ' -l ' + TARGET + ' -o tetris.mo ' + '$TARGET'
# add group to project list
projects.append(group)
diff --git a/components/module/tetris/application.c b/components/module/tetris/application.c
index 9239e3d19b..df25f1863e 100644
--- a/components/module/tetris/application.c
+++ b/components/module/tetris/application.c
@@ -33,8 +33,8 @@ int rt_application_init()
/* ע����� */
rect.x1 = 0;
rect.y1 = 0;
- rect.x2 = 128;
- rect.y2 = 96;
+ rect.x2 = 240;
+ rect.y2 = 320;
rtgui_panel_register("main", &rect);
rtgui_panel_set_default_focused("main");
diff --git a/components/module/tetris/tetris_modal.c b/components/module/tetris/tetris_modal.c
index 2ba462b8d5..d377492bc5 100644
--- a/components/module/tetris/tetris_modal.c
+++ b/components/module/tetris/tetris_modal.c
@@ -62,7 +62,7 @@ rt_tetris_t* rt_tetris_create(rt_uint32_t width, rt_uint32_t height)
rt_tetris_t* thiz = (rt_tetris_t*)rt_malloc(sizeof(rt_tetris_t));
RT_ASSERT(thiz != RT_NULL);
-
+
thiz->height = height;
thiz->width = width;
thiz->panel = rt_malloc(thiz->height * sizeof(rt_uint32_t));
diff --git a/components/module/tetris/tetris_ui.c b/components/module/tetris/tetris_ui.c
index 06eada7a43..419497036e 100644
--- a/components/module/tetris/tetris_ui.c
+++ b/components/module/tetris/tetris_ui.c
@@ -136,8 +136,6 @@ void tetris_ui_entry(void* parameter)
{
rt_mq_t mq;
- rt_kprintf("tetris_ui_entry\n");
-
mq = rt_mq_create("tetris_ui", 256, 4, RT_IPC_FLAG_FIFO);
rtgui_thread_register(rt_thread_self(), mq);
@@ -154,8 +152,7 @@ void tetris_ui_entry(void* parameter)
RTGUI_WIDGET(g_app_info.home_view)->flag |= RTGUI_WIDGET_FLAG_FOCUSABLE;
/* set widget focus */
rtgui_widget_focus(RTGUI_WIDGET(g_app_info.home_view));
- RTGUI_WIDGET_BACKGROUND(RTGUI_WIDGET(g_app_info.home_view)) = 10;
-
+ RTGUI_WIDGET_BACKGROUND(RTGUI_WIDGET(g_app_info.home_view)) = RTGUI_RGB(0xff, 0xff, 0xff);
rtgui_view_show(g_app_info.home_view, RT_FALSE);
/* create tetris modal instance */
diff --git a/components/module/tetris/tetris_view.c b/components/module/tetris/tetris_view.c
index 9b409ce5bc..14f6bf58db 100644
--- a/components/module/tetris/tetris_view.c
+++ b/components/module/tetris/tetris_view.c
@@ -79,7 +79,7 @@ static rt_err_t _rt_tetris_view_update_next_brick(rt_tetris_view_t* thiz, rt_tet
rect.y1 = 16;
rect.y2 = rect.y1 + 2 * ppb;
- RTGUI_WIDGET_BACKGROUND(widget) = 10;
+ RTGUI_DC_BC(dc) = RTGUI_RGB(0xff, 0xff, 0xff);
rtgui_dc_fill_rect(dc, &rect);
for(i=0; i<4; i++)
@@ -92,7 +92,7 @@ static rt_err_t _rt_tetris_view_update_next_brick(rt_tetris_view_t* thiz, rt_tet
rect.y1 = 16 + ppb * y ;
rect.y2 = rect.y1 + ppb - 1;
- RTGUI_WIDGET_BACKGROUND(widget) = 3;
+ RTGUI_DC_BC(dc) = RTGUI_RGB(0xff, 0x00, 0x00);
rtgui_dc_fill_rect(dc, &rect);
}
@@ -119,10 +119,10 @@ static rt_err_t _rt_tetris_view_update_level(rt_tetris_view_t* thiz, rt_tetris_t
rect.y1 = 42;
rect.x2 = 128;
rect.y2 = rect.y1 + 10;
- RTGUI_WIDGET_BACKGROUND(widget) = 10;
+ RTGUI_DC_BC(dc) = RTGUI_RGB(0xff, 0xff, 0xff);
rtgui_dc_fill_rect(dc, &rect);
rt_sprintf(text, "%d", rt_tetris_level(tetris));
- RTGUI_WIDGET_BACKGROUND(widget) = 3;
+ RTGUI_DC_BC(dc) = RTGUI_RGB(0xff, 0x00, 0x00);
rtgui_dc_draw_text(dc, text, &rect);
/* Redraw panel */
@@ -149,18 +149,18 @@ static rt_err_t _rt_tetris_view_update_score_and_lines(rt_tetris_view_t* thiz, r
rect.y1 = 64;
rect.x2 = 128;
rect.y2 = rect.y1 + 10;
- RTGUI_WIDGET_BACKGROUND(widget) = 10;
- rtgui_dc_fill_rect(dc, &rect);
+ RTGUI_DC_BC(dc) = RTGUI_RGB(0xff, 0xff, 0xff);
+ rtgui_dc_fill_rect(dc, &rect);
rt_sprintf(text, "%d", rt_tetris_lines(tetris));
- RTGUI_WIDGET_BACKGROUND(widget) = 3;
+ RTGUI_DC_BC(dc) = RTGUI_RGB(0xff, 0x00, 0x00);
rtgui_dc_draw_text(dc, text, &rect);
rect.y1 += 22;
rect.y2 = rect.y1 + 10;
- RTGUI_WIDGET_BACKGROUND(widget) = 10;
+ RTGUI_DC_BC(dc) = RTGUI_RGB(0xff, 0xff, 0xff);
rtgui_dc_fill_rect(dc, &rect);
rt_sprintf(text, "%d", rt_tetris_score(tetris));
- RTGUI_WIDGET_BACKGROUND(widget) = 3;
+ RTGUI_DC_BC(dc) = RTGUI_RGB(0xff, 0x00, 0x00);
rtgui_dc_draw_text(dc, text, &rect);
/* Redraw panel */
@@ -200,11 +200,11 @@ static rt_err_t _rt_tetris_view_update(rt_tetris_view_t* thiz, rt_tetris_t* tetr
if(rt_tetris_check_collision(tetris, k * width + j))
{
- RTGUI_WIDGET_BACKGROUND(widget) = 13;
+ RTGUI_DC_BC(dc) = RTGUI_RGB(0xff, 0xff, 0xff);
}
else
{
- RTGUI_WIDGET_BACKGROUND(widget) = 3;
+ RTGUI_DC_BC(dc) = RTGUI_RGB(0xff, 0x00, 0x00);
}
rtgui_dc_fill_rect(dc, &rect);