tetris module update
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@948 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
parent
1c590cf5d9
commit
5a8f34e46f
@ -19,11 +19,11 @@
|
|||||||
#include <rtgui/widgets/workbench.h>
|
#include <rtgui/widgets/workbench.h>
|
||||||
#include "tetris.h"
|
#include "tetris.h"
|
||||||
|
|
||||||
int rt_application_init()
|
int rt_application_init(void)
|
||||||
{
|
{
|
||||||
rt_thread_t tid;
|
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);
|
if (tid != RT_NULL) rt_thread_startup(tid);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -57,5 +57,5 @@
|
|||||||
rt_tetris_view_t* rt_tetris_view_create(void* private);
|
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 rt_tetris_view_destroy(rt_tetris_view_t* thiz);
|
||||||
|
|
||||||
rt_err_t tetris_ui_entry(void* parameter);
|
void tetris_ui_entry(void* parameter);
|
||||||
|
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
|
|
||||||
#include <rtthread.h>
|
#include <rtthread.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "tetris.h"
|
#include "tetris.h"
|
||||||
|
|
||||||
struct rt_tetris
|
struct rt_tetris
|
||||||
@ -728,3 +727,4 @@ static rt_err_t rt_tetris_release_lines(rt_tetris_t* thiz, rt_uint32_t brick[])
|
|||||||
return -RT_ERROR;
|
return -RT_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
#include <rtgui/widgets/window.h>
|
#include <rtgui/widgets/window.h>
|
||||||
#include <rtgui/widgets/workbench.h>
|
#include <rtgui/widgets/workbench.h>
|
||||||
#include <rtgui/dc.h>
|
#include <rtgui/dc.h>
|
||||||
|
|
||||||
#include "tetris.h"
|
#include "tetris.h"
|
||||||
|
|
||||||
struct app_info
|
struct app_info
|
||||||
@ -41,7 +40,7 @@ static void _game_over(void)
|
|||||||
rt_tetris_destory(g_app_info.tetris);
|
rt_tetris_destory(g_app_info.tetris);
|
||||||
rt_tetris_view_destroy(g_app_info.tetris_view);
|
rt_tetris_view_destroy(g_app_info.tetris_view);
|
||||||
rtgui_view_destroy(g_app_info.home_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");
|
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);
|
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;
|
rt_mq_t mq;
|
||||||
|
|
||||||
@ -148,7 +147,7 @@ rt_err_t tetris_ui_entry(void* parameter)
|
|||||||
if (g_app_info.workbench == RT_NULL)
|
if (g_app_info.workbench == RT_NULL)
|
||||||
{
|
{
|
||||||
rt_kprintf("can't find panel 'main'\n");
|
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);
|
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_timer_start(g_app_info._timer);
|
||||||
|
|
||||||
rtgui_workbench_event_loop(g_app_info.workbench);
|
rtgui_workbench_event_loop(g_app_info.workbench);
|
||||||
|
rtgui_workbench_destroy(g_app_info.workbench);
|
||||||
|
|
||||||
rtgui_thread_deregister(rt_thread_self());
|
rtgui_thread_deregister(rt_thread_self());
|
||||||
rt_mq_delete(mq);
|
rt_mq_delete(mq);
|
||||||
|
|
||||||
return RT_EOK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
#include <rtgui/rtgui_system.h>
|
#include <rtgui/rtgui_system.h>
|
||||||
#include <rtgui/widgets/view.h>
|
#include <rtgui/widgets/view.h>
|
||||||
#include <rtgui/dc.h>
|
#include <rtgui/dc.h>
|
||||||
|
|
||||||
#include "tetris.h"
|
#include "tetris.h"
|
||||||
|
|
||||||
static rt_err_t _rt_tetris_view_update(rt_tetris_view_t* thiz, rt_tetris_t* tetris);
|
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;
|
return RT_EOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user