sync up with github

This commit is contained in:
idea4good
2018-10-04 14:30:29 +08:00
parent 756ddc8082
commit 05c1be4afb
42 changed files with 1179 additions and 2573 deletions

View File

@@ -16,10 +16,6 @@ FILE(GLOB ADAPTER src/adapter/api_linux.cpp
ADD_LIBRARY(core
${MAIN}
${ADAPTER})
TARGET_LINK_LIBRARIES(core
pthread
dl
sample)
execute_process(
COMMAND ${CMAKE_SOURCE_DIR}/.sync.sh Core

View File

@@ -1,184 +1,184 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.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>{8C80C76D-F437-4C69-BC94-252AC44171C2}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>core</RootNamespace>
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</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|x64'">
<OutDir>$(SolutionDir)$(Configuration)\</OutDir>
<IntDir>$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>$(SolutionDir)$(Configuration)\</OutDir>
<IntDir>$(Configuration)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
</Link>
<PostBuildEvent>
<Command>call "$(SolutionDir)sync.bat" "Core"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
</Link>
<PostBuildEvent>
<Command>call "$(SolutionDir)sync.bat" "Core"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
<PostBuildEvent>
<Command>call "$(SolutionDir)sync.bat" "Core"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
<PostBuildEvent>
<Command>call "$(SolutionDir)sync.bat" "Core"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="src\adapter\api_win.cpp" />
<ClCompile Include="src\adapter\audio_win.cpp" />
<ClCompile Include="src\adapter\msg_win.cpp" />
<ClCompile Include="src\bitmap.cpp" />
<ClCompile Include="src\cmd_target.cpp" />
<ClCompile Include="src\display.cpp" />
<ClCompile Include="src\surface.cpp" />
<ClCompile Include="src\rect.cpp" />
<ClCompile Include="src\wave_buffer.cpp" />
<ClCompile Include="src\wave_ctrl.cpp" />
<ClCompile Include="src\wnd.cpp" />
<ClCompile Include="src\word.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="core_include\api.h" />
<ClInclude Include="core_include\audio.h" />
<ClInclude Include="core_include\bitmap.h" />
<ClInclude Include="core_include\cmd_target.h" />
<ClInclude Include="core_include\display.h" />
<ClInclude Include="core_include\surface.h" />
<ClInclude Include="core_include\msg.h" />
<ClInclude Include="core_include\rect.h" />
<ClInclude Include="core_include\resource_type.h" />
<ClInclude Include="core_include\wave_buffer.h" />
<ClInclude Include="core_include\wave_ctrl.h" />
<ClInclude Include="core_include\wnd.h" />
<ClInclude Include="core_include\word.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.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>{8C80C76D-F437-4C69-BC94-252AC44171C2}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>core</RootNamespace>
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</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|x64'">
<OutDir>$(SolutionDir)$(Configuration)\</OutDir>
<IntDir>$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>$(SolutionDir)$(Configuration)\</OutDir>
<IntDir>$(Configuration)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
</Link>
<PostBuildEvent>
<Command>call "$(SolutionDir)sync.bat" "Core"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
</Link>
<PostBuildEvent>
<Command>call "$(SolutionDir)sync.bat" "Core"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
<PostBuildEvent>
<Command>call "$(SolutionDir)sync.bat" "Core"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
<PostBuildEvent>
<Command>call "$(SolutionDir)sync.bat" "Core"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="src\adapter\api_win.cpp" />
<ClCompile Include="src\adapter\audio_win.cpp" />
<ClCompile Include="src\adapter\msg_win.cpp" />
<ClCompile Include="src\bitmap.cpp" />
<ClCompile Include="src\cmd_target.cpp" />
<ClCompile Include="src\display.cpp" />
<ClCompile Include="src\surface.cpp" />
<ClCompile Include="src\rect.cpp" />
<ClCompile Include="src\wave_buffer.cpp" />
<ClCompile Include="src\wave_ctrl.cpp" />
<ClCompile Include="src\wnd.cpp" />
<ClCompile Include="src\word.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="core_include\api.h" />
<ClInclude Include="core_include\audio.h" />
<ClInclude Include="core_include\bitmap.h" />
<ClInclude Include="core_include\cmd_target.h" />
<ClInclude Include="core_include\display.h" />
<ClInclude Include="core_include\surface.h" />
<ClInclude Include="core_include\msg.h" />
<ClInclude Include="core_include\rect.h" />
<ClInclude Include="core_include\resource.h" />
<ClInclude Include="core_include\wave_buffer.h" />
<ClInclude Include="core_include\wave_ctrl.h" />
<ClInclude Include="core_include\wnd.h" />
<ClInclude Include="core_include\word.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -1,95 +1,95 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Header Files\core_include">
<UniqueIdentifier>{3a033a7f-d656-4871-b7fe-f0a16aca7c8d}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\bitmap.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\cmd_target.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\rect.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\wave_buffer.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\wave_ctrl.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\wnd.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\word.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\adapter\api_win.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\adapter\audio_win.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\adapter\msg_win.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\surface.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\display.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="core_include\api.h">
<Filter>Header Files\core_include</Filter>
</ClInclude>
<ClInclude Include="core_include\audio.h">
<Filter>Header Files\core_include</Filter>
</ClInclude>
<ClInclude Include="core_include\bitmap.h">
<Filter>Header Files\core_include</Filter>
</ClInclude>
<ClInclude Include="core_include\cmd_target.h">
<Filter>Header Files\core_include</Filter>
</ClInclude>
<ClInclude Include="core_include\msg.h">
<Filter>Header Files\core_include</Filter>
</ClInclude>
<ClInclude Include="core_include\rect.h">
<Filter>Header Files\core_include</Filter>
</ClInclude>
<ClInclude Include="core_include\resource_type.h">
<Filter>Header Files\core_include</Filter>
</ClInclude>
<ClInclude Include="core_include\wave_buffer.h">
<Filter>Header Files\core_include</Filter>
</ClInclude>
<ClInclude Include="core_include\wave_ctrl.h">
<Filter>Header Files\core_include</Filter>
</ClInclude>
<ClInclude Include="core_include\wnd.h">
<Filter>Header Files\core_include</Filter>
</ClInclude>
<ClInclude Include="core_include\word.h">
<Filter>Header Files\core_include</Filter>
</ClInclude>
<ClInclude Include="core_include\surface.h">
<Filter>Header Files\core_include</Filter>
</ClInclude>
<ClInclude Include="core_include\display.h">
<Filter>Header Files\core_include</Filter>
</ClInclude>
</ItemGroup>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Header Files\core_include">
<UniqueIdentifier>{3a033a7f-d656-4871-b7fe-f0a16aca7c8d}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\bitmap.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\cmd_target.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\rect.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\wave_buffer.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\wave_ctrl.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\wnd.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\word.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\adapter\api_win.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\adapter\audio_win.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\adapter\msg_win.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\surface.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\display.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="core_include\api.h">
<Filter>Header Files\core_include</Filter>
</ClInclude>
<ClInclude Include="core_include\audio.h">
<Filter>Header Files\core_include</Filter>
</ClInclude>
<ClInclude Include="core_include\bitmap.h">
<Filter>Header Files\core_include</Filter>
</ClInclude>
<ClInclude Include="core_include\cmd_target.h">
<Filter>Header Files\core_include</Filter>
</ClInclude>
<ClInclude Include="core_include\msg.h">
<Filter>Header Files\core_include</Filter>
</ClInclude>
<ClInclude Include="core_include\rect.h">
<Filter>Header Files\core_include</Filter>
</ClInclude>
<ClInclude Include="core_include\wave_buffer.h">
<Filter>Header Files\core_include</Filter>
</ClInclude>
<ClInclude Include="core_include\wave_ctrl.h">
<Filter>Header Files\core_include</Filter>
</ClInclude>
<ClInclude Include="core_include\wnd.h">
<Filter>Header Files\core_include</Filter>
</ClInclude>
<ClInclude Include="core_include\word.h">
<Filter>Header Files\core_include</Filter>
</ClInclude>
<ClInclude Include="core_include\surface.h">
<Filter>Header Files\core_include</Filter>
</ClInclude>
<ClInclude Include="core_include\display.h">
<Filter>Header Files\core_include</Filter>
</ClInclude>
<ClInclude Include="core_include\resource.h">
<Filter>Header Files\core_include</Filter>
</ClInclude>
</ItemGroup>
</Project>

4
core/core.vcxproj.user Normal file
View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
</Project>

View File

@@ -15,6 +15,7 @@ void do_assert(const char* file, int line);
void log_out(const char* log);
#define COLOR_TRANPARENT 0xFF000000
#define GLT_RGB(r, g, b) ((0xFF << 24) | (((unsigned int)(r)) << 16) | (((unsigned int)(g)) << 8) | ((unsigned int)(b)))
#define GLT_RGB_R(rgb) ((((unsigned int)(rgb)) >> 16) & 0xFF)
#define GLT_RGB_G(rgb) ((((unsigned int)(rgb)) >> 8) & 0xFF)

View File

@@ -5,11 +5,11 @@ class c_surface;
class c_bitmap
{
public:
static void draw_bitmap(c_surface* surface, int z_order, const GUI_BITMAP *pBitmap, int x, int y);
static void draw_bitmap_in_rect(c_surface* surface, int z_order, const GUI_BITMAP *pBitmap, c_rect rect, unsigned int align_type);
static void draw_bitmap(c_surface* surface, int z_order, const BITMAP_INFO *pBitmap, int x, int y);
static void draw_bitmap_in_rect(c_surface* surface, int z_order, const BITMAP_INFO *pBitmap, c_rect rect, unsigned int align_type);
private:
static void draw_bitmap_565(c_surface* surface, int z_order, int x, int y, int xsize, int ysize, const unsigned char* pPixel);
static void get_bitmap_pos(const GUI_BITMAP *pBitmap, c_rect rect, unsigned int align_type, int &x, int &y);
static void get_bitmap_pos(const BITMAP_INFO *pBitmap, c_rect rect, unsigned int align_type, int &x, int &y);
static void draw_bitmap_565_inrect(c_surface* surface, int z_order, int x, int y, int width, int height, int xsize, int ysize, const unsigned char* pPixel);
c_bitmap(){}

View File

@@ -0,0 +1,41 @@
#ifndef _RESOURCE_H_
#define _RESOURCE_H_
//BITMAP
typedef struct struct_bitmap_info
{
unsigned short XSize;
unsigned short YSize;
unsigned short BytesPerLine;
unsigned short BitsPerPixel;
const unsigned char* pData; /* Pointer to picture data (indices) */
} BITMAP_INFO;
//FONT
typedef struct struct_lattice
{
unsigned int utf8_code;
unsigned char width;
const unsigned char* p_data;
} LATTICE;
typedef struct struct_font_info
{
unsigned char height;
unsigned int count;
LATTICE* lattice_array;
} FONT_INFO;
//SHAPE
#define INVALID_RGN 0xFFFFFF
#define COLOR_USERDEF GLT_RGB(41,49,49)
typedef struct struct_color_rect
{
int l;
int t;
int r;
int b;
unsigned int color;
}COLOR_RECT;
#endif

View File

@@ -1,72 +0,0 @@
#ifndef _RESOURCE_TYPE_H_
#define _RESOURCE_TYPE_H_
typedef struct struct_gui_bitmap
{
unsigned short XSize;
unsigned short YSize;
unsigned short BytesPerLine;
unsigned short BitsPerPixel;
const unsigned char* pData; /* Pointer to picture data (indices) */
} GUI_BITMAP;
typedef struct
{
unsigned char XSize;
unsigned char XDist;
unsigned char BytesPerLine;
void* pData;
} GUI_CHARINFO;
typedef struct
{
unsigned short First; /* first character */
unsigned short Last; /* last character */
const GUI_CHARINFO* paCharInfo; /* address of first character */
void* pNext; /* pointer to next */
} GUI_FONT_PROP;
typedef struct struct_gui_font
{
unsigned char YSize;
unsigned char YDist;
unsigned char XMag;
unsigned char YMag;
union
{
void *pFontData;
const GUI_FONT_PROP* pProp;
} p;
unsigned char Baseline;
} GUI_FONT;
typedef enum
{
LANGUAGE_BEGIN = 0,
ENGLISH = LANGUAGE_BEGIN,
CHINESE,
LANGUAGE_MAX
}LANGUAGE_TYPE;
typedef struct struct_multi_lan_strings
{
unsigned int index;
const char* text[LANGUAGE_MAX];
}MULTI_LAN_STRINGS;
typedef struct struct_unicode_lan_strings
{
unsigned int index;
const char* unicodes;
}MULTI_LAN_UNICODES;
#define ADD_STRING( index, english) \
{ \
index, \
{ \
english, \
0 \
} \
}
#endif

View File

@@ -15,26 +15,16 @@ typedef enum
Z_ORDER_LEVEL_MAX
}Z_ORDER_LEVEL;
#define INVALID_RGN 0xFFFFFF
#define COLOR_USERDEF GLT_RGB(41,49,49)
#define DUMMY_COLOR GLT_RGB(0,0,0)
typedef struct struct_custom_shape
{
int l;
int t;
int r;
int b;
unsigned int color;
}CUSTOM_SHAPE;
typedef struct struct_color_rect COLOR_RECT;
class c_display;
class c_surface {
friend class c_display;
public:
virtual void set_pixel(int x, int y, unsigned int rgb, unsigned int z_order);
virtual void fill_rect(int x0, int y0, int x1, int y1, unsigned int rgb, unsigned int z_order);
virtual unsigned int get_pixel(int x, int y, unsigned int z_order);
virtual void fill_rect(int x0, int y0, int x1, int y1, unsigned int rgb, unsigned int z_order);
void fill_rect_ex(int l, int t, int r, int b, unsigned int color, const COLOR_RECT* extend_rects, int z_order);
int get_width() { return m_width; }
int get_height() { return m_height; }
@@ -42,7 +32,6 @@ public:
void draw_vline(int x, int y0, int y1, unsigned int rgb, unsigned int z_order);
void draw_line(int x0, int y0, int x1, int y1, unsigned int rgb, unsigned int z_order);
void draw_rect(int x0, int y0, int x1, int y1, unsigned int rgb, unsigned int z_order);
void draw_custom_shape(int l, int t, int r, int b, unsigned int color, const CUSTOM_SHAPE pRgn[], int z_order);
int flush_scrren(int left, int top, int right, int bottom);
bool is_valid(c_rect rect);

View File

@@ -24,12 +24,11 @@ public:
virtual void on_init_children();
virtual void on_paint();
void set_wave_name(unsigned short wave_name_id){ m_wave_name = wave_name_id;}
unsigned short get_wave_name(){return m_wave_name;}
void set_wave_unit(unsigned short wave_unit_id){ m_wave_unit = wave_unit_id;}
void set_wave_name(char* wave_name){ m_wave_name = wave_name;}
void set_wave_unit(char* wave_unit){ m_wave_unit = wave_unit;}
void set_wave_name_font_type(const GUI_FONT* wave_name_font_type){ m_wave_name_font_type = wave_name_font_type;}
void set_wave_unit_font_type(const GUI_FONT* wave_unit_font_type){ m_wave_unit_font_type = wave_unit_font_type;}
void set_wave_name_font_type(const FONT_INFO* wave_name_font_type){ m_wave_name_font_type = wave_name_font_type;}
void set_wave_unit_font_type(const FONT_INFO* wave_unit_font_type){ m_wave_unit_font_type = wave_unit_font_type;}
void set_wave_name_color(unsigned int wave_name_color){ m_wave_name_color = wave_name_color;}
void set_wave_unit_color(unsigned int wave_unit_color){ m_wave_unit_color = wave_unit_color;}
@@ -51,11 +50,11 @@ protected:
void erase_oldest_vline();
void save_foreground();
unsigned short m_wave_name;
unsigned short m_wave_unit;
char* m_wave_name;
char* m_wave_unit;
const GUI_FONT* m_wave_name_font_type;
const GUI_FONT* m_wave_unit_font_type;
const FONT_INFO* m_wave_name_font_type;
const FONT_INFO* m_wave_unit_font_type;
unsigned int m_wave_name_color;
unsigned int m_wave_unit_color;

View File

@@ -1,5 +1,5 @@
#ifndef XT_GUI_WND_H
#define XT_GUI_WND_H
#ifndef _GUI_WND_H_
#define _GUI_WND_H_
//Window attribution
#define GLT_WIN_SHOW 0x00000001
@@ -9,10 +9,8 @@
#define GLT_ATTR_DISABLED 0x40000000L
#define GLT_ATTR_FOCUS 0x20000000L
typedef struct struct_gui_bitmap GUI_BITMAP;
typedef struct struct_gui_font GUI_FONT;
typedef struct struct_custom_shape CUSTOM_SHAPE;
typedef const GUI_FONT* (*PTR_FUNC_GET_FONT)();
typedef struct struct_font_info FONT_INFO;
typedef struct struct_color_rect COLOR_RECT;
class c_wnd;
class c_surface;
@@ -29,7 +27,7 @@ typedef struct struct_wnd_tree
{
c_wnd* p_wnd;
unsigned int resource_id;
unsigned int caption_id;
char* str;
short x;
short y;
short width;
@@ -44,9 +42,9 @@ public:
c_wnd();
virtual ~c_wnd();
virtual const char* get_class_name() const { return "c_wnd"; }
virtual int connect(c_wnd *parent, unsigned short resource_id, unsigned short str_id,
virtual int connect(c_wnd *parent, unsigned short resource_id, char* str,
short x, short y, short width, short height, WND_TREE* p_child_tree = NULL);
virtual c_wnd* connect_clone(c_wnd *parent, unsigned short resource_id, unsigned short str_id,
virtual c_wnd* connect_clone(c_wnd *parent, unsigned short resource_id, char* str,
short x, short y, short width, short height, WND_TREE* p_child_tree = NULL);
void disconnect();
virtual c_wnd* clone() = 0;
@@ -60,13 +58,8 @@ public:
unsigned int get_style() const { return m_style; }
virtual void modify_style(unsigned int add_style = 0, unsigned int remove_style = 0);
void set_str_id(unsigned short str_id) { m_str_id = str_id; }
unsigned short get_str_id() const { return m_str_id; }
void set_bitmap(const GUI_BITMAP *pBitmap) { m_bitmap = pBitmap; }
void set_focus_bitmap(const GUI_BITMAP *pBitmap) { m_bitmap_focus = pBitmap; }
void set_pushed_bitmap(const GUI_BITMAP *pBitmap) { m_bitmap_pushed = pBitmap; }
void set_disable_bitmap(const GUI_BITMAP *pBitmap) { m_bitmap_disable = pBitmap; }
void set_str(char* str) { m_str = str; }
char* get_str_id() const { return m_str; }
bool is_visible() const { return m_is_visible_now; }
bool is_foreground();
@@ -81,8 +74,8 @@ public:
unsigned int get_font_color() { return m_font_color; }
void set_bg_color(unsigned int color) { m_bg_color = color; }
unsigned int get_bg_color() { return m_bg_color; }
void set_font_type(const GUI_FONT *font_type) { m_font_type = font_type; }
const GUI_FONT* get_font_type() { return m_font_type; }
void set_font_type(const FONT_INFO *font_type) { m_font_type = font_type; }
const FONT_INFO* get_font_type() { return m_font_type; }
void set_wnd_pos(short x, short y, short width, short height);
void get_wnd_rect(c_rect &rect) const;
@@ -136,7 +129,8 @@ protected:
void draw_rect(c_rect rect, unsigned int rgb);
void fill_rect(int x0, int y0, int x1, int y1, unsigned int rgb);
void fill_rect(c_rect rect, unsigned int rgb);
void draw_custom_shape(int l, int t, int r, int b, unsigned int color, const CUSTOM_SHAPE pRgn[]);
void fill_rect_ex(int l, int t, int r, int b, unsigned int color, const COLOR_RECT* extend_rects);
void fill_rect_ex(c_rect rect, unsigned int color, const COLOR_RECT* extend_rects);
protected:
WND_STATUS m_status;
unsigned int m_style;
@@ -145,13 +139,9 @@ protected:
c_wnd* m_top_child;
c_wnd* m_prev_sibling;
c_wnd* m_next_sibling;
unsigned short m_str_id;
char* m_str;
const GUI_BITMAP* m_bitmap;
const GUI_BITMAP* m_bitmap_focus;
const GUI_BITMAP* m_bitmap_pushed;
const GUI_BITMAP* m_bitmap_disable;
const GUI_FONT* m_font_type;
const FONT_INFO* m_font_type;
unsigned int m_font_color;
unsigned int m_bg_color;

View File

@@ -1,39 +1,23 @@
#ifndef _WORD_UNIT_H_
#define _WORD_UNIT_H_
#define COLOR_TRANPARENT 0xFF000000
class c_surface;
class c_word
{
public:
static void initiallize(LANGUAGE_TYPE language);
static void draw_string(c_surface* surface, int z_order, const char *s, int x, int y, const GUI_FONT* font, unsigned int font_color, unsigned int bg_color, unsigned int align_type = ALIGN_LEFT);
static void draw_string(c_surface* surface, int z_order, unsigned long str_id, int x, int y, const GUI_FONT* font, unsigned int font_color, unsigned int bg_color, unsigned int align_type = ALIGN_LEFT);
static void draw_string_in_rect(c_surface* surface, int z_order, const char *s, c_rect rect, const GUI_FONT* font, unsigned int font_color, unsigned int bg_color, unsigned int align_type = ALIGN_LEFT);
static void draw_string_in_rect(c_surface* surface, int z_order, unsigned long str_id, c_rect rect, const GUI_FONT* font, unsigned int font_color, unsigned int bg_color, unsigned int align_type = ALIGN_LEFT);
static void draw_value(c_surface* surface, int z_order, int value, int dot_position, int x, int y, const GUI_FONT* font, unsigned int font_color, unsigned int bg_color, unsigned int align_type = ALIGN_LEFT);
static void draw_value_in_rect(c_surface* surface, int z_order, int value, int dot_position, c_rect rect, const GUI_FONT* font, unsigned int font_color, unsigned int bg_color, unsigned int align_type = ALIGN_LEFT);
static void draw_string(c_surface* surface, int z_order, const char *s, int x, int y, const FONT_INFO* font, unsigned int font_color, unsigned int bg_color, unsigned int align_type = ALIGN_LEFT);
static void draw_string_in_rect(c_surface* surface, int z_order, const char *s, c_rect rect, const FONT_INFO* font, unsigned int font_color, unsigned int bg_color, unsigned int align_type = ALIGN_LEFT);
static void draw_value(c_surface* surface, int z_order, int value, int dot_position, int x, int y, const FONT_INFO* font, unsigned int font_color, unsigned int bg_color, unsigned int align_type = ALIGN_LEFT);
static void draw_value_in_rect(c_surface* surface, int z_order, int value, int dot_position, c_rect rect, const FONT_INFO* font, unsigned int font_color, unsigned int bg_color, unsigned int align_type = ALIGN_LEFT);
static void value_2_string(int value, int dot_position, char* buf, int len);
static int get_str_pixel_length(const char *s, const GUI_FONT* font);
static const int get_font_ysize(const GUI_FONT* font_type);
static const char* get_string(unsigned long str_id);
static int get_str_pixel_length(const char *s, const FONT_INFO* font);
private:
static int get_char_cnt_in_single_line(const char *s);
static void draw_single_line_string(c_surface* surface, int z_order, const char *s, int x, int y, int len, const GUI_FONT* font, unsigned int font_color, unsigned int bg_color);
static int draw_single_char(c_surface* surface, int z_order, unsigned short code, int x, int y, const GUI_FONT* font, unsigned int font_color, unsigned int bg_color);
static void draw_lattice(c_surface* surface, int z_order, int x, int y, int width, int height, int bytes_per_line, const unsigned char* pData, unsigned int font_color, unsigned int bg_color, unsigned int font_aa_flag);
static void draw_bit_line(c_surface* surface, int z_order, int x, int y, unsigned char const*p, int width, unsigned int font_color, unsigned int bg_color);
static void draw_bit_line_AA(c_surface* surface, int z_order, int x, int y, unsigned char const*p, int width, unsigned int font_color, unsigned int bg_color);
static const GUI_FONT_PROP* find_font_prop(const GUI_FONT_PROP* pProp, unsigned short code);
static void get_string_pos(const char *s, const GUI_FONT* font, c_rect rect, unsigned int align_type, int &x, int &y);
static bool is_AA_font(const GUI_CHARINFO* pCharInfo);
static const MULTI_LAN_STRINGS *m_lang_map;
static LANGUAGE_TYPE m_lang_type;
static int draw_single_char(c_surface* surface, int z_order, unsigned int utf8_code, int x, int y, const FONT_INFO* font, unsigned int font_color, unsigned int bg_color);
static void draw_lattice(c_surface* surface, int z_order, int x, int y, int width, int height, const unsigned char* p_data, unsigned int font_color, unsigned int bg_color);
static const LATTICE* get_lattice(const FONT_INFO* font, unsigned int utf8_code);
static void get_string_pos(const char *s, const FONT_INFO* font, c_rect rect, unsigned int align_type, int &x, int &y);
private:
c_word(){};
c_word(const c_word&);

View File

@@ -1,10 +1,10 @@
#include "../core_include/api.h"
#include "../core_include/resource_type.h"
#include "../core_include/resource.h"
#include "../core_include/rect.h"
#include "../core_include/bitmap.h"
#include "../core_include/surface.h"
void c_bitmap::draw_bitmap(c_surface* surface, int z_order, const GUI_BITMAP *pBitmap, int x, int y)
void c_bitmap::draw_bitmap(c_surface* surface, int z_order, const BITMAP_INFO *pBitmap, int x, int y)
{
if (0 == pBitmap)
{
@@ -15,7 +15,7 @@ void c_bitmap::draw_bitmap(c_surface* surface, int z_order, const GUI_BITMAP *pB
(unsigned char const *)pBitmap->pData);
}
void c_bitmap::draw_bitmap_in_rect(c_surface* surface, int z_order, const GUI_BITMAP *pBitmap, c_rect rect, unsigned int align_type)
void c_bitmap::draw_bitmap_in_rect(c_surface* surface, int z_order, const BITMAP_INFO *pBitmap, c_rect rect, unsigned int align_type)
{
if (0 == pBitmap)
{
@@ -28,7 +28,7 @@ void c_bitmap::draw_bitmap_in_rect(c_surface* surface, int z_order, const GUI_BI
pBitmap->XSize, pBitmap->YSize, (unsigned char const *)pBitmap->pData);
}
void c_bitmap::get_bitmap_pos(const GUI_BITMAP *pBitmap, c_rect rect, unsigned int align_type, int &x, int &y)
void c_bitmap::get_bitmap_pos(const BITMAP_INFO *pBitmap, c_rect rect, unsigned int align_type, int &x, int &y)
{
int x_size = pBitmap->XSize;
int y_size = pBitmap->YSize;

View File

@@ -4,6 +4,7 @@
#include "../core_include/wnd.h"
#include "../core_include/surface.h"
#include "../core_include/display.h"
#include "../core_include/resource.h"
#include <string.h>
#include <stdlib.h>
@@ -374,24 +375,28 @@ int c_surface::copy_layer_pixel_2_fb(int x, int y, unsigned int z_order)
return 0;
}
void c_surface::draw_custom_shape(int l, int t, int r, int b, unsigned int color, const CUSTOM_SHAPE pRgn[], int z_order)
void c_surface::fill_rect_ex(int l, int t, int r, int b, unsigned int color, const COLOR_RECT* extend_rects, int z_order)
{
int i = 0;
int templ, tempt, tempr, tempb;
unsigned int tempcolor;
while (INVALID_RGN != pRgn[i].l)
if (NULL == extend_rects)
{
templ = (pRgn[i].l < 0) ? (r + 1 + pRgn[i].l) : pRgn[i].l + l;
tempt = (pRgn[i].t < 0) ? (b + 1 + pRgn[i].t) : pRgn[i].t + t;
tempr = (pRgn[i].r < 0) ? (r + 1 + pRgn[i].r) : pRgn[i].r + l;
tempb = (pRgn[i].b < 0) ? (b + 1 + pRgn[i].b) : pRgn[i].b + t;
return fill_rect(l, t, r, b, color, z_order);
}
COLOR_RECT* p_item = (COLOR_RECT*)extend_rects;
int templ, tempt, tempr, tempb;
for(int i = 0; INVALID_RGN != p_item[i].l; i++)
{
templ = (p_item[i].l < 0) ? (r + 1 + p_item[i].l) : p_item[i].l + l;
tempt = (p_item[i].t < 0) ? (b + 1 + p_item[i].t) : p_item[i].t + t;
tempr = (p_item[i].r < 0) ? (r + 1 + p_item[i].r) : p_item[i].r + l;
tempb = (p_item[i].b < 0) ? (b + 1 + p_item[i].b) : p_item[i].b + t;
if (templ >= tempr)
tempr = templ;
if (tempt >= tempb)
tempb = tempt;
tempcolor = (COLOR_USERDEF == pRgn[i].color) ? (color) : pRgn[i].color;
unsigned int tempcolor = (COLOR_USERDEF == p_item[i].color) ? (color) : p_item[i].color;
for (int y = tempt ; y <= tempb; y++)
{
@@ -400,7 +405,6 @@ void c_surface::draw_custom_shape(int l, int t, int r, int b, unsigned int color
set_pixel(x , y, tempcolor, z_order);
}
}
i++;
}
}

View File

@@ -4,7 +4,7 @@
#include "../core_include/wnd.h"
#include "../core_include/wave_buffer.h"
#include "../core_include/surface.h"
#include "../core_include/resource_type.h"
#include "../core_include/resource.h"
#include "../core_include/word.h"
#include "../core_include/wave_ctrl.h"
#include <stdlib.h>

View File

@@ -1,15 +1,13 @@
#include "../core_include/rect.h"
#include "../core_include/cmd_target.h"
#include "../core_include/api.h"
#include "../core_include/resource_type.h"
#include "../core_include/resource.h"
#include "../core_include/bitmap.h"
#include "../core_include/surface.h"
#include "../core_include/wnd.h"
c_wnd::c_wnd(): m_status(STATUS_NORMAL), m_style(GLT_ATTR_VISIBLE), m_parent(NULL), m_top_child(NULL), m_prev_sibling(NULL), m_next_sibling(NULL),
m_str_id(0),m_bitmap(NULL), m_bitmap_focus(NULL), m_bitmap_pushed(NULL), m_bitmap_disable(NULL),
m_font_type(NULL), m_font_color(0), m_bg_color(0), m_is_visible_now(false),m_resource_id(0),
m_z_order(Z_ORDER_LEVEL_0), m_active_child(NULL), m_surface(NULL)
m_str(0), m_font_color(0), m_bg_color(0), m_is_visible_now(false),m_resource_id(0), m_z_order(Z_ORDER_LEVEL_0), m_active_child(NULL), m_surface(NULL)
{
m_wnd_rect.Empty();
}
@@ -23,7 +21,7 @@ void c_wnd::pre_create_wnd()
m_style = GLT_ATTR_VISIBLE | GLT_ATTR_FOCUS;
}
int c_wnd::connect(c_wnd *parent, unsigned short resource_id, unsigned short str_id,
int c_wnd::connect(c_wnd *parent, unsigned short resource_id, char* str,
short x, short y, short width, short height, WND_TREE* p_child_tree )
{
if(0 == resource_id)
@@ -58,7 +56,7 @@ int c_wnd::connect(c_wnd *parent, unsigned short resource_id, unsigned short str
ASSERT(m_surface->is_valid(rect));
pre_create_wnd();
set_str_id(str_id);
set_str(str);
if ( 0 != parent )
{
@@ -91,7 +89,7 @@ int c_wnd::load_child_wnd(WND_TREE *p_child_tree)
}
else
{
p_cur->p_wnd->connect(this, p_cur->resource_id, p_cur->caption_id,
p_cur->p_wnd->connect(this, p_cur->resource_id, p_cur->str,
p_cur->x, p_cur->y, p_cur->width, p_cur->height,p_cur->p_child_tree);
}
p_cur++;
@@ -100,7 +98,7 @@ int c_wnd::load_child_wnd(WND_TREE *p_child_tree)
return sum;
}
c_wnd* c_wnd::connect_clone(c_wnd *parent, unsigned short resource_id, unsigned short str_id,
c_wnd* c_wnd::connect_clone(c_wnd *parent, unsigned short resource_id, char* str,
short x, short y, short width, short height, WND_TREE* p_child_tree )
{
if(0 == resource_id)
@@ -140,7 +138,7 @@ c_wnd* c_wnd::connect_clone(c_wnd *parent, unsigned short resource_id, unsigned
ASSERT(wnd->m_surface->is_valid(rect));
wnd->pre_create_wnd();
wnd->set_str_id(str_id);
wnd->set_str(str);
if ( 0 != parent )
{
@@ -166,7 +164,7 @@ int c_wnd::load_clone_child_wnd(WND_TREE *p_child_tree)
WND_TREE* p_cur = p_child_tree;
while(p_cur->p_wnd)
{
p_cur->p_wnd->connect_clone(this, p_cur->resource_id, p_cur->caption_id,
p_cur->p_wnd->connect_clone(this, p_cur->resource_id, p_cur->str,
p_cur->x, p_cur->y, p_cur->width, p_cur->height,p_cur->p_child_tree);
p_cur++;
sum++;
@@ -787,7 +785,12 @@ void c_wnd::fill_rect(c_rect rect, unsigned int rgb)
m_surface->fill_rect(rect.m_left, rect.m_top, rect.m_right, rect.m_bottom, rgb, m_z_order);
}
void c_wnd::draw_custom_shape(int l, int t, int r, int b, unsigned int color, const CUSTOM_SHAPE pRgn[])
void c_wnd::fill_rect_ex(int l, int t, int r, int b, unsigned int color, const COLOR_RECT* extend_rects)
{
m_surface->draw_custom_shape(l, t, r, b, color, pRgn, m_z_order);
m_surface->fill_rect_ex(l, t, r, b, color, extend_rects, m_z_order);
}
void c_wnd::fill_rect_ex(c_rect rect, unsigned int color, const COLOR_RECT* extend_rects)
{
m_surface->fill_rect_ex(rect.m_left, rect.m_top, rect.m_right, rect.m_bottom, color, extend_rects, m_z_order);
}

View File

@@ -1,120 +1,110 @@
#include "../core_include/api.h"
#include "../core_include/rect.h"
#include "../core_include/resource_type.h"
#include "../core_include/resource.h"
#include "../core_include/word.h"
#include "../core_include/surface.h"
#include <string.h>
#include <stdio.h>
#define BUFFER_LEN 16
const MULTI_LAN_STRINGS * c_word::m_lang_map;
LANGUAGE_TYPE c_word::m_lang_type;
extern const MULTI_LAN_STRINGS *get_multi_lan_pointer();
extern const MULTI_LAN_UNICODES *get_unicode_lan_pointer();
void c_word::initiallize(LANGUAGE_TYPE language)
unsigned char s_utf8_length_table[256] =
{
m_lang_type = language;
m_lang_map = get_multi_lan_pointer();
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 1, 1
};
inline static int get_utf8_code(const char* s, unsigned int& output_utf8_code)
{
unsigned char* us = (unsigned char*)s;
int utf8_bytes = s_utf8_length_table[*us];
switch (utf8_bytes)
{
case 1:
output_utf8_code = *us;
break;
case 2:
output_utf8_code = (*us << 8) | (*(us + 1));
break;
case 3:
output_utf8_code = (*us << 16) | ((*(us + 1)) << 8) | *(us + 2);
break;
case 4:
output_utf8_code = (*us << 24) | ((*(us + 1)) << 16) | (*(us + 2) << 8) | *(us + 3);
break;
default:
ASSERT(FALSE);
break;
}
return utf8_bytes;
}
void c_word::draw_value_in_rect(c_surface* surface, int z_order, int value, int dot_position, c_rect rect, const GUI_FONT* font, unsigned int font_color, unsigned int bg_color, unsigned int align_type)
void c_word::draw_value_in_rect(c_surface* surface, int z_order, int value, int dot_position, c_rect rect, const FONT_INFO* font, unsigned int font_color, unsigned int bg_color, unsigned int align_type)
{
char buf[BUFFER_LEN];
value_2_string(value, dot_position, buf, BUFFER_LEN);
draw_string_in_rect(surface, z_order, buf, rect, font, font_color, bg_color, align_type);
}
void c_word::draw_value(c_surface* surface, int z_order, int value, int dot_position, int x, int y, const GUI_FONT* font, unsigned int font_color, unsigned int bg_color, unsigned int align_type)
void c_word::draw_value(c_surface* surface, int z_order, int value, int dot_position, int x, int y, const FONT_INFO* font, unsigned int font_color, unsigned int bg_color, unsigned int align_type)
{
char buf[BUFFER_LEN];
value_2_string(value, dot_position, buf, BUFFER_LEN);
draw_string(surface, z_order, buf, x, y, font, font_color, bg_color, align_type);
}
void c_word::draw_string_in_rect(c_surface* surface, int z_order, unsigned long str_id, c_rect rect, const GUI_FONT* font, unsigned int font_color, unsigned int bg_color, unsigned int align_type)
{
const char* s = get_string(str_id);
if (NULL == s)
{
return;
}
draw_string_in_rect(surface, z_order, s, rect, font, font_color, bg_color, align_type);
}
void c_word::draw_string_in_rect(c_surface* surface, int z_order, const char *s, c_rect rect, const GUI_FONT* font, unsigned int font_color, unsigned int bg_color, unsigned int align_type)
void c_word::draw_string_in_rect(c_surface* surface, int z_order, const char *s, c_rect rect, const FONT_INFO* font, unsigned int font_color, unsigned int bg_color, unsigned int align_type)
{
if(NULL == s)
{
return;
}
if (NULL == font)
{
ASSERT(FALSE);
}
int x, y;
get_string_pos(s, font, rect, align_type, x, y);
draw_string(surface, z_order, s, rect.m_left + x, rect.m_top + y, font, font_color, bg_color, ALIGN_LEFT);
}
void c_word::draw_string(c_surface* surface, int z_order, unsigned long str_id, int x, int y, const GUI_FONT* font, unsigned int font_color, unsigned int bg_color, unsigned int align_type)
void c_word::draw_string(c_surface* surface, int z_order, const char *s, int x, int y, const FONT_INFO* font, unsigned int font_color, unsigned int bg_color, unsigned int align_type)
{
const char* s = get_string(str_id);
if (NULL == s)
{
return;
}
draw_string(surface, z_order, s, x, y, font, font_color, bg_color, align_type);
}
void c_word::draw_string(c_surface* surface, int z_order, const char *s, int x, int y, const GUI_FONT* font, unsigned int font_color, unsigned int bg_color, unsigned int align_type)
{
if(0 == s)
{
return;
}
for (; *s; s++)
{
int line_len = get_char_cnt_in_single_line(s);
int str_pixel_length = get_str_pixel_length(s, font);
if (align_type == ALIGN_RIGHT)
{
x = x - str_pixel_length + 1;
}
else if (align_type == ALIGN_HCENTER)
{
x = x - str_pixel_length / 2;
}
draw_single_line_string(surface, z_order, s, x, y , line_len, font, font_color, bg_color);
s += line_len;
if (*s == '\n')
{
y += font->YSize;
}
if (*s==0)
break;
}
}
const char* c_word::get_string(unsigned long str_id)
{
if(NULL == m_lang_map)
{
return NULL;
}
if(str_id != m_lang_map[str_id].index)
if (NULL == font)
{
ASSERT(FALSE);
return NULL;
}
return m_lang_map[str_id].text[m_lang_type];
}
const int c_word::get_font_ysize(const GUI_FONT* font_type)
{
if (!font_type)
{
return 0;
int offset = 0;
unsigned int utf8_code;
while (*s)
{
if (*s == '\n')
{
y += font->height;
offset = 0;
continue;
}
s += get_utf8_code(s, utf8_code);
offset += draw_single_char(surface, z_order, utf8_code, (x + offset), y, font, font_color, bg_color);
}
return font_type->YSize;
}
void c_word::value_2_string(int value, int dot_position, char* buf, int len)
@@ -145,50 +135,30 @@ void c_word::value_2_string(int value, int dot_position, char* buf, int len)
}
}
int c_word::get_char_cnt_in_single_line(const char *s)
const LATTICE* c_word::get_lattice(const FONT_INFO* font, unsigned int utf8_code)
{
int len = 0;
unsigned char code_high;
while (((code_high = *(unsigned char*)s) != 0))
{
if (code_high > 127)
{
len++; s++;
}
else
{
switch (code_high)
{
case '\n': return len;
}
}
len++;
s++;
}
return len;
int first = 0;
int last = font->count - 1;
int middle = (first + last) / 2;
while (first <= last)
{
if (font->lattice_array[middle].utf8_code < utf8_code)
first = middle + 1;
else if (font->lattice_array[middle].utf8_code == utf8_code)
{
return &font->lattice_array[middle];
}
else
{
last = middle - 1;
}
middle = (first + last) / 2;
}
return NULL;
}
void c_word::draw_single_line_string(c_surface* surface, int z_order, const char *s, int x, int y, int len, const GUI_FONT* font, unsigned int font_color, unsigned int bg_color)
{
int offset = 0;
while (--len >= 0)
{
offset = draw_single_char(surface, z_order, *s++, x, y, font, font_color, bg_color);
x += offset;
}
}
const GUI_FONT_PROP* c_word::find_font_prop(const GUI_FONT_PROP* pProp, unsigned short code)
{
for (; pProp; pProp=(GUI_FONT_PROP*) pProp->pNext)
{
if ((code>=pProp->First) && (code<=pProp->Last))
break;
}
return pProp;
}
int c_word::draw_single_char(c_surface* surface, int z_order, unsigned short code, int x, int y, const GUI_FONT* font, unsigned int font_color, unsigned int bg_color)
int c_word::draw_single_char(c_surface* surface, int z_order, unsigned int utf8_code, int x, int y, const FONT_INFO* font, unsigned int font_color, unsigned int bg_color)
{
if (NULL == font)
{
@@ -196,137 +166,83 @@ int c_word::draw_single_char(c_surface* surface, int z_order, unsigned short cod
return 0;
}
const GUI_FONT_PROP* pProp = find_font_prop(font->p.pProp, code);
if (pProp)
const LATTICE* p_lattice = get_lattice(font, utf8_code);
if (p_lattice)
{
const GUI_CHARINFO* pCharInfo = pProp->paCharInfo+(code - pProp->First);
int bytes_per_line = pCharInfo->BytesPerLine;
draw_lattice(surface, z_order, x, y, pCharInfo->XSize, font->YSize,
bytes_per_line, (unsigned char const *)pCharInfo->pData, font_color, bg_color, is_AA_font(pCharInfo));
return pCharInfo->XDist;
draw_lattice(surface, z_order, x, y, p_lattice->width, font->height, p_lattice->p_data, font_color, bg_color);
return p_lattice->width;
}
return 0;
int len = font->height;
for (int y_ = 0; y_ < len; y_++)
{
for (int x_ = 0; x_ < len; x_++)
{
((y_ % 4) == 0) ? surface->set_pixel((x + x_), (y + y_), 0, z_order) :
surface->set_pixel((x + x_), (y + y_), 0xFFFFFFFF, z_order);
}
}
return len;
}
void c_word::draw_lattice(c_surface* surface, int z_order, int x, int y, int width, int height,
int bytes_per_line, const unsigned char* pData,
unsigned int font_color, unsigned int bg_color, unsigned int font_aa_flag)
const unsigned char* p_data, unsigned int font_color, unsigned int bg_color)
{
int i;
if (!font_aa_flag)
unsigned int r, g, b;
unsigned int bg_color_set = (COLOR_TRANPARENT == bg_color) ? surface->get_pixel(x, y, z_order) : bg_color;
for (int y_ = 0; y_ < height; y_++)
{
for (i = 0; i < height; i++)
for (int x_ = 0; x_ < width; x_++)
{
draw_bit_line(surface, z_order, x, i + y, pData, width, font_color, bg_color);
pData += bytes_per_line;
}
}
else
{
for (i = 0; i < height; i++)
{
draw_bit_line_AA(surface, z_order, x, i + y, pData, width, font_color, bg_color);
pData += bytes_per_line;
}
}
}
void c_word::draw_bit_line(c_surface* surface, int z_order, int x, int y, unsigned char const*p, int width, unsigned int font_color, unsigned int bg_color)
{
unsigned int color;
int diff = 0;
do
{
color = (*p & (0x80>>diff)) ? font_color : bg_color;
if (COLOR_TRANPARENT != color)
{
surface->set_pixel(x, y, color, z_order);
}
x++;
if (++diff == 8)
{
diff = 0;
p++;
}
} while (--width);
}
void c_word::draw_bit_line_AA(c_surface* surface, int z_order, int x, int y, unsigned char const*p, int width, unsigned int font_color, unsigned int bg_color)
{
unsigned int color, current_bg_color;
unsigned int b, g, r;
if(COLOR_TRANPARENT == bg_color)
{
current_bg_color = surface->get_pixel(x, y, z_order);
}
else
{
current_bg_color = bg_color;
}
do
{
if (0x00 == *p)
{
if(bg_color != COLOR_TRANPARENT)
unsigned char value = *p_data;
if (0x00 == value)
{
surface->set_pixel(x, y, current_bg_color, z_order);
if (bg_color != COLOR_TRANPARENT)
{
surface->set_pixel(x + x_, y + y_, bg_color_set, z_order);
}
}
}
else
{
b = (GLT_RGB_B(font_color) * (*p) + GLT_RGB_B(current_bg_color) * (255 - *p)) >> 8;
g = (GLT_RGB_G(font_color) * (*p) + GLT_RGB_G(current_bg_color) * (255 - *p)) >> 8;
r = (GLT_RGB_R(font_color) * (*p) + GLT_RGB_R(current_bg_color) * (255 - *p)) >> 8;
color = GLT_RGB(r, g, b);
surface->set_pixel(x, y, color, z_order);
}
x++;
p++;
} while (--width);
}
int c_word::get_str_pixel_length(const char *s, const GUI_FONT* font)
{
int ret = 0;
if(0 == s)
{
return ret;
}
for (; *s; s++)
{
int len = get_char_cnt_in_single_line(s);
unsigned char code_high;
int last_char_xdist = 0;
while (--len >= 0)
{
const GUI_FONT_PROP* pProp = find_font_prop(font->p.pProp, *s);
if (pProp)
else
{
const GUI_CHARINFO* pCharInfo = pProp->paCharInfo+(*s - pProp->First);
last_char_xdist = pCharInfo->XDist;
b = (GLT_RGB_B(font_color) * value + GLT_RGB_B(bg_color_set) * (255 - value)) >> 8;
g = (GLT_RGB_G(font_color) * value + GLT_RGB_G(bg_color_set) * (255 - value)) >> 8;
r = (GLT_RGB_R(font_color) * value + GLT_RGB_R(bg_color_set) * (255 - value)) >> 8;
surface->set_pixel((x + x_), (y + y_), GLT_RGB(r, g, b), z_order);
}
ret += last_char_xdist;
s++;
p_data++;
}
if (*s==0)
break;
}
return ret;
}
void c_word::get_string_pos(const char *s, const GUI_FONT* font, c_rect rect, unsigned int align_type, int &x, int &y)
int c_word::get_str_pixel_length(const char *s, const FONT_INFO* font)
{
if(NULL == s)
{
return 0;
}
if (NULL == font)
{
ASSERT(FALSE);
}
int lattice_width = 0;
unsigned int utf8_code;
int utf8_bytes;
while (*s)
{
utf8_bytes = get_utf8_code(s, utf8_code);
const LATTICE* p_lattice = get_lattice(font, utf8_code);
lattice_width += p_lattice?p_lattice->width:font->height;
s += utf8_bytes;
}
return lattice_width;
}
void c_word::get_string_pos(const char *s, const FONT_INFO* font, c_rect rect, unsigned int align_type, int &x, int &y)
{
int x_size = get_str_pixel_length(s, font);
int y_size = get_font_ysize(font);
int y_size = font->height;
int height = rect.m_bottom - rect.m_top + 1;
int width = rect.m_right - rect.m_left + 1;
@@ -387,8 +303,3 @@ void c_word::get_string_pos(const char *s, const GUI_FONT* font, c_rect rect, un
break;
}
}
bool c_word::is_AA_font(const GUI_CHARINFO* pCharInfo)
{
return (pCharInfo->XSize == pCharInfo->BytesPerLine) ? true : false;
}