diff options
Diffstat (limited to 'task02/Guschin')
| -rw-r--r-- | task02/Guschin/Guschin.vcxproj | 140 | ||||
| -rw-r--r-- | task02/Guschin/Guschin.vcxproj.filters | 32 | ||||
| -rw-r--r-- | task02/Guschin/Guschin.vcxproj.user | 4 | ||||
| -rw-r--r-- | task02/Guschin/MyForm.cpp | 12 | ||||
| -rw-r--r-- | task02/Guschin/MyForm.h | 366 | ||||
| -rw-r--r-- | task02/Guschin/MyForm.resx | 120 |
6 files changed, 674 insertions, 0 deletions
diff --git a/task02/Guschin/Guschin.vcxproj b/task02/Guschin/Guschin.vcxproj new file mode 100644 index 0000000..20e327c --- /dev/null +++ b/task02/Guschin/Guschin.vcxproj @@ -0,0 +1,140 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" 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"> + <VCProjectVersion>16.0</VCProjectVersion> + <ProjectGuid>{7FD831C6-82A0-4285-8C15-41D557E54312}</ProjectGuid> + <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion> + <Keyword>ManagedCProj</Keyword> + <RootNamespace>Guschin</RootNamespace> + <WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v142</PlatformToolset> + <CLRSupport>true</CLRSupport> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>v142</PlatformToolset> + <CLRSupport>true</CLRSupport> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v141</PlatformToolset> + <CLRSupport>true</CLRSupport> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>v142</PlatformToolset> + <CLRSupport>true</CLRSupport> + <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 /> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <PreprocessorDefinitions>WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + <Link> + <AdditionalDependencies /> + <SubSystem>Windows</SubSystem> + <EntryPointSymbol>Main</EntryPointSymbol> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + <Link> + <AdditionalDependencies /> + <SubSystem>Windows</SubSystem> + <EntryPointSymbol>Main</EntryPointSymbol> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <PreprocessorDefinitions>WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + <Link> + <AdditionalDependencies /> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + <Link> + <AdditionalDependencies /> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="MyForm.h"> + <FileType>CppForm</FileType> + </ClInclude> + </ItemGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.Data" /> + <Reference Include="System.Drawing" /> + <Reference Include="System.Windows.Forms" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="MyForm.cpp" /> + </ItemGroup> + <ItemGroup> + <EmbeddedResource Include="MyForm.resx"> + <DependentUpon>MyForm.h</DependentUpon> + </EmbeddedResource> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/task02/Guschin/Guschin.vcxproj.filters b/task02/Guschin/Guschin.vcxproj.filters new file mode 100644 index 0000000..67a6242 --- /dev/null +++ b/task02/Guschin/Guschin.vcxproj.filters @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Исходные файлы"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="Файлы заголовков"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions> + </Filter> + <Filter Include="Файлы ресурсов"> + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClInclude Include="MyForm.h"> + <Filter>Файлы заголовков</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="MyForm.cpp"> + <Filter>Исходные файлы</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <EmbeddedResource Include="MyForm.resx"> + <Filter>Файлы ресурсов</Filter> + </EmbeddedResource> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/task02/Guschin/Guschin.vcxproj.user b/task02/Guschin/Guschin.vcxproj.user new file mode 100644 index 0000000..88a5509 --- /dev/null +++ b/task02/Guschin/Guschin.vcxproj.user @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup /> +</Project>
\ No newline at end of file diff --git a/task02/Guschin/MyForm.cpp b/task02/Guschin/MyForm.cpp new file mode 100644 index 0000000..3ddb603 --- /dev/null +++ b/task02/Guschin/MyForm.cpp @@ -0,0 +1,12 @@ +#include "MyForm.h" + +using namespace System; +using namespace System::Windows::Forms; + +[STAThreadAttribute] +void Main(array<String^> ^ args) { + Application::EnableVisualStyles(); + Application::SetCompatibleTextRenderingDefault(false); + Guschin::MyForm form; + Application::Run(% form); +}
\ No newline at end of file diff --git a/task02/Guschin/MyForm.h b/task02/Guschin/MyForm.h new file mode 100644 index 0000000..f195cd7 --- /dev/null +++ b/task02/Guschin/MyForm.h @@ -0,0 +1,366 @@ +#pragma once + +namespace Guschin { + + using namespace System; + using namespace System::ComponentModel; + using namespace System::Collections; + using namespace System::Windows::Forms; + using namespace System::Data; + using namespace System::Drawing; + + // 20 x 30 + + float clown[] = { + // + 8.f, 29.f, 12.f, 29.f, + 12.f, 29.f, 13.f, 28.f, + 13.f, 28.f, 14.f, 26.f, + 14.f, 26.f, 13.f, 24.f, + 13.f, 24.f, 15.f, 23.f, + 15.f, 23.f, 15.f, 22.f, + 15.f, 22.f, 14.f, 21.f, + 14.f, 21.f, 12.f, 22.f, + 12.f, 22.f, 8.f, 22.f, + 8.f, 22.f, 6.f, 21.f, + 6.f, 21.f, 5.f, 22.f, + 5.f, 22.f, 5.f, 23.f, + 5.f, 23.f, 7.f, 24.f, + 7.f, 24.f, 6.f, 26.f, + 6.f, 26.f, 7.f, 28.f, + 7.f, 28.f, 8.f, 29.f, + + 14.f, 26.f, 15.f, 26.f, + 15.f, 26.f, 16.f, 27.f, + 16.f, 27.f, 16.f, 26.f, + 16.f, 26.f, 17.f, 25.f, + 17.f, 25.f, 16.f, 25.f, + 16.f, 25.f, 15.f, 24.f, + 15.f, 24.f, 15.f, 25.f, + 15.f, 25.f, 14.f, 26.f, + + 15.f, 25.f, 15.f, 26.f, + 15.f, 26.f, 16.f, 26.f, + 16.f, 26.f, 16.f, 25.f, + 16.f, 25.f, 15.f, 25.f, + 15.f, 25.f, 12.f, 23.f, + + // + 15.f, 22.f, 19.f, 17.f, + 19.f, 17.f, 19.f, 15.f, + 19.f, 15.f, 18.f, 16.f, + 18.f, 16.f, 19.f, 14.f, + 19.f, 14.f, 18.f, 13.f, + 18.f, 13.f, 17.f, 15.f, + 17.f, 15.f, 18.f, 12.f, + 18.f, 12.f, 16.f, 10.f, + 16.f, 10.f, 15.f, 8.f, + 15.f, 8.f, 11.f, 6.f, + 11.f, 6.f, 9.f, 6.f, + 9.f, 6.f, 5.f, 8.f, + 5.f, 8.f, 4.f, 10.f, + 4.f, 10.f, 2.f, 12.f, + 2.f, 12.f, 3.f, 15.f, + 3.f, 15.f, 2.f, 13.f, + 2.f, 13.f, 1.f, 14.f, + 1.f, 14.f, 2.f, 16.f, + 2.f, 16.f, 1.f, 15.f, + 1.f, 15.f, 1.f, 17.f, + 1.f, 17.f, 5.f, 22.f, + + // + 7.f, 16.f, 5.f, 17.f, + 5.f, 17.f, 5.f, 19.f, + 5.f, 19.f, 7.f, 21.f, + 7.f, 21.f, 9.f, 21.f, + 9.f, 21.f, 10.f, 18.5f, + 10.f, 18.5f, 9.f, 16.f, + 9.f, 16.f, 7.f, 16.f, + 7.f, 16.f, 6.f, 17.f, + 6.f, 17.f, 7.f, 19.f, + 7.f, 19.f, 8.f, 19.f, + 8.f, 19.f, 9.f, 17.f, + 9.f, 17.f, 8.f, 16.f, + 8.f, 16.f, 8.f, 17.f, + 8.f, 17.f, 7.f, 17.f, + 7.f, 17.f, 7.f, 16.f, + + 13.f, 16.f, 15.f, 17.f, + 15.f, 17.f, 15.f, 19.f, + 15.f, 19.f, 13.f, 21.f, + 13.f, 21.f, 11.f, 21.f, + 11.f, 21.f, 10.f, 18.5f, + 10.f, 18.5f, 11.f, 16.f, + 11.f, 16.f, 13.f, 16.f, + 13.f, 16.f, 14.f, 17.f, + 14.f, 17.f, 13.f, 19.f, + 13.f, 19.f, 12.f, 19.f, + 12.f, 19.f, 11.f, 17.f, + 11.f, 17.f, 12.f, 16.f, + 12.f, 16.f, 12.f, 17.f, + 12.f, 17.f, 13.f, 17.f, + 13.f, 17.f, 13.f, 16.f, + + // + 9.f, 16.f, 11.f, 16.f, + 11.f, 16.f, 13.f, 15.f, + 13.f, 15.f, 14.f, 13.f, + 14.f, 13.f, 13.f, 12.f, + 13.f, 12.f, 10.f, 11.f, + 9.f, 16.f, 7.f, 15.f, + 7.f, 15.f, 6.f, 13.f, + 6.f, 13.f, 7.f, 12.f, + 7.f, 12.f, 10.f, 11.f, + + // + 14.f, 13.f, 15.f, 13.f, + 15.f, 13.f, 16.f, 12.f, + 16.f, 12.f, 16.f, 11.f, + 16.f, 11.f, 13.f, 9.f, + 13.f, 9.f, 10.f, 8.f, + 6.f, 13.f, 5.f, 13.f, + 5.f, 13.f, 4.f, 12.f, + 4.f, 12.f, 4.f, 11.f, + 4.f, 11.f, 7.f, 9.f, + 7.f, 9.f, 10.f, 8.f, + + // + 14.f, 12.f, 15.f, 11.f, + 14.f, 11.f, 13.f, 10.f, + 13.f, 10.f, 10.f, 9.f, + 6.f, 12.f, 5.f, 11.f, + 6.f, 11.f, 7.f, 10.f, + 7.f, 10.f, 10.f, 9.f, + + // + 15.f, 17.f, 16.f, 15.f, + 16.f, 15.f, 16.f, 10.f, + 5.f, 17.f, 4.f, 15.f, + 4.f, 15.f, 4.f, 10.f, + + // + 10.f, 5.f, 14.f, 1.f, + 14.f, 1.f, 14.f, 7.f, + 14.f, 7.f, 10.f, 3.f, + + 12.f, 5.f, 13.f, 5.f, + 13.f, 5.f, 13.f, 4.f, + 13.f, 4.f, 12.f, 4.f, + 12.f, 4.f, 12.f, 5.f, + + 13.f, 6.f, 14.f, 5.f, + + 14.f, 4.f, 13.f, 3.f, + 13.f, 3.f, 14.f, 2.f, + + // + 10.f, 3.f, 6.f, 7.f, + 6.f, 7.f, 6.f, 1.f, + 6.f, 1.f, 10.f, 5.f, + + 8.f, 3.f, 7.f, 3.f, + 7.f, 3.f, 7.f, 4.f, + 7.f, 4.f, 8.f, 4.f, + 8.f, 4.f, 8.f, 3.f, + + 7.f, 2.f, 6.f, 3.f, + + 6.f, 4.f, 7.f, 5.f, + 7.f, 5.f, 6.f, 6.f, + }; + unsigned int clownSize = sizeof(clown) / sizeof(float); + float clownVx = 20.f; + float clownVy = 30.f; + + float rabbit[] = { + // голова + 0.5f,3.f,1.f,4.5f, // от левой щеки вверх до уха + 1.f,4.5f,0.5f,6.f, // левое ухо слева снизу вверх + 0.5f,6.f,0.5f, 7.5f,// левое ухо слева + 0.5f, 7.5f,1.f,8.f,// левое ухо верх слева + 1.f,8.f,1.5f,8.f,// левое ухо верх середина + 1.5f,8.f,2.f,7.5f,// левое ухо верх справа + 2.f,7.5f,1.5f, 6.f,// левое ухо справа сверху вниз + 1.5f, 6.f,1.5f,4.5f,// левое ухо справа до макушки + 1.5f,4.5f,3.f,4.5f,// макушка + 3.f,4.5f,3.f,6.f,// правое ухо слева снизу вверх + 3.f,6.f,2.5f,7.5f,// правое ухо слева + 2.5f,7.5f,3.f,8.f,// правое ухо верх слева + 3.f,8.f,3.5f,8.f,// правое ухо верх середина + 3.5f,8.f,4.f,7.5f,// правое ухо верх справа + 4.f,7.5f,4.f,6.f,// правое ухо сверху вниз + 4.f,6.f,3.5f,4.5f,// правое ухо справа + 3.5f,4.5f,4.f,3.f,// от правого уха вниз до щеки + 4.f,3.f,3.5f,1.5f,// правая скула + 3.5f,1.5f,2.5f,1.f,// подбородок справа + 2.5f,1.f,2.f,1.f,// подбородок снизу + 2.f,1.f,1.f,1.5f,// подбородок слева + 1.f,1.5f,0.5f,3.f,// левая скула + // туловище + 4.f,3.f,5.5f,3.5f,// спина от головы вправо + 5.5f,3.5f,7.f,3.5f,// спина верх + 7.f,3.5f,7.5f,2.5f,// спина сверху до хвоста + 7.5f,2.5f,8.f,2.5f,// хвост сверху + 8.f,2.5f,8.f,2.f,// хвост справа + 8.f,2.f,7.5f,2.f,// хвост низ справа налево + 7.5f,2.f,7.5f,0.5f,// задняя нога справа сверху вниз + 7.5f,0.5f,6.5f,0.5f,// задняя нога низ + 6.5f,0.5f,6.5f,1.f,// задняя нога слева + 6.5f,1.f,6.f,1.f,// между задних ног + 6.f,1.f,6.f,0.5f,// левая задняя нога справа + 6.f,0.5f,5.f,0.5f,// левая задняя нога низ + 5.f,0.5f,5.f,1.f,// левая задняя нога слева + 5.f,1.f,4.f,1.f,// между задними и передними ногами + 4.f,1.f,4.f,0.5f,// правая передняя нога справа + 4.f,0.5f,3.f,0.5f,// правая передняя нога низ + 3.f,0.5f,3.f,1.f,// правая передняя нога слева + 3.f,1.f,2.5f,1.f,// между передних ног + 2.5f,1.f,2.5f,0.5f,// передняя нога справа + 2.5f,0.5f,1.5f,0.5f,// передняя нога низ + 1.5f,0.5f,1.5f,1.25f,// передняя нога слева + // левый глаз + 1.5f,3.5f,1.5f,3.f,// левый глаз слева сверху вниз + 1.5f,3.f,2.f,3.f,// левый глаз низ + 2.f, 3.f,2.f,3.5f,// левый глаз справа + 2.f,3.5f,1.5f,3.5f,// левый глаз верх + // правый глаз + 2.5f,3.5f,2.5f,3.f,// правый глаз слева + 2.5f,3.f,3.f, 3.f,// правый глаз снизу + 3.f,3.f,3.f,3.5f,// правый глаз справа + 3.f,3.5f,2.5f,3.5f,// правый глаз сверху + // ушные раковины + 1.f,5.5f,1.f,7.f,// левая ушная раковина + 3.5f,5.5f,3.5f,7.f,// правая ушная раковина + // нос + 2.f,2.5f,2.5f,2.5f,// нос сверху + 2.5f,2.5f,2.25f,2.f,// нос справа + 2.25f,2.f,2.f,2.5f// нос слева + }; + unsigned int rabbitSize = sizeof(rabbit) / sizeof(float); + float rabbitVx = 8.5f; + float rabbitVy = 8.5f; + + /// <summary> + /// Ñâîäêà äëÿ MyForm + /// </summary> + public ref class MyForm : public System::Windows::Forms::Form + { + public: + MyForm(void) + { + InitializeComponent(); + // + //TODO: äîáàâüòå êîä êîíñòðóêòîðà + // + } + + protected: + /// <summary> + /// Îñâîáîäèòü âñå èñïîëüçóåìûå ðåñóðñû. + /// </summary> + ~MyForm() + { + if (components) + { + delete components; + } + } + + private: + /// <summary> + /// Îáÿçàòåëüíàÿ ïåðåìåííàÿ êîíñòðóêòîðà. + /// </summary> + System::ComponentModel::Container ^components; + +#pragma region Windows Form Designer generated code + /// <summary> + /// Òðåáóåìûé ìåòîä äëÿ ïîääåðæêè êîíñòðóêòîðà — íå èçìåíÿéòå + /// ñîäåðæèìîå ýòîãî ìåòîäà ñ ïîìîùüþ ðåäàêòîðà êîäà. + /// </summary> + void InitializeComponent(void) + { + this->SuspendLayout(); + // + // MyForm + // + this->AutoScaleDimensions = System::Drawing::SizeF(6, 13); + this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font; + this->ClientSize = System::Drawing::Size(553, 557); + this->Name = L"MyForm"; + this->Text = L"MyForm"; + this->Load += gcnew System::EventHandler(this, &MyForm::MyForm_Load); + this->Paint += gcnew System::Windows::Forms::PaintEventHandler(this, &MyForm::MyForm_Paint); + this->KeyDown += gcnew System::Windows::Forms::KeyEventHandler(this, &MyForm::MyForm_KeyDown); + this->Resize += gcnew System::EventHandler(this, &MyForm::MyForm_Resize); + this->ResumeLayout(false); + + } +#pragma endregion + private: bool keepAspectRatio; + private: bool showClown; + private: float* lines = clown; + private: unsigned int arrayLength = clownSize; + private: float Vx = clownVx; + private: float Vy = clownVy; + + private: System::Void MyForm_Resize(System::Object^ sender, System::EventArgs^ e) { + Refresh(); + } + private: System::Void MyForm_Paint(System::Object^ sender, System::Windows::Forms::PaintEventArgs^ e) { + Graphics^ g = e->Graphics; + Pen^ blackPen = gcnew Pen(Color::Black, 2); + + float Wx = ClientRectangle.Width; + float Wy = ClientRectangle.Height; + + float aspectFig = Vx / Vy; + float aspectForm = Wx / Wy; + + float Sx, Sy; + if (keepAspectRatio) { + Sx = Sy = aspectFig < aspectForm ? Wy / Vy : Wx / Vx; + } + else { + Sx = Wx / Vx; + Sy = Wy / Vy; + } + + float Ty = Sy * Vy; + + for (int i = 0; i < arrayLength; i += 4) { + g->DrawLine(blackPen, Sx * lines[i], Ty - Sy * lines[i + 1], + Sx * lines[i + 2], Ty - Sy * lines[i + 3]); + } + } + private: System::Void MyForm_Load(System::Object^ sender, System::EventArgs^ e) { + keepAspectRatio = true; + } + private: System::Void MyForm_KeyDown(System::Object^ sender, System::Windows::Forms::KeyEventArgs^ e) { + switch (e->KeyCode) { + case Keys::M : + keepAspectRatio = !keepAspectRatio; + break; + case Keys::N : + if (showClown) + { + lines = rabbit; + arrayLength = rabbitSize; + Vx = rabbitVx; + Vy = rabbitVy; + } + else + { + lines = clown; + arrayLength = clownSize; + Vx = clownVx; + Vy = clownVy; + } + showClown = !showClown; + break; + default: + break; + } + Refresh(); + } + }; +} diff --git a/task02/Guschin/MyForm.resx b/task02/Guschin/MyForm.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/task02/Guschin/MyForm.resx @@ -0,0 +1,120 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" use="required" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> +</root>
\ No newline at end of file |