World of Might and Magic  0.2.0
Open reimplementation of Might and Magic 6 7 8 game engine
IRenderConfigFactory.cpp
См. документацию.
2 
3 #include "Platform/Api.h"
4 
7 
8 
9 std::shared_ptr<IRenderConfig> IRenderConfigFactory::Clone(
10  std::shared_ptr<const IRenderConfig> other
11 ) {
12  return std::make_shared<IRenderConfig>(*other.get());
13 }
14 
15 std::shared_ptr<IRenderConfig> IRenderConfigFactory::Create(
16  const std::string &renderer_name,
17  bool is_fullscreen
18 ) {
19  auto config = std::make_shared<IRenderConfig>();
20 
21  if (renderer_name == "DirectDraw") {
22  config->renderer_type = RendererType::DirectDraw;
23  }
24  if (renderer_name == "OpenGL") {
25  config->renderer_type = RendererType::OpenGl;
26  }
27 
28  config->is_fullscreen = is_fullscreen;
29  config->is_tinting = OS_GetAppInt("Tinting", 1) != 0;
30  config->is_using_colored_lights = OS_GetAppInt("Colored Lights", 0) != 0;
31 
32  return config;
33 }
Graphics::IRenderConfigFactory::Create
std::shared_ptr< IRenderConfig > Create(const std::string &renderer_name, bool is_fullscreen)
Definition: IRenderConfigFactory.cpp:15
IRenderConfigFactory.h
Graphics::RendererType::OpenGl
@ OpenGl
Graphics::IRenderConfig
Definition: IRenderConfig.h:12
string
GLsizei const GLchar *const * string
Definition: SDL_opengl_glext.h:691
Graphics::IRenderConfigFactory
Definition: IRenderConfigFactory.h:10
config
EGLConfig config
Definition: SDL_egl.h:1149
Api.h
OS_GetAppInt
int OS_GetAppInt(const char *pKey, int uDefValue)
Definition: Lin.cpp:89
Graphics::RendererType::DirectDraw
@ DirectDraw