mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-24 00:03:11 +01:00
Allow drawing engine registration via context interfaces
This commit is contained in:
@@ -20,7 +20,9 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <shellapi.h>
|
#include <shellapi.h>
|
||||||
|
#include <openrct2/Context.h>
|
||||||
#include <openrct2/OpenRCT2.h>
|
#include <openrct2/OpenRCT2.h>
|
||||||
|
#include <openrct2-ui/UiContext.h>
|
||||||
|
|
||||||
#define DLLEXPORT extern "C" __declspec(dllexport)
|
#define DLLEXPORT extern "C" __declspec(dllexport)
|
||||||
|
|
||||||
@@ -37,7 +39,14 @@ DLLEXPORT int LaunchOpenRCT2(int argc, wchar_t * * argvW)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int exitCode = RunOpenRCT2(argc, argv);
|
OpenRCT2::IContext * context = OpenRCT2::CreateContext();
|
||||||
|
OpenRCT2::Ui::IUiContext * uiContext = OpenRCT2::Ui::CreateContext(context);
|
||||||
|
|
||||||
|
int exitCode = context->RunOpenRCT2(argc, argv);
|
||||||
|
|
||||||
|
delete uiContext;
|
||||||
|
delete context;
|
||||||
|
|
||||||
FreeCommandLineArgs(argc, argv);
|
FreeCommandLineArgs(argc, argv);
|
||||||
return exitCode;
|
return exitCode;
|
||||||
}
|
}
|
||||||
|
|||||||
49
src/openrct2-ui/UiContext.cpp
Normal file
49
src/openrct2-ui/UiContext.cpp
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
#pragma region Copyright (c) 2014-2016 OpenRCT2 Developers
|
||||||
|
/*****************************************************************************
|
||||||
|
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
|
||||||
|
*
|
||||||
|
* OpenRCT2 is the work of many authors, a full list can be found in contributors.md
|
||||||
|
* For more information, visit https://github.com/OpenRCT2/OpenRCT2
|
||||||
|
*
|
||||||
|
* OpenRCT2 is free software: you can redistribute it and/or modify
|
||||||
|
* it 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.
|
||||||
|
*
|
||||||
|
* A full copy of the GNU General Public License can be found in licence.txt
|
||||||
|
*****************************************************************************/
|
||||||
|
#pragma endregion
|
||||||
|
|
||||||
|
#include "UiContext.h"
|
||||||
|
#include "drawing\engines\DrawingEngines.h"
|
||||||
|
|
||||||
|
using namespace OpenRCT2;
|
||||||
|
using namespace OpenRCT2::Ui;
|
||||||
|
|
||||||
|
class UiContext : public IUiContext
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
IContext * const _context;
|
||||||
|
|
||||||
|
// Drawing engines
|
||||||
|
SoftwareDrawingEngineFactory _softwareDrawingFactory;
|
||||||
|
HardwareDisplayDrawingEngineFactory _hardwareDrawingFactory;
|
||||||
|
#ifndef DISABLE_OPENGL
|
||||||
|
OpenGLDrawingEngineFactory _openglDrawingFactory;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
public:
|
||||||
|
UiContext(IContext * context) :
|
||||||
|
_context(context)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
~UiContext() override
|
||||||
|
{
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
IUiContext * OpenRCT2::Ui::CreateContext(IContext * context)
|
||||||
|
{
|
||||||
|
return new UiContext(context);
|
||||||
|
}
|
||||||
34
src/openrct2-ui/UiContext.h
Normal file
34
src/openrct2-ui/UiContext.h
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
#pragma region Copyright (c) 2014-2016 OpenRCT2 Developers
|
||||||
|
/*****************************************************************************
|
||||||
|
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
|
||||||
|
*
|
||||||
|
* OpenRCT2 is the work of many authors, a full list can be found in contributors.md
|
||||||
|
* For more information, visit https://github.com/OpenRCT2/OpenRCT2
|
||||||
|
*
|
||||||
|
* OpenRCT2 is free software: you can redistribute it and/or modify
|
||||||
|
* it 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.
|
||||||
|
*
|
||||||
|
* A full copy of the GNU General Public License can be found in licence.txt
|
||||||
|
*****************************************************************************/
|
||||||
|
#pragma endregion
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <openrct2/common.h>
|
||||||
|
|
||||||
|
namespace OpenRCT2
|
||||||
|
{
|
||||||
|
interface IContext;
|
||||||
|
|
||||||
|
namespace Ui
|
||||||
|
{
|
||||||
|
interface IUiContext
|
||||||
|
{
|
||||||
|
virtual ~IUiContext() { }
|
||||||
|
};
|
||||||
|
|
||||||
|
IUiContext * CreateContext(IContext * context);
|
||||||
|
}
|
||||||
|
}
|
||||||
50
src/openrct2-ui/drawing/engines/DrawingEngines.h
Normal file
50
src/openrct2-ui/drawing/engines/DrawingEngines.h
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
#pragma region Copyright (c) 2014-2016 OpenRCT2 Developers
|
||||||
|
/*****************************************************************************
|
||||||
|
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
|
||||||
|
*
|
||||||
|
* OpenRCT2 is the work of many authors, a full list can be found in contributors.md
|
||||||
|
* For more information, visit https://github.com/OpenRCT2/OpenRCT2
|
||||||
|
*
|
||||||
|
* OpenRCT2 is free software: you can redistribute it and/or modify
|
||||||
|
* it 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.
|
||||||
|
*
|
||||||
|
* A full copy of the GNU General Public License can be found in licence.txt
|
||||||
|
*****************************************************************************/
|
||||||
|
#pragma endregion
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <openrct2/common.h>
|
||||||
|
#include <openrct2/drawing/IDrawingEngine.h>
|
||||||
|
|
||||||
|
interface IDrawingEngineFactory;
|
||||||
|
|
||||||
|
class SoftwareDrawingEngineFactory : public IDrawingEngineFactory
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
SoftwareDrawingEngineFactory();
|
||||||
|
~SoftwareDrawingEngineFactory() override;
|
||||||
|
IDrawingEngine * Create() override;
|
||||||
|
};
|
||||||
|
|
||||||
|
class HardwareDisplayDrawingEngineFactory : public IDrawingEngineFactory
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
HardwareDisplayDrawingEngineFactory();
|
||||||
|
~HardwareDisplayDrawingEngineFactory() override;
|
||||||
|
IDrawingEngine * Create() override;
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifndef DISABLE_OPENGL
|
||||||
|
|
||||||
|
class OpenGLDrawingEngineFactory : public IDrawingEngineFactory
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
OpenGLDrawingEngineFactory();
|
||||||
|
~OpenGLDrawingEngineFactory() override;
|
||||||
|
IDrawingEngine * Create() override;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // DISABLE_OPENGL
|
||||||
@@ -21,6 +21,7 @@
|
|||||||
#include <openrct2/drawing/IDrawingContext.h>
|
#include <openrct2/drawing/IDrawingContext.h>
|
||||||
#include <openrct2/drawing/IDrawingEngine.h>
|
#include <openrct2/drawing/IDrawingEngine.h>
|
||||||
#include <openrct2/drawing/Rain.h>
|
#include <openrct2/drawing/Rain.h>
|
||||||
|
#include "DrawingEngines.h"
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
@@ -827,12 +828,32 @@ private:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
IDrawingEngine * DrawingEngineFactory::CreateSoftware()
|
SoftwareDrawingEngineFactory::SoftwareDrawingEngineFactory()
|
||||||
|
{
|
||||||
|
DrawingEngineFactory::Register(DRAWING_ENGINE_SOFTWARE, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
SoftwareDrawingEngineFactory::~SoftwareDrawingEngineFactory()
|
||||||
|
{
|
||||||
|
DrawingEngineFactory::Unregister(DRAWING_ENGINE_SOFTWARE);
|
||||||
|
}
|
||||||
|
|
||||||
|
IDrawingEngine * SoftwareDrawingEngineFactory::Create()
|
||||||
{
|
{
|
||||||
return new SoftwareDrawingEngine(false);
|
return new SoftwareDrawingEngine(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
IDrawingEngine * DrawingEngineFactory::CreateSoftwareWithHardwareDisplay()
|
HardwareDisplayDrawingEngineFactory::HardwareDisplayDrawingEngineFactory()
|
||||||
|
{
|
||||||
|
DrawingEngineFactory::Register(DRAWING_ENGINE_SOFTWARE_WITH_HARDWARE_DISPLAY, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
HardwareDisplayDrawingEngineFactory::~HardwareDisplayDrawingEngineFactory()
|
||||||
|
{
|
||||||
|
DrawingEngineFactory::Unregister(DRAWING_ENGINE_SOFTWARE_WITH_HARDWARE_DISPLAY);
|
||||||
|
}
|
||||||
|
|
||||||
|
IDrawingEngine * HardwareDisplayDrawingEngineFactory::Create()
|
||||||
{
|
{
|
||||||
return new SoftwareDrawingEngine(true);
|
return new SoftwareDrawingEngine(true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,17 +29,7 @@ IDrawingEngine * DrawingEngineFactory::CreateOpenGL()
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <SDL_platform.h>
|
#include <SDL_platform.h>
|
||||||
|
|
||||||
#include "GLSLTypes.h"
|
#include <openrct2/config/Config.h>
|
||||||
#include "OpenGLAPI.h"
|
|
||||||
#include "OpenGLFramebuffer.h"
|
|
||||||
#include "CopyFramebufferShader.h"
|
|
||||||
#include "DrawImageShader.h"
|
|
||||||
#include "DrawLineShader.h"
|
|
||||||
#include "FillRectShader.h"
|
|
||||||
#include "SwapFramebuffer.h"
|
|
||||||
#include "TextureCache.h"
|
|
||||||
#include "DrawCommands.h"
|
|
||||||
|
|
||||||
#include <openrct2/core/Console.hpp>
|
#include <openrct2/core/Console.hpp>
|
||||||
#include <openrct2/core/Exception.hpp>
|
#include <openrct2/core/Exception.hpp>
|
||||||
#include <openrct2/core/Math.hpp>
|
#include <openrct2/core/Math.hpp>
|
||||||
@@ -51,13 +41,24 @@ IDrawingEngine * DrawingEngineFactory::CreateOpenGL()
|
|||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
#include <openrct2/config/Config.h>
|
|
||||||
#include <openrct2/interface/screenshot.h>
|
#include <openrct2/interface/screenshot.h>
|
||||||
#include <openrct2/interface/window.h>
|
#include <openrct2/interface/window.h>
|
||||||
#include <openrct2/intro.h>
|
#include <openrct2/intro.h>
|
||||||
#include <openrct2/drawing/drawing.h>
|
#include <openrct2/drawing/drawing.h>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#include "../DrawingEngines.h"
|
||||||
|
#include "GLSLTypes.h"
|
||||||
|
#include "OpenGLAPI.h"
|
||||||
|
#include "OpenGLFramebuffer.h"
|
||||||
|
#include "CopyFramebufferShader.h"
|
||||||
|
#include "DrawImageShader.h"
|
||||||
|
#include "DrawLineShader.h"
|
||||||
|
#include "FillRectShader.h"
|
||||||
|
#include "SwapFramebuffer.h"
|
||||||
|
#include "TextureCache.h"
|
||||||
|
#include "DrawCommands.h"
|
||||||
|
|
||||||
struct OpenGLVersion
|
struct OpenGLVersion
|
||||||
{
|
{
|
||||||
GLint Major;
|
GLint Major;
|
||||||
@@ -498,7 +499,17 @@ private:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
IDrawingEngine * DrawingEngineFactory::CreateOpenGL()
|
OpenGLDrawingEngineFactory::OpenGLDrawingEngineFactory()
|
||||||
|
{
|
||||||
|
DrawingEngineFactory::Register(DRAWING_ENGINE_OPENGL, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
OpenGLDrawingEngineFactory::~OpenGLDrawingEngineFactory()
|
||||||
|
{
|
||||||
|
DrawingEngineFactory::Unregister(DRAWING_ENGINE_OPENGL);
|
||||||
|
}
|
||||||
|
|
||||||
|
IDrawingEngine * OpenGLDrawingEngineFactory::Create()
|
||||||
{
|
{
|
||||||
return new OpenGLDrawingEngine();
|
return new OpenGLDrawingEngine();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,8 +33,10 @@
|
|||||||
<ClCompile Include="drawing\engines\opengl\SwapFramebuffer.cpp" />
|
<ClCompile Include="drawing\engines\opengl\SwapFramebuffer.cpp" />
|
||||||
<ClCompile Include="drawing\engines\opengl\TextureCache.cpp" />
|
<ClCompile Include="drawing\engines\opengl\TextureCache.cpp" />
|
||||||
<ClCompile Include="drawing\engines\SoftwareDrawingEngine.cpp" />
|
<ClCompile Include="drawing\engines\SoftwareDrawingEngine.cpp" />
|
||||||
|
<ClCompile Include="UiContext.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ClInclude Include="drawing\engines\DrawingEngines.h" />
|
||||||
<ClInclude Include="drawing\engines\opengl\CopyFramebufferShader.h" />
|
<ClInclude Include="drawing\engines\opengl\CopyFramebufferShader.h" />
|
||||||
<ClInclude Include="drawing\engines\opengl\DrawCommands.h" />
|
<ClInclude Include="drawing\engines\opengl\DrawCommands.h" />
|
||||||
<ClInclude Include="drawing\engines\opengl\DrawImageShader.h" />
|
<ClInclude Include="drawing\engines\opengl\DrawImageShader.h" />
|
||||||
@@ -46,6 +48,7 @@
|
|||||||
<ClInclude Include="drawing\engines\opengl\OpenGLShaderProgram.h" />
|
<ClInclude Include="drawing\engines\opengl\OpenGLShaderProgram.h" />
|
||||||
<ClInclude Include="drawing\engines\opengl\SwapFramebuffer.h" />
|
<ClInclude Include="drawing\engines\opengl\SwapFramebuffer.h" />
|
||||||
<ClInclude Include="drawing\engines\opengl\TextureCache.h" />
|
<ClInclude Include="drawing\engines\opengl\TextureCache.h" />
|
||||||
|
<ClInclude Include="UiContext.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<PropertyGroup Label="Globals">
|
<PropertyGroup Label="Globals">
|
||||||
<ProjectGuid>{8DD8AB7D-2EA6-44E3-8265-BAF08E832951}</ProjectGuid>
|
<ProjectGuid>{8DD8AB7D-2EA6-44E3-8265-BAF08E832951}</ProjectGuid>
|
||||||
|
|||||||
42
src/openrct2/Context.cpp
Normal file
42
src/openrct2/Context.cpp
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
#pragma region Copyright (c) 2014-2016 OpenRCT2 Developers
|
||||||
|
/*****************************************************************************
|
||||||
|
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
|
||||||
|
*
|
||||||
|
* OpenRCT2 is the work of many authors, a full list can be found in contributors.md
|
||||||
|
* For more information, visit https://github.com/OpenRCT2/OpenRCT2
|
||||||
|
*
|
||||||
|
* OpenRCT2 is free software: you can redistribute it and/or modify
|
||||||
|
* it 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.
|
||||||
|
*
|
||||||
|
* A full copy of the GNU General Public License can be found in licence.txt
|
||||||
|
*****************************************************************************/
|
||||||
|
#pragma endregion
|
||||||
|
|
||||||
|
#include "Context.h"
|
||||||
|
#include "OpenRCT2.h"
|
||||||
|
|
||||||
|
using namespace OpenRCT2;
|
||||||
|
|
||||||
|
class Context : public IContext
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Context()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
~Context() override
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
sint32 RunOpenRCT2(int argc, char * * argv) override
|
||||||
|
{
|
||||||
|
return ::RunOpenRCT2(argc, argv);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
IContext * OpenRCT2::CreateContext()
|
||||||
|
{
|
||||||
|
return new Context();
|
||||||
|
}
|
||||||
33
src/openrct2/Context.h
Normal file
33
src/openrct2/Context.h
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
#pragma region Copyright (c) 2014-2016 OpenRCT2 Developers
|
||||||
|
/*****************************************************************************
|
||||||
|
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
|
||||||
|
*
|
||||||
|
* OpenRCT2 is the work of many authors, a full list can be found in contributors.md
|
||||||
|
* For more information, visit https://github.com/OpenRCT2/OpenRCT2
|
||||||
|
*
|
||||||
|
* OpenRCT2 is free software: you can redistribute it and/or modify
|
||||||
|
* it 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.
|
||||||
|
*
|
||||||
|
* A full copy of the GNU General Public License can be found in licence.txt
|
||||||
|
*****************************************************************************/
|
||||||
|
#pragma endregion
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <openrct2/common.h>
|
||||||
|
|
||||||
|
namespace OpenRCT2
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Represents an instance of OpenRCT2 and can be used to get various services.
|
||||||
|
*/
|
||||||
|
interface IContext
|
||||||
|
{
|
||||||
|
virtual ~IContext() { }
|
||||||
|
virtual sint32 RunOpenRCT2(int argc, char * * argv) abstract;
|
||||||
|
};
|
||||||
|
|
||||||
|
IContext * CreateContext();
|
||||||
|
}
|
||||||
@@ -26,6 +26,7 @@ enum DRAWING_ENGINE
|
|||||||
DRAWING_ENGINE_SOFTWARE,
|
DRAWING_ENGINE_SOFTWARE,
|
||||||
DRAWING_ENGINE_SOFTWARE_WITH_HARDWARE_DISPLAY,
|
DRAWING_ENGINE_SOFTWARE_WITH_HARDWARE_DISPLAY,
|
||||||
DRAWING_ENGINE_OPENGL,
|
DRAWING_ENGINE_OPENGL,
|
||||||
|
DRAWING_ENGINE_COUNT,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum DRAWING_ENGINE_FLAGS
|
enum DRAWING_ENGINE_FLAGS
|
||||||
@@ -66,11 +67,16 @@ interface IDrawingEngine
|
|||||||
virtual void InvalidateImage(uint32 image) abstract;
|
virtual void InvalidateImage(uint32 image) abstract;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
interface IDrawingEngineFactory
|
||||||
|
{
|
||||||
|
virtual ~IDrawingEngineFactory() { }
|
||||||
|
virtual IDrawingEngine * Create() abstract;
|
||||||
|
};
|
||||||
|
|
||||||
namespace DrawingEngineFactory
|
namespace DrawingEngineFactory
|
||||||
{
|
{
|
||||||
IDrawingEngine * CreateSoftware();
|
void Register(DRAWING_ENGINE type, IDrawingEngineFactory * factory);
|
||||||
IDrawingEngine * CreateSoftwareWithHardwareDisplay();
|
void Unregister(DRAWING_ENGINE type);
|
||||||
IDrawingEngine * CreateOpenGL();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IRainDrawer
|
interface IRainDrawer
|
||||||
|
|||||||
@@ -29,8 +29,27 @@ extern "C"
|
|||||||
#include "../rct2.h"
|
#include "../rct2.h"
|
||||||
}
|
}
|
||||||
|
|
||||||
static sint32 _drawingEngineType = DRAWING_ENGINE_SOFTWARE;
|
static sint32 _drawingEngineType = DRAWING_ENGINE_SOFTWARE;
|
||||||
static IDrawingEngine * _drawingEngine = nullptr;
|
static IDrawingEngine * _drawingEngine = nullptr;
|
||||||
|
static IDrawingEngineFactory * _drawingEngineFactories[DRAWING_ENGINE_COUNT] = { nullptr };
|
||||||
|
|
||||||
|
void DrawingEngineFactory::Register(DRAWING_ENGINE type, IDrawingEngineFactory * factory)
|
||||||
|
{
|
||||||
|
if (_drawingEngineFactories[type] != nullptr)
|
||||||
|
{
|
||||||
|
throw std::invalid_argument("Engine already registered.");
|
||||||
|
}
|
||||||
|
_drawingEngineFactories[type] = factory;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DrawingEngineFactory::Unregister(DRAWING_ENGINE type)
|
||||||
|
{
|
||||||
|
if (_drawingEngineFactories[type] == nullptr)
|
||||||
|
{
|
||||||
|
throw std::invalid_argument("Engine not registered.");
|
||||||
|
}
|
||||||
|
_drawingEngineFactories[type] = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
@@ -69,20 +88,15 @@ extern "C"
|
|||||||
{
|
{
|
||||||
assert(_drawingEngine == nullptr);
|
assert(_drawingEngine == nullptr);
|
||||||
|
|
||||||
IDrawingEngine * drawingEngine = nullptr;
|
|
||||||
_drawingEngineType = gConfigGeneral.drawing_engine;
|
_drawingEngineType = gConfigGeneral.drawing_engine;
|
||||||
switch (_drawingEngineType) {
|
IDrawingEngineFactory * deFactory = _drawingEngineFactories[_drawingEngineType];
|
||||||
case DRAWING_ENGINE_SOFTWARE:
|
if (deFactory == nullptr)
|
||||||
drawingEngine = DrawingEngineFactory::CreateSoftware();
|
{
|
||||||
break;
|
log_fatal("Drawing engine not registered.");
|
||||||
case DRAWING_ENGINE_SOFTWARE_WITH_HARDWARE_DISPLAY:
|
exit(-1);
|
||||||
drawingEngine = DrawingEngineFactory::CreateSoftwareWithHardwareDisplay();
|
|
||||||
break;
|
|
||||||
case DRAWING_ENGINE_OPENGL:
|
|
||||||
drawingEngine = DrawingEngineFactory::CreateOpenGL();
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IDrawingEngine * drawingEngine = deFactory->Create();
|
||||||
if (drawingEngine == nullptr)
|
if (drawingEngine == nullptr)
|
||||||
{
|
{
|
||||||
if (_drawingEngineType == DRAWING_ENGINE_SOFTWARE)
|
if (_drawingEngineType == DRAWING_ENGINE_SOFTWARE)
|
||||||
|
|||||||
Reference in New Issue
Block a user