diff options
Diffstat (limited to 'components')
| -rw-r--r-- | components/finsh/cmd.c | 2 | ||||
| -rw-r--r-- | components/module/tetris/application.c | 4 | ||||
| -rw-r--r-- | components/module/tetris/tetris.h | 2 | ||||
| -rw-r--r-- | components/module/tetris/tetris_modal.c | 18 | ||||
| -rw-r--r-- | components/module/tetris/tetris_ui.c | 10 | ||||
| -rw-r--r-- | components/module/tetris/tetris_view.c | 2 |
6 files changed, 18 insertions, 20 deletions
diff --git a/components/finsh/cmd.c b/components/finsh/cmd.c index 5ed5d42cd7..710ff3b0e1 100644 --- a/components/finsh/cmd.c +++ b/components/finsh/cmd.c @@ -385,7 +385,7 @@ int list_module(void) /* list main thread in module */ if(module->module_thread != RT_NULL) { - rt_kprintf(" main thread pri status sp stack size max used left tick error\n"); + rt_kprintf("main thread pri status sp stack size max used left tick error\n"); rt_kprintf("------------- ---- ------- ---------- ---------- ---------- ---------- ---\n"); thread = module->module_thread; rt_kprintf("%-8s 0x%02x", thread->name, thread->current_priority); diff --git a/components/module/tetris/application.c b/components/module/tetris/application.c index 4c684735cc..d845346eb3 100644 --- a/components/module/tetris/application.c +++ b/components/module/tetris/application.c @@ -19,11 +19,11 @@ #include <rtgui/widgets/workbench.h>
#include "tetris.h"
-int rt_application_init()
+int rt_application_init(void)
{
rt_thread_t tid;
- tid = rt_thread_create("wb", tetris_ui_entry, RT_NULL, 2048, 20, 5);
+ tid = rt_thread_create("tetris", tetris_ui_entry, RT_NULL, 2048, 20, 5);
if (tid != RT_NULL) rt_thread_startup(tid);
return 0;
}
diff --git a/components/module/tetris/tetris.h b/components/module/tetris/tetris.h index e6f570d455..b5ef13785f 100644 --- a/components/module/tetris/tetris.h +++ b/components/module/tetris/tetris.h @@ -57,5 +57,5 @@ rt_tetris_view_t* rt_tetris_view_create(void* private);
rt_err_t rt_tetris_view_destroy(rt_tetris_view_t* thiz);
-rt_err_t tetris_ui_entry(void* parameter);
+void tetris_ui_entry(void* parameter);
diff --git a/components/module/tetris/tetris_modal.c b/components/module/tetris/tetris_modal.c index d377492bc5..01b5850e96 100644 --- a/components/module/tetris/tetris_modal.c +++ b/components/module/tetris/tetris_modal.c @@ -14,21 +14,20 @@ #include <rtthread.h>
#include <stdlib.h>
-
#include "tetris.h"
struct rt_tetris
{
rt_uint32_t width; /* the width of the tetris */
rt_uint32_t height; /* the height of the tetris */
- rt_uint16_t* panel; /* the panel of the tetris */
- rt_uint32_t* brick; /* the current brick of the tetris */
- rt_uint32_t* next_brick; /* the next brick of the tetris */
- rt_tetris_view_t* view; /* the view on which the tetris show */
- rt_uint32_t level; /* game level */
- rt_uint32_t lines; /* released lines count */
- rt_uint32_t score; /* total scores statistic */
- rt_bool_t status; /* game status, pause or runing */
+ rt_uint16_t* panel; /* the panel of the tetris */
+ rt_uint32_t* brick; /* the current brick of the tetris */
+ rt_uint32_t* next_brick; /* the next brick of the tetris */
+ rt_tetris_view_t* view; /* the view on which the tetris show */
+ rt_uint32_t level; /* game level */
+ rt_uint32_t lines; /* released lines count */
+ rt_uint32_t score; /* total scores statistic */
+ rt_bool_t status; /* game status, pause or runing */
};
static const rt_uint32_t g_brick[][4] =
@@ -728,3 +727,4 @@ static rt_err_t rt_tetris_release_lines(rt_tetris_t* thiz, rt_uint32_t brick[]) return -RT_ERROR;
}
}
+
diff --git a/components/module/tetris/tetris_ui.c b/components/module/tetris/tetris_ui.c index 49c7a66619..808a713602 100644 --- a/components/module/tetris/tetris_ui.c +++ b/components/module/tetris/tetris_ui.c @@ -20,7 +20,6 @@ #include <rtgui/widgets/window.h>
#include <rtgui/widgets/workbench.h>
#include <rtgui/dc.h>
-
#include "tetris.h"
struct app_info
@@ -41,7 +40,7 @@ static void _game_over(void) rt_tetris_destory(g_app_info.tetris);
rt_tetris_view_destroy(g_app_info.tetris_view);
rtgui_view_destroy(g_app_info.home_view);
- rtgui_workbench_destroy(g_app_info.workbench);
+ rtgui_workbench_close(g_app_info.workbench);
rt_kprintf("GAME OVER\n");
}
@@ -137,7 +136,7 @@ static rt_bool_t workbench_event_handler(rtgui_widget_t *widget, rtgui_event_t * return rtgui_workbench_event_handler(widget, event);
}
-rt_err_t tetris_ui_entry(void* parameter)
+void tetris_ui_entry(void* parameter)
{
rt_mq_t mq;
@@ -148,7 +147,7 @@ rt_err_t tetris_ui_entry(void* parameter) if (g_app_info.workbench == RT_NULL)
{
rt_kprintf("can't find panel 'main'\n");
- return -RT_ERROR;
+ return;
}
rtgui_widget_set_event_handler(RTGUI_WIDGET(g_app_info.workbench), workbench_event_handler);
@@ -177,10 +176,9 @@ rt_err_t tetris_ui_entry(void* parameter) rtgui_timer_start(g_app_info._timer);
rtgui_workbench_event_loop(g_app_info.workbench);
+ rtgui_workbench_destroy(g_app_info.workbench);
rtgui_thread_deregister(rt_thread_self());
rt_mq_delete(mq);
-
- return RT_EOK;
}
diff --git a/components/module/tetris/tetris_view.c b/components/module/tetris/tetris_view.c index 14f6bf58db..dcb0cb312a 100644 --- a/components/module/tetris/tetris_view.c +++ b/components/module/tetris/tetris_view.c @@ -17,7 +17,6 @@ #include <rtgui/rtgui_system.h>
#include <rtgui/widgets/view.h>
#include <rtgui/dc.h>
-
#include "tetris.h"
static rt_err_t _rt_tetris_view_update(rt_tetris_view_t* thiz, rt_tetris_t* tetris);
@@ -216,3 +215,4 @@ static rt_err_t _rt_tetris_view_update(rt_tetris_view_t* thiz, rt_tetris_t* tetr return RT_EOK;
}
+
|
