code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.2.1, 2022-01-18T11:00:29. -->
<qtcreator>
 <data>
  <variable>EnvironmentId</variable>
  <value type="QByteArray">{4268855b-6801-4df5-9f6d-8ad33364b881}</value>
 </data>
 <data>
  <variable>ProjectExplorer.Project.ActiveTarget</variable>
  <value type="int">0</value>
 </data>
 <data>
  <variable>ProjectExplorer.Project.EditorSettings</variable>
  <valuemap type="QVariantMap">
   <value type="bool" key="EditorConfiguration.AutoIndent">true</value>
   <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
   <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
   <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
    <value type="QString" key="language">Cpp</value>
    <valuemap type="QVariantMap" key="value">
     <value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
    </valuemap>
   </valuemap>
   <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
    <value type="QString" key="language">QmlJS</value>
    <valuemap type="QVariantMap" key="value">
     <value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
    </valuemap>
   </valuemap>
   <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
   <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
   <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
   <value type="int" key="EditorConfiguration.IndentSize">4</value>
   <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
   <value type="int" key="EditorConfiguration.MarginColumn">80</value>
   <value type="bool" key="EditorConfiguration.MouseHiding">true</value>
   <value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
   <value type="int" key="EditorConfiguration.PaddingMode">1</value>
   <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
   <value type="bool" key="EditorConfiguration.ShowMargin">false</value>
   <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
   <value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value>
   <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
   <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
   <value type="int" key="EditorConfiguration.TabSize">8</value>
   <value type="bool" key="EditorConfiguration.UseGlobal">true</value>
   <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
   <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
   <value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
   <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
   <value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
  </valuemap>
 </data>
 <data>
  <variable>ProjectExplorer.Project.PluginSettings</variable>
  <valuemap type="QVariantMap"/>
 </data>
 <data>
  <variable>ProjectExplorer.Project.Target.0</variable>
  <valuemap type="QVariantMap">
   <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.8.0 MinGW 32bit</value>
   <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.8.0 MinGW 32bit</value>
   <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.58.win32_mingw53_kit</value>
   <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
   <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
   <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
   <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
    <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:/Users/USER/Documents/build-Probnec-Desktop_Qt_5_8_0_MinGW_32bit-Debug</value>
    <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
     <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
      <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
      <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
      <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">true</value>
      <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
      <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
      <value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
      <value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
     </valuemap>
     <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
      <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Сборка</value>
      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
      <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
      <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
      <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
      <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
      <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
     </valuemap>
     <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Сборка</value>
     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
     <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
    </valuemap>
    <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
     <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
      <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Сборка</value>
      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
      <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
      <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
      <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
      <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
      <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
     </valuemap>
     <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Очистка</value>
     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
     <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
    </valuemap>
    <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
    <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
    <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Отладка</value>
    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
    <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
    <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
    <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
   </valuemap>
   <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
    <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:/Users/USER/Documents/build-Probnec-Desktop_Qt_5_8_0_MinGW_32bit-Release</value>
    <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
     <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
      <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
      <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
      <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
      <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
      <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
      <value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
      <value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
     </valuemap>
     <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
      <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Сборка</value>
      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
      <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
      <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
      <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
      <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
      <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
     </valuemap>
     <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Сборка</value>
     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
     <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
    </valuemap>
    <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
     <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
      <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Сборка</value>
      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
      <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
      <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
      <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
      <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
      <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
     </valuemap>
     <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Очистка</value>
     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
     <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
    </valuemap>
    <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
    <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
    <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Выпуск</value>
    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
    <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
    <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
    <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
   </valuemap>
   <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
    <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:/Users/USER/Documents/build-Probnec-Desktop_Qt_5_8_0_MinGW_32bit-Profile</value>
    <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
     <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
      <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
      <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
      <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">true</value>
      <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
      <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
      <value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">true</value>
      <value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
     </valuemap>
     <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
      <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Сборка</value>
      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
      <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
      <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
      <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
      <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
      <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
     </valuemap>
     <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Сборка</value>
     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
     <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
    </valuemap>
    <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
     <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
      <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Сборка</value>
      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
      <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
      <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
      <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
      <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
      <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
     </valuemap>
     <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Очистка</value>
     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
     <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
    </valuemap>
    <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
    <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
    <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Профилирование</value>
    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
    <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
    <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
    <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
   </valuemap>
   <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">3</value>
   <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
    <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
     <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Установка</value>
     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
     <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
    </valuemap>
    <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Локальная установка</value>
    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
    <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
   </valuemap>
   <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
   <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
   <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
    <value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
    <value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
    <value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value>
    <value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value>
    <value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
    <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
    <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
    <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
    <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
    <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
    <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
    <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
    <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
    <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
    <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
    <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
    <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
    <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
    <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
    <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
    <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
    <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
    <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
     <value type="int">0</value>
     <value type="int">1</value>
     <value type="int">2</value>
     <value type="int">3</value>
     <value type="int">4</value>
     <value type="int">5</value>
     <value type="int">6</value>
     <value type="int">7</value>
     <value type="int">8</value>
     <value type="int">9</value>
     <value type="int">10</value>
     <value type="int">11</value>
     <value type="int">12</value>
     <value type="int">13</value>
     <value type="int">14</value>
    </valuelist>
    <value type="int" key="PE.EnvironmentAspect.Base">-1</value>
    <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
    <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Arguments"></value>
    <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable"></value>
    <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.WorkingDirectory">%{buildDir}</value>
    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Особая программа</value>
    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
    <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
    <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
    <value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
    <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
    <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
    <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
    <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
   </valuemap>
   <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
  </valuemap>
 </data>
 <data>
  <variable>ProjectExplorer.Project.TargetCount</variable>
  <value type="int">1</value>
 </data>
 <data>
  <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
  <value type="int">18</value>
 </data>
 <data>
  <variable>Version</variable>
  <value type="int">18</value>
 </data>
</qtcreator>


code:
#include <iostream>

struct DateStruct
{
    int day;
    int month;
    int year;
};

void print(DateStruct &date)
{
    std::cout << date.day << "/" << date.month << "/" << date.year;

}

int main()
{
    DateStruct today {12, 11, 2018};

    today.day =18;
    print(today);

    return 0;
}

repo_name: Shiroddex/probnec

license: unknown


code:
#include <iostream>

struct DateStruct
{
    int day;
    int month;
    int year;
};

void print(DateStruct &date)
{
    std::cout << date.day << "/" << date.month << "/" << sdate.year;

}

int main()
{
    DateStruct today {12, 11, 2018};

    today.day =18;
    print(today);

    return 0;
}


code:
#include <stdio.h>

void and(int a, int b)
{
	printf("%d & %d = %d\n", a, b, a & b);
}

void or(int a, int b)
{
	printf("%d | %d = %d\n", a, b, a | b);
}

void inversBit(int a)
{
	printf("~%d = %d\n", ~a);
}

void xor(int a, int b)
{
	printf("%d ^ %d = %d\n", a, b, a ^ b);
}

int main()
{

	return 0;
}

repo_name: cryptusman/learnC


code:
#include <stdio.h>
#include <math.h>

void fromIntToBinary(const float *number);

int main(int argc, char *argv[]) {

	float num = 30;
	fromIntToBinary(&num);
}

void fromIntToBinary(const float *number) {

	float copyNumber = *number;

	// buffer count for binary
	char buffer[80];
	size_t buffer_id = 0;

	// cicle for translate from numbers to binary
	while (copyNumber > 0) {

		// for integer
		if (floor(copyNumber) == copyNumber) {
			if (copyNumber != *number) {
				buffer[buffer_id] = '0';
			}
		// for float
		} else {
			copyNumber = (int)copyNumber;
			if (copyNumber != *number) {
				buffer[buffer_id] = '1';
			}
		}

		buffer_id++;
		copyNumber = copyNumber / 2;
	}

	// output binary numbers in reverse order
	for(size_t id = (buffer_id - 1); id > 0; id--) {
		printf("%c", buffer[id]);
	}
}


code:
#include <stdio.h>

int main()
{

	int i = 1;

	while(i == 1) {
		char c = getchar();

		switch(c) {
			case 'w':
				printf("up\n");
				break;
			case 'a':
				printf("left\n");
				break;
			case 'd':
				printf("right\n");
				break;
			case 's':
				printf("down\n");
				break;
			case 'p':
				i++;
				break;
			default:
				break;
		}
	}

	return 0;
}


code:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

void fromIntToBinary(const float *number);
void toRight(unsigned int a, unsigned int b);
void toLeft(unsigned int a, unsigned int b);

int main(int argc, char *argv[]) {

	toLeft(12, 1);
	toRight(12, 1);

	return 0;
}

void fromIntToBinary(const float *number) {

	float copyNumber = *number;

	// buffer count for binary
	char buffer[80];
	size_t buffer_id = 0;

	// cicle for translate from numbers to binary
	while (copyNumber > 0) {

		// for integer
		if (floor(copyNumber) == copyNumber) {
			if (copyNumber != *number) {
				buffer[buffer_id] = '0';
			}
		// for float
		} else {
			copyNumber = (int)copyNumber;
			if (copyNumber != *number) {
				buffer[buffer_id] = '1';
			}
		}

		buffer_id++;
		copyNumber = copyNumber / 2;
	}

	// output binary numbers in reverse order
	for(size_t id = (buffer_id - 1); id > 0; id--) {
		printf("%c", buffer[id]);
	}
}

void toRight(unsigned int a, unsigned int b) {

	float aa = ((float)a);

	fromIntToBinary(&aa);
	unsigned int c = a >> b;
	float cc = ((float) c);

	printf("(%d) >> %d = ", a, b);
	fromIntToBinary(&cc);
	printf("(%d)\n", c);

}

void toLeft(unsigned int a, unsigned int b) {

	float aa = ((float)a);

	fromIntToBinary(&aa);
	unsigned int c = a << b;
	float cc = ((float) c);

	printf("(%d) << %d = ", a, b);
	fromIntToBinary(&cc);
	printf("(%d)\n", c);

}

/*
result:

1100(12) << 1 = 11000(24)
1100(12) >> 1 = 110(6)

*/


code:
.idea
CMakeCache.txt
CMakeFiles
Makefile
cmake_install.cmake
install_manifest.txt
build
bin
3ds_portlibs

res/sdmc
*.shbin

path: .gitignore


code:
[submodule "external/tween-engine"]
	path = external/tween-engine
	url = https://github.com/cpp3ds/universal-tween-engine-cpp.git

path: .gitmodules


code:
cmake_minimum_required(VERSION 2.8.11)

option(BUILD_EMULATOR "Build with cpp3ds emulator (Qt5 required)" OFF)
option(BUILD_TESTS "Build unit tests" OFF)

# Project name without spaces or special characters
project("cpp3ds-temp-re")

set(APP_TITLE "CPPTemplate")
set(APP_DESCRIPTION "CPP3DS Template 2.0")
set(APP_AUTHOR "arc13")
set(APP_ICON ${PROJECT_SOURCE_DIR}/res/app/icon.png)

# First one is Title Version, second is the readable version
set(APP_VERSION 1024)

# CIA settings
set(APP_UNIQUE_ID 0xC663D) # This must be unique for your CIA project
set(APP_PRODUCT_CODE ${PROJECT_NAME})
set(BANNER_IMAGE ${PROJECT_SOURCE_DIR}/res/app/banner.png)
set(BANNER_SOUND ${PROJECT_SOURCE_DIR}/res/app/banner.wav)
set(ICON_FLAGS --flags visible,ratingrequired,recordusage,savedata --cero 153 --esrb 153 --usk 153 --pegigen 153 --pegiptr 153 --pegibbfc 153 --cob 153 --grb 153 --cgsrr 153)
set(CIA_CONFIG ${PROJECT_SOURCE_DIR}/res/app/cia.rsf)

# Include cpp3ds cmake module
set(CPP3DS $ENV{CPP3DS})
if(NOT CPP3DS)
	message(FATAL_ERROR "You need to set the env variable CPP3DS before compiling.")
endif()
set(CMAKE_MODULE_PATH "${CPP3DS}/cmake" ${CMAKE_MODULE_PATH})
include(cpp3ds)

include_directories(
	${PROJECT_SOURCE_DIR}/external/tween-engine/include
)
FILE(GLOB_RECURSE TWEEN_ENGINE_SOURCE ${PROJECT_SOURCE_DIR}/external/tween-engine/src/*.cpp)

set(SOURCE_FILES
	${PROJECT_SOURCE_DIR}/src/main.cpp
	${PROJECT_SOURCE_DIR}/src/Template.cpp
	${PROJECT_SOURCE_DIR}/src/MusicBCSTM.cpp
	${PROJECT_SOURCE_DIR}/src/Util.cpp
	${PROJECT_SOURCE_DIR}/src/AssetManager.hpp
	${PROJECT_SOURCE_DIR}/src/Notification.cpp
	${PROJECT_SOURCE_DIR}/src/Keyboard/Keyboard.cpp
	${PROJECT_SOURCE_DIR}/src/Keyboard/tinyxml2.cpp
	${PROJECT_SOURCE_DIR}/src/GUI/Button.cpp
	${PROJECT_SOURCE_DIR}/src/GUI/NinePatch.cpp
	${PROJECT_SOURCE_DIR}/src/GUI/Scrollable.cpp
	${PROJECT_SOURCE_DIR}/src/GUI/ScrollBar.cpp
	${PROJECT_SOURCE_DIR}/src/States/State.cpp
	${PROJECT_SOURCE_DIR}/src/States/StateStack.cpp
	${PROJECT_SOURCE_DIR}/src/States/DefaultState.cpp
	${TWEEN_ENGINE_SOURCE}
)

set(ARM_SOURCE_FILES
	${PROJECT_SOURCE_DIR}/src/KeyboardApplet.cpp
)

# Use either nihstro or picasso for your shader scripts
set(SHADER_AS nihstro)
FILE(GLOB_RECURSE SHADER_FILES ${PROJECT_SOURCE_DIR}/res/romfs/shaders/[^.]*.vsh)

##################################################
# Don't usually need to change anything below
##################################################
set(CPP3DS_ARM_FLAGS "-g -O3 -march=armv6k -mtune=mpcore -mfloat-abi=hard -mtp=soft")
set(CPP3DS_EMU_FLAGS "-O0")
set(TEST_FLAGS "-O0 -coverage")
include_directories(${DEVKITPRO}/portlibs/armv6k/include)

set(CPP3DS_ARM_LIBS cpp3ds-window cpp3ds-network cpp3ds-graphics cpp3ds-audio cpp3ds-system citro3d ctru freetype png z vorbisidec ogg archive faad fmt)
set(CPP3DS_EMU_LIBS cpp3ds-emu sfml-graphics sfml-window sfml-system sfml-audio openal GLEW GL jpeg freetype vorbisfile vorbis ogg ssl crypto pthread archive faad fmt)

add_subdirectory(${CPP3DS}/cmake/template_arm build/arm)
if(BUILD_EMULATOR)
add_subdirectory(${CPP3DS}/cmake/template_emu build/emu)
endif()
if(BUILD_TESTS)
	add_subdirectory(test)
endif()


code:
# cpp3ds-template-v2
An updated and more complete template to get started with cpp3ds.
Don't forget to check the [cpp3ds's documentation](http://cpp3ds.github.io/docs/annotated.htm).

### How to build
You will need at first the [cpp3ds library](https://github.com/Naxann/cpp3ds), whose location must be defined
in the environment variable CPP3DS.

To build from source on a Linux/UNIX-based system, run the following commands:

	mkdir -p build
	cd build
	cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_EMULATOR=ON -DBUILD_TESTS=ON ..
	make -j4

*-DCMAKE_BUILD_TYPE* can be set to either "Release" or "Debug" (without the quotes):

**Release** is the mode chosen when you are about to release/update your app, the debugging console on the bottom screen and the FPS counter on the top screen will not be drawn in this mode.

**Debug** is the mode chosen when you are developing your application, this mode will allow you to see the debugging console and the FPS counter, useful to debug your application.

### Compiled files
**3DS**: The files **[project-name].3dsx** and **[project-name].cia** are usable by the 3DS to test your application on the real hardware.

**Computer**: The file **[project-name]-emu** is usable to test your application without the needs of install the app on the 3DS.

Note: The emulator *can't* run libctru's functions.

### How to use
You can start to dev your app in the *States/DefaultState.cpp* file, some examples are in this file.

### Random help
* You can use libctru functions in your cpp3ds project, but you need to put your libctru functions between **##ifndef EMULATION** and **##endif**. Example:

```
#include <cpp3ds/Graphics/Sprite.hpp>
##ifndef EMULATION
// 3ds.h must ALWAYS be included between ifndef EMULATION too
#include <3ds.h>
##endif

RandomClass::RandomClass()
{
    // Random things
    cpp3ds::Sprite randomSprite;
    randomSprite.setPosition(5.f, 5.f);

    cpp3ds::Uint8 systemLanguage = 0;
##ifndef EMULATION
    // Here, the code will NOT be compiled for the emulator
    // Calling the libctru's function CFGU_GetSystemLanguage
    CFGU_GetSystemLanguage(&systemLanguage);
##endif

    // Other things
}
```

* In the *CMakeLists.txt* file, you will want to modify some values:

L7: **project("project-name")** - Enter your project name here without space or special characters

L9: **APP_TITLE** - The title of your app that will appear on the HOME Menu and on other places

L10: **APP_DESCRIPTION** - The description of your app that will appear on the HOME Menu and on other places

L11: **APP_AUTHOR** - The author(s) of your app that will appear on the HOME Menu and on other places

L15: **APP_VERSION** - The version of your app, each update of your app have to see this number incremented, checkout my [converter for Linux](https://notabug.org/arc13/titleVersionConverter)

L18: **APP_UNIQUE_ID** - The product ID of your app, must be an hexadecimal value

* You can find your app's icon, banner, banner sound and .rsf in the *res/app* directory
* You can put the assets of your app in the *res/romfs* directory
* The *res/sdmc* directory is generated by the emulator to emulate the SD card
* The generated binaries are in the *bin/* directory, when *make -j4* is executed, and the compilation is successful, this should include: A **[project-name].3dsx** and a **[project-name].cia** file for the 3DS, a **[project-name]-emu** (the emulator) and a **[project-name]-tests** file for the computer, and a [project-name].bnr, [project-name].elf and [project-name].smdh file.

### Credits
* [Cruel](https://github.com/Cruel) - For cpp3ds and it's template
* [Naxann](https://github.com/Naxann) - To keep alive [cpp3ds](https://github.com/Naxann/cpp3ds)


code:
BasicInfo:
  Title                   : $(APP_TITLE)
  ProductCode             : $(APP_PRODUCT_CODE)
  Logo                    : Homebrew

RomFs:
  # Specifies the root path of the read only file system to include in the ROM.
  RootPath                : "res/romfs"

TitleInfo:
  Category                : Application
  UniqueId                : $(APP_UNIQUE_ID)

Option:
  UseOnSD                 : true # true if App is to be installed to SD
  FreeProductCode         : true # Removes limitations on ProductCode
  MediaFootPadding        : false # If true CCI files are created with padding
  EnableCrypt             : false # Enables encryption for NCCH and CIA
  EnableCompress          : false # Compresses where applicable (currently only exefs:/.code)

AccessControlInfo:
  CoreVersion                   : 2

  # Exheader Format Version
  DescVersion                   : 2

  # Minimum Required Kernel Version (below is for 4.5.0)
  ReleaseKernelMajor            : "02"
  ReleaseKernelMinor            : "33"

  # ExtData
  UseExtSaveData                : false # enables ExtData
  #ExtSaveDataId                : 0x300 # only set this when the ID is different to the UniqueId

  # FS:USER Archive Access Permissions
  # Uncomment as required
  FileSystemAccess:
   - CategorySystemApplication
   - CategoryHardwareCheck
   - CategoryFileSystemTool
   - Debug
   - TwlCardBackup
   - TwlNandData
   - Boss
   - DirectSdmc
   - Core
   - CtrNandRo
   - CtrNandRw
   - CtrNandRoWrite
   - CategorySystemSettings
   - CardBoard
   - ExportImportIvs
   - DirectSdmcWrite
   - SwitchCleanup
   - SaveDataMove
   - Shop
   - Shell
   - CategoryHomeMenu
   - SeedDB
  IoAccessControl:
   - FsMountNand
   - FsMountNandRoWrite
   - FsMountTwln
   - FsMountWnand
   - FsMountCardSpi
   - UseSdif3
   - CreateSeed
   - UseCardSpi

  # Process Settings
  MemoryType                    : Application # Application/System/Base
  SystemMode                    : 64MB # 64MB(Default)/96MB/80MB/72MB/32MB
  IdealProcessor                : 0
  AffinityMask                  : 1
  Priority                      : 16
  MaxCpu                        : 0 # Let system decide
  HandleTableSize               : 0x200
  DisableDebug                  : false
  EnableForceDebug              : false
  CanWriteSharedPage            : true
  CanUsePrivilegedPriority      : false
  CanUseNonAlphabetAndNumber    : true
  PermitMainFunctionArgument    : true
  CanShareDeviceMemory          : true
  RunnableOnSleep               : false
  SpecialMemoryArrange          : true

  # New3DS Exclusive Process Settings
  #SystemModeExt                 : 128MB # Legacy(Default)/124MB/178MB  Legacy:Use Old3DS SystemMode
  CpuSpeed                      : 804MHz # 268MHz(Default)/804MHz
  EnableL2Cache                 : true # false(default)/true
  CanAccessCore2                : true

  # Virtual Address Mappings
  IORegisterMapping:
   - 1ff00000-1ff7ffff   # DSP memory
  MemoryMapping:
   - 1f000000-1f5fffff:r # VRAM

  # Accessible SVCs, <Name>:<ID>
  SystemCallAccess:
    ControlMemory: 1
    QueryMemory: 2
    ExitProcess: 3
    GetProcessAffinityMask: 4
    SetProcessAffinityMask: 5
    GetProcessIdealProcessor: 6
    SetProcessIdealProcessor: 7
    CreateThread: 8
    ExitThread: 9
    SleepThread: 10
    GetThreadPriority: 11
    SetThreadPriority: 12
    GetThreadAffinityMask: 13
    SetThreadAffinityMask: 14
    GetThreadIdealProcessor: 15
    SetThreadIdealProcessor: 16
    GetCurrentProcessorNumber: 17
    Run: 18
    CreateMutex: 19
    ReleaseMutex: 20
    CreateSemaphore: 21
    ReleaseSemaphore: 22
    CreateEvent: 23
    SignalEvent: 24
    ClearEvent: 25
    CreateTimer: 26
    SetTimer: 27
    CancelTimer: 28
    ClearTimer: 29
    CreateMemoryBlock: 30
    MapMemoryBlock: 31
    UnmapMemoryBlock: 32
    CreateAddressArbiter: 33
    ArbitrateAddress: 34
    CloseHandle: 35
    WaitSynchronization1: 36
    WaitSynchronizationN: 37
    SignalAndWait: 38
    DuplicateHandle: 39
    GetSystemTick: 40
    GetHandleInfo: 41
    GetSystemInfo: 42
    GetProcessInfo: 43
    GetThreadInfo: 44
    ConnectToPort: 45
    SendSyncRequest1: 46
    SendSyncRequest2: 47
    SendSyncRequest3: 48
    SendSyncRequest4: 49
    SendSyncRequest: 50
    OpenProcess: 51
    OpenThread: 52
    GetProcessId: 53
    GetProcessIdOfThread: 54
    GetThreadId: 55
    GetResourceLimit: 56
    GetResourceLimitLimitValues: 57
    GetResourceLimitCurrentValues: 58
    GetThreadContext: 59
    Break: 60
    OutputDebugString: 61
    ControlPerformanceCounter: 62
    CreatePort: 71
    CreateSessionToPort: 72
    CreateSession: 73
    AcceptSession: 74
    ReplyAndReceive1: 75
    ReplyAndReceive2: 76
    ReplyAndReceive3: 77
    ReplyAndReceive4: 78
    ReplyAndReceive: 79
    BindInterrupt: 80
    UnbindInterrupt: 81
    InvalidateProcessDataCache: 82
    StoreProcessDataCache: 83
    FlushProcessDataCache: 84
    StartInterProcessDma: 85
    StopDma: 86
    GetDmaState: 87
    RestartDma: 88
    DebugActiveProcess: 96
    BreakDebugProcess: 97
    TerminateDebugProcess: 98
    GetProcessDebugEvent: 99
    ContinueDebugEvent: 100
    GetProcessList: 101
    GetThreadList: 102
    GetDebugThreadContext: 103
    SetDebugThreadContext: 104
    QueryDebugProcessMemory: 105
    ReadProcessMemory: 106
    WriteProcessMemory: 107
    SetHardwareBreakPoint: 108
    GetDebugThreadParam: 109
    ControlProcessMemory: 112
    MapProcessMemory: 113
    UnmapProcessMemory: 114
    CreateCodeSet: 115
    CreateProcess: 117
    TerminateProcess: 118
    SetProcessResourceLimits: 119
    CreateResourceLimit: 120
    SetResourceLimitValues: 121
    AddCodeSegment: 122
    Backdoor: 123
    KernelSetState: 124
    QueryProcessMemory: 125

  # Service List
  # Maximum 34 services (32 if firmware is prior to 9.3.0)
  ServiceAccessControl:
   - cfg:u
   - fs:USER
   - gsp::Gpu
   - hid:USER
   - ndm:u
   - pxi:dev
   - APT:U
   - ac:u
   - act:u
   - am:net
   - cam:u
   - cecd:u
   - dsp::DSP
   - frd:u
   - http:C
   - ir:USER
   - ir:u
   - ir:rst
   - ldr:ro
   - gsp::Lcd
   - news:u
   - mcu::HWC
   - nim:s
   - nwm::UDS
   - ptm:u
   - qtm:u
   - soc:U
   - ssl:C
   - ptm:sysm
   - am:u
   - ns:s
   - nwm::EXT

SystemControlInfo:
  SaveDataSize: 0K
  RemasterVersion: 0
  StackSize: 0x8000

  # Modules that run services listed above should be included below
  # Maximum 48 dependencies
  # If a module is listed that isn't present on the 3DS, the title will get stuck at the logo (3ds waves)
  # So act, nfc and qtm are commented for 4.x support. Uncomment if you need these.
  # <module name>:<module titleid>
  Dependency:
    ac: 0x0004013000002402
    #act: 0x0004013000003802
    am: 0x0004013000001502
    boss: 0x0004013000003402
    camera: 0x0004013000001602
    cecd: 0x0004013000002602
    cfg: 0x0004013000001702
    codec: 0x0004013000001802
    csnd: 0x0004013000002702
    dlp: 0x0004013000002802
    dsp: 0x0004013000001a02
    friends: 0x0004013000003202
    gpio: 0x0004013000001b02
    gsp: 0x0004013000001c02
    hid: 0x0004013000001d02
    http: 0x0004013000002902
    i2c: 0x0004013000001e02
    ir: 0x0004013000003302
    mcu: 0x0004013000001f02
    mic: 0x0004013000002002
    ndm: 0x0004013000002b02
    news: 0x0004013000003502
    #nfc: 0x0004013000004002
    nim: 0x0004013000002c02
    nwm: 0x0004013000002d02
    pdn: 0x0004013000002102
    ps: 0x0004013000003102
    ptm: 0x0004013000002202
    #qtm: 0x0004013020004202
    ro: 0x0004013000003702
    socket: 0x0004013000002e02
    spi: 0x0004013000002302
    ssl: 0x0004013000002f02


code:
<keyboard image="keyboard.png" default-layout="lowercase">
	<style name="basic">
		<state name="default">
			<text fontsize="12" offsetx="10" offsety="5" color="#FFFFFFFF"></text>
			<image x="0" y="0" w="28" h="28"></image>
		</state>
		<state name="active">
			<text fontsize="12" offsetx="11" offsety="6" color="#FFFFFFFF"></text>
			<image x="28" y="0" w="28" h="28"></image>
		</state>
	</style>
	<style name="spacebar">
		<state name="default"><image x="0" y="56" w="128" h="28"></image></state>
		<state name="active"><image x="0" y="84" w="128" h="28"></image></state>
	</style>
	<style name="special">
		<state name="default">
			<text fontsize="12" offsetx="7" offsety="5" color="#FFFFFFFF"></text>
			<image x="0" y="28" w="56" h="28"></image>
		</state>
		<state name="active">
			<text fontsize="12" offsetx="8" offsety="6" color="#FFFFFFFF"></text>
			<image x="56" y="28" w="56" h="28"></image>
		</state>
	</style>
	<style name="enter">
		<state name="default"><image x="56" y="0" w="56" h="28"></image></state>
		<state name="active"><image x="128" y="56" w="56" h="28"></image></state>
	</style>
	<style name="shift">
		<state name="default"><image x="145" y="0" w="56" h="28"></image></state>
		<state name="active"><image x="145" y="28" w="56" h="28"></image></state>
	</style>
	<style name="backspace">
		<state name="default"><image x="112" y="0" w="33" h="23"></image></state>
		<state name="active"><image x="112" y="23" w="33" h="23"></image></state>
	</style>
	<style name="input">
		<state name="default">
			<text fontsize="14" offsetx="-20" offsety="4" color="#FFFFFFFF"></text>
			<image x="255" y="0" w="1" h="28"></image>
		</state>
		<state name="active"><image x="255" y="0" w="1" h="28"></image></state>
	</style>

	<input style="input" x="0" y="58" w="320" h="28" max-width="260" cursor-color="#FFFFFFFF" cursor-height="22"></input>

	<layout name="lowercase" label="abc123">
		<button style="basic" x="6" y="88" w="28" h="28">1</button>
		<button style="basic" x="36" y="88" w="28" h="28">2</button>
		<button style="basic" x="66" y="88" w="28" h="28">3</button>
		<button style="basic" x="96" y="88" w="28" h="28">4</button>
		<button style="basic" x="126" y="88" w="28" h="28">5</button>
		<button style="basic" x="156" y="88" w="28" h="28">6</button>
		<button style="basic" x="186" y="88" w="28" h="28">7</button>
		<button style="basic" x="216" y="88" w="28" h="28">8</button>
		<button style="basic" x="246" y="88" w="28" h="28">9</button>
		<button style="basic" x="276" y="88" w="28" h="28">0</button>

		<button style="basic" x="10" y="118" w="28" h="28">a</button>
		<button style="basic" x="40" y="118" w="28" h="28">z</button>
		<button style="basic" x="70" y="118" w="28" h="28">e</button>
		<button style="basic" x="100" y="118" w="28" h="28">r</button>
		<button style="basic" x="130" y="118" w="28" h="28">t</button>
		<button style="basic" x="160" y="118" w="28" h="28">y</button>
		<button style="basic" x="190" y="118" w="28" h="28">u</button>
		<button style="basic" x="220" y="118" w="28" h="28">i</button>
		<button style="basic" x="250" y="118" w="28" h="28">o</button>
		<button style="basic" x="280" y="118" w="28" h="28">p</button>

		<button style="basic" x="18" y="148" w="28" h="28">q</button>
		<button style="basic" x="48" y="148" w="28" h="28">s</button>
		<button style="basic" x="78" y="148" w="28" h="28">d</button>
		<button style="basic" x="108" y="148" w="28" h="28">f</button>
		<button style="basic" x="138" y="148" w="28" h="28">g</button>
		<button style="basic" x="168" y="148" w="28" h="28">h</button>
		<button style="basic" x="198" y="148" w="28" h="28">j</button>
		<button style="basic" x="228" y="148" w="28" h="28">k</button>
		<button style="basic" x="258" y="148" w="28" h="28">l</button>
		<button style="basic" x="288" y="148" w="28" h="28">m</button>

		<button style="basic" x="30" y="178" w="28" h="28">w</button>
		<button style="basic" x="60" y="178" w="28" h="28">x</button>
		<button style="basic" x="90" y="178" w="28" h="28">c</button>
		<button style="basic" x="120" y="178" w="28" h="28">v</button>
		<button style="basic" x="150" y="178" w="28" h="28">b</button>
		<button style="basic" x="180" y="178" w="28" h="28">n</button>
		<button style="basic" x="210" y="178" w="28" h="28">'</button>
		<button type="layoutchangetemp" layout="uppercase" style="shift" x="250" y="178" w="56" h="28"></button>

		<button style="basic" x="194" y="208" w="28" h="28">,</button>
		<button style="basic" x="224" y="208" w="28" h="28">.</button>

		<button type="backspace" style="backspace" x="280" y="60" w="33" h="23"></button>

		<button style="spacebar" x="66" y="208" w="126" h="28"> </button>
		<button type="enter" style="enter" x="254" y="208" w="56" h="28"></button>
		<button type="layoutchange" layout="uppercase" style="special" x="5" y="208" w="58" h="28">ABC?#%</button>
	</layout>
	<layout name="uppercase" label="ABC?#%">
		<button style="basic" x="6" y="88" w="28" h="28">!</button>
		<button style="basic" x="36" y="88" w="28" h="28">@</button>
		<button style="basic" x="66" y="88" w="28" h="28">#</button>
		<button style="basic" x="96" y="88" w="28" h="28">$</button>
		<button style="basic" x="126" y="88" w="28" h="28">%</button>
		<button style="basic" x="156" y="88" w="28" h="28">^</button>
		<button style="basic" x="186" y="88" w="28" h="28">&</button>
		<button style="basic" x="216" y="88" w="28" h="28">*</button>
		<button style="basic" x="246" y="88" w="28" h="28">(</button>
		<button style="basic" x="276" y="88" w="28" h="28">)</button>

		<button style="basic" x="10" y="118" w="28" h="28">A</button>
		<button style="basic" x="40" y="118" w="28" h="28">Z</button>
		<button style="basic" x="70" y="118" w="28" h="28">E</button>
		<button style="basic" x="100" y="118" w="28" h="28">R</button>
		<button style="basic" x="130" y="118" w="28" h="28">T</button>
		<button style="basic" x="160" y="118" w="28" h="28">Y</button>
		<button style="basic" x="190" y="118" w="28" h="28">U</button>
		<button style="basic" x="220" y="118" w="28" h="28">I</button>
		<button style="basic" x="250" y="118" w="28" h="28">O</button>
		<button style="basic" x="280" y="118" w="28" h="28">P</button>

		<button style="basic" x="18" y="148" w="28" h="28">Q</button>
		<button style="basic" x="48" y="148" w="28" h="28">S</button>
		<button style="basic" x="78" y="148" w="28" h="28">D</button>
		<button style="basic" x="108" y="148" w="28" h="28">F</button>
		<button style="basic" x="138" y="148" w="28" h="28">G</button>
		<button style="basic" x="168" y="148" w="28" h="28">H</button>
		<button style="basic" x="198" y="148" w="28" h="28">J</button>
		<button style="basic" x="228" y="148" w="28" h="28">K</button>
		<button style="basic" x="258" y="148" w="28" h="28">L</button>
		<button style="basic" x="288" y="148" w="28" h="28">M</button>

		<button style="basic" x="30" y="178" w="28" h="28">W</button>
		<button style="basic" x="60" y="178" w="28" h="28">X</button>
		<button style="basic" x="90" y="178" w="28" h="28">C</button>
		<button style="basic" x="120" y="178" w="28" h="28">V</button>
		<button style="basic" x="150" y="178" w="28" h="28">B</button>
		<button style="basic" x="180" y="178" w="28" h="28">N</button>
		<button style="basic" x="210" y="178" w="28" h="28">"</button>
		<button type="layoutchange" layout="lowercase" style="shift" x="250" y="178" w="56" h="28"></button>

		<button style="basic" x="194" y="208" w="28" h="28">-</button>
		<button style="basic" x="224" y="208" w="28" h="28">?</button>

		<button type="backspace" style="backspace" x="280" y="60" w="33" h="23"></button>

		<button style="spacebar" x="66" y="208" w="126" h="28"> </button>
		<button type="enter" style="enter" x="254" y="208" w="56" h="28"></button>
		<button type="layoutchange" layout="lowercase" style="special" x="5" y="208" w="58" h="28">abc123</button>
	</layout>
</keyboard>


code:
<keyboard image="keyboard.png" default-layout="firstPage">
	<style name="basic">
		<state name="default">
			<text fontsize="12" offsetx="10" offsety="5" color="#FFFFFFFF"></text>
			<image x="0" y="0" w="28" h="28"></image>
		</state>
		<state name="active">
			<text fontsize="12" offsetx="11" offsety="6" color="#FFFFFFFF"></text>
			<image x="28" y="0" w="28" h="28"></image>
		</state>
	</style>
	<style name="spacebar">
		<state name="default"><image x="0" y="56" w="128" h="28"></image></state>
		<state name="active"><image x="0" y="84" w="128" h="28"></image></state>
	</style>
	<style name="special">
		<state name="default">
			<text fontsize="12" offsetx="7" offsety="5" color="#FFFFFFFF"></text>
			<image x="0" y="28" w="56" h="28"></image>
		</state>
		<state name="active">
			<text fontsize="12" offsetx="8" offsety="6" color="#FFFFFFFF"></text>
			<image x="56" y="28" w="56" h="28"></image>
		</state>
	</style>
	<style name="enter">
		<state name="default"><image x="56" y="0" w="56" h="28"></image></state>
		<state name="active"><image x="128" y="56" w="56" h="28"></image></state>
	</style>
	<style name="shift">
		<state name="default"><image x="145" y="0" w="56" h="28"></image></state>
		<state name="active"><image x="145" y="28" w="56" h="28"></image></state>
	</style>
	<style name="backspace">
		<state name="default"><image x="112" y="0" w="33" h="23"></image></state>
		<state name="active"><image x="112" y="23" w="33" h="23"></image></state>
	</style>
	<style name="input">
		<state name="default">
			<text fontsize="14" offsetx="-20" offsety="4" color="#FFFFFFFF"></text>
			<image x="255" y="0" w="1" h="28"></image>
		</state>
		<state name="active"><image x="255" y="0" w="1" h="28"></image></state>
	</style>

	<input style="input" x="0" y="58" w="320" h="28" max-width="260" cursor-color="#FFFFFFFF" cursor-height="22"></input>

	<layout name="firstPage" label="1..">
		<button style="basic" x="6" y="88" w="28" h="28">1</button>
		<button style="basic" x="36" y="88" w="28" h="28">2</button>
		<button style="basic" x="66" y="88" w="28" h="28">3</button>
		<button style="basic" x="96" y="88" w="28" h="28">4</button>
		<button style="basic" x="126" y="88" w="28" h="28">5</button>
		<button style="basic" x="156" y="88" w="28" h="28">6</button>
		<button style="basic" x="186" y="88" w="28" h="28">7</button>
		<button style="basic" x="216" y="88" w="28" h="28">8</button>
		<button style="basic" x="246" y="88" w="28" h="28">9</button>
		<button style="basic" x="276" y="88" w="28" h="28">0</button>

		<button style="basic" x="10" y="118" w="28" h="28">ア</button>
		<button style="basic" x="40" y="118" w="28" h="28">カ</button>
		<button style="basic" x="70" y="118" w="28" h="28">サ</button>
		<button style="basic" x="100" y="118" w="28" h="28">タ</button>
		<button style="basic" x="130" y="118" w="28" h="28">ナ</button>
		<button style="basic" x="160" y="118" w="28" h="28">ハ</button>
		<button style="basic" x="190" y="118" w="28" h="28">マ</button>
		<button style="basic" x="220" y="118" w="28" h="28">ヤ</button>
		<button style="basic" x="250" y="118" w="28" h="28">ラ</button>
		<button style="basic" x="280" y="118" w="28" h="28">ワ</button>

		<button style="basic" x="18" y="148" w="28" h="28">ガ</button>
		<button style="basic" x="48" y="148" w="28" h="28">ザ</button>
		<button style="basic" x="78" y="148" w="28" h="28">ダ</button>
		<button style="basic" x="108" y="148" w="28" h="28">バ</button>
		<button style="basic" x="138" y="148" w="28" h="28">パ</button>
		<button style="basic" x="168" y="148" w="28" h="28">イ</button>
		<button style="basic" x="198" y="148" w="28" h="28">キ</button>
		<button style="basic" x="228" y="148" w="28" h="28">シ</button>
		<button style="basic" x="258" y="148" w="28" h="28">チ</button>
		<button style="basic" x="288" y="148" w="28" h="28">ニ</button>

		<button style="basic" x="30" y="178" w="28" h="28">ヒ</button>
		<button style="basic" x="60" y="178" w="28" h="28">ミ</button>
		<button style="basic" x="90" y="178" w="28" h="28">リ</button>
		<button style="basic" x="120" y="178" w="28" h="28">ヰ</button>
		<button style="basic" x="150" y="178" w="28" h="28">ギ</button>
		<button style="basic" x="180" y="178" w="28" h="28">ジ</button>
		<button style="basic" x="210" y="178" w="28" h="28">ヂ</button>

		<button style="basic" x="194" y="208" w="28" h="28">,</button>
		<button style="basic" x="224" y="208" w="28" h="28">.</button>

		<button type="backspace" style="backspace" x="280" y="60" w="33" h="23"></button>

		<button style="spacebar" x="66" y="208" w="126" h="28"> </button>
		<button type="enter" style="enter" x="254" y="208" w="56" h="28"></button>
		<button type="layoutchange" layout="secondPage" style="special" x="5" y="208" w="58" h="28">1..</button>
	</layout>
	<layout name="secondPage" label=".2.">
		<button style="basic" x="6" y="88" w="28" h="28">!</button>
		<button style="basic" x="36" y="88" w="28" h="28">@</button>
		<button style="basic" x="66" y="88" w="28" h="28">#</button>
		<button style="basic" x="96" y="88" w="28" h="28">$</button>
		<button style="basic" x="126" y="88" w="28" h="28">%</button>
		<button style="basic" x="156" y="88" w="28" h="28">^</button>
		<button style="basic" x="186" y="88" w="28" h="28">&</button>
		<button style="basic" x="216" y="88" w="28" h="28">*</button>
		<button style="basic" x="246" y="88" w="28" h="28">(</button>
		<button style="basic" x="276" y="88" w="28" h="28">)</button>

		<button style="basic" x="10" y="118" w="28" h="28">ビ</button>
		<button style="basic" x="40" y="118" w="28" h="28">ピ</button>
		<button style="basic" x="70" y="118" w="28" h="28">ウ</button>
		<button style="basic" x="100" y="118" w="28" h="28">ク</button>
		<button style="basic" x="130" y="118" w="28" h="28">ス</button>
		<button style="basic" x="160" y="118" w="28" h="28">ツ</button>
		<button style="basic" x="190" y="118" w="28" h="28">ヌ</button>
		<button style="basic" x="220" y="118" w="28" h="28">フ</button>
		<button style="basic" x="250" y="118" w="28" h="28">ム</button>
		<button style="basic" x="280" y="118" w="28" h="28">ユ</button>

		<button style="basic" x="18" y="148" w="28" h="28">ル</button>
		<button style="basic" x="48" y="148" w="28" h="28">グ</button>
		<button style="basic" x="78" y="148" w="28" h="28">ズ</button>
		<button style="basic" x="108" y="148" w="28" h="28">ヅ</button>
		<button style="basic" x="138" y="148" w="28" h="28">ブ</button>
		<button style="basic" x="168" y="148" w="28" h="28">プ</button>
		<button style="basic" x="198" y="148" w="28" h="28">エ</button>
		<button style="basic" x="228" y="148" w="28" h="28">ケ</button>
		<button style="basic" x="258" y="148" w="28" h="28">セ</button>
		<button style="basic" x="288" y="148" w="28" h="28">テ</button>

		<button style="basic" x="30" y="178" w="28" h="28">ネ</button>
		<button style="basic" x="60" y="178" w="28" h="28">ヘ</button>
		<button style="basic" x="90" y="178" w="28" h="28">メ</button>
		<button style="basic" x="120" y="178" w="28" h="28">レ</button>
		<button style="basic" x="150" y="178" w="28" h="28">ヱ</button>
		<button style="basic" x="180" y="178" w="28" h="28">ゲ</button>
		<button style="basic" x="210" y="178" w="28" h="28">ゼ</button>

		<button style="basic" x="194" y="208" w="28" h="28">-</button>
		<button style="basic" x="224" y="208" w="28" h="28">?</button>

		<button type="backspace" style="backspace" x="280" y="60" w="33" h="23"></button>

		<button style="spacebar" x="66" y="208" w="126" h="28"> </button>
		<button type="enter" style="enter" x="254" y="208" w="56" h="28"></button>
		<button type="layoutchange" layout="thirdPage" style="special" x="5" y="208" w="58" h="28">.2.</button>
	</layout>
	<layout name="thirdPage" label="..3">
		<button style="basic" x="6" y="88" w="28" h="28">デ</button>
		<button style="basic" x="36" y="88" w="28" h="28">ベ</button>
		<button style="basic" x="66" y="88" w="28" h="28">ペ</button>
		<button style="basic" x="96" y="88" w="28" h="28">オ</button>
		<button style="basic" x="126" y="88" w="28" h="28">コ</button>
		<button style="basic" x="156" y="88" w="28" h="28">ソ</button>
		<button style="basic" x="186" y="88" w="28" h="28">ト</button>
		<button style="basic" x="216" y="88" w="28" h="28">ノ</button>
		<button style="basic" x="246" y="88" w="28" h="28">ホ</button>
		<button style="basic" x="276" y="88" w="28" h="28">モ</button>

		<button style="basic" x="10" y="118" w="28" h="28">ヨ</button>
		<button style="basic" x="40" y="118" w="28" h="28">ロ</button>
		<button style="basic" x="70" y="118" w="28" h="28">ヲ</button>
		<button style="basic" x="100" y="118" w="28" h="28">ゴ</button>
		<button style="basic" x="130" y="118" w="28" h="28">ゾ</button>
		<button style="basic" x="160" y="118" w="28" h="28">ド</button>
		<button style="basic" x="190" y="118" w="28" h="28">ボ</button>
		<button style="basic" x="220" y="118" w="28" h="28">ポ</button>

		<button style="basic" x="30" y="178" w="28" h="28">ヴ</button>
		<button style="basic" x="60" y="178" w="28" h="28">ッ</button>
		<button style="basic" x="90" y="178" w="28" h="28">ン</button>
		<button style="basic" x="120" y="178" w="28" h="28">・</button>
		<button style="basic" x="150" y="178" w="28" h="28">ー</button>
		<button style="basic" x="180" y="178" w="28" h="28">ヽ</button>
		<button style="basic" x="210" y="178" w="28" h="28">ヾ</button>

		<button style="basic" x="194" y="208" w="28" h="28">、</button>
		<button style="basic" x="224" y="208" w="28" h="28">。</button>

		<button type="backspace" style="backspace" x="280" y="60" w="33" h="23"></button>

		<button style="spacebar" x="66" y="208" w="126" h="28"> </button>
		<button type="enter" style="enter" x="254" y="208" w="56" h="28"></button>
		<button type="layoutchange" layout="firstPage" style="special" x="5" y="208" w="58" h="28">..3</button>
	</layout>
</keyboard>


code:
<keyboard image="keyboard.png" default-layout="lowercase">
	<style name="basic">
		<state name="default">
			<text fontsize="12" offsetx="10" offsety="5" color="#FFFFFFFF"></text>
			<image x="0" y="0" w="28" h="28"></image>
		</state>
		<state name="active">
			<text fontsize="12" offsetx="11" offsety="6" color="#FFFFFFFF"></text>
			<image x="28" y="0" w="28" h="28"></image>
		</state>
	</style>
	<style name="spacebar">
		<state name="default"><image x="0" y="56" w="128" h="28"></image></state>
		<state name="active"><image x="0" y="84" w="128" h="28"></image></state>
	</style>
	<style name="special">
		<state name="default">
			<text fontsize="12" offsetx="7" offsety="5" color="#FFFFFFFF"></text>
			<image x="0" y="28" w="56" h="28"></image>
		</state>
		<state name="active">
			<text fontsize="12" offsetx="8" offsety="6" color="#FFFFFFFF"></text>
			<image x="56" y="28" w="56" h="28"></image>
		</state>
	</style>
	<style name="enter">
		<state name="default"><image x="56" y="0" w="56" h="28"></image></state>
		<state name="active"><image x="128" y="56" w="56" h="28"></image></state>
	</style>
	<style name="shift">
		<state name="default"><image x="145" y="0" w="56" h="28"></image></state>
		<state name="active"><image x="145" y="28" w="56" h="28"></image></state>
	</style>
	<style name="backspace">
		<state name="default"><image x="112" y="0" w="33" h="23"></image></state>
		<state name="active"><image x="112" y="23" w="33" h="23"></image></state>
	</style>
	<style name="input">
		<state name="default">
			<text fontsize="14" offsetx="-20" offsety="4" color="#FFFFFFFF"></text>
			<image x="255" y="0" w="1" h="28"></image>
		</state>
		<state name="active"><image x="255" y="0" w="1" h="28"></image></state>
	</style>

	<input style="input" x="0" y="58" w="320" h="28" max-width="260" cursor-color="#FFFFFFFF" cursor-height="22"></input>

	<layout name="lowercase" label="abc123">
		<button style="basic" x="6" y="88" w="28" h="28">1</button>
		<button style="basic" x="36" y="88" w="28" h="28">2</button>
		<button style="basic" x="66" y="88" w="28" h="28">3</button>
		<button style="basic" x="96" y="88" w="28" h="28">4</button>
		<button style="basic" x="126" y="88" w="28" h="28">5</button>
		<button style="basic" x="156" y="88" w="28" h="28">6</button>
		<button style="basic" x="186" y="88" w="28" h="28">7</button>
		<button style="basic" x="216" y="88" w="28" h="28">8</button>
		<button style="basic" x="246" y="88" w="28" h="28">9</button>
		<button style="basic" x="276" y="88" w="28" h="28">0</button>

		<button style="basic" x="10" y="118" w="28" h="28">q</button>
		<button style="basic" x="40" y="118" w="28" h="28">w</button>
		<button style="basic" x="70" y="118" w="28" h="28">e</button>
		<button style="basic" x="100" y="118" w="28" h="28">r</button>
		<button style="basic" x="130" y="118" w="28" h="28">t</button>
		<button style="basic" x="160" y="118" w="28" h="28">y</button>
		<button style="basic" x="190" y="118" w="28" h="28">u</button>
		<button style="basic" x="220" y="118" w="28" h="28">i</button>
		<button style="basic" x="250" y="118" w="28" h="28">o</button>
		<button style="basic" x="280" y="118" w="28" h="28">p</button>

		<button style="basic" x="18" y="148" w="28" h="28">a</button>
		<button style="basic" x="48" y="148" w="28" h="28">s</button>
		<button style="basic" x="78" y="148" w="28" h="28">d</button>
		<button style="basic" x="108" y="148" w="28" h="28">f</button>
		<button style="basic" x="138" y="148" w="28" h="28">g</button>
		<button style="basic" x="168" y="148" w="28" h="28">h</button>
		<button style="basic" x="198" y="148" w="28" h="28">j</button>
		<button style="basic" x="228" y="148" w="28" h="28">k</button>
		<button style="basic" x="258" y="148" w="28" h="28">l</button>
		<button style="basic" x="288" y="148" w="28" h="28">'</button>

		<button style="basic" x="30" y="178" w="28" h="28">z</button>
		<button style="basic" x="60" y="178" w="28" h="28">x</button>
		<button style="basic" x="90" y="178" w="28" h="28">c</button>
		<button style="basic" x="120" y="178" w="28" h="28">v</button>
		<button style="basic" x="150" y="178" w="28" h="28">b</button>
		<button style="basic" x="180" y="178" w="28" h="28">n</button>
		<button style="basic" x="210" y="178" w="28" h="28">m</button>
		<button type="layoutchangetemp" layout="uppercase" style="shift" x="250" y="178" w="56" h="28"></button>

		<button style="basic" x="194" y="208" w="28" h="28">,</button>
		<button style="basic" x="224" y="208" w="28" h="28">.</button>

		<button type="backspace" style="backspace" x="280" y="60" w="33" h="23"></button>

		<button style="spacebar" x="66" y="208" w="126" h="28"> </button>
		<button type="enter" style="enter" x="254" y="208" w="56" h="28"></button>
		<button type="layoutchange" layout="uppercase" style="special" x="5" y="208" w="58" h="28">ABC?#%</button>
	</layout>
	<layout name="uppercase" label="ABC?#%">
		<button style="basic" x="6" y="88" w="28" h="28">!</button>
		<button style="basic" x="36" y="88" w="28" h="28">@</button>
		<button style="basic" x="66" y="88" w="28" h="28">#</button>
		<button style="basic" x="96" y="88" w="28" h="28">$</button>
		<button style="basic" x="126" y="88" w="28" h="28">%</button>
		<button style="basic" x="156" y="88" w="28" h="28">^</button>
		<button style="basic" x="186" y="88" w="28" h="28">&</button>
		<button style="basic" x="216" y="88" w="28" h="28">*</button>
		<button style="basic" x="246" y="88" w="28" h="28">(</button>
		<button style="basic" x="276" y="88" w="28" h="28">)</button>

		<button style="basic" x="10" y="118" w="28" h="28">Q</button>
		<button style="basic" x="40" y="118" w="28" h="28">W</button>
		<button style="basic" x="70" y="118" w="28" h="28">E</button>
		<button style="basic" x="100" y="118" w="28" h="28">R</button>
		<button style="basic" x="130" y="118" w="28" h="28">T</button>
		<button style="basic" x="160" y="118" w="28" h="28">Y</button>
		<button style="basic" x="190" y="118" w="28" h="28">U</button>
		<button style="basic" x="220" y="118" w="28" h="28">I</button>
		<button style="basic" x="250" y="118" w="28" h="28">O</button>
		<button style="basic" x="280" y="118" w="28" h="28">P</button>

		<button style="basic" x="18" y="148" w="28" h="28">A</button>
		<button style="basic" x="48" y="148" w="28" h="28">S</button>
		<button style="basic" x="78" y="148" w="28" h="28">D</button>
		<button style="basic" x="108" y="148" w="28" h="28">F</button>
		<button style="basic" x="138" y="148" w="28" h="28">G</button>
		<button style="basic" x="168" y="148" w="28" h="28">H</button>
		<button style="basic" x="198" y="148" w="28" h="28">J</button>
		<button style="basic" x="228" y="148" w="28" h="28">K</button>
		<button style="basic" x="258" y="148" w="28" h="28">L</button>
		<button style="basic" x="288" y="148" w="28" h="28">"</button>

		<button style="basic" x="30" y="178" w="28" h="28">Z</button>
		<button style="basic" x="60" y="178" w="28" h="28">X</button>
		<button style="basic" x="90" y="178" w="28" h="28">C</button>
		<button style="basic" x="120" y="178" w="28" h="28">V</button>
		<button style="basic" x="150" y="178" w="28" h="28">B</button>
		<button style="basic" x="180" y="178" w="28" h="28">N</button>
		<button style="basic" x="210" y="178" w="28" h="28">M</button>
		<button type="layoutchange" layout="lowercase" style="shift" x="250" y="178" w="56" h="28"></button>

		<button style="basic" x="194" y="208" w="28" h="28">-</button>
		<button style="basic" x="224" y="208" w="28" h="28">?</button>

		<button type="backspace" style="backspace" x="280" y="60" w="33" h="23"></button>

		<button style="spacebar" x="66" y="208" w="126" h="28"> </button>
		<button type="enter" style="enter" x="254" y="208" w="56" h="28"></button>
		<button type="layoutchange" layout="lowercase" style="special" x="5" y="208" w="58" h="28">abc123</button>
	</layout>
</keyboard>


code:
<keyboard image="keyboard.png" default-layout="lowercase">
	<style name="basic">
		<state name="default">
			<text fontsize="12" offsetx="10" offsety="5" color="#FFFFFFFF"></text>
			<image x="0" y="0" w="28" h="28"></image>
		</state>
		<state name="active">
			<text fontsize="12" offsetx="11" offsety="6" color="#FFFFFFFF"></text>
			<image x="28" y="0" w="28" h="28"></image>
		</state>
	</style>
	<style name="spacebar">
		<state name="default"><image x="0" y="56" w="128" h="28"></image></state>
		<state name="active"><image x="0" y="84" w="128" h="28"></image></state>
	</style>
	<style name="special">
		<state name="default">
			<text fontsize="12" offsetx="7" offsety="5" color="#FFFFFFFF"></text>
			<image x="0" y="28" w="56" h="28"></image>
		</state>
		<state name="active">
			<text fontsize="12" offsetx="8" offsety="6" color="#FFFFFFFF"></text>
			<image x="56" y="28" w="56" h="28"></image>
		</state>
	</style>
	<style name="enter">
		<state name="default"><image x="56" y="0" w="56" h="28"></image></state>
		<state name="active"><image x="128" y="56" w="56" h="28"></image></state>
	</style>
	<style name="shift">
		<state name="default"><image x="145" y="0" w="56" h="28"></image></state>
		<state name="active"><image x="145" y="28" w="56" h="28"></image></state>
	</style>
	<style name="backspace">
		<state name="default"><image x="112" y="0" w="33" h="23"></image></state>
		<state name="active"><image x="112" y="23" w="33" h="23"></image></state>
	</style>
	<style name="input">
		<state name="default">
			<text fontsize="14" offsetx="-20" offsety="4" color="#FFFFFFFF"></text>
			<image x="255" y="0" w="1" h="28"></image>
		</state>
		<state name="active"><image x="255" y="0" w="1" h="28"></image></state>
	</style>

	<input style="input" x="0" y="58" w="320" h="28" max-width="260" cursor-color="#FFFFFFFF" cursor-height="22"></input>

	<layout name="lowercase" label="abc123">
		<button style="basic" x="6" y="88" w="28" h="28">1</button>
		<button style="basic" x="36" y="88" w="28" h="28">2</button>
		<button style="basic" x="66" y="88" w="28" h="28">3</button>
		<button style="basic" x="96" y="88" w="28" h="28">4</button>
		<button style="basic" x="126" y="88" w="28" h="28">5</button>
		<button style="basic" x="156" y="88" w="28" h="28">6</button>
		<button style="basic" x="186" y="88" w="28" h="28">7</button>
		<button style="basic" x="216" y="88" w="28" h="28">8</button>
		<button style="basic" x="246" y="88" w="28" h="28">9</button>
		<button style="basic" x="276" y="88" w="28" h="28">0</button>

		<button style="basic" x="10" y="118" w="28" h="28">q</button>
		<button style="basic" x="40" y="118" w="28" h="28">w</button>
		<button style="basic" x="70" y="118" w="28" h="28">e</button>
		<button style="basic" x="100" y="118" w="28" h="28">r</button>
		<button style="basic" x="130" y="118" w="28" h="28">t</button>
		<button style="basic" x="160" y="118" w="28" h="28">z</button>
		<button style="basic" x="190" y="118" w="28" h="28">u</button>
		<button style="basic" x="220" y="118" w="28" h="28">i</button>
		<button style="basic" x="250" y="118" w="28" h="28">o</button>
		<button style="basic" x="280" y="118" w="28" h="28">p</button>

		<button style="basic" x="18" y="148" w="28" h="28">a</button>
		<button style="basic" x="48" y="148" w="28" h="28">s</button>
		<button style="basic" x="78" y="148" w="28" h="28">d</button>
		<button style="basic" x="108" y="148" w="28" h="28">f</button>
		<button style="basic" x="138" y="148" w="28" h="28">g</button>
		<button style="basic" x="168" y="148" w="28" h="28">h</button>
		<button style="basic" x="198" y="148" w="28" h="28">j</button>
		<button style="basic" x="228" y="148" w="28" h="28">k</button>
		<button style="basic" x="258" y="148" w="28" h="28">l</button>
		<button style="basic" x="288" y="148" w="28" h="28">'</button>

		<button style="basic" x="30" y="178" w="28" h="28">y</button>
		<button style="basic" x="60" y="178" w="28" h="28">x</button>
		<button style="basic" x="90" y="178" w="28" h="28">c</button>
		<button style="basic" x="120" y="178" w="28" h="28">v</button>
		<button style="basic" x="150" y="178" w="28" h="28">b</button>
		<button style="basic" x="180" y="178" w="28" h="28">n</button>
		<button style="basic" x="210" y="178" w="28" h="28">m</button>
		<button type="layoutchangetemp" layout="uppercase" style="shift" x="250" y="178" w="56" h="28"></button>

		<button style="basic" x="194" y="208" w="28" h="28">,</button>
		<button style="basic" x="224" y="208" w="28" h="28">.</button>

		<button type="backspace" style="backspace" x="280" y="60" w="33" h="23"></button>

		<button style="spacebar" x="66" y="208" w="126" h="28"> </button>
		<button type="enter" style="enter" x="254" y="208" w="56" h="28"></button>
		<button type="layoutchange" layout="uppercase" style="special" x="5" y="208" w="58" h="28">ABC?#%</button>
	</layout>
	<layout name="uppercase" label="ABC?#%">
		<button style="basic" x="6" y="88" w="28" h="28">!</button>
		<button style="basic" x="36" y="88" w="28" h="28">@</button>
		<button style="basic" x="66" y="88" w="28" h="28">#</button>
		<button style="basic" x="96" y="88" w="28" h="28">$</button>
		<button style="basic" x="126" y="88" w="28" h="28">%</button>
		<button style="basic" x="156" y="88" w="28" h="28">^</button>
		<button style="basic" x="186" y="88" w="28" h="28">&</button>
		<button style="basic" x="216" y="88" w="28" h="28">*</button>
		<button style="basic" x="246" y="88" w="28" h="28">(</button>
		<button style="basic" x="276" y="88" w="28" h="28">)</button>

		<button style="basic" x="10" y="118" w="28" h="28">Q</button>
		<button style="basic" x="40" y="118" w="28" h="28">W</button>
		<button style="basic" x="70" y="118" w="28" h="28">E</button>
		<button style="basic" x="100" y="118" w="28" h="28">R</button>
		<button style="basic" x="130" y="118" w="28" h="28">T</button>
		<button style="basic" x="160" y="118" w="28" h="28">Z</button>
		<button style="basic" x="190" y="118" w="28" h="28">U</button>
		<button style="basic" x="220" y="118" w="28" h="28">I</button>
		<button style="basic" x="250" y="118" w="28" h="28">O</button>
		<button style="basic" x="280" y="118" w="28" h="28">P</button>

		<button style="basic" x="18" y="148" w="28" h="28">A</button>
		<button style="basic" x="48" y="148" w="28" h="28">S</button>
		<button style="basic" x="78" y="148" w="28" h="28">D</button>
		<button style="basic" x="108" y="148" w="28" h="28">F</button>
		<button style="basic" x="138" y="148" w="28" h="28">G</button>
		<button style="basic" x="168" y="148" w="28" h="28">H</button>
		<button style="basic" x="198" y="148" w="28" h="28">J</button>
		<button style="basic" x="228" y="148" w="28" h="28">K</button>
		<button style="basic" x="258" y="148" w="28" h="28">L</button>
		<button style="basic" x="288" y="148" w="28" h="28">"</button>

		<button style="basic" x="30" y="178" w="28" h="28">Y</button>
		<button style="basic" x="60" y="178" w="28" h="28">X</button>
		<button style="basic" x="90" y="178" w="28" h="28">C</button>
		<button style="basic" x="120" y="178" w="28" h="28">V</button>
		<button style="basic" x="150" y="178" w="28" h="28">B</button>
		<button style="basic" x="180" y="178" w="28" h="28">N</button>
		<button style="basic" x="210" y="178" w="28" h="28">M</button>
		<button type="layoutchange" layout="lowercase" style="shift" x="250" y="178" w="56" h="28"></button>

		<button style="basic" x="194" y="208" w="28" h="28">-</button>
		<button style="basic" x="224" y="208" w="28" h="28">?</button>

		<button type="backspace" style="backspace" x="280" y="60" w="33" h="23"></button>

		<button style="spacebar" x="66" y="208" w="126" h="28"> </button>
		<button type="enter" style="enter" x="254" y="208" w="56" h="28"></button>
		<button type="layoutchange" layout="lowercase" style="special" x="5" y="208" w="58" h="28">abc123</button>
	</layout>
</keyboard>


code:
<keyboard image="keyboard.png" default-layout="lowercase">
	<style name="basic">
		<state name="default">
			<text fontsize="12" offsetx="10" offsety="5" color="#FFFFFFFF"></text>
			<image x="0" y="0" w="28" h="28"></image>
		</state>
		<state name="active">
			<text fontsize="12" offsetx="11" offsety="6" color="#FFFFFFFF"></text>
			<image x="28" y="0" w="28" h="28"></image>
		</state>
	</style>
	<style name="spacebar">
		<state name="default"><image x="0" y="56" w="128" h="28"></image></state>
		<state name="active"><image x="0" y="84" w="128" h="28"></image></state>
	</style>
	<style name="special">
		<state name="default">
			<text fontsize="12" offsetx="7" offsety="5" color="#FFFFFFFF"></text>
			<image x="0" y="28" w="56" h="28"></image>
		</state>
		<state name="active">
			<text fontsize="12" offsetx="8" offsety="6" color="#FFFFFFFF"></text>
			<image x="56" y="28" w="56" h="28"></image>
		</state>
	</style>
	<style name="enter">
		<state name="default"><image x="56" y="0" w="56" h="28"></image></state>
		<state name="active"><image x="128" y="56" w="56" h="28"></image></state>
	</style>
	<style name="shift">
		<state name="default"><image x="145" y="0" w="56" h="28"></image></state>
		<state name="active"><image x="145" y="28" w="56" h="28"></image></state>
	</style>
	<style name="backspace">
		<state name="default"><image x="112" y="0" w="33" h="23"></image></state>
		<state name="active"><image x="112" y="23" w="33" h="23"></image></state>
	</style>
	<style name="input">
		<state name="default">
			<text fontsize="14" offsetx="-20" offsety="4" color="#FFFFFFFF"></text>
			<image x="255" y="0" w="1" h="28"></image>
		</state>
		<state name="active"><image x="255" y="0" w="1" h="28"></image></state>
	</style>

	<input style="input" x="0" y="58" w="320" h="28" max-width="260" cursor-color="#FFFFFFFF" cursor-height="22"></input>

	<layout name="lowercase" label="abc123">
		<button style="basic" x="6" y="88" w="28" h="28">1</button>
		<button style="basic" x="36" y="88" w="28" h="28">2</button>
		<button style="basic" x="66" y="88" w="28" h="28">3</button>
		<button style="basic" x="96" y="88" w="28" h="28">4</button>
		<button style="basic" x="126" y="88" w="28" h="28">5</button>
		<button style="basic" x="156" y="88" w="28" h="28">6</button>
		<button style="basic" x="186" y="88" w="28" h="28">7</button>
		<button style="basic" x="216" y="88" w="28" h="28">8</button>
		<button style="basic" x="246" y="88" w="28" h="28">9</button>
		<button style="basic" x="276" y="88" w="28" h="28">0</button>

		<button style="basic" x="50" y="118" w="28" h="28">A</button>
		<button style="basic" x="80" y="118" w="28" h="28">B</button>
		<button style="basic" x="110" y="118" w="28" h="28">C</button>
		<button style="basic" x="140" y="118" w="28" h="28">D</button>
		<button style="basic" x="170" y="118" w="28" h="28">E</button>
		<button style="basic" x="200" y="118" w="28" h="28">F</button>

		<button type="backspace" style="backspace" x="280" y="60" w="33" h="23"></button>
		<button type="enter" style="enter" x="254" y="208" w="56" h="28"></button>
	</layout>
</keyboard>


code:
#ifndef TEMPLATE_ASSETMANAGER_HPP
#define TEMPLATE_ASSETMANAGER_HPP

#include <cpp3ds/Audio/Sound.hpp>
#include <cpp3ds/Audio/SoundBuffer.hpp>
#include <cpp3ds/System/Err.hpp>
#include <memory>
#include <map>
#include <assert.h>

namespace Template {

template <class T>
class AssetManager {
public:
	static T& get(const std::string& filename)
	{
		static AssetManager<T> manager; // Yep, singleton

		auto item = manager.m_assets.find(filename);
		if (item == manager.m_assets.end())
		{
			std::unique_ptr<T> asset(new T);
			if (!asset->loadFromFile(filename))
				cpp3ds::err() << "Failed to load asset: " << filename << std::endl;
			manager.m_assets.insert(std::make_pair(filename, std::move(asset)));
			return get(filename);
		}
		return *item->second;
	}

private:
	AssetManager<T>() {} // Empty constructor

	std::map<std::string, std::unique_ptr<T>> m_assets;
};

} // namespace Template

#endif // TEMPLATE_ASSETMANAGER_HPP


code:
#include <cmath>
#include "Button.hpp"

namespace gui3ds {

Button::Button()
: m_autoSize(true)
, m_needsUpdate(true)
, m_active(false)
, m_backgroundColor(cpp3ds::Color::White)
{
	m_text.useSystemFont();
}

void Button::draw(cpp3ds::RenderTarget &target, cpp3ds::RenderStates states) const
{
	ensureUpdate();
	NinePatch::draw(target, states);

	states.transform *= getTransform();

	if (!m_text.getString().isEmpty())
		target.draw(m_text, states);
}

void Button::setTextOffset(const cpp3ds::Vector2f& offset)
{
	m_textOffset = offset;
	m_needsUpdate = true;
}

const cpp3ds::Vector2f& Button::getTextOffset() const
{
	return m_textOffset;
}

void Button::setContentSize(const cpp3ds::Vector2f& size)
{
	NinePatch::setContentSize(size);
	m_autoSize = false;
}

void Button::setContentSize(float width, float height)
{
	NinePatch::setContentSize(width, height);
	m_autoSize = false;
}

const cpp3ds::Vector2f& Button::getContentSize() const
{
	ensureUpdate();
	return NinePatch::getContentSize();
}

const cpp3ds::Vector2f& Button::getSize() const
{
	ensureUpdate();
	return m_size;
}

void Button::setString(const cpp3ds::String& string)
{
	m_text.setString(string);
	m_needsUpdate = true;
}

const cpp3ds::String& Button::getString() const
{
	return m_text.getString();
}

void Button::setTextColor(const cpp3ds::Color& color)
{
	m_textColor = color;
	m_needsUpdate = true;
}

const cpp3ds::Color& Button::getTextColor() const
{
	return m_textColor;
}

void Button::setTextActiveColor(const cpp3ds::Color& color)
{
	m_textActiveColor = color;
	m_needsUpdate = true;
}

const cpp3ds::Color& Button::getTextActiveColor() const
{
	return m_textActiveColor;
}

void Button::setColor(const cpp3ds::Color& color)
{
	m_backgroundColor = color;
	m_needsUpdate = true;
}

const cpp3ds::Color& Button::getColor() const
{
	return m_backgroundColor;
}

void Button::setActiveColor(const cpp3ds::Color& color)
{
	m_backgroundActiveColor = color;
	m_needsUpdate = true;
}

const cpp3ds::Color& Button::getActiveColor() const
{
	return m_backgroundActiveColor;
}

void Button::autoSize()
{
	m_autoSize = true;
	m_needsUpdate = true;
}

bool Button::processEvent(const cpp3ds::Event &event)
{
	if (event.type == cpp3ds::Event::TouchBegan)
	{
		if (m_rect.contains(event.touch.x, event.touch.y))
		{
			m_active = true;
			m_needsUpdate = true;
			return false;
		}
	}

	if (event.type == cpp3ds::Event::TouchEnded)
	{
		if (m_active) {
			m_active = false;
			m_needsUpdate = true;
			if (m_clickFunction)
				m_clickFunction();
			return false;
		}
	}

	if (event.type == cpp3ds::Event::TouchMoved)
	{
		if (m_active) {
			if (!m_rect.contains(event.touch.x, event.touch.y)) {
				m_active = false;
				m_needsUpdate = true;
			}
			return false;
		}
	}

	return true;
}

void Button::ensureUpdate() const
{
	if (m_needsUpdate)
	{
		if (m_autoSize)
			NinePatch::setContentSize(cpp3ds::Vector2f(m_text.getLocalBounds().width, m_text.getLocalBounds().height));

		cpp3ds::FloatRect textBounds = m_text.getLocalBounds();
		cpp3ds::FloatRect padding = getPadding();
		cpp3ds::Vector2f contentSize = NinePatch::getContentSize();

		if (m_autoSize && getTexture()) {
			m_size.x = contentSize.x + getTexture()->getSize().x - padding.width;
			m_size.y = contentSize.y + getTexture()->getSize().y - padding.height;
		} else {
			m_size.x = contentSize.x - padding.width;
			m_size.y = contentSize.y - padding.height;
		}

		m_text.setOrigin(std::round(textBounds.left + textBounds.width/2),
		                 std::round(textBounds.top + textBounds.height/2));
		m_text.setPosition(std::round(padding.left + contentSize.x/2 + m_textOffset.x),
		                   std::round(padding.top + contentSize.y/2 + m_textOffset.y));

		if (m_active) {
			NinePatch::setColor(m_backgroundActiveColor);
			m_text.setFillColor(m_textActiveColor);
		} else {
			NinePatch::setColor(m_backgroundColor);
			m_text.setFillColor(m_textColor);
		}

		m_needsUpdate = false;
	}

	m_rect.left = getPosition().x;
	m_rect.top = getPosition().y;
	m_rect.width = m_size.x;
	m_rect.height = m_size.y;
}

void Button::onClick(const std::function<void()>& callback)
{
	m_clickFunction = callback;
}

int Button::getValues(int tweenType, float *returnValues)
{
	switch (tweenType) {
		case COLOR_RGB: {
			cpp3ds::Color color = getColor();
			returnValues[0] = color.r;
			returnValues[1] = color.g;
			returnValues[2] = color.b;
			return 3;
		}
		case COLOR_ALPHA: returnValues[0] = getColor().a; return 1;
		case CONTENT_X: returnValues[0] = getContentSize().x; return 1;
		case TEXTCOLOR_ALPHA: returnValues[0] = getTextColor().a; return 1;
		default:
			return TweenTransformable::getValues(tweenType, returnValues);
	}
}

void Button::setValues(int tweenType, float *newValues)
{
	switch (tweenType) {
		case COLOR_RGB: {
			cpp3ds::Color color;
			color.r = std::max(std::min(newValues[0], 255.f), 0.f);
			color.g = std::max(std::min(newValues[1], 255.f), 0.f);
			color.b = std::max(std::min(newValues[2], 255.f), 0.f);
			color.a = getColor().a;
			setColor(color);
			break;
		}
		case COLOR_ALPHA: {
			cpp3ds::Color color = getColor();
			color.a = std::max(std::min(newValues[0], 255.f), 0.f);
			setColor(color);
			break;
		}
		case CONTENT_X: setContentSize(cpp3ds::Vector2f(newValues[0], getContentSize().y)); break;
		case TEXTCOLOR_ALPHA: {
			cpp3ds::Color color = getTextColor();
			color.a = std::max(std::min(newValues[0], 255.f), 0.f);
			setTextColor(color);
			break;
		}
		default:
			TweenTransformable::setValues(tweenType, newValues);
			break;
	}
}

cpp3ds::Text &Button::getText() const
{
	return m_text;
}

} // namespace gui3ds


code:
#ifndef GUI3DS_BUTTON_HPP
#define GUI3DS_BUTTON_HPP

#include <functional>
#include <cpp3ds/Graphics/Text.hpp>
#include <cpp3ds/Graphics/RectangleShape.hpp>
#include <cpp3ds/Window/Event.hpp>
#include "NinePatch.hpp"
#include "../TweenObjects.hpp"

namespace gui3ds {

class Button : public util3ds::TweenNinePatch {
public:
	static const int COLOR_RGB   = 11;
	static const int COLOR_ALPHA = 12;
	static const int CONTENT_X   = 13;
	static const int TEXTCOLOR_ALPHA = 14;

	Button();

	bool processEvent(const cpp3ds::Event& event);

	void setTextOffset(const cpp3ds::Vector2f& offset);
	const cpp3ds::Vector2f& getTextOffset() const;

	void autoSize();
	void setContentSize(const cpp3ds::Vector2f& size);
	void setContentSize(float width, float height);
	const cpp3ds::Vector2f& getContentSize() const;
	const cpp3ds::Vector2f& getSize() const;

	void setString(const cpp3ds::String& string);
	const cpp3ds::String& getString() const;

	cpp3ds::Text& getText() const;

	void setTextColor(const cpp3ds::Color& color);
	const cpp3ds::Color& getTextColor() const;

	void setTextActiveColor(const cpp3ds::Color& color);
	const cpp3ds::Color& getTextActiveColor() const;

	void setColor(const cpp3ds::Color& color);
	const cpp3ds::Color& getColor() const;

	void setActiveColor(const cpp3ds::Color& color);
	const cpp3ds::Color& getActiveColor() const;

	void onClick(const std::function<void()>& callback);

protected:
	virtual int getValues(int tweenType, float *returnValues);
	virtual void setValues(int tweenType, float *newValues);
	virtual void draw(cpp3ds::RenderTarget& target, cpp3ds::RenderStates states) const;
	void ensureUpdate() const;

private:
	mutable cpp3ds::Vector2f m_size;
	mutable cpp3ds::FloatRect m_rect;
	mutable cpp3ds::Text m_text;

	cpp3ds::Vector2f m_textOffset;
	cpp3ds::Color m_textColor;
	cpp3ds::Color m_textActiveColor;

	cpp3ds::Color m_backgroundColor;
	cpp3ds::Color m_backgroundActiveColor;

	std::function<void()> m_clickFunction;

	mutable bool m_needsUpdate;
	bool m_autoSize;
	bool m_active;
};

} // namespace gui3ds

#endif // GUI3DS_BUTTON_HPP


code:
#include <cmath>
#include "NinePatch.hpp"

namespace gui3ds {

NinePatch::NinePatch()
: m_color(cpp3ds::Color::White)
, m_padding(0,0,0,0)
, m_needsUpdate(true)
{
	setTexture(nullptr);
}

NinePatch::~NinePatch()
{

}

void NinePatch::setTexture(const cpp3ds::Texture *texture)
{
	m_texture = texture;
	updateRegions();
	m_needsUpdate = true;
}

const cpp3ds::Texture* NinePatch::getTexture() const
{
	return m_texture;
}

void NinePatch::setContentSize(const cpp3ds::Vector2f &size) const
{
	m_contentSize = size;
	m_needsUpdate = true;
}

void NinePatch::setContentSize(float width, float height) const
{
	setContentSize(cpp3ds::Vector2f(width, height));
}

void NinePatch::setSize(const cpp3ds::Vector2f &size) const
{
	m_contentSize.x = size.x + getPadding().width - getTexture()->getSize().x + 2.f;
	m_contentSize.y = size.y + getPadding().height - getTexture()->getSize().y + 2.f;
	m_needsUpdate = true;
}

void NinePatch::setSize(float width, float height) const
{
	setSize(cpp3ds::Vector2f(width, height));
}

const cpp3ds::Vector2f &NinePatch::getContentSize() const
{
	ensureUpdate();
	return m_contentSize;
}

cpp3ds::Vector2f NinePatch::getSize() const
{
	ensureUpdate();
	return m_size;
}

void NinePatch::setPadding(const cpp3ds::FloatRect &padding)
{
	m_needsUpdate = true;
	m_padding = padding;
}

void NinePatch::setPadding(float left, float top, float width, float height)
{
	setPadding(cpp3ds::FloatRect(left, top, width, height));
}

const cpp3ds::FloatRect &NinePatch::getPadding() const
{
	ensureUpdate();
	return m_padding;
}

void NinePatch::setColor(const cpp3ds::Color &color) const
{
	m_color = color;
	m_needsUpdate = true;
}

const cpp3ds::Color &NinePatch::getColor() const
{
	return m_color;
}

void NinePatch::draw(cpp3ds::RenderTarget &target, cpp3ds::RenderStates states) const
{
	ensureUpdate();
	states.transform *= getTransform();

	states.texture = m_texture;
	target.draw(m_vertices, states);
}

void NinePatch::ensureUpdate() const
{
	if (m_needsUpdate) {
		updateVertices();
		m_needsUpdate = false;
	}
}

void NinePatch::updateRegions() const
{
	m_regions.clear();

	if (!m_texture)
	{
		Region region;
		region.type = DynamicBoth;
		region.rect = cpp3ds::FloatRect(0.f, 0.f, 1.f, 1.f);
		m_dynamicHeight = m_dynamicWidth = 1.f;
		m_staticHeight = m_staticWidth = 0.f;
		m_regions.push_back(region);
		return;
	}

	cpp3ds::Image image = m_texture->copyToImage();

	unsigned int x, y, last_x, last_y;
	bool is_static_y = true;
	bool is_static_x = true;

	last_x = 1;
	last_y = 1;
	m_staticHeight = 0;
	m_dynamicHeight = 0;

	for (y = 1; y < image.getSize().y - 1; y++)
	{
		cpp3ds::Color color_y = image.getPixel(0, y);
		bool is_region_y = is_static_y ? (color_y == cpp3ds::Color::Black) : (color_y.a == 0);
		if (y == image.getSize().y - 2) {
			is_region_y = true;
			y++;
		}
		if (is_region_y)
		{
			m_staticWidth = 0;
			m_dynamicWidth = 0;
			is_static_x = true;
			for (x = 1; x < image.getSize().x - 1; x++)
			{
				cpp3ds::Color color_x = image.getPixel(x, 0);
				bool is_region_x = is_static_x ? (color_x == cpp3ds::Color::Black) : (color_x.a == 0);
				if (x == image.getSize().x - 2) {
					is_region_x = true;
					x++;
				}
				if (is_region_x)
				{
					// add region
					Region region;
					if (is_static_x) {
						region.type = is_static_y ? Static : DynamicHeight;
					} else {
						region.type = is_static_y ? DynamicWidth : DynamicBoth;
					}
					region.rect.left = last_x;
					region.rect.top  = last_y;
					region.rect.width  = x - last_x;
					region.rect.height = y - last_y;

					m_regions.push_back(region);

					if (is_static_x)
						m_staticWidth += x - last_x;
					else
						m_dynamicWidth += x - last_x;
					last_x = x;
					is_static_x = !is_static_x;
				}
			}

			if (is_static_y)
				m_staticHeight += y - last_y;
			else
				m_dynamicHeight += y - last_y;
			last_x = 1;
			last_y = y;
			is_static_y = !is_static_y;
		}
	}

	// Get padding
	bool is_padding = false;
	for (y = 1; y < image.getSize().y - 1; y++)
	{
		cpp3ds::Color color = image.getPixel(image.getSize().x - 1, y);
		if (is_padding) {
			if (color.a == 0) {
				m_padding.height = y - 1 - m_padding.top;
				break;
			}
		} else {
			if (color == cpp3ds::Color::Black) {
				is_padding = true;
				m_padding.top = y - 1;
				continue;
			}
		}
	}
	is_padding = false;
	for (x = 1; x < image.getSize().x - 1; x++)
	{
		cpp3ds::Color color = image.getPixel(x, image.getSize().y - 1);
		if (is_padding) {
			if (color.a == 0) {
				m_padding.width = x - 1 - m_padding.left;
				break;
			}
		} else {
			if (color == cpp3ds::Color::Black) {
				is_padding = true;
				m_padding.left = x - 1;
				continue;
			}
		}
	}
}

void NinePatch::updateVertices() const
{
	m_vertices.clear();
	cpp3ds::Vertex vertices[4];

	m_contentSize.x = std::max(m_contentSize.x, m_padding.width);
	m_contentSize.y = std::max(m_contentSize.y, m_padding.height);

	m_size.x = m_contentSize.x + m_texture->getSize().x - 2.f - m_padding.width;
	m_size.y = m_contentSize.y + m_texture->getSize().y - 2.f - m_padding.height;

	vertices[0].color = vertices[1].color = vertices[2].color = vertices[3].color = m_color;

	float dynamicWidthSum  = 0;
	float dynamicHeightSum = 0;
	float dynamicWidth;
	float dynamicHeight;
	bool addedHeight = false;
	bool addedWidth  = false;

	for (const auto &region: m_regions)
	{
		if (region.rect.left <= 1) {
			dynamicWidthSum = 0;
		}

		vertices[0].texCoords.x = region.rect.left;
		vertices[0].texCoords.y = region.rect.top;
		vertices[1].texCoords.x = region.rect.left + region.rect.width;
		vertices[1].texCoords.y = region.rect.top;
		vertices[2].texCoords.x = region.rect.left;
		vertices[2].texCoords.y = region.rect.top + region.rect.height;
		vertices[3].texCoords.x = region.rect.left + region.rect.width;
		vertices[3].texCoords.y = region.rect.top + region.rect.height;

		if (region.type == DynamicWidth || region.type == DynamicBoth) {
			dynamicWidth = std::floor((region.rect.width / m_dynamicWidth) * (m_contentSize.x - m_padding.width));
			if (!addedWidth) {
				addedWidth = true;
				dynamicWidthSum += dynamicWidth;
			}
		}

		if (region.type == DynamicHeight || region.type == DynamicBoth) {
			dynamicHeight = std::floor((region.rect.height / m_dynamicHeight) * (m_contentSize.y - m_padding.height));
			if (!addedHeight) {
				addedHeight = true;
				dynamicHeightSum += dynamicHeight;
			}
		}

		switch (region.type) {
			case DynamicWidth:
				addedHeight = false;
				vertices[0].position.x = region.rect.left + dynamicWidthSum - dynamicWidth - 1;
				vertices[0].position.y = region.rect.top  + dynamicHeightSum - 1;
				vertices[1].position.x = region.rect.left + region.rect.width + dynamicWidthSum - 1;
				vertices[1].position.y = region.rect.top  + dynamicHeightSum - 1;
				vertices[2].position.x = region.rect.left + dynamicWidthSum - dynamicWidth - 1;
				vertices[2].position.y = region.rect.top  + region.rect.height + dynamicHeightSum - 1;
				break;
			case DynamicHeight:
				addedWidth = false;
				vertices[0].position.x = region.rect.left + dynamicWidthSum - 1;
				vertices[0].position.y = region.rect.top  + dynamicHeightSum - dynamicHeight - 1;
				vertices[1].position.x = region.rect.left + region.rect.width + dynamicWidthSum - 1;
				vertices[1].position.y = region.rect.top  + dynamicHeightSum - dynamicHeight - 1;
				vertices[2].position.x = region.rect.left + dynamicWidthSum - 1;
				vertices[2].position.y = region.rect.top  + region.rect.height + dynamicHeightSum - 1;
				break;
			case DynamicBoth:
				vertices[0].position.x = region.rect.left + dynamicWidthSum  - dynamicWidth  - 1;
				vertices[0].position.y = region.rect.top  + dynamicHeightSum - dynamicHeight - 1;
				vertices[1].position.x = region.rect.left + region.rect.width + dynamicWidthSum - 1;
				vertices[1].position.y = region.rect.top  + dynamicHeightSum - dynamicHeight - 1;
				vertices[2].position.x = region.rect.left + dynamicWidthSum  - dynamicWidth  - 1;
				vertices[2].position.y = region.rect.top  + region.rect.height + dynamicHeightSum - 1;
				break;
			case Static:
			default:
				addedWidth = false;
				addedHeight = false;
				vertices[0].position = cpp3ds::Vector2f(region.rect.left+dynamicWidthSum-1, region.rect.top+dynamicHeightSum-1);
				vertices[1].position = cpp3ds::Vector2f(region.rect.left+dynamicWidthSum-1 + region.rect.width, region.rect.top+dynamicHeightSum-1);
				vertices[2].position = cpp3ds::Vector2f(region.rect.left+dynamicWidthSum-1, region.rect.top+dynamicHeightSum-1 + region.rect.height);
				break;
		}

		// Bottom-right position is the same for all region rectangles
		vertices[3].position.x = region.rect.left + region.rect.width  + dynamicWidthSum  - 1;
		vertices[3].position.y = region.rect.top  + region.rect.height + dynamicHeightSum - 1;

		// Add vertices counter-clockwise as two triangles
		m_vertices.append(vertices[0]);
		m_vertices.append(vertices[2]);
		m_vertices.append(vertices[3]);

		m_vertices.append(vertices[1]);
		m_vertices.append(vertices[0]);
		m_vertices.append(vertices[3]);
	}
}

} // namespace gui3ds


code:
#ifndef GUI3DS_NINEPATCH_HPP
#define GUI3DS_NINEPATCH_HPP

#include <cpp3ds/Graphics/Drawable.hpp>
#include <cpp3ds/Graphics/Texture.hpp>
#include <cpp3ds/Graphics/RenderTarget.hpp>
#include <cpp3ds/Graphics/VertexArray.hpp>
#include <cpp3ds/Graphics/RectangleShape.hpp>

namespace gui3ds {

class NinePatch : public cpp3ds::Drawable, public cpp3ds::Transformable {
public:
	NinePatch();
	~NinePatch();

	void setTexture(const cpp3ds::Texture *texture);
	const cpp3ds::Texture* getTexture() const;

	void setContentSize(const cpp3ds::Vector2f& size) const;
	void setContentSize(float width, float height) const;
	void setSize(const cpp3ds::Vector2f& size) const;
	void setSize(float width, float height) const;
	const cpp3ds::Vector2f& getContentSize() const;
	cpp3ds::Vector2f getSize() const;

	void setPadding(const cpp3ds::FloatRect& padding);
	void setPadding(float left, float top, float width, float height);
	const cpp3ds::FloatRect& getPadding() const;

	void setColor(const cpp3ds::Color& color) const;
	const cpp3ds::Color& getColor() const;

protected:
	virtual void draw(cpp3ds::RenderTarget& target, cpp3ds::RenderStates states) const;
	void ensureUpdate() const;
	void updateRegions() const;
	void updateVertices() const;

private:
	enum ExpandType {
		Stretch,
		Repeat,
	};
	enum RegionType {
		Static,
		DynamicWidth,
		DynamicHeight,
		DynamicBoth,
	};
	struct Region {
		RegionType type;
		cpp3ds::FloatRect rect;

	};

	const cpp3ds::Texture *m_texture;
	mutable cpp3ds::Color m_color;
	mutable cpp3ds::Vector2f m_contentSize;
	mutable cpp3ds::Vector2f m_size;
	mutable std::vector<Region> m_regions;
	mutable cpp3ds::VertexArray m_vertices;
	mutable cpp3ds::FloatRect m_padding;

	// Used for internal calculation
	mutable float m_staticWidth;
	mutable float m_staticHeight;
	mutable float m_dynamicWidth;
	mutable float m_dynamicHeight;

	mutable bool m_needsUpdate;
};

} // namespace gui3ds

#endif // GUI3DS_NINEPATCH_HPP