awtk/demos/demo_main.c

61 lines
1.3 KiB
C
Raw Normal View History

2018-02-21 19:36:38 +08:00
/**
2018-03-10 22:01:10 +08:00
* File: demo_main.c
2018-05-15 09:31:58 +08:00
* Author: AWTK Develop Team
2018-03-10 22:01:10 +08:00
* Brief: demo main
2018-02-21 19:36:38 +08:00
*
2018-05-08 10:22:32 +08:00
* Copyright (c) 2018 - 2018 Guangzhou ZHIYUAN Electronics Co.,Ltd.
2018-02-21 19:36:38 +08:00
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* License file for more details.
*
*/
/**
* History:
* ================================================================
* 2018-02-16 Li XianJing <xianjimli@hotmail.com> created
*
*/
2018-08-05 18:56:46 +08:00
#include "awtk.h"
2018-05-09 18:15:24 +08:00
#include "base/mem.h"
2018-04-26 16:09:53 +08:00
#include "resource.h"
#include "base/system_info.h"
2018-02-22 18:07:22 +08:00
ret_t application_init(void);
2018-02-21 19:36:38 +08:00
2018-05-07 17:50:05 +08:00
#ifdef USE_GUI_MAIN
2018-05-14 11:53:05 +08:00
int gui_app_start(int lcd_w, int lcd_h) {
2018-05-17 11:14:41 +08:00
tk_init(lcd_w, lcd_h);
2018-02-24 20:40:44 +08:00
#elif defined(WIN32)
2018-02-21 19:36:38 +08:00
#include <windows.h>
int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hprevinstance, LPSTR lpcmdline, int ncmdshow) {
2018-05-17 11:14:41 +08:00
tk_init(320, 480);
2018-02-21 19:36:38 +08:00
#else
int main(void) {
2018-05-12 18:28:38 +08:00
tk_init(320, 480);
2018-05-14 11:53:05 +08:00
#endif
2018-02-21 19:36:38 +08:00
2018-06-14 15:53:44 +08:00
//#define WITH_LCD_PORTRAIT 1
2018-06-27 15:47:30 +08:00
#if defined(USE_GUI_MAIN) && defined(WITH_LCD_PORTRAIT)
2018-06-14 15:50:32 +08:00
if (lcd_w > lcd_h) {
tk_set_lcd_orientation(LCD_ORIENTATION_90);
}
2018-06-14 15:50:32 +08:00
#endif /*WITH_LCD_PORTRAIT*/
#ifdef WITH_LCD_LANDSCAPE
2018-06-14 15:50:32 +08:00
if (lcd_w < lcd_h) {
tk_set_lcd_orientation(LCD_ORIENTATION_90);
}
2018-06-14 15:50:32 +08:00
#endif /*WITH_LCD_PORTRAIT*/
2018-02-21 19:36:38 +08:00
resource_init();
application_init();
2018-04-27 11:23:09 +08:00
tk_run();
2018-02-21 19:36:38 +08:00
return 0;
}