diff --git a/OpenRa.FileFormats/Graphics/IGraphicsDevice.cs b/OpenRa.FileFormats/Graphics/IGraphicsDevice.cs index e826fa2269..b102b7a2cb 100755 --- a/OpenRa.FileFormats/Graphics/IGraphicsDevice.cs +++ b/OpenRa.FileFormats/Graphics/IGraphicsDevice.cs @@ -25,7 +25,6 @@ namespace OpenRa.FileFormats.Graphics IVertexBuffer CreateVertexBuffer( int length ); IIndexBuffer CreateIndexBuffer( int length ); ITexture CreateTexture( Bitmap bitmap ); - IFont CreateFont( string filename ); IShader CreateShader( Stream stream ); Size WindowSize { get; } diff --git a/OpenRa.Game/Chrome.cs b/OpenRa.Game/Chrome.cs index 4690b738af..0de8adb4da 100644 --- a/OpenRa.Game/Chrome.cs +++ b/OpenRa.Game/Chrome.cs @@ -177,7 +177,7 @@ namespace OpenRa buttons.Clear(); renderer.Device.DisableScissor(); - renderer.RegularFont.DrawText("RenderFrame {0} ({2:F1} ms)\nTick {1} ({3:F1} ms)\n".F( + renderer.RegularFont.DrawText( rgbaRenderer, "RenderFrame {0} ({2:F1} ms)\nTick {1} ({3:F1} ms)\n".F( Game.RenderFrame, Game.orderManager.FrameNumber, PerfHistory.items["render"].LastValue, @@ -326,7 +326,7 @@ namespace OpenRa if (map == currentMap) DrawDialogBackground(itemRect, "panel"); - renderer.RegularFont.DrawText(map.Map.Title, new int2(r.Left + 60, y), Color.White); + renderer.RegularFont.DrawText(rgbaRenderer, map.Map.Title, new int2(r.Left + 60, y), Color.White); var closureMap = map; AddButton(itemRect, _ => { currentMap = closureMap; mapPreviewDirty = true; }); } @@ -444,11 +444,11 @@ namespace OpenRa } var f = renderer.BoldFont; - f.DrawText("Name", new int2(r.Left + 40, r.Top + 50), Color.White); - f.DrawText("Color", new int2(r.Left + 140, r.Top + 50), Color.White); - f.DrawText("Faction", new int2(r.Left + 220, r.Top + 50), Color.White); - f.DrawText("Status", new int2(r.Left + 290, r.Top + 50), Color.White); - f.DrawText("Spawn", new int2(r.Left + 390, r.Top + 50), Color.White); + f.DrawText(rgbaRenderer, "Name", new int2(r.Left + 40, r.Top + 50), Color.White); + f.DrawText(rgbaRenderer, "Color", new int2(r.Left + 140, r.Top + 50), Color.White); + f.DrawText(rgbaRenderer, "Faction", new int2(r.Left + 220, r.Top + 50), Color.White); + f.DrawText(rgbaRenderer, "Status", new int2(r.Left + 290, r.Top + 50), Color.White); + f.DrawText(rgbaRenderer, "Spawn", new int2(r.Left + 390, r.Top + 50), Color.White); var y = r.Top + 80; foreach (var client in Game.LobbyInfo.Clients) @@ -481,17 +481,19 @@ namespace OpenRa shpRenderer.Flush(); f = renderer.RegularFont; - f.DrawText(client.Name, new int2(r.Left + 40, y), Color.White); + f.DrawText(rgbaRenderer, client.Name, new int2(r.Left + 40, y), Color.White); lineRenderer.FillRect(RectangleF.FromLTRB(paletteRect.Left + Game.viewport.Location.X + 5, paletteRect.Top + Game.viewport.Location.Y + 5, paletteRect.Right + Game.viewport.Location.X - 5, paletteRect.Bottom+Game.viewport.Location.Y - 5), Player.PlayerColors[client.PaletteIndex].c); lineRenderer.Flush(); - f.DrawText(client.Country, new int2(r.Left + 220, y), Color.White); - f.DrawText(client.State.ToString(), new int2(r.Left + 290, y), Color.White); - f.DrawText((client.SpawnPoint == 0)? "-" : client.SpawnPoint.ToString(), new int2(r.Left + 410, y), Color.White); + f.DrawText(rgbaRenderer, client.Country, new int2(r.Left + 220, y), Color.White); + f.DrawText(rgbaRenderer, client.State.ToString(), new int2(r.Left + 290, y), Color.White); + f.DrawText(rgbaRenderer, (client.SpawnPoint == 0) ? "-" : client.SpawnPoint.ToString(), new int2(r.Left + 410, y), Color.White); y += 30; + + rgbaRenderer.Flush(); } var typingBox = new Rectangle(r.Left + 20, r.Bottom - 47, r.Width - 40, 27); @@ -740,7 +742,7 @@ namespace OpenRa shpRenderer.DrawSprite(optionsButton.Image, optionsDrawPos, "chrome"); shpRenderer.Flush(); - renderer.RegularFont.DrawText("Options", new int2((int)(optionsButton.Image.size.X - renderer.RegularFont.Measure("Options").X) / 2, -2), Color.White); + renderer.RegularFont.DrawText(rgbaRenderer, "Options", new int2((int)(optionsButton.Image.size.X - renderer.RegularFont.Measure("Options").X) / 2, -2), Color.White); } void DrawOptionsMenu() @@ -803,6 +805,8 @@ namespace OpenRa if (Game.chat.isChatting) RenderChatLine(Tuple.New(Color.White, "Chat:", Game.chat.typing), new int2(typingArea.X + 10, typingArea.Y + 6)); + + rgbaRenderer.Flush(); renderer.Device.DisableScissor(); renderer.Device.EnableScissor(chatLogArea.Left, chatLogArea.Top, chatLogArea.Width, chatLogArea.Height); @@ -811,14 +815,16 @@ namespace OpenRa chatpos.Y -= 20; RenderChatLine(line, chatpos); } + + rgbaRenderer.Flush(); renderer.Device.DisableScissor(); } void RenderChatLine(Tuple line, int2 p) { var size = renderer.RegularFont.Measure(line.b); - renderer.RegularFont.DrawText(line.b, p, line.a); - renderer.RegularFont.DrawText(line.c, p + new int2(size.X + 10, 0), Color.White); + renderer.RegularFont.DrawText(rgbaRenderer, line.b, p, line.a); + renderer.RegularFont.DrawText(rgbaRenderer, line.c, p + new int2(size.X + 10, 0), Color.White); } void TickPaletteAnimation() @@ -1064,12 +1070,12 @@ namespace OpenRa void DrawRightAligned(string text, int2 pos, Color c) { - renderer.BoldFont.DrawText(text, pos - new int2(renderer.BoldFont.Measure(text).X, 0), c); + renderer.BoldFont.DrawText(rgbaRenderer, text, pos - new int2(renderer.BoldFont.Measure(text).X, 0), c); } void DrawCentered(string text, int2 pos, Color c) { - renderer.BoldFont.DrawText(text, pos - new int2(renderer.BoldFont.Measure(text).X / 2, 0), c); + renderer.BoldFont.DrawText(rgbaRenderer, text, pos - new int2(renderer.BoldFont.Measure(text).X / 2, 0), c); } void DrawProductionTooltip(World world, string unit, int2 pos) @@ -1077,12 +1083,12 @@ namespace OpenRa var tooltipSprite = ChromeProvider.GetImage(renderer, chromeCollection, "tooltip-bg"); var p = pos.ToFloat2() - new float2(tooltipSprite.size.X, 0); rgbaRenderer.DrawSprite(tooltipSprite, p, "chrome"); - rgbaRenderer.Flush(); + var info = Rules.Info[unit]; var buildable = info.Traits.Get(); - renderer.BoldFont.DrawText(buildable.Description, p.ToInt2() + new int2(5, 5), Color.White); + renderer.BoldFont.DrawText(rgbaRenderer, buildable.Description, p.ToInt2() + new int2(5, 5), Color.White); DrawRightAligned( "${0}".F(buildable.Cost), pos + new int2(-5,5), world.LocalPlayer.Cash + world.LocalPlayer.Ore >= buildable.Cost ? Color.White : Color.Red); @@ -1100,15 +1106,17 @@ namespace OpenRa { var prereqs = buildable.Prerequisites .Select( a => Description( a ) ); - renderer.RegularFont.DrawText("Requires {0}".F( string.Join( ", ", prereqs.ToArray() ) ), p.ToInt2(), + renderer.RegularFont.DrawText(rgbaRenderer, "Requires {0}".F(string.Join(", ", prereqs.ToArray())), p.ToInt2(), Color.White); } if (buildable.LongDesc != null) { p += new int2(0, 15); - renderer.RegularFont.DrawText(buildable.LongDesc.Replace( "\\n", "\n" ), p.ToInt2(), Color.White); + renderer.RegularFont.DrawText(rgbaRenderer, buildable.LongDesc.Replace( "\\n", "\n" ), p.ToInt2(), Color.White); } + + rgbaRenderer.Flush(); } static string Description( string a ) @@ -1201,7 +1209,7 @@ namespace OpenRa pos += new int2(5, 5); - renderer.BoldFont.DrawText(sp.Info.Description, pos, Color.White); + renderer.BoldFont.DrawText(rgbaRenderer, sp.Info.Description, pos, Color.White); var timer = "Charge Time: {0}".F(FormatTime(sp.RemainingTime)); DrawRightAligned(timer, pos + new int2((int)tooltipSprite.size.X - 10, 0), Color.White); @@ -1209,8 +1217,10 @@ namespace OpenRa if (sp.Info.LongDesc != null) { pos += new int2(0, 25); - renderer.RegularFont.DrawText(sp.Info.LongDesc.Replace("\\n", "\n"), pos, Color.White); + renderer.RegularFont.DrawText(rgbaRenderer, sp.Info.LongDesc.Replace("\\n", "\n"), pos, Color.White); } + + rgbaRenderer.Flush(); } public void SetCurrentTab(string produces) diff --git a/OpenRa.Game/Graphics/CursorSheetBuilder.cs b/OpenRa.Game/Graphics/CursorSheetBuilder.cs index 3ba207c0fa..94e726d4a6 100644 --- a/OpenRa.Game/Graphics/CursorSheetBuilder.cs +++ b/OpenRa.Game/Graphics/CursorSheetBuilder.cs @@ -34,12 +34,12 @@ namespace OpenRa.Graphics try { var shp = new Dune2ShpReader(FileSystem.OpenWithExts(filename, exts)); - return shp.Select(a => SheetBuilder.Add(a.Image, a.Size)).ToArray(); + return shp.Select(a => SheetBuilder.SharedInstance.Add(a.Image, a.Size)).ToArray(); } catch (IndexOutOfRangeException) // This will occur when loading a custom (RA-format) .shp { var shp = new ShpReader(FileSystem.OpenWithExts(filename, exts)); - return shp.Select(a => SheetBuilder.Add(a.Image, shp.Size)).ToArray(); + return shp.Select(a => SheetBuilder.SharedInstance.Add(a.Image, shp.Size)).ToArray(); } } diff --git a/OpenRa.Game/Graphics/Renderer.cs b/OpenRa.Game/Graphics/Renderer.cs index 441d6beb86..9a23670968 100644 --- a/OpenRa.Game/Graphics/Renderer.cs +++ b/OpenRa.Game/Graphics/Renderer.cs @@ -43,7 +43,7 @@ namespace OpenRa.Graphics public ITexture PaletteTexture; - public readonly IFont RegularFont, BoldFont; + public readonly SpriteFont RegularFont, BoldFont; public Size Resolution { get { return device.WindowSize; } } @@ -56,8 +56,11 @@ namespace OpenRa.Graphics RgbaSpriteShader = device.CreateShader(FileSystem.Open("shaders/chrome-rgba.fx")); WorldSpriteShader = device.CreateShader(FileSystem.Open("shaders/chrome-shp.fx")); - RegularFont = device.CreateFont( "FreeSans.ttf" ); - BoldFont = device.CreateFont( "FreeSansBold.ttf" ); +// RegularFont = device.CreateFont( "FreeSans.ttf" ); +// BoldFont = device.CreateFont( "FreeSansBold.ttf" ); + + RegularFont = new SpriteFont(this, "FreeSans.ttf", 14); + BoldFont = new SpriteFont(this, "FreeSansBold.ttf", 14); } IGraphicsDevice CreateDevice( Assembly rendererDll, int width, int height, bool windowed, bool vsync ) diff --git a/OpenRa.Game/Graphics/SheetBuilder.cs b/OpenRa.Game/Graphics/SheetBuilder.cs index f016c5d65c..f47504d3e2 100644 --- a/OpenRa.Game/Graphics/SheetBuilder.cs +++ b/OpenRa.Game/Graphics/SheetBuilder.cs @@ -22,24 +22,31 @@ using System.Drawing; namespace OpenRa.Graphics { - static class SheetBuilder + class SheetBuilder { + public static SheetBuilder SharedInstance; public static void Initialize(Renderer r) + { + SharedInstance = new SheetBuilder(r, TextureChannel.Red); + } + + public SheetBuilder(Renderer r, TextureChannel ch) { renderer = r; current = null; rowHeight = 0; channel = null; + initialChannel = ch; } - public static Sprite Add(byte[] src, Size size) + public Sprite Add(byte[] src, Size size) { - Sprite rect = AddImage(size); + Sprite rect = Allocate(size); Util.FastCopyIntoChannel(rect, src); return rect; } - public static Sprite Add(Size size, byte paletteIndex) + public Sprite Add(Size size, byte paletteIndex) { byte[] data = new byte[size.Width * size.Height]; for (int i = 0; i < data.Length; i++) @@ -48,18 +55,19 @@ namespace OpenRa.Graphics return Add(data, size); } - static Sheet NewSheet() { return new Sheet( renderer, new Size( Renderer.SheetSize, Renderer.SheetSize ) ); } + Sheet NewSheet() { return new Sheet( renderer, new Size( Renderer.SheetSize, Renderer.SheetSize ) ); } - static Renderer renderer; - static Sheet current = null; - static int rowHeight = 0; - static Point p; - static TextureChannel? channel = null; + Renderer renderer; + Sheet current = null; + int rowHeight = 0; + Point p; + TextureChannel? channel = null; + TextureChannel initialChannel; - static TextureChannel? NextChannel(TextureChannel? t) + TextureChannel? NextChannel(TextureChannel? t) { if (t == null) - return TextureChannel.Red; + return initialChannel; switch (t.Value) { @@ -72,7 +80,7 @@ namespace OpenRa.Graphics } } - static Sprite AddImage(Size imageSize) + public Sprite Allocate(Size imageSize) { if (current == null) { diff --git a/OpenRa.Game/Graphics/SpriteFont.cs b/OpenRa.Game/Graphics/SpriteFont.cs new file mode 100644 index 0000000000..2f542269eb --- /dev/null +++ b/OpenRa.Game/Graphics/SpriteFont.cs @@ -0,0 +1,116 @@ +using System; +using System.Drawing; +using System.Linq; +using OpenRa.FileFormats; +using Tao.FreeType; +using System.Runtime.InteropServices; + +namespace OpenRa.Graphics +{ + class SpriteFont + { + int size; + public SpriteFont(Renderer r, string name, int size) + { + this.size = size; + + if (0 != FT.FT_New_Face(library, name, 0, out face)) + throw new InvalidOperationException("FT_New_Face failed"); + + FT.FT_Set_Pixel_Sizes(face, 0, (uint)size); + glyphs = new Cache(CreateGlyph); + + // setup a 1-channel SheetBuilder for our private use + if (builder == null) builder = new SheetBuilder(r, TextureChannel.Alpha); + + // precache glyphs for U+0020 - U+007f + for (var n = (char)0x20; n < (char)0x7f; n++) + if (glyphs[n] == null) + throw new InvalidOperationException(); + } + + public void DrawText(SpriteRenderer r, string text, float2 location, Color c) + { + location.Y += size; // baseline vs top + + var p = location; + foreach (var s in text) + { + if (s == '\n') + { + location.Y += size; + p = location; + continue; + } + + var g = glyphs[s]; + r.DrawSprite(g.Sprite, + new float2( + (int)Math.Round(p.X + g.Offset.X, 0), + p.Y + g.Offset.Y), + "chrome"); + p.X += g.Advance; + } + + r.Flush(); + } + + public int2 Measure(string text) + { + return new int2((int)text.Split( '\n' ).Max( s => s.Sum(a => glyphs[a].Advance)), size); + } + + Cache glyphs; + IntPtr face; + + GlyphInfo CreateGlyph(char c) + { + var index = FT.FT_Get_Char_Index(face, (uint)c); + FT.FT_Load_Glyph(face, index, FT.FT_LOAD_RENDER); + + var _face = (FT_FaceRec)Marshal.PtrToStructure(face, typeof(FT_FaceRec)); + var _glyph = (FT_GlyphSlotRec)Marshal.PtrToStructure(_face.glyph, typeof(FT_GlyphSlotRec)); + + var s = builder.Allocate(new Size(_glyph.metrics.width >> 6, _glyph.metrics.height >> 6)); + + var g = new GlyphInfo + { + Sprite = s, + Advance = _glyph.metrics.horiAdvance / 64f, + Offset = { X = _glyph.bitmap_left, Y = -_glyph.bitmap_top } + }; + + unsafe + { + var p = (byte*)_glyph.bitmap.buffer; + + for (var j = 0; j < s.size.Y; j++) + { + for (var i = 0; i < s.size.X; i++) + if (p[i] != 0) + s.sheet.Bitmap.SetPixel(i + s.bounds.Left, j + s.bounds.Top, + Color.FromArgb(p[i], 0xff, 0xff, 0xff)); + + p += _glyph.bitmap.pitch; + } + } + + return g; + } + + static SpriteFont() + { + FT.FT_Init_FreeType(out library); + } + + static IntPtr library; + static SheetBuilder builder; + } + + class GlyphInfo + { + public float Advance; + public int2 Offset; + public Sprite Sprite; + } +} diff --git a/OpenRa.Game/Graphics/SpriteSheetBuilder.cs b/OpenRa.Game/Graphics/SpriteSheetBuilder.cs index 9c985fdd1c..d02a47d6f3 100644 --- a/OpenRa.Game/Graphics/SpriteSheetBuilder.cs +++ b/OpenRa.Game/Graphics/SpriteSheetBuilder.cs @@ -42,7 +42,7 @@ namespace OpenRa.Graphics static Sprite[] LoadSprites(string filename) { var shp = new ShpReader(FileSystem.OpenWithExts(filename, exts)); - return shp.Select(a => SheetBuilder.Add(a.Image, shp.Size)).ToArray(); + return shp.Select(a => SheetBuilder.SharedInstance.Add(a.Image, shp.Size)).ToArray(); } public static Sprite[] LoadAllSprites(string filename) { return sprites[filename]; } diff --git a/OpenRa.Game/Graphics/TerrainRenderer.cs b/OpenRa.Game/Graphics/TerrainRenderer.cs index c78098b0a6..85b0a98e58 100644 --- a/OpenRa.Game/Graphics/TerrainRenderer.cs +++ b/OpenRa.Game/Graphics/TerrainRenderer.cs @@ -42,7 +42,7 @@ namespace OpenRa.Graphics Size tileSize = new Size( Game.CellSize, Game.CellSize ); var tileMapping = new Cache( - x => SheetBuilder.Add(world.TileSet.GetBytes(x), tileSize)); + x => SheetBuilder.SharedInstance.Add(world.TileSet.GetBytes(x), tileSize)); Vertex[] vertices = new Vertex[4 * map.Height * map.Width]; ushort[] indices = new ushort[6 * map.Height * map.Width]; diff --git a/OpenRa.Game/OpenRa.Game.csproj b/OpenRa.Game/OpenRa.Game.csproj index 5aaa4041ee..1e887ff951 100644 --- a/OpenRa.Game/OpenRa.Game.csproj +++ b/OpenRa.Game/OpenRa.Game.csproj @@ -65,11 +65,8 @@ + - - False - ..\thirdparty\ISE.FreeType.dll - @@ -93,6 +90,7 @@ + diff --git a/OpenRa.Game/Traits/Bridge.cs b/OpenRa.Game/Traits/Bridge.cs index f21fb1a7e6..dd769235d7 100644 --- a/OpenRa.Game/Traits/Bridge.cs +++ b/OpenRa.Game/Traits/Bridge.cs @@ -90,7 +90,7 @@ namespace OpenRa.Traits { cachedTheater = world.Map.Theater; sprites = new Cache( - x => SheetBuilder.Add(world.TileSet.GetBytes(x), + x => SheetBuilder.SharedInstance.Add(world.TileSet.GetBytes(x), new Size(Game.CellSize, Game.CellSize))); } diff --git a/OpenRa.Game/UiOverlay.cs b/OpenRa.Game/UiOverlay.cs index afec9de13f..a236aa06ad 100644 --- a/OpenRa.Game/UiOverlay.cs +++ b/OpenRa.Game/UiOverlay.cs @@ -50,7 +50,7 @@ namespace OpenRa for (int j = 0; j < Game.CellSize; j++) data[i * Game.CellSize + j] = ((i + j) % 4 < 2) ? (byte)0 : paletteIndex; - return SheetBuilder.Add( data, new Size(Game.CellSize,Game.CellSize) ); + return SheetBuilder.SharedInstance.Add(data, new Size(Game.CellSize, Game.CellSize)); } public void Draw( World world ) diff --git a/OpenRa.Gl/GraphicsDevice.cs b/OpenRa.Gl/GraphicsDevice.cs index 6436546a28..0ded13ddae 100644 --- a/OpenRa.Gl/GraphicsDevice.cs +++ b/OpenRa.Gl/GraphicsDevice.cs @@ -1,4 +1,4 @@ -#region Copyright & License Information +#region Copyright & License Information /* * Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford. * This file is part of OpenRA. @@ -28,7 +28,6 @@ using Tao.Cg; using Tao.OpenGl; using OpenRa.FileFormats.Graphics; using Tao.Sdl; -using ISE; [assembly: Renderer( typeof( OpenRa.GlRenderer.GraphicsDevice ))] @@ -60,9 +59,12 @@ namespace OpenRa.GlRenderer Sdl.SDL_GL_SetAttribute(Sdl.SDL_GL_BLUE_SIZE, 8); Sdl.SDL_GL_SetAttribute(Sdl.SDL_GL_ALPHA_SIZE, 8); - Environment.SetEnvironmentVariable("SDL_VIDEO_WINDOW_POS", "0,0"); - surf = Sdl.SDL_SetVideoMode(width, height, 0, Sdl.SDL_NOFRAME | Sdl.SDL_OPENGL | (windowed ? 0 : Sdl.SDL_FULLSCREEN)); + // Breaks os x usability + //Environment.SetEnvironmentVariable("SDL_VIDEO_WINDOW_POS", "0,0"); + //surf = Sdl.SDL_SetVideoMode(width, height, 0, Sdl.SDL_NOFRAME | Sdl.SDL_OPENGL | (windowed ? 0 : Sdl.SDL_FULLSCREEN)); + surf = Sdl.SDL_SetVideoMode(width, height, 0, Sdl.SDL_OPENGL | (windowed ? 0 : Sdl.SDL_FULLSCREEN)); + Sdl.SDL_WM_SetCaption("OpenRA", "OpenRA"); Sdl.SDL_ShowCursor(0); Sdl.SDL_EnableUNICODE( 1 ); @@ -265,11 +267,6 @@ namespace OpenRa.GlRenderer return new Shader( this, stream ); } - public IFont CreateFont( string filename ) - { - return new Font( this, filename ); - } - #endregion } @@ -453,63 +450,4 @@ namespace OpenRa.GlRenderer bitmap.UnlockBits(bits); } } - - class Font : IFont - { - const int RenderedFontSize = 48; - const float emHeight = 14f; /* px */ - - GraphicsDevice dev; - FTFontGL font; - - public Font( GraphicsDevice dev, string filename ) - { - this.dev = dev; - int Errors; - font = new FTFontGL(filename, out Errors); - - if (Errors > 0) - throw new InvalidOperationException("Error(s) loading font"); - - font.ftRenderToTexture(RenderedFontSize, 192); - font.FT_ALIGN = FTFontAlign.FT_ALIGN_LEFT; - } - - public void DrawText( string text, int2 pos, Color c ) - { - pos.Y += (int)(emHeight); - - Gl.glMatrixMode(Gl.GL_MODELVIEW); - Gl.glPushMatrix(); - Gl.glLoadIdentity(); - - Gl.glMatrixMode(Gl.GL_PROJECTION); - Gl.glPushMatrix(); - Gl.glLoadIdentity(); - - Gl.glOrtho(0, dev.WindowSize.Width, 0, dev.WindowSize.Height, 0, 1); - - Gl.glMatrixMode(Gl.GL_MODELVIEW); - Gl.glTranslatef(pos.X, dev.WindowSize.Height - pos.Y, 0); - Gl.glScalef(emHeight / RenderedFontSize, emHeight / RenderedFontSize, 1); - - font.ftBeginFont(false); - Gl.glColor4f(c.R / 255f, c.G / 255f, c.B / 255f, c.A / 255f); - font.ftWrite(text); - font.ftEndFont(); - - Gl.glMatrixMode(Gl.GL_PROJECTION); - Gl.glPopMatrix(); - - Gl.glMatrixMode(Gl.GL_MODELVIEW); - Gl.glPopMatrix(); - - GraphicsDevice.CheckGlError(); - } - - public int2 Measure( string text ) - { - return new int2((int)(font.ftExtent(ref text) / 3), (int)emHeight); - } - } } diff --git a/OpenRa.Gl/OpenRa.Gl.csproj b/OpenRa.Gl/OpenRa.Gl.csproj index 26652c5fd8..28e892ea54 100644 --- a/OpenRa.Gl/OpenRa.Gl.csproj +++ b/OpenRa.Gl/OpenRa.Gl.csproj @@ -31,22 +31,12 @@ 4 - - False - ..\thirdparty\ISE.FreeType.dll - 3.5 - - 3.5 - - - 3.5 - @@ -55,9 +45,6 @@ False - - False - diff --git a/packaging/osx/dmgsource/.background/bg.png b/packaging/osx/dmgsource/.background/bg.png new file mode 100644 index 0000000000..8eac9f5eba Binary files /dev/null and b/packaging/osx/dmgsource/.background/bg.png differ diff --git a/packaging/osx/osx-dmgbg.xcf b/packaging/osx/osx-dmgbg.xcf new file mode 100644 index 0000000000..e2c4caa1cc Binary files /dev/null and b/packaging/osx/osx-dmgbg.xcf differ diff --git a/packaging/osx/package_dmg.sh b/packaging/osx/package_dmg.sh new file mode 100755 index 0000000000..40f03f699e --- /dev/null +++ b/packaging/osx/package_dmg.sh @@ -0,0 +1,42 @@ +source=./packaging/osx/dmgsource/ +title=OpenRA +size=70m +dmgName=OpenRA.dmg + +mv openra_server ${source} +mv OpenRA.app ${source} + +hdiutil create -srcfolder "${source}" -volname "${title}" -fs HFS+ -fsargs "-c c=64,a=16,e=16" -format UDRW -size ${size} temp.dmg +sleep 2 +device=$(hdiutil attach -readwrite -noverify -noautoopen "temp.dmg" | egrep '^/dev/' | sed 1q | awk '{print $1}') +echo ' + tell application "Finder" + tell disk "'${title}'" + open + set current view of container window to icon view + set toolbar visible of container window to false + set statusbar visible of container window to false + set the bounds of container window to {400, 100, 885, 430} + set theViewOptions to the icon view options of container window + set arrangement of theViewOptions to not arranged + set icon size of theViewOptions to 72 + set background picture of theViewOptions to file ".background:bg.png" + make new alias file at container window to POSIX file "/Applications" with properties {name:"Applications"} + set position of item "OpenRA.app" of container window to {100, 90} + set position of item "openra_server" of container window to {100, 210} + set position of item "Applications" of container window to {375, 150} + close + open + update without registering applications + delay 5 + end tell + end tell +' | osascript +sleep 5 +chmod -Rf go-w /Volumes/"${title}" +sync +hdiutil detach ${device} +hdiutil convert "./temp.dmg" -format UDZO -imagekey zlib-level=9 -o "${dmgName}" +rm -f ./temp.dmg +rm -rf ${source}OpenRA.app +rm -f ${source}openra_server \ No newline at end of file diff --git a/thirdparty/ISE.FreeType.dll b/thirdparty/ISE.FreeType.dll deleted file mode 100755 index 7a7b7a7587..0000000000 Binary files a/thirdparty/ISE.FreeType.dll and /dev/null differ diff --git a/thirdparty/ISE.FreeType.dll.config b/thirdparty/ISE.FreeType.dll.config deleted file mode 100644 index eb6146f72c..0000000000 --- a/thirdparty/ISE.FreeType.dll.config +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/thirdparty/Tao.Externals.dll b/thirdparty/Tao.Externals.dll deleted file mode 100755 index 81ecf2e1aa..0000000000 Binary files a/thirdparty/Tao.Externals.dll and /dev/null differ diff --git a/thirdparty/Tao.Externals.dll.config b/thirdparty/Tao.Externals.dll.config deleted file mode 100644 index 280afa3d65..0000000000 --- a/thirdparty/Tao.Externals.dll.config +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file