Remove the null renderer.

This commit is contained in:
Paul Chote
2016-03-30 19:35:12 +01:00
parent 706d3ae52a
commit 345f91d3ec
9 changed files with 6 additions and 316 deletions

View File

@@ -87,7 +87,7 @@ INSTALL_PROGRAM = $(INSTALL) -m755
INSTALL_DATA = $(INSTALL) -m644
# program targets
CORE = pdefault pnull game utility server
CORE = pdefault game utility server
TOOLS = gamemonitor
VERSION = $(shell git name-rev --name-only --tags --no-undefined HEAD 2>/dev/null || echo git-`git rev-parse --short HEAD`)
@@ -119,14 +119,8 @@ pdefault_TARGET = OpenRA.Platforms.Default.dll
pdefault_KIND = library
pdefault_DEPS = $(game_TARGET)
pdefault_LIBS = $(COMMON_LIBS) thirdparty/download/SDL2-CS.dll thirdparty/download/OpenAL-CS.dll $(pdefault_DEPS)
pnull_SRCS := $(shell find OpenRA.Platforms.Null/ -iname '*.cs')
pnull_TARGET = OpenRA.Platforms.Null.dll
pnull_KIND = library
pnull_DEPS = $(game_TARGET)
pnull_LIBS = $(COMMON_LIBS) $(pnull_DEPS)
PROGRAMS += pdefault pnull
platforms: $(pdefault_TARGET) $(pnull_TARGET)
PROGRAMS += pdefault
platforms: $(pdefault_TARGET)
# Mods Common
mod_common_SRCS := $(shell find OpenRA.Mods.Common/ -iname '*.cs')
@@ -202,9 +196,6 @@ check: utility mods
@echo "Checking for code style violations in OpenRA.Platforms.Default..."
@mono --debug OpenRA.Utility.exe ra --check-code-style OpenRA.Platforms.Default
@echo
@echo "Checking for code style violations in OpenRA.Platforms.Null..."
@mono --debug OpenRA.Utility.exe ra --check-code-style OpenRA.Platforms.Null
@echo
@echo "Checking for code style violations in OpenRA.GameMonitor..."
@mono --debug OpenRA.Utility.exe ra --check-code-style OpenRA.GameMonitor
@echo

View File

@@ -94,7 +94,6 @@ namespace OpenRA
{
var defaultDevices = new[]
{
new SoundDevice("Default", null, "Default Output"),
new SoundDevice("Null", null, "Output Disabled")
};

View File

@@ -1,105 +0,0 @@
#region Copyright & License Information
/*
* Copyright 2007-2016 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version. For more
* information, see COPYING.
*/
#endregion
using System;
using System.Drawing;
using OpenRA.Graphics;
namespace OpenRA.Platforms.Null
{
public sealed class NullGraphicsDevice : IGraphicsDevice
{
public Size WindowSize { get; private set; }
public NullGraphicsDevice(Size size, WindowMode window)
{
Console.WriteLine("Using Null renderer");
WindowSize = size;
}
public void Dispose() { }
public void EnableScissor(int left, int top, int width, int height) { }
public void DisableScissor() { }
public void EnableDepthBuffer() { }
public void DisableDepthBuffer() { }
public void SetBlendMode(BlendMode mode) { }
public void GrabWindowMouseFocus() { }
public void ReleaseWindowMouseFocus() { }
public void Clear() { }
public void Present() { }
public Bitmap TakeScreenshot() { return new Bitmap(1, 1); }
public string GetClipboardText() { return ""; }
public bool SetClipboardText(string text) { return false; }
public void PumpInput(IInputHandler ih)
{
Game.HasInputFocus = false;
ih.ModifierKeys(Modifiers.None);
}
public void DrawPrimitives(PrimitiveType pt, int firstVertex, int numVertices) { }
public IVertexBuffer<Vertex> CreateVertexBuffer(int size) { return new NullVertexBuffer<Vertex>(); }
public ITexture CreateTexture() { return new NullTexture(); }
public ITexture CreateTexture(Bitmap bitmap) { return new NullTexture(); }
public IFrameBuffer CreateFrameBuffer(Size s) { return new NullFrameBuffer(); }
public IShader CreateShader(string name) { return new NullShader(); }
public IHardwareCursor CreateHardwareCursor(string name, Size size, byte[] data, int2 hotspot) { return null; }
public void SetHardwareCursor(IHardwareCursor cursor) { }
public string GLVersion { get { return "(null)"; } }
}
public class NullShader : IShader
{
public void SetBool(string name, bool value) { }
public void SetVec(string name, float x) { }
public void SetVec(string name, float x, float y) { }
public void SetVec(string name, float[] vec, int length) { }
public void SetTexture(string param, ITexture texture) { }
public void SetMatrix(string param, float[] mtx) { }
public void Render(Action a) { }
}
public sealed class NullTexture : ITexture
{
public TextureScaleFilter ScaleFilter { get { return TextureScaleFilter.Nearest; } set { } }
public void SetData(Bitmap bitmap) { }
public void SetData(uint[,] colors) { }
public void SetData(byte[] colors, int width, int height) { }
public byte[] GetData() { return new byte[0]; }
public Size Size { get { return new Size(0, 0); } }
public void Dispose() { }
}
public sealed class NullFrameBuffer : IFrameBuffer
{
public void Bind() { }
public void Unbind() { }
public ITexture Texture { get { return new NullTexture(); } }
public void Dispose() { }
}
sealed class NullVertexBuffer<T> : IVertexBuffer<T>
{
public void Bind() { }
public void SetData(T[] vertices, int length) { }
public void SetData(T[] vertices, int start, int length) { }
public void SetData(IntPtr data, int start, int length) { }
public void Dispose() { }
}
}

View File

@@ -1,31 +0,0 @@
#region Copyright & License Information
/*
* Copyright 2007-2016 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version. For more
* information, see COPYING.
*/
#endregion
using System.Drawing;
using OpenRA;
[assembly: Platform(typeof(OpenRA.Platforms.Null.DeviceFactory))]
namespace OpenRA.Platforms.Null
{
public class DeviceFactory : IDeviceFactory
{
public IGraphicsDevice CreateGraphics(Size size, WindowMode windowMode)
{
return new NullGraphicsDevice(size, windowMode);
}
public ISoundEngine CreateSound()
{
return new NullSoundEngine();
}
}
}

View File

@@ -1,58 +0,0 @@
#region Copyright & License Information
/*
* Copyright 2007-2016 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version. For more
* information, see COPYING.
*/
#endregion
using System;
namespace OpenRA.Platforms.Null
{
sealed class NullSoundEngine : ISoundEngine
{
public SoundDevice[] AvailableDevices()
{
return new[] { new SoundDevice("Null", null, "Output Disabled") };
}
public NullSoundEngine()
{
Console.WriteLine("Using Null sound engine which disables SFX completely");
}
public ISoundSource AddSoundSourceFromMemory(byte[] data, int channels, int sampleBits, int sampleRate)
{
return new NullSoundSource();
}
public ISound Play2D(ISoundSource sound, bool loop, bool relative, WPos pos, float volume, bool attenuateVolume)
{
return new NullSound();
}
public void PauseSound(ISound sound, bool paused) { }
public void StopSound(ISound sound) { }
public void SetAllSoundsPaused(bool paused) { }
public void StopAllSounds() { }
public void SetListenerPosition(WPos position) { }
public void SetSoundVolume(float volume, ISound music, ISound video) { }
public float Volume { get; set; }
public void Dispose() { }
}
class NullSoundSource : ISoundSource { }
class NullSound : ISound
{
public float Volume { get; set; }
public float SeekPosition { get { return 0; } }
public bool Playing { get { return false; } }
}
}

View File

@@ -1,98 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{0C4AEC1A-E7D5-4114-8CCD-3EEC82872981}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OpenRA.Platforms.Null</RootNamespace>
<AssemblyName>OpenRA.Platforms.Null</AssemblyName>
<FileAlignment>512</FileAlignment>
<FileUpgradeFlags></FileUpgradeFlags>
<OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation />
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<OutputPath>..\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>..\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<Optimize>true</Optimize>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Drawing" />
<Reference Include="Eluant">
<HintPath>..\thirdparty\download\Eluant.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="NullGraphicsDevice.cs" />
<Compile Include="NullSound.cs" />
<Compile Include="NullPlatform.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\OpenRA.Game\OpenRA.Game.csproj">
<Project>{0DFB103F-2962-400F-8C6D-E2C28CCBA633}</Project>
<Name>OpenRA.Game</Name>
<Private>False</Private>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
<Visible>False</Visible>
<ProductName>Windows Installer 3.1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -11,8 +11,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenRA.Mods.Cnc", "OpenRA.M
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenRA.Utility", "OpenRA.Utility\OpenRA.Utility.csproj", "{F33337BE-CB69-4B24-850F-07D23E408DDF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenRA.Platforms.Null", "OpenRA.Platforms.Null\OpenRA.Platforms.Null.csproj", "{0C4AEC1A-E7D5-4114-8CCD-3EEC82872981}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenRA.Server", "OpenRA.Server\OpenRA.Server.csproj", "{76F621A1-3D8E-4A99-9F7E-B071EB657817}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenRA.Mods.D2k", "OpenRA.Mods.D2k\OpenRA.Mods.D2k.csproj", "{C0B0465C-6BE2-409C-8770-3A9BF64C4344}"
@@ -133,10 +131,6 @@ Global
{76F621A1-3D8E-4A99-9F7E-B071EB657817}.Debug|x86.Build.0 = Debug|x86
{76F621A1-3D8E-4A99-9F7E-B071EB657817}.Release|x86.ActiveCfg = Release|x86
{76F621A1-3D8E-4A99-9F7E-B071EB657817}.Release|x86.Build.0 = Release|x86
{0C4AEC1A-E7D5-4114-8CCD-3EEC82872981}.Debug|x86.ActiveCfg = Debug|x86
{0C4AEC1A-E7D5-4114-8CCD-3EEC82872981}.Debug|x86.Build.0 = Debug|x86
{0C4AEC1A-E7D5-4114-8CCD-3EEC82872981}.Release|x86.ActiveCfg = Release|x86
{0C4AEC1A-E7D5-4114-8CCD-3EEC82872981}.Release|x86.Build.0 = Release|x86
{C0B0465C-6BE2-409C-8770-3A9BF64C4344}.Debug|x86.ActiveCfg = Debug|x86
{C0B0465C-6BE2-409C-8770-3A9BF64C4344}.Debug|x86.Build.0 = Debug|x86
{C0B0465C-6BE2-409C-8770-3A9BF64C4344}.Release|x86.ActiveCfg = Release|x86

View File

@@ -31,8 +31,8 @@ markdown DOCUMENTATION.md > DOCUMENTATION.html
markdown Lua-API.md > Lua-API.html
# List of files that are packaged on all platforms
FILES=('OpenRA.Game.exe' 'OpenRA.Game.exe.config' 'OpenRA.Utility.exe' 'OpenRA.Server.exe' \
'OpenRA.Platforms.Default.dll' 'OpenRA.Platforms.Null.dll' \
FILES=('OpenRA.Game.exe' 'OpenRA.Game.exe.config' 'OpenRA.Utility.exe' 'OpenRA.Server.exe'
'OpenRA.Platforms.Default.dll' \
'lua' 'glsl' 'mods/common' 'mods/ra' 'mods/cnc' 'mods/d2k' 'mods/modchooser' \
'AUTHORS' 'COPYING' 'README.html' 'CONTRIBUTING.html' 'DOCUMENTATION.html' 'CHANGELOG.html' \
'global mix database.dat' 'GeoLite2-Country.mmdb.gz')

View File

@@ -86,7 +86,6 @@ Section "Game" GAME
File "${SRCDIR}\OpenRA.Game.exe.config"
File "${SRCDIR}\OpenRA.Utility.exe"
File "${SRCDIR}\OpenRA.Server.exe"
File "${SRCDIR}\OpenRA.Platforms.Null.dll"
File "${SRCDIR}\OpenRA.Platforms.Default.dll"
File "${SRCDIR}\ICSharpCode.SharpZipLib.dll"
File "${SRCDIR}\FuzzyLogicLibrary.dll"
@@ -192,7 +191,6 @@ Function ${UN}Clean
Delete $INSTDIR\OpenRA.Game.exe.config
Delete $INSTDIR\OpenRA.Utility.exe
Delete $INSTDIR\OpenRA.Server.exe
Delete $INSTDIR\OpenRA.Platforms.Null.dll
Delete $INSTDIR\OpenRA.Platforms.Default.dll
Delete $INSTDIR\ICSharpCode.SharpZipLib.dll
Delete $INSTDIR\FuzzyLogicLibrary.dll