mirror of
https://gitee.com/zlgopen/awtk.git
synced 2024-12-15 17:41:29 +08:00
87 lines
1.9 KiB
C
87 lines
1.9 KiB
C
/**
|
|
* File: demo_main.c
|
|
* Author: AWTK Develop Team
|
|
* Brief: demo main
|
|
*
|
|
* Copyright (c) 2018 - 2018 Guangzhou ZHIYUAN Electronics Co.,Ltd.
|
|
*
|
|
* 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
|
|
*
|
|
*/
|
|
|
|
#include "awtk.h"
|
|
#include "assets.h"
|
|
#include "base/mem.h"
|
|
#include "base/path.h"
|
|
#include "base/system_info.h"
|
|
#include "base/window_manager.h"
|
|
|
|
ret_t application_init(void);
|
|
|
|
#ifdef USE_GUI_MAIN
|
|
int gui_app_start(int lcd_w, int lcd_h) {
|
|
tk_init(lcd_w, lcd_h, APP_MOBILE, NULL, NULL);
|
|
#else
|
|
|
|
#if defined(WIN32)
|
|
#include <windows.h>
|
|
int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hprevinstance, LPSTR lpcmdline, int ncmdshow) {
|
|
#else
|
|
int main(void) {
|
|
#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);
|
|
|
|
#if defined(WIN32)
|
|
#if !defined(NDEBUG)
|
|
{
|
|
AllocConsole();
|
|
FILE* fp = NULL;
|
|
freopen_s(&fp, "CONOUT$", "w+t", stdout);
|
|
}
|
|
#endif /*NDEBUG*/
|
|
#endif /*WIN32*/
|
|
|
|
tk_init(320, 480, APP_SIMULATOR, NULL, res_root);
|
|
#endif
|
|
|
|
//#define WITH_LCD_PORTRAIT 1
|
|
#if defined(USE_GUI_MAIN) && defined(WITH_LCD_PORTRAIT)
|
|
if (lcd_w > lcd_h) {
|
|
tk_set_lcd_orientation(LCD_ORIENTATION_90);
|
|
}
|
|
#endif /*WITH_LCD_PORTRAIT*/
|
|
|
|
#ifdef WITH_LCD_LANDSCAPE
|
|
if (lcd_w < lcd_h) {
|
|
tk_set_lcd_orientation(LCD_ORIENTATION_90);
|
|
}
|
|
#endif /*WITH_LCD_PORTRAIT*/
|
|
|
|
log_debug("Build at: %s %s\n", __DATE__, __TIME__);
|
|
assets_init();
|
|
application_init();
|
|
|
|
#ifdef ENABLE_CURSOR
|
|
window_manager_set_cursor(window_manager(), "cursor");
|
|
#endif /*ENABLE_CURSOR*/
|
|
|
|
tk_run();
|
|
|
|
return 0;
|
|
}
|