update tetris module
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@930 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
parent
3013432806
commit
e8db9d735b
|
@ -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')
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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_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);
|
||||
|
|
Loading…
Reference in New Issue