添加项目文件。
51
2048uwp.sln
Normal file
@@ -0,0 +1,51 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.30011.22
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "2048uwp", "2048uwp\2048uwp.vcxproj", "{AC1D64A4-9CB3-4F69-947C-802840993C67}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|ARM = Debug|ARM
|
||||
Debug|ARM64 = Debug|ARM64
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|ARM = Release|ARM
|
||||
Release|ARM64 = Release|ARM64
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{AC1D64A4-9CB3-4F69-947C-802840993C67}.Debug|ARM.ActiveCfg = Debug|ARM
|
||||
{AC1D64A4-9CB3-4F69-947C-802840993C67}.Debug|ARM.Build.0 = Debug|ARM
|
||||
{AC1D64A4-9CB3-4F69-947C-802840993C67}.Debug|ARM.Deploy.0 = Debug|ARM
|
||||
{AC1D64A4-9CB3-4F69-947C-802840993C67}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{AC1D64A4-9CB3-4F69-947C-802840993C67}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{AC1D64A4-9CB3-4F69-947C-802840993C67}.Debug|ARM64.Deploy.0 = Debug|ARM64
|
||||
{AC1D64A4-9CB3-4F69-947C-802840993C67}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{AC1D64A4-9CB3-4F69-947C-802840993C67}.Debug|x64.Build.0 = Debug|x64
|
||||
{AC1D64A4-9CB3-4F69-947C-802840993C67}.Debug|x64.Deploy.0 = Debug|x64
|
||||
{AC1D64A4-9CB3-4F69-947C-802840993C67}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{AC1D64A4-9CB3-4F69-947C-802840993C67}.Debug|x86.Build.0 = Debug|Win32
|
||||
{AC1D64A4-9CB3-4F69-947C-802840993C67}.Debug|x86.Deploy.0 = Debug|Win32
|
||||
{AC1D64A4-9CB3-4F69-947C-802840993C67}.Release|ARM.ActiveCfg = Release|ARM
|
||||
{AC1D64A4-9CB3-4F69-947C-802840993C67}.Release|ARM.Build.0 = Release|ARM
|
||||
{AC1D64A4-9CB3-4F69-947C-802840993C67}.Release|ARM.Deploy.0 = Release|ARM
|
||||
{AC1D64A4-9CB3-4F69-947C-802840993C67}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{AC1D64A4-9CB3-4F69-947C-802840993C67}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{AC1D64A4-9CB3-4F69-947C-802840993C67}.Release|ARM64.Deploy.0 = Release|ARM64
|
||||
{AC1D64A4-9CB3-4F69-947C-802840993C67}.Release|x64.ActiveCfg = Release|x64
|
||||
{AC1D64A4-9CB3-4F69-947C-802840993C67}.Release|x64.Build.0 = Release|x64
|
||||
{AC1D64A4-9CB3-4F69-947C-802840993C67}.Release|x64.Deploy.0 = Release|x64
|
||||
{AC1D64A4-9CB3-4F69-947C-802840993C67}.Release|x86.ActiveCfg = Release|Win32
|
||||
{AC1D64A4-9CB3-4F69-947C-802840993C67}.Release|x86.Build.0 = Release|Win32
|
||||
{AC1D64A4-9CB3-4F69-947C-802840993C67}.Release|x86.Deploy.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {0E8B49DC-49E9-4128-8FCD-4DA49640F2FE}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
239
2048uwp/2048uwp.vcxproj
Normal file
@@ -0,0 +1,239 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{ac1d64a4-9cb3-4f69-947c-802840993c67}</ProjectGuid>
|
||||
<RootNamespace>_2048uwp</RootNamespace>
|
||||
<DefaultLanguage>en-US</DefaultLanguage>
|
||||
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
|
||||
<AppContainerApplication>true</AppContainerApplication>
|
||||
<ApplicationType>Windows Store</ApplicationType>
|
||||
<WindowsTargetPlatformVersion Condition=" '$(WindowsTargetPlatformVersion)' == '' ">10.0.19041.0</WindowsTargetPlatformVersion>
|
||||
<WindowsTargetPlatformMinVersion>10.0.17763.0</WindowsTargetPlatformMinVersion>
|
||||
<ApplicationTypeRevision>10.0</ApplicationTypeRevision>
|
||||
<AppxPackageSigningEnabled>True</AppxPackageSigningEnabled>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|ARM">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>ARM</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|ARM64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>ARM64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|ARM">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>ARM</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|ARM64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>ARM64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</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|ARM'">
|
||||
<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|ARM'">
|
||||
<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">
|
||||
<GenerateAppInstallerFile>False</GenerateAppInstallerFile>
|
||||
<AppxPackageSigningTimestampDigestAlgorithm>SHA256</AppxPackageSigningTimestampDigestAlgorithm>
|
||||
<AppxAutoIncrementPackageRevision>True</AppxAutoIncrementPackageRevision>
|
||||
<GenerateTestArtifacts>False</GenerateTestArtifacts>
|
||||
<AppxBundle>Always</AppxBundle>
|
||||
<AppxBundlePlatforms>x86|x64|arm|arm64</AppxBundlePlatforms>
|
||||
<HoursBetweenUpdateChecks>0</HoursBetweenUpdateChecks>
|
||||
<PackageCertificateKeyFile>2048uwp_TemporaryKey.pfx</PackageCertificateKeyFile>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
|
||||
<ClCompile>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
<DisableSpecificWarnings>4453;28204</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
|
||||
<ClCompile>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
<DisableSpecificWarnings>4453;28204</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
|
||||
<ClCompile>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
<DisableSpecificWarnings>4453;28204</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
|
||||
<ClCompile>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
<DisableSpecificWarnings>4453;28204</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
<DisableSpecificWarnings>4453;28204</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
<DisableSpecificWarnings>4453;28204</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
<DisableSpecificWarnings>4453;28204</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
<DisableSpecificWarnings>4453;28204</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="pch.h" />
|
||||
<ClInclude Include="App.xaml.h">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
</ClInclude>
|
||||
<ClInclude Include="MainPage.xaml.h">
|
||||
<DependentUpon>MainPage.xaml</DependentUpon>
|
||||
</ClInclude>
|
||||
<ClInclude Include="resource.h" />
|
||||
<ClInclude Include="ui.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="App.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Page Include="MainPage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AppxManifest Include="Package.appxmanifest">
|
||||
<SubType>Designer</SubType>
|
||||
</AppxManifest>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="Assets\LockScreenLogo.scale-200.png" />
|
||||
<Image Include="Assets\miku.jpg" />
|
||||
<Image Include="Assets\SplashScreen.scale-200.png" />
|
||||
<Image Include="Assets\Square150x150Logo.scale-200.png" />
|
||||
<Image Include="Assets\Square44x44Logo.scale-200.png" />
|
||||
<Image Include="Assets\Square44x44Logo.targetsize-24_altform-unplated.png" />
|
||||
<Image Include="Assets\StoreLogo.png" />
|
||||
<Image Include="Assets\Wide310x150Logo.scale-200.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="App.xaml.cpp">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
</ClCompile>
|
||||
<ClCompile Include="MainPage.xaml.cpp">
|
||||
<DependentUpon>MainPage.xaml</DependentUpon>
|
||||
</ClCompile>
|
||||
<ClCompile Include="pch.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="2048uwp_TemporaryKey.pfx" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Package.StoreAssociation.xml" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
59
2048uwp/2048uwp.vcxproj.filters
Normal file
@@ -0,0 +1,59 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Common">
|
||||
<UniqueIdentifier>ac1d64a4-9cb3-4f69-947c-802840993c67</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Assets">
|
||||
<UniqueIdentifier>c6240b1d-a8e5-48bd-82b3-86ad23d3c936</UniqueIdentifier>
|
||||
<Extensions>bmp;fbx;gif;jpg;jpeg;tga;tiff;tif;png</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="App.xaml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="pch.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="pch.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
<ClInclude Include="ui.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="Assets\LockScreenLogo.scale-200.png">
|
||||
<Filter>Assets</Filter>
|
||||
</Image>
|
||||
<Image Include="Assets\SplashScreen.scale-200.png">
|
||||
<Filter>Assets</Filter>
|
||||
</Image>
|
||||
<Image Include="Assets\Square150x150Logo.scale-200.png">
|
||||
<Filter>Assets</Filter>
|
||||
</Image>
|
||||
<Image Include="Assets\Square44x44Logo.scale-200.png">
|
||||
<Filter>Assets</Filter>
|
||||
</Image>
|
||||
<Image Include="Assets\Square44x44Logo.targetsize-24_altform-unplated.png">
|
||||
<Filter>Assets</Filter>
|
||||
</Image>
|
||||
<Image Include="Assets\StoreLogo.png">
|
||||
<Filter>Assets</Filter>
|
||||
</Image>
|
||||
<Image Include="Assets\Wide310x150Logo.scale-200.png">
|
||||
<Filter>Assets</Filter>
|
||||
</Image>
|
||||
<Image Include="Assets\miku.jpg">
|
||||
<Filter>Assets</Filter>
|
||||
</Image>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AppxManifest Include="Package.appxmanifest" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Page Include="MainPage.xaml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="2048uwp_TemporaryKey.pfx" />
|
||||
<None Include="Package.StoreAssociation.xml" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
7
2048uwp/App.xaml
Normal file
@@ -0,0 +1,7 @@
|
||||
<Application
|
||||
x:Class="_2048uwp.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:_2048uwp">
|
||||
|
||||
</Application>
|
||||
116
2048uwp/App.xaml.cpp
Normal file
@@ -0,0 +1,116 @@
|
||||
//
|
||||
// App.xaml.cpp
|
||||
// App 类的实现。
|
||||
//
|
||||
|
||||
#include "pch.h"
|
||||
#include "MainPage.xaml.h"
|
||||
|
||||
using namespace _2048uwp;
|
||||
|
||||
using namespace Platform;
|
||||
using namespace Windows::ApplicationModel;
|
||||
using namespace Windows::ApplicationModel::Activation;
|
||||
using namespace Windows::Foundation;
|
||||
using namespace Windows::Foundation::Collections;
|
||||
using namespace Windows::UI::Xaml;
|
||||
using namespace Windows::UI::Xaml::Controls;
|
||||
using namespace Windows::UI::Xaml::Controls::Primitives;
|
||||
using namespace Windows::UI::Xaml::Data;
|
||||
using namespace Windows::UI::Xaml::Input;
|
||||
using namespace Windows::UI::Xaml::Interop;
|
||||
using namespace Windows::UI::Xaml::Media;
|
||||
using namespace Windows::UI::Xaml::Navigation;
|
||||
|
||||
/// <summary>
|
||||
/// 初始化单一实例应用程序对象。这是执行的创作代码的第一行,
|
||||
/// 已执行,逻辑上等同于 main() 或 WinMain()。
|
||||
/// </summary>
|
||||
App::App()
|
||||
{
|
||||
InitializeComponent();
|
||||
Suspending += ref new SuspendingEventHandler(this, &App::OnSuspending);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 在应用程序由最终用户正常启动时进行调用。
|
||||
/// 将在启动应用程序以打开特定文件等情况下使用。
|
||||
/// </summary>
|
||||
/// <param name="e">有关启动请求和过程的详细信息。</param>
|
||||
void App::OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ e)
|
||||
{
|
||||
auto rootFrame = dynamic_cast<Frame^>(Window::Current->Content);
|
||||
|
||||
// 不要在窗口已包含内容时重复应用程序初始化,
|
||||
// 只需确保窗口处于活动状态
|
||||
if (rootFrame == nullptr)
|
||||
{
|
||||
// 创建一个 Frame 以用作导航上下文并将其与
|
||||
// SuspensionManager 键关联
|
||||
rootFrame = ref new Frame();
|
||||
|
||||
rootFrame->NavigationFailed += ref new Windows::UI::Xaml::Navigation::NavigationFailedEventHandler(this, &App::OnNavigationFailed);
|
||||
|
||||
if (e->PreviousExecutionState == ApplicationExecutionState::Terminated)
|
||||
{
|
||||
// TODO: 仅当适用时还原保存的会话状态,并安排
|
||||
// 还原完成后的最终启动步骤
|
||||
|
||||
}
|
||||
|
||||
if (e->PrelaunchActivated == false)
|
||||
{
|
||||
if (rootFrame->Content == nullptr)
|
||||
{
|
||||
// 当导航堆栈尚未还原时,导航到第一页,
|
||||
// 并通过将所需信息作为导航参数传入来配置
|
||||
// 新页面
|
||||
rootFrame->Navigate(TypeName(MainPage::typeid), e->Arguments);
|
||||
}
|
||||
// 将框架放在当前窗口中
|
||||
Window::Current->Content = rootFrame;
|
||||
// 确保当前窗口处于活动状态
|
||||
Window::Current->Activate();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (e->PrelaunchActivated == false)
|
||||
{
|
||||
if (rootFrame->Content == nullptr)
|
||||
{
|
||||
// 当导航堆栈尚未还原时,导航到第一页,
|
||||
// 并通过将所需信息作为导航参数传入来配置
|
||||
// 参数
|
||||
rootFrame->Navigate(TypeName(MainPage::typeid), e->Arguments);
|
||||
}
|
||||
// 确保当前窗口处于活动状态
|
||||
Window::Current->Activate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 在将要挂起应用程序执行时调用。 在不知道应用程序
|
||||
/// 无需知道应用程序会被终止还是会恢复,
|
||||
/// 并让内存内容保持不变。
|
||||
/// </summary>
|
||||
/// <param name="sender">挂起的请求的源。</param>
|
||||
/// <param name="e">有关挂起请求的详细信息。</param>
|
||||
void App::OnSuspending(Object^ sender, SuspendingEventArgs^ e)
|
||||
{
|
||||
(void) sender; // 未使用的参数
|
||||
(void) e; // 未使用的参数
|
||||
|
||||
//TODO: 保存应用程序状态并停止任何后台活动
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 导航到特定页失败时调用
|
||||
/// </summary>
|
||||
///<param name="sender">导航失败的框架</param>
|
||||
///<param name="e">有关导航失败的详细信息</param>
|
||||
void App::OnNavigationFailed(Platform::Object ^sender, Windows::UI::Xaml::Navigation::NavigationFailedEventArgs ^e)
|
||||
{
|
||||
throw ref new FailureException("Failed to load Page " + e->SourcePageType.Name);
|
||||
}
|
||||
27
2048uwp/App.xaml.h
Normal file
@@ -0,0 +1,27 @@
|
||||
//
|
||||
// App.xaml.h
|
||||
// App 类的声明。
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "App.g.h"
|
||||
|
||||
namespace _2048uwp
|
||||
{
|
||||
/// <summary>
|
||||
/// 提供特定于应用程序的行为,以补充默认的应用程序类。
|
||||
/// </summary>
|
||||
ref class App sealed
|
||||
{
|
||||
protected:
|
||||
virtual void OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ e) override;
|
||||
|
||||
internal:
|
||||
App();
|
||||
|
||||
private:
|
||||
void OnSuspending(Platform::Object^ sender, Windows::ApplicationModel::SuspendingEventArgs^ e);
|
||||
void OnNavigationFailed(Platform::Object ^sender, Windows::UI::Xaml::Navigation::NavigationFailedEventArgs ^e);
|
||||
};
|
||||
}
|
||||
BIN
2048uwp/Assets/LockScreenLogo.scale-200.png
Normal file
|
After Width: | Height: | Size: 7.5 KiB |
BIN
2048uwp/Assets/SplashScreen.scale-200.png
Normal file
|
After Width: | Height: | Size: 671 KiB |
BIN
2048uwp/Assets/Square150x150Logo.scale-200.png
Normal file
|
After Width: | Height: | Size: 192 KiB |
BIN
2048uwp/Assets/Square44x44Logo.scale-200.png
Normal file
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 3.5 KiB |
BIN
2048uwp/Assets/StoreLogo.png
Normal file
|
After Width: | Height: | Size: 8.0 KiB |
BIN
2048uwp/Assets/Wide310x150Logo.scale-200.png
Normal file
|
After Width: | Height: | Size: 196 KiB |
BIN
2048uwp/Assets/miku.jpg
Normal file
|
After Width: | Height: | Size: 2.3 MiB |
64
2048uwp/MainPage.xaml
Normal file
@@ -0,0 +1,64 @@
|
||||
<Page x:Name="bpage"
|
||||
x:Class="_2048uwp.MainPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:_2048uwp"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
Background="Black" d:DesignWidth="1164" SizeChanged="Page_SizeChanged" KeyUp="bpage_KeyUp" RightTapped="bpage_RightTapped">
|
||||
|
||||
<Grid x:Name="basegrid" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" ScrollViewer.VerticalScrollBarVisibility="Disabled" ManipulationCompleted="basegrid_ManipulationCompleted" ManipulationMode="All" ManipulationDelta="basegrid_ManipulationDelta">
|
||||
<Grid.Background>
|
||||
<ImageBrush ImageSource="/Assets/miku.jpg" Stretch="UniformToFill"/>
|
||||
</Grid.Background>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="0*"/>
|
||||
<RowDefinition x:Name="rbase" Height="69*"/>
|
||||
<RowDefinition Height="431*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition x:Name="menucol" Width="25*"/>
|
||||
<ColumnDefinition x:Name="cbase1" Width="241*"/>
|
||||
<ColumnDefinition x:Name="cbase2" Width="25*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid x:Name="stage" HorizontalAlignment="Center" VerticalAlignment="Top" CornerRadius="32,32,32,32" ScrollViewer.VerticalScrollBarVisibility="Disabled" Width="600" Height="600" Grid.Row="2" SizeChanged="stage_SizeChanged" Grid.Column="1">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="151*"/>
|
||||
<RowDefinition x:Name="c1" Height="294*"/>
|
||||
<RowDefinition x:Name="c2" Height="155*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="143*"/>
|
||||
<ColumnDefinition x:Name="r1" Width="313*"/>
|
||||
<ColumnDefinition x:Name="r2" Width="145*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.Background>
|
||||
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" Opacity="0.6">
|
||||
<GradientStop Color="#FFFCE7D2" Offset="0"/>
|
||||
<GradientStop Color="#FF7EB8C3" Offset="1"/>
|
||||
</LinearGradientBrush>
|
||||
</Grid.Background>
|
||||
<Button x:Name="b11" Content="999" Margin="10,10,0,0" Height="133" Width="133" CornerRadius="32,32,32,32" Background="#66FFFFFF" FontWeight="Normal" IsDoubleTapEnabled="False" IsHoldingEnabled="False" IsRightTapEnabled="False" IsTapEnabled="False" VerticalAlignment="Top" FontSize="48" FontFamily="Impact" Foreground="#FFDD8E8E"/>
|
||||
<Button x:Name="b14" Content="" Height="133" Width="133" CornerRadius="32,32,32,32" Background="#66FFFFFF" FontWeight="Normal" IsDoubleTapEnabled="False" IsHoldingEnabled="False" IsRightTapEnabled="False" IsTapEnabled="False" Grid.Column="2" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,10,10,0" FontSize="48" FontFamily="Impact"/>
|
||||
<Button x:Name="b13" Content="" Height="133" Width="133" CornerRadius="32,32,32,32" Background="#66FFFFFF" FontWeight="Normal" IsDoubleTapEnabled="False" IsHoldingEnabled="False" IsRightTapEnabled="False" IsTapEnabled="False" Grid.Column="1" Margin="0,10,10,0" HorizontalAlignment="Right" VerticalAlignment="Top" FontSize="48" FontFamily="Impact"/>
|
||||
<Button x:Name="b21" Content="" Margin="10,10,0,0" VerticalAlignment="Top" Height="133" CornerRadius="32,32,32,32" Background="#66FFFFFF" FontWeight="Normal" IsDoubleTapEnabled="False" IsHoldingEnabled="False" IsRightTapEnabled="False" IsTapEnabled="False" Grid.Row="1" Width="133" FontSize="48" FontFamily="Impact"/>
|
||||
<Button x:Name="b22" Content="" Margin="10,10,0,0" VerticalAlignment="Top" Width="133" CornerRadius="32,32,32,32" Background="#66FFFFFF" FontWeight="Normal" IsDoubleTapEnabled="False" IsHoldingEnabled="False" IsRightTapEnabled="False" IsTapEnabled="False" Grid.Column="1" Grid.Row="1" Height="133" FontSize="48" FontFamily="Impact"/>
|
||||
<Button x:Name="b23" Content="" Margin="0,10,10,0" VerticalAlignment="Top" Height="133" Width="133" CornerRadius="32,32,32,32" Background="#66FFFFFF" FontWeight="Normal" IsDoubleTapEnabled="False" IsHoldingEnabled="False" IsRightTapEnabled="False" IsTapEnabled="False" Grid.Column="1" Grid.Row="1" HorizontalAlignment="Right" FontSize="48" FontFamily="Impact"/>
|
||||
<Button x:Name="b24" Content="" Margin="0,10,10,0" VerticalAlignment="Top" Height="133" Width="133" CornerRadius="32,32,32,32" Background="#66FFFFFF" FontWeight="Normal" IsDoubleTapEnabled="False" IsHoldingEnabled="False" IsRightTapEnabled="False" IsTapEnabled="False" Grid.Column="2" Grid.Row="1" HorizontalAlignment="Right" FontSize="48" FontFamily="Impact"/>
|
||||
<Button x:Name="b31" Content="" Margin="10,0,0,10" VerticalAlignment="Bottom" Height="133" Width="133" CornerRadius="32,32,32,32" Background="#66FFFFFF" FontWeight="Normal" IsDoubleTapEnabled="False" IsHoldingEnabled="False" IsRightTapEnabled="False" IsTapEnabled="False" Grid.Row="1" FontSize="48" FontFamily="Impact"/>
|
||||
<Button x:Name="b32" Content="" VerticalAlignment="Bottom" Height="133" CornerRadius="32,32,32,32" Background="#66FFFFFF" FontWeight="Normal" IsDoubleTapEnabled="False" IsHoldingEnabled="False" IsRightTapEnabled="False" IsTapEnabled="False" Grid.Column="1" Grid.Row="1" Width="133" Margin="10,0,0,10" FontSize="48" FontFamily="Impact"/>
|
||||
<Button x:Name="b33" Content="" Margin="0,0,10,10" VerticalAlignment="Bottom" Height="133" Width="133" CornerRadius="32,32,32,32" Background="#66FFFFFF" FontWeight="Normal" IsDoubleTapEnabled="False" IsHoldingEnabled="False" IsRightTapEnabled="False" IsTapEnabled="False" Grid.Column="1" Grid.Row="1" HorizontalAlignment="Right" FontSize="48" FontFamily="Impact"/>
|
||||
<Button x:Name="b34" Content="2048" Margin="0,0,10,10" VerticalAlignment="Bottom" Height="133" CornerRadius="32,32,32,32" Background="#66FFFFFF" FontWeight="Normal" IsDoubleTapEnabled="False" IsHoldingEnabled="False" IsRightTapEnabled="False" IsTapEnabled="False" Grid.Column="2" Grid.Row="1" HorizontalAlignment="Right" Width="133" FontSize="48" FontFamily="Impact" Foreground="#FF555555"/>
|
||||
<Button x:Name="b41" Content="" Margin="10,0,0,10" Height="133" Width="133" CornerRadius="32,32,32,32" Background="#66FFFFFF" FontWeight="Normal" IsDoubleTapEnabled="False" IsHoldingEnabled="False" IsRightTapEnabled="False" IsTapEnabled="False" Grid.Row="2" VerticalAlignment="Bottom" FontSize="48" FontFamily="Impact"/>
|
||||
<Button x:Name="b42" Content="" Height="133" Width="133" CornerRadius="32,32,32,32" Background="#66FFFFFF" FontWeight="Normal" IsDoubleTapEnabled="False" IsHoldingEnabled="False" IsRightTapEnabled="False" IsTapEnabled="False" Grid.Column="1" Grid.Row="2" Margin="10,0,0,10" VerticalAlignment="Bottom" FontSize="48" FontFamily="Impact"/>
|
||||
<Button x:Name="b43" Content="" Height="133" CornerRadius="32,32,32,32" Background="#66FFFFFF" FontWeight="Normal" IsDoubleTapEnabled="False" IsHoldingEnabled="False" IsRightTapEnabled="False" IsTapEnabled="False" Grid.Column="1" Grid.Row="2" Width="133" Margin="0,0,10,10" HorizontalAlignment="Right" FontSize="48" FontFamily="Impact"/>
|
||||
<Button x:Name="b44" Content="" Width="133" CornerRadius="32,32,32,32" Background="#66FFFFFF" FontWeight="Normal" IsDoubleTapEnabled="False" IsHoldingEnabled="False" IsRightTapEnabled="False" IsTapEnabled="False" Grid.Column="2" Grid.Row="2" Height="133" Margin="0,0,10,10" HorizontalAlignment="Right" FontSize="48" FontFamily="Impact"/>
|
||||
<Button x:Name="b12" Content="" Height="133" CornerRadius="32,32,32,32" Background="#66FFFFFF" FontWeight="Normal" IsDoubleTapEnabled="False" IsHoldingEnabled="False" IsRightTapEnabled="False" IsTapEnabled="False" Grid.Column="1" Width="133" Margin="10,10,0,0" VerticalAlignment="Top" FontSize="48" FontFamily="Impact"/>
|
||||
</Grid>
|
||||
<Button x:Name="bs" Content="114514" Height="90" CornerRadius="32,32,32,32" Background="#CCFBE7D1" FontWeight="Normal" IsDoubleTapEnabled="False" IsHoldingEnabled="False" IsRightTapEnabled="False" IsTapEnabled="False" Width="198" FontSize="48" FontFamily="Impact" Grid.Row="1" Foreground="#FF555555" Grid.Column="1" HorizontalAlignment="Center" Click="bs_Click"/>
|
||||
<Button x:Name="bbk" Content="bk" Height="64" CornerRadius="32,32,32,32" Background="#FF7AAEB7" FontWeight="Normal" IsDoubleTapEnabled="False" IsHoldingEnabled="False" IsRightTapEnabled="False" IsTapEnabled="False" Width="64" FontSize="36" FontFamily="Impact" Grid.Row="2" HorizontalAlignment="Center" Click="bbk_Click"/>
|
||||
<Button x:Name="bre" Content="re" Height="64" CornerRadius="32,32,32,32" Background="#FF7AAEB7" FontWeight="Normal" IsDoubleTapEnabled="False" IsHoldingEnabled="False" IsRightTapEnabled="False" IsTapEnabled="False" Grid.Column="2" Width="64" FontSize="36" FontFamily="Impact" Grid.Row="2" HorizontalAlignment="Center" Click="bre_Click"/>
|
||||
<AppBarButton x:Name="bhide" Label="" Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="{x:Null}" BorderBrush="{x:Null}" FocusVisualPrimaryBrush="{x:Null}" FocusVisualSecondaryBrush="{x:Null}" Click="bhide_Click" Background="{x:Null}" Icon="Flag" Opacity="0"/>
|
||||
</Grid>
|
||||
</Page>
|
||||
204
2048uwp/MainPage.xaml.cpp
Normal file
@@ -0,0 +1,204 @@
|
||||
//
|
||||
// MainPage.xaml.cpp
|
||||
// MainPage 类的实现。
|
||||
//
|
||||
|
||||
#include "pch.h"
|
||||
#include "MainPage.xaml.h"
|
||||
#include "ui.h"
|
||||
using namespace Concurrency;
|
||||
|
||||
using namespace _2048uwp;
|
||||
using namespace Platform;
|
||||
using namespace Windows::Foundation;
|
||||
using namespace Windows::Foundation::Collections;
|
||||
using namespace Windows::UI::Popups;
|
||||
using namespace Windows::UI::ViewManagement;
|
||||
using namespace Windows::UI::Xaml;
|
||||
using namespace Windows::UI::Xaml::Controls;
|
||||
using namespace Windows::UI::Xaml::Controls::Primitives;
|
||||
using namespace Windows::UI::Xaml::Data;
|
||||
using namespace Windows::UI::Xaml::Input;
|
||||
using namespace Windows::UI::Xaml::Media;
|
||||
using namespace Windows::UI::Xaml::Navigation;
|
||||
|
||||
static wchar_t buff[1024];
|
||||
static float rbh = 0;
|
||||
|
||||
MainPage::MainPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
brushinit();
|
||||
btninit();
|
||||
getfilepath();
|
||||
gamedisplay();
|
||||
}
|
||||
void _2048uwp::MainPage::stage_SizeChanged(Platform::Object^ sender, Windows::UI::Xaml::SizeChangedEventArgs^ e)
|
||||
{
|
||||
float buttonsz = (e->NewSize.Width - 50.0) / 4.0;
|
||||
float rate = pow((float)buttonsz / (float)e->NewSize.Width - 1.0, 3);
|
||||
|
||||
if (rate > 1.0) rate = 1.0;
|
||||
bs->Width = buttonsz * 2;
|
||||
bs->Height = buttonsz * (asin(rate) / 3.14 * 2.2 + 1.0);
|
||||
}
|
||||
void _2048uwp::MainPage::Page_SizeChanged(Platform::Object^ sender, Windows::UI::Xaml::SizeChangedEventArgs^ e)
|
||||
{
|
||||
float rate = pow((float)e->NewSize.Height / (float)e->NewSize.Width - 1.0, 3);
|
||||
|
||||
if (rate > 1.0) rate = 1.0;
|
||||
rbase->Height = rbh = 127 * (asin(rate) / 3.14 * 2 + 1.0);
|
||||
float newsize = ((e->NewSize.Width > e->NewSize.Height) ? e->NewSize.Height : e->NewSize.Width) - 128;
|
||||
float buttonsz = (newsize - 50.0) / 4.0;
|
||||
|
||||
stage->Width = newsize;
|
||||
stage->Height = newsize;
|
||||
setbtnsz(b11); setbtnsz(b12); setbtnsz(b13); setbtnsz(b14);
|
||||
setbtnsz(b21); setbtnsz(b22); setbtnsz(b23); setbtnsz(b24);
|
||||
setbtnsz(b31); setbtnsz(b32); setbtnsz(b33); setbtnsz(b34);
|
||||
setbtnsz(b41); setbtnsz(b42); setbtnsz(b43); setbtnsz(b44);
|
||||
setbtntxtsz(b11); setbtntxtsz(b12); setbtntxtsz(b13); setbtntxtsz(b14);
|
||||
setbtntxtsz(b21); setbtntxtsz(b22); setbtntxtsz(b23); setbtntxtsz(b24);
|
||||
setbtntxtsz(b31); setbtntxtsz(b32); setbtntxtsz(b33); setbtntxtsz(b34);
|
||||
setbtntxtsz(b41); setbtntxtsz(b42); setbtntxtsz(b43); setbtntxtsz(b44);
|
||||
setbtntxtsz(bs);
|
||||
r2->Width = 10 + buttonsz;
|
||||
r1->Width = 30 + 2 * buttonsz;
|
||||
c2->Height = 10 + buttonsz;
|
||||
c1->Height = 30 + 2 * buttonsz;
|
||||
bbk->Height = buttonsz / 2.5; bbk->Width = buttonsz / 2.5;
|
||||
bre->Height = buttonsz / 2.5; bre->Width = buttonsz / 2.5;
|
||||
bbk->FontSize = buttonsz / 6; bre->FontSize = buttonsz / 6;
|
||||
}
|
||||
void _2048uwp::MainPage::bbk_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
|
||||
{
|
||||
memcpy(arr, arr2, sizeof(arr)); drawblocks(); printmyscore(); save2file();
|
||||
}
|
||||
|
||||
void _2048uwp::MainPage::bre_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
|
||||
{
|
||||
ContentDialog^ refreshGame = ref new ContentDialog;
|
||||
refreshGame->Title = "重置游戏";
|
||||
refreshGame->Content = "您将失去现有进度";
|
||||
refreshGame->PrimaryButtonText = "重置";
|
||||
refreshGame->CloseButtonText = "取消";
|
||||
refreshGame->DefaultButton = ContentDialogButton::Close;
|
||||
IAsyncOperation<ContentDialogResult>^ refreshTask = refreshGame->ShowAsync();
|
||||
create_task(refreshTask).then([this](ContentDialogResult result) {
|
||||
if (result == ContentDialogResult::Primary){
|
||||
_wremove(filepath); gamedisplay(); savestage();
|
||||
}
|
||||
});
|
||||
}
|
||||
void _2048uwp::MainPage::bs_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
|
||||
{
|
||||
wchar_t* buf = buff;
|
||||
char c = 0;
|
||||
|
||||
memset(buff, 0, sizeof(buff));
|
||||
swprintf_s(buf, 1024, L"方文社©2020 by 源文雨.\n\t\tNow\n");
|
||||
for (int i = 0; i <= 5; i++) {
|
||||
for (int j = 0; j <= 5; j++) {
|
||||
swprintf_s(buf + wcslen(buf), 1024 - wcslen(buf), L"%05d ", arr[i][j]);
|
||||
if (arr[i][j]) c++;
|
||||
}
|
||||
swprintf_s(buf + wcslen(buf), 1024 - wcslen(buf), L"\n");
|
||||
}
|
||||
swprintf_s(buf + wcslen(buf), 1024 - wcslen(buf), L"\t\tPrev\n");
|
||||
for (int i = 0; i <= 5; i++) {
|
||||
for (int j = 0; j <= 5; j++) {
|
||||
swprintf_s(buf + wcslen(buf), 1024 - wcslen(buf), L"%05d ", arr[i][j]);
|
||||
if (arr2[i][j]) c++;
|
||||
}
|
||||
swprintf_s(buf + wcslen(buf), 1024 - wcslen(buf), L"\n");
|
||||
}
|
||||
swprintf_s(buf + wcslen(buf), 1024 - wcslen(buf), L"Manipulation: (%d, %d). ", XPOS, YPOS);
|
||||
swprintf_s(buf + wcslen(buf), 1024 - wcslen(buf), L"Win status: %d. Fail status: %d.\n", ISWIN, ISFAIL);
|
||||
//swprintf_s(buf + wcslen(buf), 1024 - wcslen(buf), L"Active blocks in all data: %d. ", c);
|
||||
//swprintf_s(buf + wcslen(buf), 1024 - wcslen(buf), L"Active blocks in stage: %d.\n", activeblocks());
|
||||
swprintf_s(buf + wcslen(buf), 1024 - wcslen(buf), L"Background color is #%02X%02X%02X%02X, so the system is in ", UISettings().GetColorValue(UIColorType::Background).A, UISettings().GetColorValue(UIColorType::Background).R, UISettings().GetColorValue(UIColorType::Background).G, UISettings().GetColorValue(UIColorType::Background).B);
|
||||
swprintf_s(buf + wcslen(buf), 1024 - wcslen(buf), L"%s mode.\n", isbglight()?L"light":L"dark");
|
||||
//String^ s = ref new String(buf);
|
||||
//s += L"Data folder: " + ApplicationData::Current->LocalFolder->Path;
|
||||
ContentDialog^ message = ref new ContentDialog;
|
||||
message->Title = "Info";
|
||||
message->Content = ref new String(buf);
|
||||
message->PrimaryButtonText = "确定";
|
||||
//MessageDialog^ msg = ref new MessageDialog(ref new String(buf));
|
||||
//msg->Title = "Info";
|
||||
//msg->ShowAsync();
|
||||
message->ShowAsync();
|
||||
//delete[] s;
|
||||
//if(!er) fclose(fp);
|
||||
}
|
||||
void _2048uwp::MainPage::bpage_KeyUp(Platform::Object^ sender, Windows::UI::Xaml::Input::KeyRoutedEventArgs^ e)
|
||||
{
|
||||
NOMOV = 1;
|
||||
|
||||
switch (e->Key.ToString()->Begin()[0]) {
|
||||
case 'L': savestage(); merge(leftmove, leftadd); break;
|
||||
case 'R': savestage(); merge(rightmove, rightadd); break;
|
||||
case 'U': savestage(); merge(upmove, upadd); break;
|
||||
case 'D': savestage(); merge(downmove, downadd); break;
|
||||
case 'B': memcpy(arr, arr2, sizeof(arr)); drawblocks(); printmyscore(); save2file(); break;
|
||||
case 'E': Windows::ApplicationModel::Core::CoreApplication::Exit();
|
||||
default: return; break;
|
||||
}
|
||||
if (NOMOV) { loadfromfile(); havempty(); return; }
|
||||
else {
|
||||
if (havempty()) newblock();
|
||||
if (!ISWIN && !ISFAIL) printmyscore();
|
||||
if (!ISFAIL) { drawblocks(); save2file(); }
|
||||
}
|
||||
}
|
||||
void _2048uwp::MainPage::basegrid_ManipulationCompleted(Platform::Object^ sender, Windows::UI::Xaml::Input::ManipulationCompletedRoutedEventArgs^ e)
|
||||
{
|
||||
MVTAG = 0;
|
||||
rbase->Height = rbh;
|
||||
cbase1->Width = GridLength((double)241, GridUnitType::Star);
|
||||
cbase2->Width = GridLength((double)25, GridUnitType::Star);
|
||||
}
|
||||
void _2048uwp::MainPage::bpage_RightTapped(Platform::Object^ sender, Windows::UI::Xaml::Input::RightTappedRoutedEventArgs^ e)
|
||||
{
|
||||
if (CH) { CH = 0; basegrid->Opacity = 0.7; }
|
||||
else { CH = 1; basegrid->Opacity = 1.0; }
|
||||
}
|
||||
void _2048uwp::MainPage::basegrid_ManipulationDelta(Platform::Object^ sender, Windows::UI::Xaml::Input::ManipulationDeltaRoutedEventArgs^ e)
|
||||
{
|
||||
if (MVTAG) {
|
||||
rbase->Height = rbh;
|
||||
cbase1->Width = GridLength((double)241, GridUnitType::Star);
|
||||
cbase2->Width = GridLength((double)25, GridUnitType::Star);
|
||||
return;
|
||||
}
|
||||
rbase->Height = abs(rbh + DY / 16);
|
||||
cbase1->Width = GridLength((double)abs(241 - DX / 16), GridUnitType::Star);
|
||||
cbase2->Width = GridLength((double)abs(25 - DX / 16), GridUnitType::Star);
|
||||
MUMOV = 1;
|
||||
|
||||
AXPOS = abs(e->Cumulative.Translation.X);
|
||||
AYPOS = abs(e->Cumulative.Translation.Y);
|
||||
XPOS = e->Cumulative.Translation.X;
|
||||
YPOS = e->Cumulative.Translation.Y;
|
||||
if (abs(AXPOS - AYPOS) < 100) return;
|
||||
else {
|
||||
savestage();
|
||||
MVTAG = 1;
|
||||
if (AXPOS > AYPOS) {
|
||||
if (XPOS < 0) { mmerge(leftmove, leftadd); }
|
||||
else { mmerge(rightmove, rightadd); }
|
||||
}
|
||||
else if (YPOS > 0) { mmerge(downmove, downadd); }
|
||||
else { mmerge(upmove, upadd); }
|
||||
if (MUMOV) { loadfromfile(); havempty(); return; }
|
||||
else {
|
||||
if (havempty()) newblock();
|
||||
if (!ISWIN && !ISFAIL) printmyscore();
|
||||
if (!ISFAIL) { drawblocks(); save2file(); }
|
||||
}
|
||||
}
|
||||
}
|
||||
void _2048uwp::MainPage::bhide_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
|
||||
{
|
||||
if (CH++ > 6) { arr[3][4] = 2048; CH = 0; }
|
||||
}
|
||||
37
2048uwp/MainPage.xaml.h
Normal file
@@ -0,0 +1,37 @@
|
||||
//
|
||||
// MainPage.xaml.h
|
||||
// MainPage 类的声明。
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "MainPage.g.h"
|
||||
|
||||
namespace _2048uwp
|
||||
{
|
||||
/// <summary>
|
||||
/// 可用于自身或导航至 Frame 内部的空白页。
|
||||
/// </summary>
|
||||
public ref class MainPage sealed
|
||||
{
|
||||
public:
|
||||
MainPage();
|
||||
|
||||
private:
|
||||
int havempty();
|
||||
void printmyscore();
|
||||
void btninit();
|
||||
void drawblocks();
|
||||
void gamedisplay();
|
||||
void stage_SizeChanged(Platform::Object^ sender, Windows::UI::Xaml::SizeChangedEventArgs^ e);
|
||||
void Page_SizeChanged(Platform::Object^ sender, Windows::UI::Xaml::SizeChangedEventArgs^ e);
|
||||
void bbk_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void bre_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void bs_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void bpage_KeyUp(Platform::Object^ sender, Windows::UI::Xaml::Input::KeyRoutedEventArgs^ e);
|
||||
void basegrid_ManipulationCompleted(Platform::Object^ sender, Windows::UI::Xaml::Input::ManipulationCompletedRoutedEventArgs^ e);
|
||||
void bpage_RightTapped(Platform::Object^ sender, Windows::UI::Xaml::Input::RightTappedRoutedEventArgs^ e);
|
||||
void basegrid_ManipulationDelta(Platform::Object^ sender, Windows::UI::Xaml::Input::ManipulationDeltaRoutedEventArgs^ e);
|
||||
void bhide_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
};
|
||||
}
|
||||
50
2048uwp/Package.appxmanifest
Normal file
@@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<Package
|
||||
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
|
||||
xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
|
||||
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
|
||||
IgnorableNamespaces="uap mp">
|
||||
|
||||
<Identity
|
||||
Name="549426E2D6DED.Miku2048"
|
||||
Publisher="CN=101D9BA8-A0C7-43C7-878D-8944A88F93B6"
|
||||
Version="3.0.24.0" />
|
||||
|
||||
<mp:PhoneIdentity PhoneProductId="7ceb1a0e-6943-411c-89a4-7118a10a48c2" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
|
||||
|
||||
<Properties>
|
||||
<DisplayName>Miku2048</DisplayName>
|
||||
<PublisherDisplayName>源文雨</PublisherDisplayName>
|
||||
<Logo>Assets\StoreLogo.png</Logo>
|
||||
</Properties>
|
||||
|
||||
<Dependencies>
|
||||
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" />
|
||||
</Dependencies>
|
||||
|
||||
<Resources>
|
||||
<Resource Language="x-generate"/>
|
||||
</Resources>
|
||||
|
||||
<Applications>
|
||||
<Application Id="App"
|
||||
Executable="$targetnametoken$.exe"
|
||||
EntryPoint="_2048uwp.App">
|
||||
<uap:VisualElements
|
||||
DisplayName="Miku2048"
|
||||
Square150x150Logo="Assets\Square150x150Logo.png"
|
||||
Square44x44Logo="Assets\Square44x44Logo.png"
|
||||
Description="和Miku一起玩2048吧~"
|
||||
BackgroundColor="transparent">
|
||||
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png"/>
|
||||
<uap:SplashScreen Image="Assets\SplashScreen.png" />
|
||||
<uap:InitialRotationPreference>
|
||||
<uap:Rotation Preference="landscape"/>
|
||||
<uap:Rotation Preference="portrait"/>
|
||||
<uap:Rotation Preference="landscapeFlipped"/>
|
||||
<uap:Rotation Preference="portraitFlipped"/></uap:InitialRotationPreference>
|
||||
</uap:VisualElements>
|
||||
</Application>
|
||||
</Applications>
|
||||
</Package>
|
||||
5
2048uwp/pch.cpp
Normal file
@@ -0,0 +1,5 @@
|
||||
//
|
||||
// pch.cpp
|
||||
//
|
||||
|
||||
#include "pch.h"
|
||||
15
2048uwp/pch.h
Normal file
@@ -0,0 +1,15 @@
|
||||
//
|
||||
// pch.h
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <collection.h>
|
||||
#include <ppltasks.h>
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string>
|
||||
#include <tchar.h>
|
||||
#include "App.xaml.h"
|
||||
|
||||
16
2048uwp/resource.h
Normal file
@@ -0,0 +1,16 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ <20><><EFBFBD>ɵİ<C9B5><C4B0><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
|
||||
// <20><> 2048uwp.rc ʹ<><CAB9>
|
||||
//
|
||||
#define IDR_IMG1 101
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 102
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1001
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
565
2048uwp/ui.h
Normal file
@@ -0,0 +1,565 @@
|
||||
#pragma once
|
||||
#include "pch.h"
|
||||
#include "MainPage.xaml.h"
|
||||
|
||||
using namespace _2048uwp;
|
||||
using namespace Platform;
|
||||
using namespace Windows::Foundation;
|
||||
using namespace Windows::Foundation::Collections;
|
||||
using namespace Windows::Storage;
|
||||
using namespace Windows::UI::ViewManagement;
|
||||
using namespace Windows::UI::Xaml;
|
||||
using namespace Windows::UI::Xaml::Controls;
|
||||
using namespace Windows::UI::Xaml::Controls::Primitives;
|
||||
using namespace Windows::UI::Xaml::Data;
|
||||
using namespace Windows::UI::Xaml::Input;
|
||||
using namespace Windows::UI::Xaml::Media;
|
||||
using namespace Windows::UI::Xaml::Navigation;;
|
||||
|
||||
#define C8192 Windows::UI::ColorHelper::FromArgb(0xbb, 0x36, 0x91, 0xff)
|
||||
#define C4096 Windows::UI::ColorHelper::FromArgb(0xbb, 0x8e, 0xd2, 0xff)
|
||||
#define C2048 Windows::UI::ColorHelper::FromArgb(0xbb, 0xeb, 0xc7, 0x03)
|
||||
#define C1024 Windows::UI::ColorHelper::FromArgb(0xbb, 0xe3, 0xb9, 0x15)
|
||||
#define C512 Windows::UI::ColorHelper::FromArgb(0xbb, 0xec, 0xc8, 0x50)
|
||||
#define C256 Windows::UI::ColorHelper::FromArgb(0xbb, 0xed, 0xcc, 0x61)
|
||||
#define C128 Windows::UI::ColorHelper::FromArgb(0xbb, 0xed, 0xce, 0x71)
|
||||
#define C64 Windows::UI::ColorHelper::FromArgb(0xbb, 0xf6, 0x5d, 0x3b)
|
||||
#define C32 Windows::UI::ColorHelper::FromArgb(0xbb, 0xf5, 0x7c, 0x5f)
|
||||
#define C16 Windows::UI::ColorHelper::FromArgb(0xbb, 0xf5, 0x95, 0x63)
|
||||
#define C8 Windows::UI::ColorHelper::FromArgb(0xbb, 0xf2, 0xb1, 0x79)
|
||||
#define C4 Windows::UI::ColorHelper::FromArgb(0xdd, 0xec, 0xe0, 0xc8)
|
||||
#define C2 Windows::UI::ColorHelper::FromArgb(0xdd, 0xee, 0xe4, 0xda)
|
||||
#define C0 Windows::UI::ColorHelper::FromArgb(0x55, 0xff, 0xff, 0xff)
|
||||
#define DGRAY Windows::UI::ColorHelper::FromArgb(0xff, 0x55, 0x55, 0x55)
|
||||
#define WTE Windows::UI::ColorHelper::FromArgb(0xff, 0xff, 0xff, 0xff)
|
||||
|
||||
#define COLOR8192 colors[15]
|
||||
#define COLOR4096 colors[14]
|
||||
#define COLOR2048 colors[11]
|
||||
#define COLOR1024 colors[10]
|
||||
#define COLOR512 colors[9]
|
||||
#define COLOR256 colors[8]
|
||||
#define COLOR128 colors[7]
|
||||
#define COLOR64 colors[6]
|
||||
#define COLOR32 colors[5]
|
||||
#define COLOR16 colors[4]
|
||||
#define COLOR8 colors[3]
|
||||
#define COLOR4 colors[2]
|
||||
#define COLOR2 colors[1]
|
||||
#define COLOR0 colors[0]
|
||||
#define DARKGRAY colors[12]
|
||||
#define WHITE colors[13]
|
||||
|
||||
#define setbtnsz(x) x->Width = buttonsz; x->Height = buttonsz
|
||||
#define setbtncolor(btn, color) btn->Background = color
|
||||
#define setbtntxt(x, t) x->Content = t
|
||||
#define setbtntxtsz(x) x->FontSize = buttonsz / 3
|
||||
#define setbtntxtcolor(x, c) x->Foreground = c
|
||||
|
||||
static Brush^ colors[16];
|
||||
|
||||
static short arr[6][6];
|
||||
|
||||
#define CH arr[0][0]
|
||||
#define XPOS arr[0][1]
|
||||
#define YPOS arr[0][2]
|
||||
#define AXPOS arr[0][3]
|
||||
#define AYPOS arr[0][4]
|
||||
#define FLAG arr[0][5]
|
||||
|
||||
#define FLAG2 arr[5][0]
|
||||
#define FLAG3 arr[5][1]
|
||||
#define FLAG4 arr[5][2]
|
||||
#define ISFAIL arr[5][3]
|
||||
#define ISWIN arr[5][4]
|
||||
#define NOMOV arr[5][5]
|
||||
|
||||
#define SCORE arr[1][0]
|
||||
#define MUMOV arr[2][0]
|
||||
#define MVTAG arr[3][0]
|
||||
|
||||
#define DX e->Delta.Translation.X
|
||||
#define DY e->Delta.Translation.Y
|
||||
|
||||
static short arr2[6][6];
|
||||
#define savestage() memcpy(arr2, arr, sizeof(arr))
|
||||
#define merge(x, y) FLAG3 = !x(); FLAG4 = !y(); NOMOV = FLAG3 && FLAG4
|
||||
#define mmerge(x, y) FLAG3 = !x(); FLAG4 = !y(); MUMOV = FLAG3 && FLAG4
|
||||
|
||||
static Button^ btngrp[4][4];
|
||||
#define drawb(color) setbtncolor(btngrp[i][j], color)
|
||||
#define drawt(color, text) setbtntxt(btngrp[i][j], text); setbtntxtcolor(btngrp[i][j], color)
|
||||
|
||||
static FILE fbuf;
|
||||
static String^ path;
|
||||
static const wchar_t* filepath;
|
||||
#define localpath ApplicationData::Current->LocalFolder->Path
|
||||
#define getfilepath() path = localpath; path += "\\savedata"; filepath = path->Begin()
|
||||
|
||||
int activeblocks();
|
||||
void brushinit();
|
||||
//void btninit();
|
||||
short calScore(short arr[6][6]);
|
||||
int downadd();
|
||||
int downmove();
|
||||
//void drawblocks();
|
||||
//void gamedisplay();
|
||||
//havempty();
|
||||
int isbglight();
|
||||
int leftadd();
|
||||
int leftmove();
|
||||
errno_t loadfromfile();
|
||||
void newblock();
|
||||
//printmyscore();
|
||||
int rightadd();
|
||||
int rightmove();
|
||||
int save2file();
|
||||
int upadd();
|
||||
int upmove();
|
||||
|
||||
int activeblocks() {
|
||||
char c = 0;
|
||||
for (int i = 1; i <= 4; i++) {
|
||||
for (int j = 1; j <= 4; j++) {
|
||||
if (arr[i][j]) c++;
|
||||
}
|
||||
}
|
||||
return c;
|
||||
}
|
||||
void brushinit() {
|
||||
colors[0] = ref new SolidColorBrush(C0);
|
||||
colors[1] = ref new SolidColorBrush(C2);
|
||||
colors[2] = ref new SolidColorBrush(C4);
|
||||
colors[3] = ref new SolidColorBrush(C8);
|
||||
colors[4] = ref new SolidColorBrush(C16);
|
||||
colors[5] = ref new SolidColorBrush(C32);
|
||||
colors[6] = ref new SolidColorBrush(C64);
|
||||
colors[7] = ref new SolidColorBrush(C128);
|
||||
colors[8] = ref new SolidColorBrush(C256);
|
||||
colors[9] = ref new SolidColorBrush(C512);
|
||||
colors[10] = ref new SolidColorBrush(C1024);
|
||||
colors[11] = ref new SolidColorBrush(C2048);
|
||||
colors[12] = ref new SolidColorBrush(DGRAY);
|
||||
colors[13] = ref new SolidColorBrush(WTE);
|
||||
colors[14] = ref new SolidColorBrush(C4096);
|
||||
colors[15] = ref new SolidColorBrush(C8192);
|
||||
}
|
||||
void _2048uwp::MainPage::btninit() {
|
||||
btngrp[0][0] = b11; btngrp[0][1] = b12; btngrp[0][2] = b13; btngrp[0][3] = b14;
|
||||
btngrp[1][0] = b21; btngrp[1][1] = b22; btngrp[1][2] = b23; btngrp[1][3] = b24;
|
||||
btngrp[2][0] = b31; btngrp[2][1] = b32; btngrp[2][2] = b33; btngrp[2][3] = b34;
|
||||
btngrp[3][0] = b41; btngrp[3][1] = b42; btngrp[3][2] = b43; btngrp[3][3] = b44;
|
||||
}
|
||||
short calScore(short arr[6][6]) {
|
||||
SCORE = 0;
|
||||
for (int i = 1; i <= 4; i++) {
|
||||
for (int j = 1; j <= 4; j++) {
|
||||
SCORE += arr[i][j];
|
||||
}
|
||||
}
|
||||
return SCORE % 9999 + 1;
|
||||
}
|
||||
int downadd() {
|
||||
FLAG = 0;
|
||||
for (int j = 1; j <= 4; j++)
|
||||
switch ((arr[1][j] ? 8 : 0) + (arr[2][j] ? 4 : 0) + (arr[3][j] ? 2 : 0) + (arr[4][j] ? 1 : 0)) {
|
||||
case 0: case 1: break;
|
||||
case 3:
|
||||
if (arr[3][j] == arr[4][j]) {
|
||||
arr[4][j] *= 2;
|
||||
FLAG++;
|
||||
arr[3][j] = 0;
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
if (arr[3][j] == arr[4][j]) {
|
||||
arr[4][j] *= 2;
|
||||
FLAG++;
|
||||
arr[3][j] = arr[2][j];
|
||||
arr[2][j] = 0;
|
||||
}
|
||||
else if (arr[2][j] == arr[3][j]) {
|
||||
arr[3][j] *= 2;
|
||||
FLAG++;
|
||||
arr[2][j] = 0;
|
||||
}
|
||||
break;
|
||||
case 15:
|
||||
if (arr[3][j] == arr[4][j]) {
|
||||
arr[4][j] *= 2;
|
||||
FLAG++;
|
||||
arr[3][j] = 0;
|
||||
}
|
||||
else if (arr[2][j] == arr[3][j]) {
|
||||
arr[3][j] *= 2;
|
||||
FLAG++;
|
||||
arr[2][j] = 0;
|
||||
}
|
||||
if (arr[1][j] == arr[2][j]) {
|
||||
arr[2][j] *= 2;
|
||||
FLAG++;
|
||||
arr[1][j] = 0;
|
||||
}
|
||||
downmove();
|
||||
break;
|
||||
}
|
||||
return FLAG;
|
||||
}
|
||||
int downmove() {
|
||||
FLAG2 = 0;
|
||||
for (int j = 1; j <= 4; j++)
|
||||
switch ((arr[1][j] ? 8 : 0) + (arr[2][j] ? 4 : 0) + (arr[3][j] ? 2 : 0) + (arr[4][j] ? 1 : 0)) {
|
||||
case 0: case 1: case 3: case 7: case 15: FLAG2++; break;
|
||||
case 2: arr[4][j] = arr[3][j]; arr[3][j] = 0; break;
|
||||
case 4: arr[4][j] = arr[2][j]; arr[2][j] = 0; break;
|
||||
case 5: arr[3][j] = arr[2][j]; arr[2][j] = 0; break;
|
||||
case 6: arr[4][j] = arr[3][j]; arr[3][j] = arr[2][j]; arr[2][j] = 0; break;
|
||||
case 8: arr[4][j] = arr[1][j]; arr[1][j] = 0; break;
|
||||
case 9: arr[3][j] = arr[1][j]; arr[1][j] = 0; break;
|
||||
case 10: arr[4][j] = arr[3][j]; arr[3][j] = arr[1][j]; arr[1][j] = 0; break;
|
||||
case 11: arr[2][j] = arr[1][j]; arr[1][j] = 0; break;
|
||||
case 12: arr[4][j] = arr[2][j]; arr[3][j] = arr[1][j]; arr[1][j] = arr[2][j] = 0; break;
|
||||
case 13: arr[3][j] = arr[2][j]; arr[2][j] = arr[1][j]; arr[1][j] = 0; break;
|
||||
case 14: arr[4][j] = arr[3][j]; arr[3][j] = arr[2][j]; arr[2][j] = arr[1][j]; arr[1][j] = 0; break;
|
||||
default: break;
|
||||
}
|
||||
return (FLAG2 - 4);
|
||||
}
|
||||
void _2048uwp::MainPage::drawblocks() {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
for (int j = 0; j < 4; j++) {
|
||||
switch (arr[i + 1][j + 1]) {
|
||||
case 0:
|
||||
drawb(COLOR0);
|
||||
drawt(DARKGRAY, "");
|
||||
break;
|
||||
case 2:
|
||||
drawb(COLOR2);
|
||||
drawt(DARKGRAY, "2");
|
||||
break;
|
||||
case 4:
|
||||
drawb(COLOR4);
|
||||
drawt(DARKGRAY, "4");
|
||||
break;
|
||||
case 8:
|
||||
drawb(COLOR8);
|
||||
drawt(WHITE, "8");
|
||||
break;
|
||||
case 16:
|
||||
drawb(COLOR16);
|
||||
drawt(WHITE, "16");
|
||||
break;
|
||||
case 32:
|
||||
drawb(COLOR32);
|
||||
drawt(WHITE, "32");
|
||||
break;
|
||||
case 64:
|
||||
drawb(COLOR64);
|
||||
drawt(WHITE, "64");
|
||||
break;
|
||||
case 128:
|
||||
drawb(COLOR128);
|
||||
drawt(WHITE, "128");
|
||||
break;
|
||||
case 256:
|
||||
drawb(COLOR256);
|
||||
drawt(WHITE, "256");
|
||||
break;
|
||||
case 512:
|
||||
drawb(COLOR512);
|
||||
drawt(WHITE, "512");
|
||||
break;
|
||||
case 1024:
|
||||
drawb(COLOR1024);
|
||||
drawt(WHITE, "1024");
|
||||
break;
|
||||
case 2048:
|
||||
drawb(COLOR2048);
|
||||
drawt(WHITE, "2048");
|
||||
break;
|
||||
case 4096:
|
||||
drawb(COLOR4096);
|
||||
drawt(WHITE, "4096");
|
||||
break;
|
||||
case 8192:
|
||||
drawb(COLOR8192);
|
||||
drawt(WHITE, "8192");
|
||||
break;
|
||||
default:
|
||||
drawb(COLOR8192);
|
||||
drawt(WHITE, arr[i+1][j+1]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
void _2048uwp::MainPage::gamedisplay() {
|
||||
srand(time(0));
|
||||
memset(arr, 0, sizeof(arr));
|
||||
memset(arr2, 0, sizeof(arr));
|
||||
CH = -1;
|
||||
if(loadfromfile() || !activeblocks()) newblock();
|
||||
if (!~CH) {
|
||||
if ((CH = isbglight())) basegrid->Opacity = 1.0;
|
||||
else basegrid->Opacity = 0.7;
|
||||
}
|
||||
drawblocks();
|
||||
printmyscore();
|
||||
havempty();
|
||||
}
|
||||
int _2048uwp::MainPage::havempty() {
|
||||
char c = 0;
|
||||
ISWIN = 0;
|
||||
for (int i = 1; i <= 4; i++) for (int j = 1; j <= 4; j++) {
|
||||
if (arr[i][j]) c++;
|
||||
if (arr[i][j] >= 2048) {
|
||||
bs->Content = "WIN!";
|
||||
return ISWIN = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (c >= 16) {
|
||||
if (!ISFAIL) {
|
||||
bs->Content = "FAILED!";
|
||||
ISFAIL = 1;
|
||||
}
|
||||
}
|
||||
else ISFAIL = 0;
|
||||
return !ISFAIL;
|
||||
}
|
||||
int isbglight() {
|
||||
return (0.299 * UISettings().GetColorValue(UIColorType::Background).R +
|
||||
0.587 * UISettings().GetColorValue(UIColorType::Background).G +
|
||||
0.114 * UISettings().GetColorValue(UIColorType::Background).B) / 255.0 > 0.5;
|
||||
}
|
||||
int leftadd() {
|
||||
FLAG = 0;
|
||||
for (int j = 1; j <= 4; j++)
|
||||
switch ((arr[j][1] ? 8 : 0) + (arr[j][2] ? 4 : 0) + (arr[j][3] ? 2 : 0) + (arr[j][4] ? 1 : 0)) {
|
||||
case 0: case 8: break;
|
||||
case 12:
|
||||
if (arr[j][1] == arr[j][2]) {
|
||||
arr[j][1] *= 2;
|
||||
FLAG++;
|
||||
arr[j][2] = 0;
|
||||
}
|
||||
break;
|
||||
case 14:
|
||||
if (arr[j][1] == arr[j][2]) {
|
||||
arr[j][1] *= 2;
|
||||
FLAG++;
|
||||
arr[j][2] = arr[j][3];
|
||||
arr[j][3] = 0;
|
||||
}
|
||||
else if (arr[j][2] == arr[j][3]) {
|
||||
arr[j][2] *= 2;
|
||||
FLAG++;
|
||||
arr[j][3] = 0;
|
||||
}
|
||||
break;
|
||||
case 15:
|
||||
if (arr[j][1] == arr[j][2]) {
|
||||
arr[j][1] *= 2;
|
||||
FLAG++;
|
||||
arr[j][2] = 0;
|
||||
}
|
||||
else if (arr[j][2] == arr[j][3]) {
|
||||
arr[j][2] *= 2;
|
||||
FLAG++;
|
||||
arr[j][3] = 0;
|
||||
}
|
||||
if (arr[j][3] == arr[j][4]) {
|
||||
arr[j][3] *= 2;
|
||||
FLAG++;
|
||||
arr[j][4] = 0;
|
||||
}
|
||||
leftmove();
|
||||
break;
|
||||
}
|
||||
return FLAG;
|
||||
}
|
||||
int leftmove() {
|
||||
FLAG2 = 0;
|
||||
for (int j = 1; j <= 4; j++)
|
||||
switch ((arr[j][1] ? 8 : 0) + (arr[j][2] ? 4 : 0) + (arr[j][3] ? 2 : 0) + (arr[j][4] ? 1 : 0)) {
|
||||
case 0: case 8: case 12: case 14: case 15: FLAG2++; break;
|
||||
case 1: arr[j][1] = arr[j][4]; arr[j][4] = 0; break;
|
||||
case 2: arr[j][1] = arr[j][3]; arr[j][3] = 0; break;
|
||||
case 3: arr[j][1] = arr[j][3]; arr[j][2] = arr[j][4]; arr[j][3] = arr[j][4] = 0; break;
|
||||
case 4: arr[j][1] = arr[j][2]; arr[j][2] = 0; break;
|
||||
case 5: arr[j][1] = arr[j][2]; arr[j][2] = arr[j][4]; arr[j][4] = 0; break;
|
||||
case 6: arr[j][1] = arr[j][2]; arr[j][2] = arr[j][3]; arr[j][3] = 0; break;
|
||||
case 7: arr[j][1] = arr[j][2]; arr[j][2] = arr[j][3]; arr[j][3] = arr[j][4]; arr[j][4] = 0; break;
|
||||
case 9: arr[j][2] = arr[j][4]; arr[j][4] = 0; break;
|
||||
case 10: arr[j][2] = arr[j][3]; arr[j][3] = 0; break;
|
||||
case 11: arr[j][2] = arr[j][3]; arr[j][3] = arr[j][4]; arr[j][4] = 0; break;
|
||||
case 13: arr[j][3] = arr[j][4]; arr[j][4] = 0; break;
|
||||
default: break;
|
||||
}
|
||||
return (FLAG2 - 4);
|
||||
}
|
||||
errno_t loadfromfile() {
|
||||
FILE* fp = &fbuf;
|
||||
errno_t e = _wfopen_s(&fp, filepath, L"rb");
|
||||
if (!e) {
|
||||
fread(arr, sizeof(short), 36, fp);
|
||||
fread(arr2, sizeof(short), 36, fp);
|
||||
fclose(fp);
|
||||
}
|
||||
return e;
|
||||
}
|
||||
void newblock() {
|
||||
int x = rand() % 4 + 1;
|
||||
int y = rand() % 4 + 1;
|
||||
while (arr[x][y]) {
|
||||
x = rand() % 4 + 1;
|
||||
y = rand() % 4 + 1;
|
||||
}
|
||||
if (!(rand() % 10)) arr[x][y] = 4;
|
||||
else arr[x][y] = 2;
|
||||
}
|
||||
void _2048uwp::MainPage::printmyscore() {
|
||||
bs->Content = calScore(arr);
|
||||
}
|
||||
int rightadd() {
|
||||
FLAG = 0;
|
||||
for (int j = 1; j <= 4; j++)
|
||||
switch ((arr[j][1] ? 8 : 0) + (arr[j][2] ? 4 : 0) + (arr[j][3] ? 2 : 0) + (arr[j][4] ? 1 : 0)) {
|
||||
case 0: case 1: break;
|
||||
case 3:
|
||||
if (arr[j][3] == arr[j][4]) {
|
||||
arr[j][4] *= 2;
|
||||
FLAG++;
|
||||
arr[j][3] = 0;
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
if (arr[j][3] == arr[j][4]) {
|
||||
arr[j][4] *= 2;
|
||||
FLAG++;
|
||||
arr[j][3] = arr[j][2];
|
||||
arr[j][2] = 0;
|
||||
}
|
||||
else if (arr[j][2] == arr[j][3]) {
|
||||
arr[j][3] *= 2;
|
||||
FLAG++;
|
||||
arr[j][2] = 0;
|
||||
}
|
||||
else FLAG++;
|
||||
break;
|
||||
case 15:
|
||||
if (arr[j][3] == arr[j][4]) {
|
||||
arr[j][4] *= 2;
|
||||
FLAG++;
|
||||
arr[j][3] = 0;
|
||||
}
|
||||
else if (arr[j][2] == arr[j][3]) {
|
||||
arr[j][3] *= 2;
|
||||
FLAG++;
|
||||
arr[j][2] = 0;
|
||||
}
|
||||
if (arr[j][1] == arr[j][2]) {
|
||||
arr[j][2] *= 2;
|
||||
FLAG++;
|
||||
arr[j][1] = 0;
|
||||
}
|
||||
rightmove();
|
||||
break;
|
||||
}
|
||||
return FLAG;
|
||||
}
|
||||
int rightmove() {
|
||||
FLAG2 = 0;
|
||||
for (int j = 1; j <= 4; j++)
|
||||
switch ((arr[j][1] ? 8 : 0) + (arr[j][2] ? 4 : 0) + (arr[j][3] ? 2 : 0) + (arr[j][4] ? 1 : 0)) {
|
||||
case 0: case 1: case 3: case 7: case 15: FLAG2++; break;
|
||||
case 2: arr[j][4] = arr[j][3]; arr[j][3] = 0; break;
|
||||
case 4: arr[j][4] = arr[j][2]; arr[j][2] = 0; break;
|
||||
case 5: arr[j][3] = arr[j][2]; arr[j][2] = 0; break;
|
||||
case 6: arr[j][4] = arr[j][3]; arr[j][3] = arr[j][2]; arr[j][2] = 0; break;
|
||||
case 8: arr[j][4] = arr[j][1]; arr[j][1] = 0; break;
|
||||
case 9: arr[j][3] = arr[j][1]; arr[j][1] = 0; break;
|
||||
case 10: arr[j][4] = arr[j][3]; arr[j][3] = arr[j][1]; arr[j][1] = 0; break;
|
||||
case 11: arr[j][2] = arr[j][1]; arr[j][1] = 0; break;
|
||||
case 12: arr[j][4] = arr[j][2]; arr[j][3] = arr[j][1]; arr[j][1] = arr[j][2] = 0; break;
|
||||
case 13: arr[j][3] = arr[j][2]; arr[j][2] = arr[j][1]; arr[j][1] = 0; break;
|
||||
case 14: arr[j][4] = arr[j][3]; arr[j][3] = arr[j][2]; arr[j][2] = arr[j][1]; arr[j][1] = 0; break;
|
||||
default: break;
|
||||
}
|
||||
return (FLAG2 - 4);
|
||||
}
|
||||
int save2file() {
|
||||
FILE* fp = &fbuf;
|
||||
if (!_wfopen_s(&fp, filepath, L"wb")) {
|
||||
fwrite(arr, sizeof(short), 36, fp);
|
||||
fwrite(arr2, sizeof(short), 36, fp);
|
||||
fclose(fp);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
int upadd() {
|
||||
FLAG = 0;
|
||||
for (int j = 1; j <= 4; j++)
|
||||
switch ((arr[1][j] ? 8 : 0) + (arr[2][j] ? 4 : 0) + (arr[3][j] ? 2 : 0) + (arr[4][j] ? 1 : 0)) {
|
||||
case 0: case 8: break;
|
||||
case 12:
|
||||
if (arr[1][j] == arr[2][j]) {
|
||||
arr[1][j] *= 2;
|
||||
FLAG++;
|
||||
arr[2][j] = 0;
|
||||
}
|
||||
break;
|
||||
case 14:
|
||||
if (arr[1][j] == arr[2][j]) {
|
||||
arr[1][j] *= 2;
|
||||
FLAG++;
|
||||
arr[2][j] = arr[3][j];
|
||||
arr[3][j] = 0;
|
||||
}
|
||||
else if (arr[2][j] == arr[3][j]) {
|
||||
arr[2][j] *= 2;
|
||||
FLAG++;
|
||||
arr[3][j] = 0;
|
||||
}
|
||||
break;
|
||||
case 15:
|
||||
if (arr[1][j] == arr[2][j]) {
|
||||
arr[1][j] *= 2;
|
||||
FLAG++;
|
||||
arr[2][j] = 0;
|
||||
}
|
||||
else if (arr[2][j] == arr[3][j]) {
|
||||
arr[2][j] *= 2;
|
||||
FLAG++;
|
||||
arr[3][j] = 0;
|
||||
}
|
||||
if (arr[3][j] == arr[4][j]) {
|
||||
arr[3][j] *= 2;
|
||||
FLAG++;
|
||||
arr[4][j] = 0;
|
||||
}
|
||||
upmove();
|
||||
break;
|
||||
}
|
||||
return FLAG;
|
||||
}
|
||||
int upmove() {
|
||||
FLAG2 = 0;
|
||||
for (int j = 1; j <= 4; j++)
|
||||
switch ((arr[1][j] ? 8 : 0) + (arr[2][j] ? 4 : 0) + (arr[3][j] ? 2 : 0) + (arr[4][j] ? 1 : 0)) {
|
||||
case 0: case 8: case 12: case 14: case 15: FLAG2++; break;
|
||||
case 1: arr[1][j] = arr[4][j]; arr[4][j] = 0; break;
|
||||
case 2: arr[1][j] = arr[3][j]; arr[3][j] = 0; break;
|
||||
case 3: arr[1][j] = arr[3][j]; arr[2][j] = arr[4][j]; arr[3][j] = arr[4][j] = 0; break;
|
||||
case 4: arr[1][j] = arr[2][j]; arr[2][j] = 0; break;
|
||||
case 5: arr[1][j] = arr[2][j]; arr[2][j] = arr[4][j]; arr[4][j] = 0; break;
|
||||
case 6: arr[1][j] = arr[2][j]; arr[2][j] = arr[3][j]; arr[3][j] = 0; break;
|
||||
case 7: arr[1][j] = arr[2][j]; arr[2][j] = arr[3][j]; arr[3][j] = arr[4][j]; arr[4][j] = 0; break;
|
||||
case 9: arr[2][j] = arr[4][j]; arr[4][j] = 0; break;
|
||||
case 10: arr[2][j] = arr[3][j]; arr[3][j] = 0; break;
|
||||
case 11: arr[2][j] = arr[3][j]; arr[3][j] = arr[4][j]; arr[4][j] = 0; break;
|
||||
case 13: arr[3][j] = arr[4][j]; arr[4][j] = 0; break;
|
||||
default: break;
|
||||
}
|
||||
return (FLAG2 - 4);
|
||||
}
|
||||