Commit what i have (doesn't work) for debug

This commit is contained in:
pchote
2010-02-20 14:01:51 +13:00
parent 4f6c37c803
commit 31a933d5ac
9 changed files with 53 additions and 14 deletions

BIN
FreeSans.ttf Executable file

Binary file not shown.

View File

@@ -16,7 +16,7 @@ gl_KIND = library
gl_DEPS = $(fileformats_TARGET) $(game_TARGET) \
thirdparty/Tao/Tao.Glfw.dll
gl_LIBS = $(COMMON_LIBS) System.Windows.Forms.dll \
thirdparty/Tao/Tao.Cg.dll thirdparty/Tao/Tao.OpenGl.dll \
thirdparty/Tao/Tao.Cg.dll thirdparty/Tao.Externals.dll \
$(gl_DEPS) $(game_TARGET)
game_SRCS = $(shell find OpenRa.Game/ -iname '*.cs')
@@ -24,7 +24,7 @@ game_TARGET = OpenRa.Game.exe
game_KIND = winexe
game_DEPS = $(fileformats_TARGET)
game_LIBS = $(COMMON_LIBS) System.Windows.Forms.dll $(game_DEPS) \
thirdparty/Tao/Tao.OpenAl.dll
thirdparty/Tao.Externals.dll thirdparty/ISE.FreeType.dll
game_FLAGS = -win32icon:OpenRa.Game/OpenRa.ico
ra_SRCS = $(shell find OpenRa.Mods.RA/ -iname '*.cs')

View File

@@ -27,6 +27,8 @@ using OpenRa.FileFormats;
using OpenRa.FileFormats.Graphics;
using OpenRa.Support;
using System.IO;
using ISE;
using Tao.OpenGl;
namespace OpenRa.Graphics
{
@@ -44,7 +46,8 @@ namespace OpenRa.Graphics
public ITexture PaletteTexture;
readonly Font fDebug, fTitle;
readonly FTFontBitmap testFont;
Sheet textSheet;
SpriteRenderer rgbaRenderer;
Sprite textSprite;
@@ -60,8 +63,13 @@ namespace OpenRa.Graphics
RgbaSpriteShader = device.CreateShader(FileSystem.Open("chrome-rgba.fx"));
WorldSpriteShader = device.CreateShader(FileSystem.Open("chrome-shp.fx"));
//fDebug = new Font("Tahoma", 10, FontStyle.Regular);
//fDebug = new Font("Tahoma", 10.0f, FontStyle.Regular);
//fTitle = new Font("Tahoma", 10, FontStyle.Bold);
int Errors;
testFont = new FTFontBitmap("FreeSans.ttf", out Errors);
testFont.ftRenderToTexture(2, 48);
testFont.FT_ALIGN = FTFontAlign.FT_ALIGN_CENTERED;
textSheet = new Sheet(this, new Size(256, 256));
rgbaRenderer = new SpriteRenderer(this, true, RgbaSpriteShader);
textSprite = new Sprite(textSheet, new Rectangle(0, 0, 256, 256), TextureChannel.Alpha);
@@ -80,6 +88,10 @@ namespace OpenRa.Graphics
Bitmap RenderTextToBitmap(string s, Font f, Color c)
{
Bitmap b = new Bitmap(256, 256);
testFont.ftBeginFont(0.9f,0.0f,0.0f,0.5f);
testFont.ftWrite("Test",b);
testFont.ftEndFont();
/*using (var g = System.Drawing.Graphics.FromImage(b))
{
g.TextRenderingHint = TextRenderingHint.SingleBitPerPixelGridFit;
@@ -91,7 +103,7 @@ namespace OpenRa.Graphics
int2 GetTextSize(string s, Font f)
{
return new int2(0,0);
return new int2(50,100);
/*Bitmap b = new Bitmap(1,1);
System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(b);
return new int2(g.MeasureString(s, f).ToSize());*/
@@ -157,9 +169,8 @@ namespace OpenRa.Graphics
public void DrawText(string text, int2 pos, Color c)
{
return;
using (new PerfSample("text"))
{
{
Bitmap b = RenderTextToBitmap(text, fDebug, c);
textSheet.Texture.SetData(b);
rgbaRenderer.DrawSprite(textSprite, pos.ToFloat2(), "chrome");
@@ -169,7 +180,6 @@ namespace OpenRa.Graphics
public void DrawText2(string text, int2 pos, Color c)
{
return;
using (new PerfSample("text"))
{
Bitmap b = RenderTextToBitmap(text, fTitle, c);
@@ -181,12 +191,12 @@ namespace OpenRa.Graphics
public int2 MeasureText(string text)
{
return new int2(0,0); //GetTextSize(text, fDebug);
return GetTextSize(text, fDebug);
}
public int2 MeasureText2(string text)
{
return new int2(0,0);// GetTextSize(text, fTitle);
return GetTextSize(text, fTitle);
}
}
}

View File

@@ -1,7 +1,8 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{0DFB103F-2962-400F-8C6D-E2C28CCBA633}</ProjectGuid>
@@ -30,8 +31,6 @@
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<StartupObject>
</StartupObject>
<ApplicationIcon>OpenRA.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
@@ -43,6 +42,8 @@
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Optimize>false</Optimize>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<OutputPath>bin\Release\</OutputPath>
@@ -53,6 +54,7 @@
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
@@ -64,6 +66,14 @@
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="Tao.OpenAl, Version=1.1.0.1, Culture=neutral, PublicKeyToken=a7579dda88828311, processorArchitecture=MSIL" />
<Reference Include="ISE.FreeType, Version=1.0.2885.37773, Culture=neutral, PublicKeyToken=null">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\thirdparty\ISE.FreeType.dll</HintPath>
</Reference>
<Reference Include="Tao.OpenGl, Version=2.1.0.12, Culture=neutral, PublicKeyToken=1ca010269a4501ef">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\thirdparty\Tao\Tao.OpenGl.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Chat.cs" />

BIN
thirdparty/ISE.FreeType.dll vendored Executable file

Binary file not shown.

BIN
thirdparty/Tao.Externals.dll vendored Executable file

Binary file not shown.

12
thirdparty/Tao.Externals.dll.config vendored Normal file
View File

@@ -0,0 +1,12 @@
<configuration>
<dllmap dll="freetype6.dll">
<dllentry os="linux" dll="libfreetype.so.6" />
<dllentry os="windows" dll="freetype6.dll" />
<dllentry os="osx" dll="/sw/lib/libfreetype.dylib" />
</dllmap>
</configuration>
<dllmap dll="OpenAL32.dll">
<dllentry os="linux" dll="libopenal.so.1" />
<dllentry os="windows" dll="OpenAL32.dll" />
<dllentry os="osx" dll="/System/Library/Frameworks/OpenAL.framework/OpenAL" />
</dllmap>

BIN
thirdparty/Tao/Tao.FreeType.dll vendored Executable file

Binary file not shown.

View File

@@ -0,0 +1,7 @@
<configuration>
<dllmap dll="freetype6.dll">
<dllentry os="linux" dll="libfreetype.so.6" />
<dllentry os="windows" dll="freetype6.dll" />
<dllentry os="osx" dll="/sw/lib/libfreetype.dylib" />
</dllmap>
</configuration>