Bläddra i källkod

added ui library

Nicolas Cannasse 9 år sedan
förälder
incheckning
0e4f65e268
4 ändrade filer med 389 tillägg och 0 borttagningar
  1. 12 0
      hl.sln
  2. 168 0
      libs/ui/ui.vcxproj
  3. 6 0
      libs/ui/ui.vcxproj.filters
  4. 203 0
      libs/ui/ui_win.c

+ 12 - 0
hl.sln

@@ -18,6 +18,7 @@ EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hlc", "hlc.vcxproj", "{80755B1F-41F6-4C73-B3F3-8325AEAE1016}"
 	ProjectSection(ProjectDependencies) = postProject
 		{7DDA1414-6675-45C7-8254-42057901F865} = {7DDA1414-6675-45C7-8254-42057901F865}
+		{6534D221-34DF-404A-AFCD-6DEC9BBC9798} = {6534D221-34DF-404A-AFCD-6DEC9BBC9798}
 		{12049F27-EA26-4A33-ADF8-E542C4167C00} = {12049F27-EA26-4A33-ADF8-E542C4167C00}
 		{C6213FBF-BC2B-4235-A827-84A60E848C52} = {C6213FBF-BC2B-4235-A827-84A60E848C52}
 	EndProjectSection
@@ -25,10 +26,13 @@ EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hl", "hl.vcxproj", "{BBF750D2-6DD2-4A41-AC3A-07C070B94FA1}"
 	ProjectSection(ProjectDependencies) = postProject
 		{7DDA1414-6675-45C7-8254-42057901F865} = {7DDA1414-6675-45C7-8254-42057901F865}
+		{6534D221-34DF-404A-AFCD-6DEC9BBC9798} = {6534D221-34DF-404A-AFCD-6DEC9BBC9798}
 		{12049F27-EA26-4A33-ADF8-E542C4167C00} = {12049F27-EA26-4A33-ADF8-E542C4167C00}
 		{C6213FBF-BC2B-4235-A827-84A60E848C52} = {C6213FBF-BC2B-4235-A827-84A60E848C52}
 	EndProjectSection
 EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ui", "libs\ui\ui.vcxproj", "{6534D221-34DF-404A-AFCD-6DEC9BBC9798}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Win32 = Debug|Win32
@@ -77,6 +81,14 @@ Global
 		{BBF750D2-6DD2-4A41-AC3A-07C070B94FA1}.Release|Win32.Build.0 = Release|Win32
 		{BBF750D2-6DD2-4A41-AC3A-07C070B94FA1}.Release|x64.ActiveCfg = Release|x64
 		{BBF750D2-6DD2-4A41-AC3A-07C070B94FA1}.Release|x64.Build.0 = Release|x64
+		{6534D221-34DF-404A-AFCD-6DEC9BBC9798}.Debug|Win32.ActiveCfg = Debug|Win32
+		{6534D221-34DF-404A-AFCD-6DEC9BBC9798}.Debug|Win32.Build.0 = Debug|Win32
+		{6534D221-34DF-404A-AFCD-6DEC9BBC9798}.Debug|x64.ActiveCfg = Debug|x64
+		{6534D221-34DF-404A-AFCD-6DEC9BBC9798}.Debug|x64.Build.0 = Debug|x64
+		{6534D221-34DF-404A-AFCD-6DEC9BBC9798}.Release|Win32.ActiveCfg = Release|Win32
+		{6534D221-34DF-404A-AFCD-6DEC9BBC9798}.Release|Win32.Build.0 = Release|Win32
+		{6534D221-34DF-404A-AFCD-6DEC9BBC9798}.Release|x64.ActiveCfg = Release|x64
+		{6534D221-34DF-404A-AFCD-6DEC9BBC9798}.Release|x64.Build.0 = Release|x64
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE

+ 168 - 0
libs/ui/ui.vcxproj

@@ -0,0 +1,168 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{6534D221-34DF-404A-AFCD-6DEC9BBC9798}</ProjectGuid>
+    <Keyword>Win32Proj</Keyword>
+    <RootNamespace>ui</RootNamespace>
+    <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v140</PlatformToolset>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v140</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v140</PlatformToolset>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v140</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="Shared">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <LinkIncremental>true</LinkIncremental>
+    <TargetExt>.hdll</TargetExt>
+    <LibraryPath>$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(NETFXKitsDir)Lib\um\x86;../../$(Configuration)</LibraryPath>
+    <IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);../../src</IncludePath>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <LinkIncremental>true</LinkIncremental>
+    <TargetExt>.hdll</TargetExt>
+    <LibraryPath>$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(NETFXKitsDir)Lib\um\x64;../../x64/$(Configuration)</LibraryPath>
+    <IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);../../src</IncludePath>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <LinkIncremental>false</LinkIncremental>
+    <TargetExt>.hdll</TargetExt>
+    <LibraryPath>$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(NETFXKitsDir)Lib\um\x86;../../$(Configuration)</LibraryPath>
+    <IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);../../src</IncludePath>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <LinkIncremental>false</LinkIncremental>
+    <TargetExt>.hdll</TargetExt>
+    <LibraryPath>$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(NETFXKitsDir)Lib\um\x64;../../x64/$(Configuration)</LibraryPath>
+    <IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);../../src</IncludePath>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;UI_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <OutputFile>../../$(Configuration)/$(TargetName).hdll</OutputFile>
+      <AdditionalDependencies>std.lib;user32.lib;gdi32.lib</AdditionalDependencies>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <ClCompile>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>_DEBUG;_WINDOWS;_USRDLL;UI_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <AdditionalDependencies>std.lib;user32.lib;gdi32.lib</AdditionalDependencies>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;UI_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <OutputFile>../../$(Configuration)/$(TargetName).hdll</OutputFile>
+      <AdditionalDependencies>std.lib;user32.lib;gdi32.lib</AdditionalDependencies>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;UI_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <AdditionalDependencies>std.lib;user32.lib;gdi32.lib</AdditionalDependencies>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClCompile Include="ui_win.c" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>

+ 6 - 0
libs/ui/ui.vcxproj.filters

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <ClCompile Include="ui_win.c" />
+  </ItemGroup>
+</Project>

+ 203 - 0
libs/ui/ui_win.c

@@ -0,0 +1,203 @@
+#define HL_NAME(n) ui_##n
+#include <windows.h>
+#include <richedit.h>
+#include <hl.h>
+
+#define CLASS_NAME		USTR("HLUIWindow")
+#define PTEXT			USTR("_text")
+#define PREF			USTR("_ref")
+
+typedef struct _wref wref;
+
+struct _wref {
+	void (*finalize)( wref * );
+	HWND h;
+	vclosure *callb;
+	int width;
+	int height;
+};
+
+static void finalize_wref( wref *w ) {
+	SetProp(w->h,PREF,NULL);
+}
+
+static wref *alloc_ref( HWND h ) {
+	wref *ref = hl_gc_alloc_finalizer(sizeof(wref));
+	memset(ref,0,sizeof(wref));
+	ref->h = h;
+	ref->finalize = finalize_wref;
+	SetProp(h,PREF,ref);
+	return ref;
+}
+
+static LRESULT CALLBACK WindowProc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
+	switch( msg ) {
+	case WM_CLOSE:
+		return 0;
+	case WM_COMMAND:
+		if( wparam == BN_CLICKED ) {
+			wref *r = (wref*)GetProp((HWND)lparam,PREF);
+			if( r && r->callb ) hl_dyn_call(r->callb,NULL,0);
+		}
+		break;
+	}
+	return DefWindowProc(hwnd,msg,wparam,lparam);
+}
+
+HL_PRIM void HL_NAME(ui_init)() {
+	WNDCLASSEX wcl;
+	HINSTANCE hinst = GetModuleHandle(NULL);
+	memset(&wcl,0,sizeof(wcl));
+	wcl.cbSize			= sizeof(WNDCLASSEX);
+	wcl.style			= CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
+	wcl.lpfnWndProc		= WindowProc;
+	wcl.cbClsExtra		= 0;
+	wcl.cbWndExtra		= 0;
+	wcl.hInstance		= hinst;
+	wcl.hIcon			= NULL;
+	wcl.hCursor			= LoadCursor(NULL, IDC_ARROW);
+	wcl.hbrBackground	= (HBRUSH)(COLOR_BTNFACE+1);
+	wcl.lpszMenuName	= USTR("");
+	wcl.lpszClassName	= CLASS_NAME;
+	wcl.hIconSm			= 0;
+	RegisterClassEx(&wcl);
+	LoadLibrary(USTR("RICHED32.DLL"));
+}
+
+HL_PRIM int HL_NAME(ui_dialog)( const uchar *title, const uchar *message, int flags ) {
+	return MessageBoxW(NULL,message,title,((flags & 1)?MB_YESNO:MB_OK) | ((flags & 2)?MB_ICONERROR:MB_ICONINFORMATION) ) == IDYES;
+}
+
+static HFONT font = NULL;
+
+HL_PRIM wref *HL_NAME(ui_winlog_new)( const uchar *title, int width, int height ) {
+	HWND wnd, text;
+	RECT rc;
+	RECT dtop;
+	DWORD style = WS_SYSMENU | WS_OVERLAPPED | WS_CAPTION;
+	DWORD exstyle = 0;
+	wref *ref;
+	// SIZE
+	rc.left = 0;
+	rc.right = width;
+	rc.top = 0;
+	rc.bottom = height;
+	AdjustWindowRectEx(&rc, style, FALSE, exstyle);
+	GetWindowRect(GetDesktopWindow(),&dtop);
+	// WINDOW
+	wnd = CreateWindowEx(
+		exstyle,
+		CLASS_NAME,
+		title,
+		style,
+		(dtop.right - rc.right) / 2,
+		(dtop.bottom - rc.bottom) / 2,
+		rc.right - rc.left,
+		rc.bottom - rc.top,
+		NULL,
+		NULL,
+		GetModuleHandle(NULL),
+		NULL
+	);
+	// FONT
+	if( font == NULL ) {
+		LOGFONT f;
+		f.lfHeight = -8;
+		f.lfWidth = 0;
+		f.lfEscapement = 0;
+		f.lfOrientation = 0;
+		f.lfWeight = FW_NORMAL;
+		f.lfItalic = FALSE;
+		f.lfUnderline = FALSE;
+		f.lfStrikeOut = FALSE;
+		f.lfCharSet = DEFAULT_CHARSET;
+		f.lfOutPrecision = OUT_DEFAULT_PRECIS;
+		f.lfClipPrecision = 0;
+		f.lfQuality = DEFAULT_QUALITY;
+		f.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
+		wcscpy(f.lfFaceName,USTR("MS Sans Serif"));
+		font = CreateFontIndirect(&f);
+	}
+	// TEXT
+	text = CreateWindowEx(WS_EX_CLIENTEDGE,USTR("RICHEDIT20A"),USTR(""),ES_MULTILINE | ES_DISABLENOSCROLL | ES_READONLY | WS_VSCROLL | WS_VISIBLE | WS_CHILD,5,5,width - 10,height - 50,wnd,NULL,NULL,NULL);
+	SendMessage(text,WM_SETFONT,(WPARAM)font,TRUE);
+	SetProp(wnd,PTEXT,text);
+	ShowWindow(wnd,SW_SHOW);
+	ref = alloc_ref(wnd);
+	ref->width = width;
+	ref->height = height;
+	return ref;
+}
+
+HL_PRIM wref *HL_NAME(ui_button_new)( wref *w, const uchar *txt, vclosure *callb ) {
+	HWND but = CreateWindowEx(0,USTR("BUTTON"),USTR(""),WS_VISIBLE | WS_CHILD,w->width - 80,w->height - 30,75,25,w->h,NULL,NULL,NULL);
+	wref *ref = alloc_ref(but);
+	w->width -= 80;
+	ref->callb = callb;
+	SendMessage(but,WM_SETFONT,(WPARAM)font,TRUE);
+	SetWindowText(but,txt);
+	return ref;
+}
+
+HL_PRIM void HL_NAME(ui_winlog_set_text)( wref *w, const uchar *txt, bool autoScroll ) {
+	HWND text = (HWND)GetProp(w->h,PTEXT);
+	DWORD a,b;
+	SCROLLINFO sinf;
+	POINT pt;
+	sinf.cbSize = sizeof(sinf);
+	sinf.fMask = SIF_RANGE | SIF_POS | SIF_PAGE;
+	GetScrollInfo(text,SB_VERT,&sinf);
+	SendMessage(text,EM_GETSCROLLPOS,0,(LPARAM)&pt);
+	SendMessage(text,EM_GETSEL,(WPARAM)&a,(LPARAM)&b);
+	SetWindowText(text,txt);
+	SendMessage(text,EM_SETSEL,a,b);
+	if( autoScroll ) {
+		if( sinf.nPos + sinf.nPage == sinf.nMax || sinf.nMax == 1 ) {
+			GetScrollInfo(text,SB_VERT,&sinf);
+			pt.y = sinf.nMax - sinf.nPage;
+		}
+		SendMessage(text,EM_SETSCROLLPOS,0,(LPARAM)&pt);
+	}
+}
+
+HL_PRIM void HL_NAME(ui_win_set_text)( wref *w, const uchar *txt ) {
+	SetWindowText(w->h,txt);
+}
+
+HL_PRIM void HL_NAME(ui_win_set_enable)( wref *w, bool enable ) {
+	EnableWindow(w->h,enable);
+}
+
+HL_PRIM void HL_NAME(ui_win_destroy)( wref *w ) {
+	DestroyWindow(w->h);
+}
+
+HL_PRIM int HL_NAME(ui_loop)( bool blocking ) {
+	MSG msg;
+	if( blocking )
+		GetMessage(&msg,NULL,0,0);
+	else if( !PeekMessage(&msg,NULL,0,0,PM_REMOVE) )
+		return 0;
+	TranslateMessage(&msg);
+	DispatchMessage(&msg);
+	if( msg.message == WM_QUIT )
+		return 2;
+	return 1;
+}
+
+HL_PRIM void HL_NAME(ui_stop_loop)() {
+	PostQuitMessage(0);
+}
+
+#define _WIN _ABSTRACT(ui_window)
+
+DEFINE_PRIM(_VOID, ui_init, _NO_ARG);
+DEFINE_PRIM(_I32, ui_dialog, _BYTES _BYTES _I32);
+DEFINE_PRIM(_WIN, ui_winlog_new, _BYTES _I32 _I32);
+DEFINE_PRIM(_WIN, ui_button_new, _WIN _BYTES _FUN(_VOID,_NO_ARG));
+DEFINE_PRIM(_VOID, ui_winlog_set_text, _WIN _BYTES _BOOL);
+DEFINE_PRIM(_VOID, ui_win_set_text, _WIN _BYTES);
+DEFINE_PRIM(_VOID, ui_win_set_enable, _WIN _BOOL);
+DEFINE_PRIM(_VOID, ui_win_destroy, _WIN);
+DEFINE_PRIM(_I32, ui_loop, _BOOL);
+DEFINE_PRIM(_VOID, ui_stop_loop, _NO_ARG);