mirror of
https://github.com/lc-soft/LCUI.git
synced 2026-11-30 16:48:21 +01:00
45 lines
976 B
C
Executable File
45 lines
976 B
C
Executable File
#include <LCUI_Build.h>
|
|
#include <LCUI/LCUI.h>
|
|
#include <LCUI/display.h>
|
|
#include <LCUI/gui/widget.h>
|
|
#include <LCUI/gui/builder.h>
|
|
|
|
#ifdef LCUI_BUILD_IN_WIN32
|
|
#include <io.h>
|
|
#include <fcntl.h>
|
|
|
|
/* 在运行程序时会打开控制台,以查看打印的调试信息 */
|
|
static void InitConsoleWindow(void)
|
|
{
|
|
int hCrt;
|
|
FILE *hf;
|
|
AllocConsole();
|
|
hCrt=_open_osfhandle((long)GetStdHandle(STD_OUTPUT_HANDLE),_O_TEXT );
|
|
hf=_fdopen( hCrt, "w" );
|
|
*stdout=*hf;
|
|
setvbuf (stdout, NULL, _IONBF, 0);
|
|
// test code
|
|
printf ("InitConsoleWindow OK!\n");
|
|
}
|
|
|
|
#endif
|
|
|
|
int main( int argc, char **argv )
|
|
{
|
|
LCUI_Widget root, box;
|
|
|
|
#ifdef LCUI_BUILD_IN_WIN32
|
|
InitConsoleWindow();
|
|
#endif
|
|
LCUI_Init();
|
|
LCUIDisplay_SetMode( LDM_WINDOWED );
|
|
LCUIDisplay_SetSize( 960, 540 );
|
|
box = LCUIBuilder_LoadFile("hello.xml");
|
|
if( box ) {
|
|
root = LCUIWidget_GetRoot();
|
|
Widget_Append( root, box );
|
|
Widget_Unwrap( &box );
|
|
}
|
|
return LCUI_Main();
|
|
}
|