Browse Source

Projektdateien hinzufügen.

Kolja Strohm 5 years ago
parent
commit
bd07da6fb1

+ 28 - 0
2DCreator.sln

@@ -0,0 +1,28 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 14
+VisualStudioVersion = 14.0.22823.1
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "2DCreator", "2DCreator\2DCreator.vcxproj", "{F17188C7-94BE-4C76-95E3-8E2799407D04}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Win32 = Debug|Win32
+		Debug|x64 = Debug|x64
+		Release|Win32 = Release|Win32
+		Release|x64 = Release|x64
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{F17188C7-94BE-4C76-95E3-8E2799407D04}.Debug|Win32.ActiveCfg = Debug|Win32
+		{F17188C7-94BE-4C76-95E3-8E2799407D04}.Debug|Win32.Build.0 = Debug|Win32
+		{F17188C7-94BE-4C76-95E3-8E2799407D04}.Debug|x64.ActiveCfg = Debug|x64
+		{F17188C7-94BE-4C76-95E3-8E2799407D04}.Debug|x64.Build.0 = Debug|x64
+		{F17188C7-94BE-4C76-95E3-8E2799407D04}.Release|Win32.ActiveCfg = Release|Win32
+		{F17188C7-94BE-4C76-95E3-8E2799407D04}.Release|Win32.Build.0 = Release|Win32
+		{F17188C7-94BE-4C76-95E3-8E2799407D04}.Release|x64.ActiveCfg = Release|x64
+		{F17188C7-94BE-4C76-95E3-8E2799407D04}.Release|x64.Build.0 = Release|x64
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal

+ 190 - 0
2DCreator/2DCreator.vcxproj

@@ -0,0 +1,190 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{F17188C7-94BE-4C76-95E3-8E2799407D04}</ProjectGuid>
+    <Keyword>Win32Proj</Keyword>
+    <RootNamespace>My2DCreator</RootNamespace>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v141</PlatformToolset>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v141</PlatformToolset>
+    <CharacterSet>MultiByte</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v141</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>MultiByte</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v141</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>MultiByte</CharacterSet>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <LinkIncremental>true</LinkIncremental>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <LinkIncremental>true</LinkIncremental>
+    <IncludePath>..\..\Framework;$(IncludePath)</IncludePath>
+    <LibraryPath>..\..\Framework\x64\Debug;$(LibraryPath)</LibraryPath>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <LinkIncremental>false</LinkIncremental>
+    <IncludePath>..\..\Framework;$(IncludePath)</IncludePath>
+    <LibraryPath>..\..\Framework\Release;$(LibraryPath)</LibraryPath>
+    <CustomBuildBeforeTargets>
+    </CustomBuildBeforeTargets>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <LinkIncremental>false</LinkIncremental>
+    <IncludePath>..\..\Framework;$(IncludePath)</IncludePath>
+    <LibraryPath>..\..\Framework\x64\Release;$(LibraryPath)</LibraryPath>
+    <CustomBuildBeforeTargets>
+    </CustomBuildBeforeTargets>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <ClCompile>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <AdditionalDependencies>Framework.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+    <CustomBuildStep>
+      <Command>copy "..\..\Framework\x64\Debug\Framework.dll" "Framework.dll"</Command>
+    </CustomBuildStep>
+    <CustomBuildStep>
+      <Outputs>kopieren...;%(Outputs)</Outputs>
+    </CustomBuildStep>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <AdditionalDependencies>Framework.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+    <CustomBuildStep>
+      <Command>copy "..\..\Framework\Release\Framework.dll" "..\Fertig\x32\Framework.dll"
+copy "..\Release\2DCreator.exe" "..\Fertig\x32\2DCreator.exe"</Command>
+    </CustomBuildStep>
+    <CustomBuildStep>
+      <Outputs>kopieren...;%(Outputs)</Outputs>
+    </CustomBuildStep>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <AdditionalDependencies>Framework.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+    <CustomBuildStep>
+      <Command>copy "..\..\Framework\x64\Release\Framework.dll" "..\Fertig\x64\Framework.dll"
+copy "..\x64\Release\2DCreator.exe" "..\Fertig\x64\2DCreator.exe"</Command>
+      <Outputs>kopieren...;%(Outputs)</Outputs>
+    </CustomBuildStep>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClCompile Include="Data.cpp" />
+    <ClCompile Include="Editor2D.cpp" />
+    <ClCompile Include="EditorListe.cpp" />
+    <ClCompile Include="GUI.cpp" />
+    <ClCompile Include="Start.cpp" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="Data.h" />
+    <ClInclude Include="Editor2D.h" />
+    <ClInclude Include="EditorListe.h" />
+    <ClInclude Include="GUI.h" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>

+ 48 - 0
2DCreator/2DCreator.vcxproj.filters

@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="Quelldateien">
+      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+    </Filter>
+    <Filter Include="Headerdateien">
+      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+      <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
+    </Filter>
+    <Filter Include="Ressourcendateien">
+      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="Start.cpp">
+      <Filter>Quelldateien</Filter>
+    </ClCompile>
+    <ClCompile Include="Data.cpp">
+      <Filter>Quelldateien</Filter>
+    </ClCompile>
+    <ClCompile Include="Editor2D.cpp">
+      <Filter>Quelldateien</Filter>
+    </ClCompile>
+    <ClCompile Include="EditorListe.cpp">
+      <Filter>Quelldateien</Filter>
+    </ClCompile>
+    <ClCompile Include="GUI.cpp">
+      <Filter>Quelldateien</Filter>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="Editor2D.h">
+      <Filter>Headerdateien</Filter>
+    </ClInclude>
+    <ClInclude Include="Data.h">
+      <Filter>Headerdateien</Filter>
+    </ClInclude>
+    <ClInclude Include="EditorListe.h">
+      <Filter>Headerdateien</Filter>
+    </ClInclude>
+    <ClInclude Include="GUI.h">
+      <Filter>Headerdateien</Filter>
+    </ClInclude>
+  </ItemGroup>
+</Project>

+ 388 - 0
2DCreator/Data.cpp

@@ -0,0 +1,388 @@
+#include "Data.h"
+
+// Inhalt der VertexData Klasse aus Data.h
+// Konstruktor
+VertexData::VertexData( Vec2< float > v, Punkt t )
+{
+	vertex = v;
+	textur = t;
+	selected = 0;
+	sichtbar = 1;
+	ref = 1;
+}
+
+// nicht constant
+void VertexData::nachLinks( float num )
+{
+	if( selected )
+		vertex.x -= num;
+}
+
+void VertexData::nachOben( float num )
+{
+	if( selected )
+		vertex.y -= num;
+}
+
+void VertexData::saveTextur( Punkt tPos )
+{
+	textur = (Punkt)vertex - tPos;
+}
+
+void VertexData::select( Punkt p1, Punkt p2 )
+{
+	selected |= vertex.istInRegion( p1, p2 ) && sichtbar;
+}
+
+void VertexData::deSelect()
+{
+	selected = 0;
+}
+
+void VertexData::setAuswahl( bool ausw )
+{
+	selected = ausw;
+}
+
+void VertexData::setSichtbar( bool s )
+{
+	sichtbar = s;
+	selected &= sichtbar;
+}
+
+// constant
+bool VertexData::istSichtbar() const
+{
+	return sichtbar;
+}
+
+bool VertexData::istAusgewählt() const
+{
+	return selected;
+}
+
+Vec2< float > VertexData::getPos() const
+{
+	return vertex;
+}
+
+Punkt VertexData::getTPos() const
+{
+	return textur;
+}
+
+// Reference Counting
+VertexData *VertexData::getThis()
+{
+	ref++;
+	return this;
+}
+
+VertexData *VertexData::release()
+{
+	ref--;
+	if( !ref )
+		delete this;
+	return 0;
+}
+
+
+// Inhalt der PolygonData Klasse aus Data.h
+// Konstruktor
+PolygonData::PolygonData( Polygon2D &pg )
+{
+	vd = new RCArray< VertexData >();
+	sichtbar = 1;
+	ref = 1;
+	int anz = pg.vertex->getEintragAnzahl();
+	for( int i = 0; i < anz; i++ )
+	{
+		Vec2< float > v( 0, 0 );
+		Punkt t( 0, 0 );
+		if( pg.vertex->hat( i ) )
+			v = pg.vertex->get( i );
+		if( pg.tKordinaten && pg.tKordinaten->hat( i ) )
+			t = pg.tKordinaten->get( i );
+		vd->add( new VertexData( v, t ) );
+	}
+}
+
+// Destruktor
+PolygonData::~PolygonData()
+{
+	vd->release();
+}
+
+// nicht constant
+void PolygonData::addVertex( Vec2< float >v, Punkt t )
+{
+	vd->add( new VertexData( v, t ) );
+}
+
+void PolygonData::removeVertex( int num )
+{
+	vd->remove( num );
+}
+
+void PolygonData::nachLinks( float num )
+{
+	for( auto *i = &vd->getArray(); i && i->set; i = i->next )
+		i->var->nachLinks( num );
+}
+
+void PolygonData::nachOben( float num )
+{
+	for( auto *i = &vd->getArray(); i && i->set; i = i->next )
+		i->var->nachOben( num );
+}
+
+void PolygonData::saveTextur( Punkt tPos )
+{
+	for( auto *i = &vd->getArray(); i && i->set; i = i->next )
+		i->var->saveTextur( tPos );
+}
+
+void PolygonData::select( Punkt p1, Punkt p2 )
+{
+	for( auto *i = &vd->getArray(); i && i->set; i = i->next )
+		i->var->select( p1, p2 );
+}
+
+void PolygonData::deSelect()
+{
+	for( auto *i = &vd->getArray(); i && i->set; i = i->next )
+		i->var->deSelect();
+}
+
+void PolygonData::setSichtbar( bool s )
+{
+	sichtbar = s;
+}
+
+// constant
+bool PolygonData::istSichtbar() const
+{
+	return sichtbar;
+}
+
+VertexData *PolygonData::zVertex( int num ) const
+{
+	return vd->z( num );
+}
+
+int PolygonData::getVertexAnzahl() const
+{
+	return vd->getEintragAnzahl();
+}
+
+void PolygonData::getM2( Polygon2D &pd, bool textur ) const
+{
+	int anz = vd->getEintragAnzahl();
+	if( !pd.vertex )
+		pd.vertex = new Array< Vertex >();
+	if( !pd.tKordinaten )
+		pd.tKordinaten = new Array< Punkt >();
+	for( int i = 0; i < anz; i++ )
+	{
+		pd.vertex->add( this->vd->z( i )->getPos() );
+		if( textur )
+			 pd.tKordinaten->add( this->vd->z( i )->getTPos() );
+	}
+}
+
+// Reference Counting
+PolygonData *PolygonData::getThis()
+{
+	ref++;
+	return this;
+}
+
+PolygonData *PolygonData::release()
+{
+	ref--;
+	if( !ref )
+		delete this;
+	return 0;
+}
+
+
+// Inhalt der Data Klasse aus Data.h
+// Konstruktor
+Data::Data( Model2DData *mdl )
+{
+	pd = new RCArray< PolygonData >();
+	tPos.x = 0;
+	tPos.y = 0;
+	textur = 0;
+	rTextur = 0;
+	sp = -1;
+	ref = 1;
+	int anz = ( mdl && mdl->polygons ) ? mdl->polygons->getEintragAnzahl() : 0;
+	for( int i = 0; i < anz; i++ )
+	{
+		if( mdl->polygons->hat( i ) )
+		{
+			pd->add( new PolygonData( mdl->polygons->get( i ) ) );
+			if( !tPos.x && !tPos.y )
+			{
+				if( mdl->polygons->get( i ).tKordinaten && mdl->polygons->get( i ).vertex
+					&& mdl->polygons->get( i ).tKordinaten->hat( 0 ) && mdl->polygons->get( i ).vertex->hat( 0 ) )
+				{
+					Punkt p = (Punkt)mdl->polygons->get( i ).vertex->get( 0 );
+					Punkt tp = mdl->polygons->get( i ).tKordinaten->get( 0 );
+					tPos = p - tp;
+				}
+			}
+		}
+	}
+	if( mdl )
+		mdl->release();
+}
+
+// Destruktor
+Data::~Data()
+{
+	pd->release();
+	if( textur )
+		textur->release();
+}
+
+// nicht constant
+void Data::addPolygon()
+{
+	Polygon2D p;
+	p.vertex = new Array< Vertex >();
+	pd->add( new PolygonData( p ) );
+	p.vertex->release();
+}
+
+void Data::removePolygon( int num )
+{
+	pd->remove( num );
+	if( sp == num )
+		sp = -1;
+}
+
+void Data::selectPolygon( int num )
+{
+	sp = num;
+}
+
+void Data::nachLinks( float num )
+{
+	for( auto *i = &pd->getArray(); i && i->set; i = i->next )
+		i->var->nachLinks( num );
+}
+
+void Data::nachOben( float num )
+{
+	for( auto *i = &pd->getArray(); i && i->set; i = i->next )
+		i->var->nachOben( num );
+}
+
+void Data::tNachLinks( int num )
+{
+	if( !rTextur )
+		return;
+	tPos.x -= num;
+}
+
+void Data::tNachOben( int num )
+{
+	if( !rTextur )
+		return;
+	tPos.y -= num;
+}
+
+void Data::setRTextur( bool rt )
+{
+	rTextur = rt;
+	if( rt && !textur )
+	{
+		textur = new Bild();
+		textur->neuBild( 500, 500, 0xFF505000 );
+	}
+}
+
+void Data::saveTextur()
+{
+	if( !rTextur )
+		return;
+	for( auto *i = &pd->getArray(); i && i->set; i = i->next )
+		i->var->saveTextur( tPos );
+}
+
+void Data::setTextur( Bild *t )
+{
+	if( textur )
+		textur->release();
+	textur = t;
+}
+
+void Data::select( Punkt p1, Punkt p2 )
+{
+	for( auto *i = &pd->getArray(); i && i->set; i = i->next )
+		i->var->select( p1, p2 );
+}
+
+void Data::deSelect()
+{
+	for( auto *i = &pd->getArray(); i && i->set; i = i->next )
+		i->var->deSelect();
+}
+
+// constant
+PolygonData *Data::zPolygon( int num ) const
+{
+	return pd->z( num );
+}
+
+int Data::getPolygonAnzahl() const
+{
+	return pd->getEintragAnzahl();
+}
+
+int Data::getSelectedPolygon() const
+{
+	return sp;
+}
+
+Model2DData *Data::getM2() const
+{
+	int anz = pd->getEintragAnzahl();
+	Array< Polygon2D > *polygons = new Array< Polygon2D >();
+	for( int i = 0; i < anz; i++ )
+	{
+		Polygon2D pd = { 0, 0 };
+		this->pd->z( i )->getM2( pd, rTextur );
+		polygons->add( pd );
+	}
+	Model2DData *ret = new Model2DData();
+	ret->erstelleModell( polygons );
+	return ret;
+}
+
+Bild *Data::zTextur() const
+{
+	return rTextur ? textur : 0;
+}
+
+Punkt Data::getTPos() const
+{
+	return tPos;
+}
+
+// Reference Counting
+Data *Data::getThis()
+{
+	ref++;
+	return this;
+}
+
+Data *Data::release()
+{
+	ref--;
+	if( !ref )
+		delete this;
+	return 0;
+}

+ 112 - 0
2DCreator/Data.h

@@ -0,0 +1,112 @@
+#ifndef Data_H
+#define Data_H
+
+#include <Array.h>
+#include <Punkt.h>
+#include <Bild.h>
+#include <Model2D.h>
+
+using namespace Framework;
+
+class VertexData
+{
+private:
+	Vec2< float > vertex;
+	Punkt textur;
+	bool selected;
+	bool sichtbar;
+	int ref;
+
+public:
+	// Konstruktor
+	VertexData( Vec2< float > v, Punkt t );
+	// nicht constant
+	void nachLinks( float num );
+	void nachOben( float num );
+	void saveTextur( Punkt tPos );
+	void select( Punkt p1, Punkt p2 );
+	void deSelect();
+	void setAuswahl( bool ausw );
+	void setSichtbar( bool s );
+	// constant
+	bool istSichtbar() const;
+	bool istAusgewählt() const;
+	Vec2< float > getPos() const;
+	Punkt getTPos() const;
+	// Reference Counting
+	VertexData *getThis();
+	VertexData *release();
+};
+
+class PolygonData
+{
+private:
+	RCArray< VertexData > *vd;
+	bool sichtbar;
+	int ref;
+
+public:
+	// Konstruktor
+	PolygonData( Polygon2D &pg );
+	// Destruktor
+	~PolygonData();
+	// nicht constant
+	void addVertex( Vec2< float >v, Punkt t );
+	void removeVertex( int num );
+	void nachLinks( float num );
+	void nachOben( float num );
+	void saveTextur( Punkt tPos );
+	void select( Punkt p1, Punkt p2 );
+	void deSelect();
+	void setSichtbar( bool s );
+	// constant
+	bool istSichtbar() const;
+	VertexData *zVertex( int num ) const;
+	int getVertexAnzahl() const;
+	void getM2( Polygon2D &pd, bool textur ) const;
+	// Reference Counting
+	PolygonData *getThis();
+	PolygonData *release();
+};
+
+class Data
+{
+private:
+	RCArray< PolygonData > *pd;
+	Bild *textur;
+	Punkt tPos;
+	bool rTextur;
+	int sp;
+	int ref;
+
+public:
+	// Konstruktor
+	Data( Model2DData *mdl );
+	// Destruktor
+	~Data();
+	// nicht constant
+	void addPolygon();
+	void removePolygon( int num );
+	void selectPolygon( int num );
+	void nachLinks( float num );
+	void nachOben( float num );
+	void tNachLinks( int num );
+	void tNachOben( int num );
+	void setRTextur( bool rt );
+	void saveTextur();
+	void setTextur( Bild *t );
+	void select( Punkt p1, Punkt p2 );
+	void deSelect();
+	// constant
+	PolygonData *zPolygon( int num ) const;
+	int getPolygonAnzahl() const;
+	int getSelectedPolygon() const;
+	Model2DData *getM2() const;
+	Bild *zTextur() const;
+	Punkt getTPos() const;
+	// Reference Counting
+	Data *getThis();
+	Data *release();
+};
+
+#endif

+ 310 - 0
2DCreator/Editor2D.cpp

@@ -0,0 +1,310 @@
+#include "Editor2D.h"
+#include <Rahmen.h>
+#include <Text.h>
+#include <Globals.h>
+#include <TastaturEreignis.h>
+#include <MausEreignis.h>
+
+// Inhalt der Editor2D Klasse aus Editor2D.h
+// Konstruktor
+Editor2D::Editor2D( Schrift *zSchrift )
+{
+	pos.x = 10;
+	pos.y = 10;
+	offs.x = -360;
+	offs.y = -360;
+	mausPos.x = 0;
+	mausPos.y = 0;
+	data = 0;
+	ram = new LRahmen();
+	ram->setFarbe( 0xFFFFFFFF );
+	ram->setRamenBreite( 1 );
+	ram->setSize( 720, 720 );
+	select = new LRahmen();
+	select->setFarbe( 0xFF5050FF );
+	select->setRamenBreite( 1 );
+	schrift = zSchrift->getThis();
+	addV = Vertex( 0, 0 );
+	mausIn = 0;
+	größe = 1;
+	ref = 1;
+}
+
+// Destruktor
+Editor2D::~Editor2D()
+{
+	ram->release();
+	select->release();
+	schrift->release();
+	if( data )
+		data->release();
+}
+
+// nicht constant
+void Editor2D::setDataZ( Data *d )
+{
+	if( data )
+		data->release();
+	data = d;
+}
+
+void Editor2D::doMausEreignis( MausEreignis &me )
+{
+	me.mx -= pos.x;
+	me.my -= pos.y;
+	if( me.mx < 0 || me.my < 0 || me.mx > ram->getBreite() || me.my > ram->getHeight() )
+	{
+		me.mx += pos.x;
+		me.my += pos.y;
+		mausIn = 0;
+		return;
+	}
+	mausIn = 1;
+	rend = 1;
+	addV = Vertex( (float)me.mx, (float)me.my ) / größe + offs;
+	if( me.id == ME_UScroll )
+		größe += 0.01f;
+	if( me.id == ME_DScroll )
+		größe -= 0.01f;
+	if( me.id == ME_PLinks )
+	{
+		select->setPosition( me.mx, me.my );
+		select->setSize( 0, 0 );
+	}
+	if( me.id == ME_PRechts || me.id == ME_PMitte )
+	{
+		mausPos.x = me.mx;
+		mausPos.y = me.my;
+	}
+	if( me.id == ME_Bewegung )
+	{
+		if( getMausStand( M_Links ) )
+		{
+			select->setSize( me.mx - select->getX(), me.my - select->getY() );
+		}
+		if( getMausStand( M_Rechts ) )
+		{
+			data->nachLinks( ( mausPos.x - me.mx ) / größe );
+			data->nachOben( ( mausPos.y - me.my ) / größe );
+			mausPos.x = me.mx;
+			mausPos.y = me.my;
+		}
+		if( getMausStand( M_Mitte ) )
+		{
+			data->tNachLinks( (int)( ( mausPos.x - me.mx ) / größe ) );
+			data->tNachOben( (int)( ( mausPos.y - me.my ) / größe ) );
+			mausPos.x = me.mx;
+			mausPos.y = me.my;
+		}
+	}
+	if( me.id == ME_RLinks )
+	{
+		if( !getTastenStand( T_Shift ) )
+			data->deSelect();
+		data->select( ( Vec2<float> )select->getPosition() / größe + offs, ( Vec2<float> )( select->getPosition() + select->getSize() ) / größe + offs );
+		select->setSize( 0, 0 );
+		select->setPosition( 0, 0 );
+	}
+	if( me.id == ME_RRechts )
+	{
+		mausPos.x = 0;
+		mausPos.y = 0;
+	}
+	me.verarbeitet = 1;
+	me.mx += pos.x;
+	me.my += pos.y;
+}
+
+void Editor2D::doTastaturEreignis( TastaturEreignis &te )
+{
+	if( te.id == TE_Release && te.taste == T_Enter && mausIn )
+	{
+		PolygonData *pd = data->zPolygon( data->getSelectedPolygon() );
+		if( pd )
+		{
+			pd->addVertex( addV, Punkt( 0, 0 ) );
+			rend = 1;
+		}
+	}
+	if( te.id == TE_Release && te.taste == T_Einfg )
+	{
+		data->addPolygon();
+		rend = 1;
+	}
+}
+
+bool Editor2D::tick( double zeit )
+{
+	if( mausIn )
+	{
+		if( getTastenStand( T_Links ) )
+		{
+			offs.x--;
+			rend = 1;
+		}
+		if( getTastenStand( T_Rechts ) )
+		{
+			offs.x++;
+			rend = 1;
+		}
+		if( getTastenStand( T_Oben ) )
+		{
+			offs.y--;
+			rend = 1;
+		}
+		if( getTastenStand( T_Unten ) )
+		{
+			offs.y++;
+			rend = 1;
+		}
+		if( getTastenStand( 'w' ) )
+		{
+			data->tNachOben( 1 );
+			rend = 1;
+		}
+		if( getTastenStand( 'a' ) )
+		{
+			data->tNachLinks( 1 );
+			rend = 1;
+		}
+		if( getTastenStand( 's' ) )
+		{
+			data->tNachOben( -1 );
+			rend = 1;
+		}
+		if( getTastenStand( 'd' ) )
+		{
+			data->tNachLinks( -1 );
+			rend = 1;
+		}
+	}
+	bool ret = rend;
+	rend = 0;
+	return ret;
+}
+
+void Editor2D::render( Bild &zRObj )
+{
+	if( !zRObj.setDrawOptions( pos, ram->getSize() ) )
+		return;
+	ram->render( zRObj );
+	if( !zRObj.setDrawOptions( 1, 1, ram->getBreite() - 2, ram->getHeight() - 2 ) )
+	{
+		zRObj.releaseDrawOptions();
+		return;
+	}
+	if( data->zTextur() )
+	{
+		Punkt tPos = data->getTPos();
+		zRObj.alphaBildSkall( (int)( ( tPos.x - offs.x ) * größe ), (int)( ( tPos.y - offs.y ) * größe ),
+							  (int)( data->zTextur()->getBreite() * größe ), (int)( data->zTextur()->getHeight() * größe ), *data->zTextur() );
+	}
+	// Raster mahlen
+	int anz = (int)( 720 / ( 50 * größe ) );
+	int xStart = ( 50 - abs( offs.x ) % 50 );
+	if( offs.x < 0 )
+		xStart = -offs.x % 50;
+	if( offs.x == 0 )
+		xStart = 0;
+	int yStart = ( 50 - abs( offs.y ) % 50 );
+	if( offs.y < 0 )
+		yStart = -offs.y % 50;
+	if( offs.y == 0 )
+		yStart = 0;
+	for( float x = xStart * größe, y = yStart * größe; !( x > 720 && y > 720 ); x += 50 * größe, y += 50 * größe )
+	{
+		zRObj.drawLinieH( 0, (int)y, 720, 0xFF505050 );
+		zRObj.drawLinieV( (int)x, 0, 720, 0xFF505050 );
+	}
+	Text xPos = "";
+	xPos = offs.x + (int)( xStart + 50 * ( anz / 2 ) );
+	schrift->setDrawPosition( (int)( xStart * größe + 50 * größe * ( anz / 2 ) ), 0 );
+	schrift->renderText( &xPos, zRObj, 0xFF505050 );
+	xPos = offs.y + (int)( yStart + 50 * ( anz / 2 ) );
+	schrift->setDrawPosition( 0, (int)( yStart * größe + 50 * größe * ( anz / 2 ) ) );
+	schrift->renderText( &xPos, zRObj, 0xFF505050 );
+	// Model mahlen
+	int pAnz = data->getPolygonAnzahl();
+	for( int i = 0; i < pAnz; i++ )
+	{
+		PolygonData *p = data->zPolygon( i );
+		if( !p->istSichtbar() )
+			continue;
+		if( data->getSelectedPolygon() == i && mausIn )
+		{
+			int vAnz = p->getVertexAnzahl();
+			VertexData tmp = VertexData( addV, Punkt() );
+			VertexData *l = p->zVertex( vAnz - 1 );
+			for( int j = -1; j < vAnz && vAnz > 0; j++ )
+			{
+				VertexData *v = j < 0 ? &tmp : p->zVertex( j );
+				if( l && v )
+				{
+					if( l->istSichtbar() && v->istSichtbar() )
+						zRObj.drawLinie( ( ( l->getPos() - offs ) * größe ), ( ( v->getPos() - offs ) * größe ), 0xFFA0A0A0 );
+					else
+						zRObj.drawLinie( ( ( l->getPos() - offs ) * größe ), ( ( v->getPos() - offs ) * größe ), 0xFF606060 );
+				}
+				if( !l->istSichtbar() )
+				{
+					l = v;
+					continue;
+				}
+				if( j == 0 )
+					zRObj.fillRegion( (int)( ( l->getPos().x - offs.x ) * größe ) - 5, (int)( ( l->getPos().y - offs.y ) * größe ) - 5, 10, 10, 0xFF50FF50 );
+				else
+				{
+					if( !l->istAusgewählt() )
+						zRObj.fillRegion( (int)( ( l->getPos().x - offs.x ) * größe ) - 5, (int)( ( l->getPos().y - offs.y ) * größe ) - 5, 10, 10, 0xFF5050FF );
+					else
+						zRObj.fillRegion( (int)( ( l->getPos().x - offs.x ) * größe ) - 5, (int)( ( l->getPos().y - offs.y ) * größe ) - 5, 10, 10, 0xFFFF5050 );
+				}
+				l = v;
+			}
+		}
+		else
+		{
+			int vAnz = p->getVertexAnzahl();
+			VertexData *l = p->zVertex( vAnz - 1 );
+			for( int j = 0; j < vAnz; j++ )
+			{
+				VertexData *v = p->zVertex( j );
+				if( l && v )
+				{
+					if( l->istSichtbar() && v->istSichtbar() )
+						zRObj.drawLinie( ( ( l->getPos() - offs ) * größe ), ( ( v->getPos() - offs ) * größe ), 0xFFA0A0A0 );
+					else
+						zRObj.drawLinie( ( ( l->getPos() - offs ) * größe ), ( ( v->getPos() - offs ) * größe ), 0xFF606060 );
+				}
+				if( !l->istSichtbar() )
+				{
+					l = v;
+					continue;
+				}
+				if( !l->istAusgewählt() )
+					zRObj.fillRegion( (int)( ( l->getPos().x - offs.x ) * größe ) - 5, (int)( ( l->getPos().y - offs.y ) * größe ) - 5, 10, 10, 0xFF5050FF );
+				else
+					zRObj.fillRegion( (int)( ( l->getPos().x - offs.x ) * größe ) - 5, (int)( ( l->getPos().y - offs.y ) * größe ) - 5, 10, 10, 0xFFFF5050 );
+				l = v;
+			}
+		}
+	}
+	select->render( zRObj );
+	zRObj.releaseDrawOptions();
+	zRObj.releaseDrawOptions();
+}
+
+// Reference Counting
+Editor2D *Editor2D::getThis()
+{
+	ref++;
+	return this;
+}
+
+Editor2D *Editor2D::release()
+{
+	ref--;
+	if( !ref )
+		delete this;
+	return 0;
+}

+ 41 - 0
2DCreator/Editor2D.h

@@ -0,0 +1,41 @@
+#ifndef Editor2D_H
+#define Editor2D_H
+
+#include <Zeichnung.h>
+#include <Schrift.h>
+#include "Data.h"
+
+using namespace Framework;
+
+class Editor2D : public Zeichnung
+{
+private:
+	Punkt pos;
+	Punkt offs;
+	Data *data;
+	LRahmen *ram;
+	LRahmen *select;
+	Schrift *schrift;
+	Punkt mausPos;
+	Vertex addV;
+	bool mausIn;
+	float größe;
+	int ref;
+
+public:
+	// Konstruktor
+	Editor2D( Schrift *zSchrift );
+	// Destruktor
+	~Editor2D();
+	// nicht constant
+	void setDataZ( Data *d );
+	void doMausEreignis( MausEreignis &me ) override;
+	void doTastaturEreignis( TastaturEreignis &te ) override;
+	bool tick( double zeit ) override;
+	void render( Bild &zRObj ) override;
+	// Reference Counting
+	Editor2D *getThis();
+	Editor2D *release();
+};
+
+#endif

+ 194 - 0
2DCreator/EditorListe.cpp

@@ -0,0 +1,194 @@
+#include "EditorListe.h"
+#include <Rahmen.h>
+#include <MausEreignis.h>
+#include <Text.h>
+
+// Inhalt der EditorListe Klasse aus EditorListe.h
+// Konstruktor
+EditorListe::EditorListe( Schrift *zSchrift )
+{
+	ram = new LRahmen();
+	ram->setRamenBreite( 1 );
+	ram->setFarbe( 0xFFFFFFFF );
+	ram->setSize( 250, 780 );
+	ram->setPosition( 740, 10 );
+	scroll = new VScrollBar();
+	schrift = zSchrift->getThis();
+	data = 0;
+	ref = 1;
+}
+
+// Destruktor
+EditorListe::~EditorListe()
+{
+	ram->release();
+	scroll->release();
+	if( data )
+		data->release();
+	schrift->release();
+}
+
+// nicht constant
+void EditorListe::setDataZ( Data *d )
+{
+	if( data )
+		data->release();
+	data = d;
+}
+
+void EditorListe::doMausEreignis( MausEreignis &me )
+{
+	me.mx -= ram->getX();
+	me.my -= ram->getY();
+	if( me.mx < 0 || me.my < 0 || me.mx > ram->getBreite() || me.my > ram->getHeight() )
+	{
+		me.mx += ram->getX();
+		me.my += ram->getY();
+		return;
+	}
+	scroll->doMausMessage( ram->getBreite() - 17, 1, 15, ram->getHeight() - 2, me );
+	rend |= scroll->getRend();
+	if( me.id == ME_RLinks )
+	{
+		int pAnz = data->getPolygonAnzahl();
+		int y = -scroll->getScrollData()->scrollPos;
+		for( int i = 0; i < pAnz; i++ )
+		{
+			if( me.mx > 0 && me.my > y && me.mx < 20 && me.my < y + 20 )
+			{ // Ein und Ausklappen
+				if( !ausgeklappt.hat( i ) )
+					ausgeklappt.set( 0, i );
+				ausgeklappt.set( !ausgeklappt.get( i ), i );
+				rend = 1;
+			}
+			else if( me.mx > 215 && me.my > y + 1 && me.mx < 232 && me.my < y + 19 )
+			{ // Löschen
+				data->removePolygon( i );
+				rend = 1;
+				break;
+			}
+			else if( me.mx > 0 && me.my > y && me.mx < 233 && me.my < y + 20 )
+			{ // Polygon Auswählen und Abwählen
+				if( data->getSelectedPolygon() != i )
+				    data->selectPolygon( i );
+				else
+					data->selectPolygon( -1 );
+				rend = 1;
+			}
+			PolygonData *pd = data->zPolygon( i );
+			if( pd && ausgeklappt.hat( i ) && ausgeklappt.get( i ) )
+			{
+				int vAnz = pd->getVertexAnzahl();
+				for( int j = 0; j < vAnz; j++ )
+				{
+					y += 20;
+					if( me.mx > 215 && me.my > y + 1 && me.mx < 232 && me.my < y + 19 )
+					{ // Löschen
+						pd->removeVertex( j );
+						rend = 1;
+					}
+					else if( me.mx > 195 && me.my > y + 5 && me.mx < 205 && me.my < y + 15 )
+					{ // Sichtbar und Unsichtbar
+						pd->zVertex( j )->setSichtbar( !pd->zVertex( j )->istSichtbar() );
+						rend = 1;
+					}
+					else if( me.my > y && me.my < y + 20 && me.mx > 0 && me.mx < 233 )
+					{ // Auswählen und Abwählen
+						pd->zVertex( j )->setAuswahl( !pd->zVertex( j )->istAusgewählt() );
+						rend = 1;
+					}
+				}
+			}
+			y += 20;
+		}
+	}
+	me.verarbeitet = 1;
+	me.mx += ram->getX();
+	me.my += ram->getY();
+}
+
+bool EditorListe::tick( double zeit )
+{
+	bool ret = rend;
+	rend = 0;
+	return ret;
+}
+
+void EditorListe::render( Bild &zRObj )
+{
+	ram->render( zRObj );
+	if( !zRObj.setDrawOptions( ram->getPosition() + Punkt( 1, 1 ), ram->getSize() - Punkt( 2, 2 ) ) )
+		return;
+	scroll->render( ram->getBreite() - 17, 1, 15, ram->getHeight() - 2, zRObj );
+	int pAnz = data->getPolygonAnzahl();
+	int y = -scroll->getScrollData()->scrollPos;
+	int maxH = 0;
+	schrift->lock();
+	schrift->setSchriftSize( 12 );
+	Text name;
+	for( int i = 0; i < pAnz; i++ )
+	{
+		if( data->getSelectedPolygon() == i )
+			zRObj.fillRegion( 0, y, 233, 20, 0xFF002000 );
+		name = "Polygon ";
+		name += i;
+		schrift->setDrawPosition( 20, y + 4 );
+		schrift->renderText( &name, zRObj, 0xFFFFFFFF );
+		zRObj.drawLinie( Punkt( 215, y + 1 ), Punkt( 232, y + 18 ), 0xFFFF0000 );
+		zRObj.drawLinie( Punkt( 232, y + 1 ), Punkt( 215, y + 18 ), 0xFFFF0000 );
+		if( ausgeklappt.hat( i ) && ausgeklappt.get( i ) )
+		{
+			zRObj.drawDreieck( Punkt( 10, 4 + y ), Punkt( 4, 16 + y ), Punkt( 16, 16 + y ), 0xFFFFFFFF );
+			PolygonData *pd = data->zPolygon( i );
+			if( pd )
+			{
+				int vAnz = pd->getVertexAnzahl();
+				for( int j = 0; j < vAnz; j++ )
+				{
+					maxH += 20;
+					y += 20;
+					if( pd->zVertex( j )->istAusgewählt() )
+						zRObj.fillRegion( 0, y, 233, 20, 0xFF101010 );
+					name = "  Vertex ";
+					name += j;
+					schrift->setDrawPosition( 20, y + 4 );
+					schrift->renderText( &name, zRObj, 0xFFFFFFFF );
+					zRObj.drawLinie( Punkt( 215, y + 1 ), Punkt( 232, y + 18 ), 0xFFFF0000 );
+					zRObj.drawLinie( Punkt( 232, y + 1 ), Punkt( 215, y + 18 ), 0xFFFF0000 );
+					if( pd->zVertex( j )->istSichtbar() )
+					{
+						zRObj.drawKreis( 200, y + 10, 5, 0xFFFFFFFF );
+						zRObj.drawKreis( 200, y + 10, 1, 0xFFFFFFFF );
+					}
+					else
+					{
+						zRObj.drawKreis( 200, y + 10, 5, 0xFF505050 );
+						zRObj.drawKreis( 200, y + 10, 1, 0xFF505050 );
+					}
+				}
+			}
+		}
+		else
+			zRObj.drawDreieck( Punkt( 10, 16 + y ), Punkt( 4, 4 + y ), Punkt( 16, 4 + y ), 0xFFFFFFFF );
+		maxH += 20;
+		y += 20;
+	}
+	schrift->unlock();
+	scroll->update( maxH, ram->getHeight() - 2 );
+	zRObj.releaseDrawOptions();
+}
+
+// Reference Counting
+EditorListe *EditorListe::getThis()
+{
+	ref++;
+	return this;
+}
+
+EditorListe *EditorListe::release()
+{
+	ref--;
+	if( !ref )
+		delete this;
+	return 0;
+}

+ 36 - 0
2DCreator/EditorListe.h

@@ -0,0 +1,36 @@
+#ifndef EditorListe_H
+#define EditorListe_H
+
+#include <Zeichnung.h>
+#include <Scroll.h>
+#include <Schrift.h>
+#include "Data.h"
+
+using namespace Framework;
+
+class EditorListe : public Zeichnung
+{
+private:
+	LRahmen *ram;
+	VScrollBar *scroll;
+	Data *data;
+	Array< bool > ausgeklappt;
+	Schrift *schrift;
+	int ref;
+
+public:
+	// Konstruktor
+	EditorListe( Schrift *zSchrift );
+	// Destruktor
+	~EditorListe();
+	// nicht constant
+	void setDataZ( Data *d );
+	void doMausEreignis( MausEreignis &me ) override;
+	bool tick( double zeit ) override;
+	void render( Bild &zRObj ) override;
+	// Reference Counting
+	EditorListe *getThis();
+	EditorListe *release();
+};
+
+#endif

BIN
2DCreator/Framework.dll


+ 250 - 0
2DCreator/GUI.cpp

@@ -0,0 +1,250 @@
+#include "GUI.h"
+#include <TextFeld.h>
+#include <MausEreignis.h>
+#include <M2Datei.h>
+#include <Text.h>
+#include <DateiSystem.h>
+#include <DateiDialog.h>
+
+Knopf *initKnopf( int x, int y, int br, int hö, Schrift *zSchrift, int style, char *titel )
+{
+	Knopf *ret = new Knopf();
+	ret->addStyle( style );
+	ret->setPosition( x, y );
+	ret->setSize( br, hö );
+	if( zSchrift )
+		ret->setSchriftZ( zSchrift->getThis() );
+	ret->setText( titel );
+	return ret;
+}
+
+TextFeld *initTextFeld( int x, int y, int br, int hö, Schrift *zSchrift, int style, char *txt )
+{
+	TextFeld *ret = new TextFeld();
+	ret->setStyle( style );
+	ret->setSchriftZ( zSchrift->getThis() );
+	ret->setText( txt );
+	ret->setSchriftFarbe( 0xFFFFFFFF );
+	ret->setSchriftSize( 12 );
+	if( ret->hatStyle( TextFeld::Style::Buffered ) )
+	{
+		ret->setAlphaFeldFarbe( 0x5500FF00 );
+		ret->setAlphaFeldStrength( -5 );
+	}
+	if( ret->hatStyle( TextFeld::Style::Rahmen ) )
+	{
+		ret->setLinienRahmenBreite( 1 );
+		ret->setLinienRahmenFarbe( 0xFF00FF00 );
+	}
+	ret->setPosition( x, y );
+	ret->setSize( br, hö );
+	return ret;
+}
+
+KontrollKnopf *initKontrollKnopf( int x, int y, int br, int hö, Schrift *zSchrift, int style, char *txt )
+{
+	KontrollKnopf *ret = new KontrollKnopf();
+	ret->setStyle( style );
+	ret->setSchriftZ( zSchrift->getThis() );
+	ret->setText( txt );
+	ret->setSText( txt );
+	ret->setSFarbe( 0xFFFFFFFF );
+	ret->setSSize( 12 );
+	if( ret->hatStyle( TextFeld::Style::Buffered ) )
+	{
+		ret->setAlphaFeldFarbe( 0x5500FF00 );
+		ret->setAlphaFeldStrength( -5 );
+	}
+	if( ret->hatStyle( TextFeld::Style::Rahmen ) )
+	{
+		ret->setLinienRahmenBreite( 1 );
+		ret->setLinienRahmenFarbe( 0xFF00FF00 );
+	}
+	ret->setPosition( x, y );
+	ret->setSize( br, hö );
+	ret->loadData( "../data/system.ltdb" );
+	ret->setMausEreignis( _ret1ME );
+	return ret;
+}
+
+// Inhalt der GUI Klasse aus GUI.h
+// Konstruktor
+GUI::GUI( Schrift *zSchrift )
+{
+	laden = initKnopf( 10, 740, 100, 20, zSchrift, Knopf::Style::Sichtbar, "Laden" );
+	speichern = initKnopf( 630, 740, 100, 20, zSchrift, Knopf::Style::Sichtbar, "Speichern" );
+	pfad = initTextFeld( 120, 740, 300, 20, zSchrift, TextFeld::Style::TextFeld, "Dateipfad" );
+    suchen = initKnopf( 430, 740, 80, 20, zSchrift, Knopf::Style::Normal, "Durchsuchen" );
+	name = initTextFeld( 520, 740, 100, 20, zSchrift, TextFeld::Style::TextFeld, "Name" );
+	textur = initKontrollKnopf( 10, 770, 70, 20, zSchrift, KontrollKnopf::Style::Normal, "Textur" );
+	texturSpeichern = initKnopf( 90, 770, 100, 20, zSchrift, Knopf::Style::Sichtbar, "Textur Speichern" );
+	texturPfad = initTextFeld( 200, 770, 220, 20, zSchrift, TextFeld::Style::TextFeld, "Textur Pfad" );
+    texturSuchen = initKnopf( 430, 770, 80, 20, zSchrift, Knopf::Style::Normal, "Durchsuchen" );
+	texturName = initTextFeld( 520, 770, 100, 20, zSchrift, TextFeld::Style::TextFeld, "Textur Name" );
+	texturLaden = initKnopf( 630, 770, 100, 20, zSchrift, Knopf::Style::Sichtbar, "Textur Laden" );
+	data = new Data( 0 );
+	editor = new Editor2D( zSchrift );
+	editor->setDataZ( data->getThis() );
+	liste = new EditorListe( zSchrift );
+	liste->setDataZ( data->getThis() );
+	ref = 1;
+}
+
+// Destruktor
+GUI::~GUI()
+{
+	editor->release();
+	liste->release();
+	speichern->release();
+	laden->release();
+	pfad->release();
+    suchen->release();
+	name->release();
+	data->release();
+	textur->release();
+	texturSpeichern->release();
+	texturPfad->release();
+    texturSuchen->release();
+	texturName->release();
+	texturLaden->release();
+}
+
+// nicht constant
+void GUI::doMausEreignis( MausEreignis &me )
+{
+	editor->doMausEreignis( me );
+	liste->doMausEreignis( me );
+	bool vera = me.verarbeitet;
+	speichern->doMausEreignis( me );
+	if( me.id == ME_RLinks && me.verarbeitet && !vera )
+	{
+		M2Datei d;
+		d.setPfad( pfad->zText()->getText() );
+		d.leseDaten();
+		Model2DData *md = data->getM2();
+		d.saveModel( md, name->zText()->getText() );
+		md->release();
+	}
+	vera = me.verarbeitet;
+	laden->doMausEreignis( me );
+	if( me.id == ME_RLinks && me.verarbeitet && !vera )
+	{
+		M2Datei d;
+		d.setPfad( pfad->zText()->getText() );
+		d.leseDaten();
+		Model2DData *md = d.ladeModel( name->zText()->getText() );
+		if( md )
+		{
+			data->release();
+			data = new Data( md );
+			editor->setDataZ( data->getThis() );
+			liste->setDataZ( data->getThis() );
+		}
+		else
+			MessageBox( 0, "Das Objekt wurde nicht gefunden.", "Fehler", MB_ICONERROR );
+	}
+    vera = me.verarbeitet;
+    suchen->doMausEreignis( me );
+    if( me.id == ME_RLinks && me.verarbeitet && !vera )
+    {
+        DateiDialog d;
+        d.addDateiTyp( "2D Modell Datei", "*.m2" );
+        Text *path = d.anzeigen( 1 );
+        if( path )
+            pfad->setText( path );
+    }
+    vera = me.verarbeitet;
+    texturSuchen->doMausEreignis( me );
+    if( me.id == ME_RLinks && me.verarbeitet && !vera )
+    {
+        DateiDialog d;
+        d.addDateiTyp( "Bild Archiv", "*.ltdb" );
+        Text *path = d.anzeigen( 1 );
+        if( path )
+            texturPfad->setText( path );
+    }
+	pfad->doMausEreignis( me );
+	name->doMausEreignis( me );
+	textur->doMausEreignis( me );
+	data->setRTextur( textur->hatStyle( KontrollKnopf::Style::Selected ) );
+	vera = me.verarbeitet;
+	texturSpeichern->doMausEreignis( me );
+	if( !vera && me.verarbeitet && me.id == ME_RLinks )
+		data->saveTextur();
+	texturPfad->doMausEreignis( me );
+	texturName->doMausEreignis( me );
+	vera = me.verarbeitet;
+	texturLaden->doMausEreignis( me );
+	if( !vera && me.verarbeitet && me.id == ME_RLinks )
+	{
+		LTDBDatei bd;
+		bd.setDatei( texturPfad->getText() );
+		bd.leseDaten( 0 );
+		Bild *t = bd.laden( 0, texturName->getText() );
+		if( !t )
+			MessageBox( 0, "Das Bild wurde nicht gefunden.", "Fehler", MB_ICONERROR );
+		else
+			data->setTextur( t );
+	}
+}
+
+void GUI::doTastaturEreignis( TastaturEreignis &te )
+{
+	editor->doTastaturEreignis( te );
+	pfad->doTastaturEreignis( te );
+	name->doTastaturEreignis( te );
+	texturPfad->doTastaturEreignis( te );
+	texturName->doTastaturEreignis( te );
+}
+
+bool GUI::tick( double zeit )
+{
+	rend |= editor->tick( zeit );
+	rend |= liste->tick( zeit );
+	rend |= speichern->tick( zeit );
+	rend |= laden->tick( zeit );
+	rend |= pfad->tick( zeit );
+    rend |= suchen->tick( zeit );
+	rend |= name->tick( zeit );
+	rend |= textur->tick( zeit );
+	rend |= texturSpeichern->tick( zeit );
+	rend |= texturName->tick( zeit );
+	rend |= texturPfad->tick( zeit );
+    rend |= texturSuchen->tick( zeit );
+	rend |= texturLaden->tick( zeit );
+	bool ret = rend;
+	rend = 0;
+	return ret;
+}
+
+void GUI::render( Bild &zRObj )
+{
+	editor->render( zRObj );
+	liste->render( zRObj );
+	speichern->render( zRObj );
+	laden->render( zRObj );
+	pfad->render( zRObj );
+    suchen->render( zRObj );
+	name->render( zRObj );
+	textur->render( zRObj );
+	texturSpeichern->render( zRObj );
+	texturPfad->render( zRObj );
+    texturSuchen->render( zRObj );
+	texturName->render( zRObj );
+	texturLaden->render( zRObj );
+}
+
+// Reference Counting
+GUI *GUI::getThis()
+{
+	ref++;
+	return 0;
+}
+
+GUI *GUI::release()
+{
+	ref--;
+	if( !ref )
+		delete this;
+	return 0;
+}

+ 44 - 0
2DCreator/GUI.h

@@ -0,0 +1,44 @@
+#ifndef GUI_H
+#define HUI_H
+
+#include <Knopf.h>
+#include "EditorListe.h"
+#include "Editor2D.h"
+
+using namespace Framework;
+
+class GUI : public Zeichnung
+{
+private:
+	Knopf *speichern;
+	Knopf *laden;
+	TextFeld *pfad;
+	TextFeld *name;
+	Editor2D *editor;
+	EditorListe *liste;
+	KontrollKnopf *textur;
+	TextFeld *texturPfad;
+	TextFeld *texturName;
+	Knopf *texturLaden;
+	Knopf *texturSpeichern;
+    Knopf *texturSuchen;
+    Knopf *suchen;
+	Data *data;
+	int ref;
+
+public:
+	// Konstruktor
+	GUI( Schrift *zSchrifto );
+	// Destruktor
+	~GUI();
+	// nicht constant
+	void doMausEreignis( MausEreignis &me ) override;
+	void doTastaturEreignis( TastaturEreignis &te ) override;
+	bool tick( double zeit ) override;
+	void render( Bild &zRObj ) override;
+	// Reference Counting
+	GUI *getThis();
+	GUI *release();
+};
+
+#endif

+ 63 - 0
2DCreator/Start.cpp

@@ -0,0 +1,63 @@
+#include <main.h>
+#include <Fenster.h>
+#include <Punkt.h>
+#include <Bildschirm.h>
+#include <RenderThread.h>
+#include <MausEreignis.h>
+#include <Schrift.h>
+#include <DateiSystem.h>
+#include <Text.h>
+#include <TastaturEreignis.h>
+#include "GUI.h"
+
+using namespace Framework;
+
+void FSchließen( void *p, void *obj )
+{
+	StopNachrichtenSchleife( ( (WFenster*)obj )->getFensterHandle() );
+}
+
+int KSGStart Framework::Start( Startparam p )
+{
+	WNDCLASS wc = F_Normal( p.hinst );
+	wc.lpszClassName = "2D Creator";
+	WFenster *wf = new WFenster();
+	wf->erstellen( WS_OVERLAPPEDWINDOW, wc );
+	wf->setSize( 1000, 820 );
+	wf->setPosition( Bildschirmmitte( wf->getThis() ) );
+	wf->setVerschiebbar( 1 );
+	wf->setVSchließAktion( FSchließen );
+	wf->setMausAktion( _ret1ME );
+	wf->setTastaturAktion( _ret1TE );
+	wf->setAnzeigeModus( 1 );
+
+	Bildschirm *bs = new Bildschirm3D( wf->getThis() );
+	wf->setBildschirm( bs->getThis() );
+	bs->update();
+	bs->render();
+
+	RenderTh *rt = new RenderTh();
+	rt->setBildschirm( bs->getThis() );
+	rt->beginn();
+
+	LTDSDatei sd;
+	sd.setPfad( new Text( "../data/normal.ltds" ) );
+	sd.leseDaten();
+	Schrift *sn = sd.ladeSchrift();
+
+	GUI *gui = new GUI( sn );
+	bs->addMember( gui );
+
+	StartNachrichtenSchleife();
+
+	rt->beenden();
+
+	gui->release();
+	sn->release();
+	rt->release();
+	bs->release();
+	wf->setBildschirm( 0 );
+	wf->release();
+
+	return 0;
+}

BIN
2DCreator/Test.m2


BIN
2DCreator/game.ltdb


BIN
2DCreator/t.m2


BIN
Fertig/data/normal.ltds


BIN
Fertig/data/system.ltdb


BIN
Fertig/x32/2DCreator.exe


BIN
Fertig/x32/Framework.dll


BIN
data/normal.ltds


BIN
data/system.ltdb