diff --git a/.gitignore b/.gitignore
index 7046fcc..a1b5a61 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,4 @@
*.exe
-lib/
\ No newline at end of file
+*.log
+lib/
+old/
\ No newline at end of file
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..c86d273
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "OpenGLCore"]
+ path = OpenGLCore
+ url = ../lazopenglcore.git
diff --git a/OpenGLCore b/OpenGLCore
new file mode 160000
index 0000000..f6ca47e
--- /dev/null
+++ b/OpenGLCore
@@ -0,0 +1 @@
+Subproject commit f6ca47eeb2c217505d9c1babe79d46b6668d3881
diff --git a/TextSuiteTest.lpr b/TextSuiteTest.lpr
deleted file mode 100644
index 79eb67f..0000000
--- a/TextSuiteTest.lpr
+++ /dev/null
@@ -1,22 +0,0 @@
-program TextSuiteTest;
-
-{$mode objfpc}{$H+}
-
-uses
- {$IFDEF UNIX}{$IFDEF UseCThreads}
- cthreads,
- {$ENDIF}{$ENDIF}
- Interfaces, // this includes the LCL widgetset
- Forms, uMainForm, TextSuite, TextSuiteClasses, TextSuiteImports, TextSuitePostProcess, TextSuiteTTFUtils,
- TextSuiteVersion, TextSuiteWideUtils, utsTextSuite, utsFontCreatorGDI, utsTtfUtils, utsTypes, utsUtils,
-utsRendererOpenGL;
-
-{$R *.res}
-
-begin
- RequireDerivedFormResource := True;
- Application.Initialize;
- Application.CreateForm(TMainForm, MainForm);
- Application.Run;
-end.
-
diff --git a/copyright.txt b/copyright.txt
new file mode 100644
index 0000000..e163df6
--- /dev/null
+++ b/copyright.txt
@@ -0,0 +1,28 @@
+TextSuite 2.0 Copyright(C) 2015 Bergmann89
+http://bergmann89.de
+
+This project is altered from the original TextSuite written by Steffen Xonna (aka Lossy eX).
+It is provided under the following licence and copyright.
+
+----------------------------------------------------------------------------------------------
+TextSuite Copyright (C) 2007-2009 Steffen Xonna (aka Lossy eX)
+http://www.opengl24.de/
+
+This license applies to everything in this package, except where otherwise
+noted.
+
+This software is provided 'as-is', without any express or implied warranty. In
+no event will the authors be held liable for any damages arising from the use
+of this software.
+
+Permission is granted to anyone to use this software for any purpose, including
+commercial applications, and to alter it and redistribute it freely, subject to
+the following restrictions:
+
+1. The origin of this software must not be misrepresented; you must not claim
+ that you wrote the original software. If you use this software in a product,
+ an acknowledgment in the product documentation would be appreciated but is
+ not required.
+2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+3. This notice may not be removed or altered from any source distribution.
diff --git a/TextSuiteTest.ico b/examples/simple/TextSuiteTest.ico
similarity index 100%
rename from TextSuiteTest.ico
rename to examples/simple/TextSuiteTest.ico
diff --git a/TextSuiteTest.lpi b/examples/simple/TextSuiteTest.lpi
similarity index 60%
rename from TextSuiteTest.lpi
rename to examples/simple/TextSuiteTest.lpi
index 7d190ab..17f73b6 100644
--- a/TextSuiteTest.lpi
+++ b/examples/simple/TextSuiteTest.lpi
@@ -33,7 +33,7 @@
-
+
@@ -47,65 +47,29 @@
-
+
-
-
+
-
-
+
-
-
+
-
-
+
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -116,7 +80,7 @@
-
+
diff --git a/examples/simple/TextSuiteTest.lpr b/examples/simple/TextSuiteTest.lpr
new file mode 100644
index 0000000..402db9e
--- /dev/null
+++ b/examples/simple/TextSuiteTest.lpr
@@ -0,0 +1,27 @@
+program TextSuiteTest;
+
+{$mode objfpc}{$H+}
+
+uses
+ {$IFDEF UNIX}{$IFDEF UseCThreads}
+ cthreads,
+ {$ENDIF}{$ENDIF}
+ Interfaces, sysutils, Forms, uMainForm,
+ utsFontCreatorGDI, utsUtils, utsTypes, utsTtfUtils, utsTextSuite, utsRendererOpenGL;
+
+{$R *.res}
+
+var
+ HeapTraceLogFile: String;
+begin
+ HeapTraceLogFile := ExtractFilePath(Application.ExeName) + 'heaptrace.log';
+ if FileExists(HeapTraceLogFile) then
+ DeleteFile(HeapTraceLogFile);
+ SetHeapTraceOutput(HeapTraceLogFile);
+
+ RequireDerivedFormResource := True;
+ Application.Initialize;
+ Application.CreateForm(TMainForm, MainForm);
+ Application.Run;
+end.
+
diff --git a/TextSuiteTest.lps b/examples/simple/TextSuiteTest.lps
similarity index 71%
rename from TextSuiteTest.lps
rename to examples/simple/TextSuiteTest.lps
index 1b5e38b..e9e2d96 100644
--- a/TextSuiteTest.lps
+++ b/examples/simple/TextSuiteTest.lps
@@ -4,13 +4,15 @@
-
+
-
-
+
+
+
+
@@ -19,27 +21,58 @@
-
-
+
+
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
-
-
-
+
@@ -50,434 +83,320 @@
-
-
-
+
+
-
-
-
+
-
-
-
+
+
-
-
-
+
-
-
-
+
+
-
-
+
-
-
-
+
+
-
-
-
+
+
-
-
-
+
-
-
-
+
+
-
-
-
+
+
-
-
-
+
-
-
-
+
+
-
-
-
+
+
-
-
-
+
+
-
-
-
+
+
-
-
-
+
-
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
+
-
-
+
+
-
-
+
+
-
-
-
+
+
-
-
+
+
-
-
+
+
-
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
-
-
+
-
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/TextSuiteTest.res b/examples/simple/TextSuiteTest.res
similarity index 100%
rename from TextSuiteTest.res
rename to examples/simple/TextSuiteTest.res
diff --git a/uMainForm.lfm b/examples/simple/uMainForm.lfm
similarity index 100%
rename from uMainForm.lfm
rename to examples/simple/uMainForm.lfm
diff --git a/uMainForm.pas b/examples/simple/uMainForm.pas
similarity index 93%
rename from uMainForm.pas
rename to examples/simple/uMainForm.pas
index 24e8df1..4aba408 100644
--- a/uMainForm.pas
+++ b/examples/simple/uMainForm.pas
@@ -2,7 +2,7 @@ unit uMainForm;
{$mode objfpc}{$H+}
-{.$DEFINE USE_OLD_TS}
+{$DEFINE USE_OLD_TS}
interface
@@ -21,11 +21,10 @@ type
fFrameTime: QWord;
fFrameCount: Integer;
fSecTime: QWord;
-
fContext: TglcContext;
{$IFDEF USE_OLD_TS}
- fTextSuiteContext: tsContextID;
- fFontID: tsFontID;
+ ftsContext: tsContextID;
+ ftsFont: tsFontID;
{$ELSE}
ftsContext: TtsContext;
ftsRenderer: TtsRendererOpenGL;
@@ -59,12 +58,12 @@ begin
fContext.BuildContext;
{$IFDEF USE_OLD_TS}
tsInit(TS_INIT_TEXTSUITE or TS_INIT_OPENGL or TS_INIT_GDI);
- tsContextCreate(@fTextSuiteContext);
+ tsContextCreate(@ftsContext);
tsSetParameteri(TS_RENDERER, TS_RENDERER_OPENGL);
tsSetParameteri(TS_CREATOR, TS_CREATOR_GDI_FACENAME);
- tsContextBind(fTextSuiteContext);
- tsFontCreateCreatorA('Calibri', 25, 0, TS_ANTIALIASING_NORMAL, TS_DEFAULT, @fFontID);
- tsFontBind(fFontID);
+ tsContextBind(ftsContext);
+ tsFontCreateCreatorA('Calibri', 25, 0, TS_ANTIALIASING_NORMAL, TS_DEFAULT, @ftsFont);
+ tsFontBind(ftsFont);
{$ELSE}
ftsContext := TtsContext.Create;
ftsRenderer := TtsRendererOpenGL.Create(ftsContext, tsFormatRGBA8);
@@ -76,7 +75,10 @@ end;
procedure TMainForm.FormDestroy(Sender: TObject);
begin
- {$IFNDEF USE_OLD_TS}
+ {$IFDEF USE_OLD_TS}
+ tsFontDestroy(ftsFont);
+ tsContextDestroy(ftsContext);
+ {$ELSE}
FreeAndNil(ftsFont);
FreeAndNil(ftsGenerator);
FreeAndNil(ftsRenderer);
diff --git a/new/utsFontCreatorGDI.pas b/utsFontCreatorGDI.pas
similarity index 100%
rename from new/utsFontCreatorGDI.pas
rename to utsFontCreatorGDI.pas
diff --git a/new/utsRendererOpenGL.pas b/utsRendererOpenGL.pas
similarity index 100%
rename from new/utsRendererOpenGL.pas
rename to utsRendererOpenGL.pas
diff --git a/new/utsTextSuite.pas b/utsTextSuite.pas
similarity index 100%
rename from new/utsTextSuite.pas
rename to utsTextSuite.pas
diff --git a/new/utsTtfUtils.pas b/utsTtfUtils.pas
similarity index 100%
rename from new/utsTtfUtils.pas
rename to utsTtfUtils.pas
diff --git a/new/utsTypes.pas b/utsTypes.pas
similarity index 100%
rename from new/utsTypes.pas
rename to utsTypes.pas
diff --git a/new/utsUtils.pas b/utsUtils.pas
similarity index 100%
rename from new/utsUtils.pas
rename to utsUtils.pas