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-08-24 07:45:37 +08:00
|
|
|
#include "assets.h"
|
2018-08-28 18:20:17 +08:00
|
|
|
#include "base/mem.h"
|
|
|
|
#include "base/path.h"
|
2018-04-26 16:09:53 +08:00
|
|
|
#include "base/system_info.h"
|
2018-10-22 12:34:47 +08:00
|
|
|
#include "base/window_manager.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-08-19 19:12:35 +08:00
|
|
|
tk_init(lcd_w, lcd_h, APP_MOBILE, NULL, NULL);
|
2018-08-28 18:20:17 +08:00
|
|
|
#else
|
|
|
|
|
|
|
|
#if defined(WIN32)
|
2018-02-21 19:36:38 +08:00
|
|
|
#include <windows.h>
|
|
|
|
int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hprevinstance, LPSTR lpcmdline, int ncmdshow) {
|
|
|
|
#else
|
|
|
|
int main(void) {
|
2018-08-28 18:20:17 +08:00
|
|
|
#endif
|
|
|
|
char res_root[MAX_PATH + 1];
|
|
|
|
char app_root[MAX_PATH + 1];
|
|
|
|
path_app_root(app_root);
|
|
|
|
memset(res_root, 0x00, sizeof(res_root));
|
|
|
|
|
|
|
|
path_build(res_root, MAX_PATH, app_root, "demos", NULL);
|
|
|
|
tk_init(320, 480, APP_SIMULATOR, NULL, res_root);
|
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) {
|
2018-06-14 11:32:46 +08:00
|
|
|
tk_set_lcd_orientation(LCD_ORIENTATION_90);
|
|
|
|
}
|
2018-06-14 15:50:32 +08:00
|
|
|
#endif /*WITH_LCD_PORTRAIT*/
|
2018-06-14 11:32:46 +08:00
|
|
|
|
|
|
|
#ifdef WITH_LCD_LANDSCAPE
|
2018-06-14 15:50:32 +08:00
|
|
|
if (lcd_w < lcd_h) {
|
2018-06-14 11:32:46 +08:00
|
|
|
tk_set_lcd_orientation(LCD_ORIENTATION_90);
|
|
|
|
}
|
2018-06-14 15:50:32 +08:00
|
|
|
#endif /*WITH_LCD_PORTRAIT*/
|
2018-06-14 11:32:46 +08:00
|
|
|
|
2018-10-25 14:56:34 +08:00
|
|
|
log_debug("Build at: %s %s\n", __DATE__, __TIME__);
|
2018-08-24 07:45:37 +08:00
|
|
|
assets_init();
|
2018-02-21 19:36:38 +08:00
|
|
|
application_init();
|
|
|
|
|
2018-10-22 12:34:47 +08:00
|
|
|
#ifdef ENABLE_CURSOR
|
|
|
|
window_manager_set_cursor(window_manager(), "cursor");
|
|
|
|
#endif /*ENABLE_CURSOR*/
|
|
|
|
|
2018-04-27 11:23:09 +08:00
|
|
|
tk_run();
|
2018-02-21 19:36:38 +08:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|